DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Static Public Member Functions | Private Member Functions
DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator > Struct Template Reference

#include <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().

{
ASSERT( aFirstEstimator.isValid());
ASSERT( aSecondEstimator.isValid());
return aFirstEstimator.eval(it) - aSecondEstimator.eval(it);
}
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< RealNumberType >::addValue(), DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare(), and DGtal::Statistic< RealNumberType >::terminate().

{
OutputStatistic stats(storeSamples);
for(ConstIterator it = itb; it!= ite; ++it)
stats.addValue( compare(aFirstEstimator,aSecondEstimator,it));
stats.terminate();
return stats;
}
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.

References M_PI.

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

{
ASSERT( aFirstEstimator.isValid());
ASSERT( aSecondEstimator.isValid());
Quantity v1 = aFirstEstimator.eval(it), v2 = aSecondEstimator.eval(it);
ASSERT( v1.norm() != 0.0 );
ASSERT( v2.norm() != 0.0 );
double ndot = (double) v1.dot(v2)
/ ( (double) ( v1.norm() * v2.norm() ) );
return ( ndot > 1.0 ) ? 0.0
: ( ndot < -1.0 ) ? M_PI : acos( ndot );
}
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< RealNumberType >::addValue(), DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors(), and DGtal::Statistic< RealNumberType >::terminate().

{
OutputVectorStatistic stats(storeSamples);
for(ConstIterator it = itb; it!= ite; ++it)
stats.addValue( compareVectors(aFirstEstimator,aSecondEstimator,it));
stats.terminate();
return stats;
}
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: