DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::L1LengthEstimator< TConstIterator > Class Template Reference

#include <L1LengthEstimator.h>

Collaboration diagram for DGtal::L1LengthEstimator< TConstIterator >:
Collaboration graph
[legend]

Public Types

typedef TConstIterator ConstIterator
typedef double Quantity

Public Member Functions

 L1LengthEstimator ()
 ~L1LengthEstimator ()
void init (const double h, const ConstIterator &itb, const ConstIterator &ite)
Quantity eval () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Member Functions

 L1LengthEstimator (const L1LengthEstimator &other)
L1LengthEstimatoroperator= (const L1LengthEstimator &other)

Private Attributes

double myH
ConstIterator myBeginIt
ConstIterator myEndIt
bool myIsInitBefore

Detailed Description

template<typename TConstIterator>
class DGtal::L1LengthEstimator< TConstIterator >

Aim: a simple model of CGlobalCurveEstimator that compute the length of a curve using the l_1 metric (just add 1/h for every step).

Description of template class 'L1LengthEstimator'

Model of CGlobalCurveGeometricEstimator.

Template Parameters:
TConstIteratora model of CConstIteratorOnArrows.

Definition at line 67 of file L1LengthEstimator.h.


Member Typedef Documentation

template<typename TConstIterator>
typedef TConstIterator DGtal::L1LengthEstimator< TConstIterator >::ConstIterator
Todo:
CONCEPT CHECK sur ConstIterator

Definition at line 74 of file L1LengthEstimator.h.

template<typename TConstIterator>
typedef double DGtal::L1LengthEstimator< TConstIterator >::Quantity

Definition at line 76 of file L1LengthEstimator.h.


Constructor & Destructor Documentation

template<typename T >
DGtal::L1LengthEstimator< T >::L1LengthEstimator ( )
inline

Default Constructor.

Constructor.

Definition at line 46 of file L1LengthEstimator.ih.

{
myIsInitBefore = false;
}
template<typename T >
DGtal::L1LengthEstimator< T >::~L1LengthEstimator ( )
inline

Destructor.

Definition at line 56 of file L1LengthEstimator.ih.

{
}
template<typename TConstIterator>
DGtal::L1LengthEstimator< TConstIterator >::L1LengthEstimator ( const L1LengthEstimator< TConstIterator > &  other)
private

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

template<typename T >
DGtal::L1LengthEstimator< T >::Quantity DGtal::L1LengthEstimator< T >::eval ( ) const
inline

Computation of the l1 length of the curve. Complexity: O(|Range|)

Precondition:
init() method must be called before.
Returns:
the curve length.

Definition at line 83 of file L1LengthEstimator.ih.

References DGtal::isNotEmpty().

{
ASSERT(myH > 0);
ASSERT(myIsInitBefore);
Quantity val = 0;
{
ConstIterator i = myBeginIt;
do
{
val += 1.0;
++i;
}
while (i != myEndIt);
}
return val*myH;
}
template<typename T >
void DGtal::L1LengthEstimator< T >::init ( const double  h,
const ConstIterator itb,
const ConstIterator ite 
)
inline

Initialize the measure computation.

Parameters:
hgrid size (must be >0).
itbbegin iterator
iteend iterator
closedtrue if the input range is closed.

Definition at line 70 of file L1LengthEstimator.ih.

{
myH = h;
myBeginIt = itb;
myEndIt = ite;
}
template<typename T >
bool DGtal::L1LengthEstimator< T >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 132 of file L1LengthEstimator.ih.

{
}
template<typename TConstIterator>
L1LengthEstimator& DGtal::L1LengthEstimator< TConstIterator >::operator= ( const L1LengthEstimator< TConstIterator > &  other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename T >
void DGtal::L1LengthEstimator< T >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 116 of file L1LengthEstimator.ih.

{
out << "[L1LengthEstimator]";
out <<" myH="<<myH;
else
out<< " not initialized";
}

Field Documentation

template<typename TConstIterator>
ConstIterator DGtal::L1LengthEstimator< TConstIterator >::myBeginIt
private

Copy of the range.

Definition at line 134 of file L1LengthEstimator.h.

template<typename TConstIterator>
ConstIterator DGtal::L1LengthEstimator< TConstIterator >::myEndIt
private

Definition at line 135 of file L1LengthEstimator.h.

template<typename TConstIterator>
double DGtal::L1LengthEstimator< TConstIterator >::myH
private

Grid size.

Definition at line 131 of file L1LengthEstimator.h.

template<typename TConstIterator>
bool DGtal::L1LengthEstimator< TConstIterator >::myIsInitBefore
private

Boolean to make sure that init() has been called before eval().

Definition at line 138 of file L1LengthEstimator.h.


The documentation for this class was generated from the following files: