DGtal  0.9.4beta
Public Types | Static Public Member Functions | Private Member Functions
DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator > Struct Template Reference

#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
 
typedef Statistic< double > OutputVectorStatistic
 

Static Public Member Functions

static Quantity compare (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it)
 
static OutputStatistic compare (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &itb, const ConstIterator &ite, const bool storeSamples=false)
 
static double compareVectors (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it)
 
static OutputVectorStatistic compareVectors (FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &itb, const ConstIterator &ite, 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

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

Definition at line 75 of file CompareLocalEstimators.h.

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

Definition at line 72 of file CompareLocalEstimators.h.

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

Output statistic type.

Definition at line 79 of file CompareLocalEstimators.h.

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

Definition at line 80 of file CompareLocalEstimators.h.

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

Definition at line 76 of file CompareLocalEstimators.h.

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

Definition at line 73 of file CompareLocalEstimators.h.

Constructor & Destructor Documentation

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

template<typename TFirstEsimator , typename TSecondEstimator >
static Quantity DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator it 
)
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, resolution h, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itthe point to evaluate the difference.
Returns
the difference between the two estiamtor values at *it. (firstEstimator value - secondEstimator value).

Definition at line 101 of file CompareLocalEstimators.h.

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

104  {
105  ASSERT( aFirstEstimator.isValid());
106  ASSERT( aSecondEstimator.isValid());
107 
108  return aFirstEstimator.eval(it) - aSecondEstimator.eval(it);
109  }
template<typename TFirstEsimator , typename TSecondEstimator >
static OutputStatistic DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator itb,
const ConstIterator ite,
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, resolution h, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itbstarting point of the comparison.
iteending point of the comparison.
storeSamplesif true, the instance of Statistic will store all the values.
Returns
the statistic of differences between the two estiamtor values

Definition at line 129 of file CompareLocalEstimators.h.

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

134  {
135  OutputStatistic stats(storeSamples);
136 
137  for(ConstIterator it = itb; it!= ite; ++it)
138  stats.addValue( compare(aFirstEstimator,aSecondEstimator,it));
139 
140  stats.terminate();
141  return stats;
142  }
static Quantity compare(FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it)
Statistic< Quantity > OutputStatistic
Output statistic type.
template<typename TFirstEsimator , typename TSecondEstimator >
static double DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator it 
)
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, resolution h, ...).
Parameters
aFirstEstimatorthe first estimator.
aSecondEstimatorthe second estimator.
itthe point to evaluate the difference.
Returns
the difference between the two estiamtor values at *it. (firstEstimator value - secondEstimator value).

Definition at line 161 of file CompareLocalEstimators.h.

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

164  {
165  ASSERT( aFirstEstimator.isValid());
166  ASSERT( aSecondEstimator.isValid());
167  Quantity v1 = aFirstEstimator.eval(it), v2 = aSecondEstimator.eval(it);
168 
169  ASSERT( v1.norm() != 0.0 );
170  ASSERT( v2.norm() != 0.0 );
171  double ndot = (double) v1.dot(v2)
172  / ( (double) ( v1.norm() * v2.norm() ) );
173  return ( ndot > 1.0 ) ? 0.0
174  : ( ndot < -1.0 ) ? M_PI : acos( ndot );
175 
176  }
FirstEstimator::Quantity Quantity
template<typename TFirstEsimator , typename TSecondEstimator >
static OutputVectorStatistic DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors ( FirstEstimator aFirstEstimator,
SecondEstimator aSecondEstimator,
const ConstIterator itb,
const ConstIterator ite,
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.
storeSamplesif true, the instance of Statistic will store all the values.
Returns
the statistic of differences between the two estiamtor values

Definition at line 196 of file CompareLocalEstimators.h.

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

201  {
202  OutputVectorStatistic stats(storeSamples);
203 
204  for(ConstIterator it = itb; it!= ite; ++it)
205  stats.addValue( compareVectors(aFirstEstimator,aSecondEstimator,it));
206 
207  stats.terminate();
208  return stats;
209  }
Statistic< double > OutputVectorStatistic
static double compareVectors(FirstEstimator &aFirstEstimator, SecondEstimator &aSecondEstimator, const ConstIterator &it)
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: