DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Private Member Functions
DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator > Struct Template Reference

Aim: Functor to compare two local geometric estimators. More...

#include <DGtal/geometry/curves/estimation/CompareLocalEstimators.h>

Public Types

typedef TFirstEsimator FirstEstimator
 
typedef TSecondEstimator SecondEstimator
 
typedef FirstEstimator::ConstIterator ConstIterator
 
typedef FirstEstimator::Quantity Quantity
 
typedef Statistic< QuantityOutputStatistic
 Output statistic type. More...
 
typedef Statistic< double > OutputVectorStatistic
 

Static Public Member Functions

static Quantity compare (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it, const double h=1.)
 
static OutputStatistic compare (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &itb, const ConstIterator &ite, const double h=1., const bool storeSamples=false)
 
static double compareVectors (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it, const double h=1.)
 
static OutputVectorStatistic compareVectors (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &itb, const ConstIterator &ite, const double h, const bool storeSamples=false)
 

Private Member Functions

 CompareLocalEstimators (const CompareLocalEstimators &other)
 
CompareLocalEstimatorsoperator= (const CompareLocalEstimators &other)
 

Detailed Description

template<typename TFirstEsimator, typename TSecondEstimator>
struct DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >

Aim: Functor to compare two local geometric estimators.

Description of template struct 'CompareLocalEstimators'

Template Parameters
TFirstEsimatortype of the first estimator.
TSecondEstimatortype of the second estimator.

Definition at line 66 of file CompareLocalEstimators.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TFirstEsimator , typename TSecondEstimator >
typedef FirstEstimator::ConstIterator DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::ConstIterator

Definition at line 75 of file CompareLocalEstimators.h.

◆ FirstEstimator

template<typename TFirstEsimator , typename TSecondEstimator >
typedef TFirstEsimator DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::FirstEstimator

Definition at line 72 of file CompareLocalEstimators.h.

◆ OutputStatistic

template<typename TFirstEsimator , typename TSecondEstimator >
typedef Statistic<Quantity> DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::OutputStatistic

Output statistic type.

Definition at line 79 of file CompareLocalEstimators.h.

◆ OutputVectorStatistic

template<typename TFirstEsimator , typename TSecondEstimator >
typedef Statistic<double> DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::OutputVectorStatistic

Definition at line 80 of file CompareLocalEstimators.h.

◆ Quantity

template<typename TFirstEsimator , typename TSecondEstimator >
typedef FirstEstimator::Quantity DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::Quantity

Definition at line 76 of file CompareLocalEstimators.h.

◆ SecondEstimator

template<typename TFirstEsimator , typename TSecondEstimator >
typedef TSecondEstimator DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::SecondEstimator

Definition at line 73 of file CompareLocalEstimators.h.

Constructor & Destructor Documentation

◆ CompareLocalEstimators()

template<typename TFirstEsimator , typename TSecondEstimator >
DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::CompareLocalEstimators ( const CompareLocalEstimators< TFirstEsimator, TSecondEstimator > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ compare() [1/2]

template<typename TFirstEsimator , typename TSecondEstimator >
static Quantity DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator it,
const double  h = 1. 
)
inlinestatic
Todo:
Assert firstestimator::Quantity==secondestimator::Quantity

Return the error (difference) between the two estimators at a given point.

Precondition
both estimators must have been initialised with the same parameters (geometry, shape, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itthe point to evaluate the difference.
hgrid size (must be > 0).
Returns
the difference between the two estiamtor values at *it. (firstEstimator value - secondEstimator value).

Definition at line 102 of file CompareLocalEstimators.h.

106 {
107 ASSERT( aFirstEstimator.isValid() );
108 ASSERT( aSecondEstimator.isValid( ));
109
110 return aFirstEstimator.eval(it, h) - aSecondEstimator.eval(it, h);
111 }

Referenced by DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare().

◆ compare() [2/2]

template<typename TFirstEsimator , typename TSecondEstimator >
static OutputStatistic DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator itb,
const ConstIterator ite,
const double  h = 1.,
const bool  storeSamples = false 
)
inlinestatic

Return a statistic on the error (difference) between the two estimators for points ranging from itb to ite.

Precondition
both estimators must have been initialised with the same parameters (geometry, shape, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itbstarting point of the comparison.
iteending point of the comparison.
hgrid size (must be > 0).
storeSamplesif true, the instance of Statistic will store all the values.
Returns
the statistic of differences between the two estiamtor values

Definition at line 132 of file CompareLocalEstimators.h.

138 {
139 OutputStatistic stats(storeSamples);
140
141 for(ConstIterator it = itb; it!= ite; ++it)
142 stats.addValue(compare(aFirstEstimator, aSecondEstimator, it, h));
143
144 stats.terminate();
145 return stats;
146 }
MyDigitalSurface::ConstIterator ConstIterator
Statistic< Quantity > OutputStatistic
Output statistic type.
static Quantity compare(FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it, const double h=1.)

References DGtal::Statistic< TQuantity >::addValue(), DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare(), and DGtal::Statistic< TQuantity >::terminate().

◆ compareVectors() [1/2]

template<typename TFirstEsimator , typename TSecondEstimator >
static double DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator it,
const double  h = 1. 
)
inlinestatic

Return the angular error between the two estimations (if Quantity values are vectors) at a given point.

Precondition
both estimators must have been initialised with the same parameters (geometry, shape, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itthe point to evaluate the difference.
hgrid size (must be > 0).
Returns
the difference between the two estiamtor values at *it. (firstEstimator value - secondEstimator value).

Definition at line 166 of file CompareLocalEstimators.h.

170 {
171 ASSERT( aFirstEstimator.isValid());
172 ASSERT( aSecondEstimator.isValid());
173 Quantity v1 = aFirstEstimator.eval(it, h), v2 = aSecondEstimator.eval(it, h);
174
175 ASSERT( v1.norm() != 0.0 );
176 ASSERT( v2.norm() != 0.0 );
177 double ndot = (double) v1.dot(v2)
178 / ( (double) ( v1.norm() * v2.norm() ) );
179 return ( ndot > 1.0 ) ? 0.0
180 : ( ndot < -1.0 ) ? M_PI : acos( ndot );
181 }
FirstEstimator::Quantity Quantity

Referenced by DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors().

◆ compareVectors() [2/2]

template<typename TFirstEsimator , typename TSecondEstimator >
static OutputVectorStatistic DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator itb,
const ConstIterator ite,
const double  h,
const bool  storeSamples = false 
)
inlinestatic

Return a statistic on the error (angular error) between the two estimators for points ranging from itb to ite.

Precondition
both estimators must have been initialised with the same parameters (geometry, resolution h, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itbstarting point of the comparison.
iteending point of the comparison.
hgrid size (must be >0).
storeSamplesif true, the instance of Statistic will store all the values.
Returns
the statistic of differences between the two estiamtor values

Definition at line 202 of file CompareLocalEstimators.h.

208 {
209 OutputVectorStatistic stats(storeSamples);
210
211 for(ConstIterator it = itb; it!= ite; ++it)
212 stats.addValue(compareVectors(aFirstEstimator, aSecondEstimator, it, h));
213
214 stats.terminate();
215 return stats;
216 }
Statistic< double > OutputVectorStatistic
static double compareVectors(FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it, const double h=1.)

References DGtal::Statistic< TQuantity >::addValue(), DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors(), and DGtal::Statistic< TQuantity >::terminate().

◆ operator=()

template<typename TFirstEsimator , typename TSecondEstimator >
CompareLocalEstimators & DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::operator= ( const CompareLocalEstimators< TFirstEsimator, TSecondEstimator > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

The documentation for this struct was generated from the following file: