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::Measure< TSet > Class Template Reference

#include <Measure.h>

Public Types

typedef TSet Set
typedef TSet::Domain Domain
typedef double Quantity

Public Member Functions

 Measure ()
 ~Measure ()
void init (const double h, const Set &aSetPointer)
Quantity eval () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Member Functions

 Measure (const Measure &other)
Measureoperator= (const Measure &other)

Private Attributes

double myH
Set::Size mySetSize
double myIsInitBefore

Detailed Description

template<typename TSet>
class DGtal::Measure< TSet >

Aim: Implements a simple measure computation (in the Lesbegue sens) of a set. In dimension 2, it corresponds to the area of the set, to the volume in dimension 3,...

Description of template class 'Measure'

Model of CGlobalGeometricEstimator

Template Parameters:
Settype of set on which the geometrical moments is computed.

Definition at line 71 of file Measure.h.


Member Typedef Documentation

template<typename TSet>
typedef TSet::Domain DGtal::Measure< TSet >::Domain

Definition at line 77 of file Measure.h.

template<typename TSet>
typedef double DGtal::Measure< TSet >::Quantity

Definition at line 82 of file Measure.h.

template<typename TSet>
typedef TSet DGtal::Measure< TSet >::Set

Definition at line 76 of file Measure.h.


Constructor & Destructor Documentation

template<typename TSet >
DGtal::Measure< TSet >::Measure ( )
inline

Constructor.

Constructon.

Definition at line 71 of file Measure.ih.

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

Destructor.

Definition at line 82 of file Measure.ih.

{
}
template<typename TSet>
DGtal::Measure< TSet >::Measure ( const Measure< TSet > &  other)
private

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

template<typename TSet >
DGtal::Measure< TSet >::Quantity DGtal::Measure< TSet >::eval ( ) const
inline

Compute the measure (area, volume) of the set. Since we rely on the Set::size() method which is O(1). The current method is O(1) too.

Precondition:
init method must have been called before.
Returns:
the measure of the set.

Definition at line 55 of file Measure.ih.

{
ASSERT(myIsInitBefore);
ASSERT(myH > 0);
double hd = std::pow(myH, (double)TSet::Domain::dimension);
return mySetSize/(double)hd;
}
template<typename TSet >
void DGtal::Measure< TSet >::init ( const double  h,
const Set aSetPointer 
)
inline

Initialize the measure computation.

Parameters:
hgrid size (must be >0).
aSetPointerxa pointer to an input set.

Definition at line 44 of file Measure.ih.

{
myH = h;
mySetSize = aSet.size() ;
}
template<typename TSet >
bool DGtal::Measure< TSet >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 112 of file Measure.ih.

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

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TSet >
void DGtal::Measure< TSet >::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 96 of file Measure.ih.

{
out << "[Measure] ";
if (this->isValid())
out << " myH="<< myH<<", mySetSize="<< mySetSize;
else
out <<" (not initialized)";
}

Field Documentation

template<typename TSet>
double DGtal::Measure< TSet >::myH
private

grid resolution parameter.

Definition at line 156 of file Measure.h.

template<typename TSet>
double DGtal::Measure< TSet >::myIsInitBefore
private

Boolean to assert that the init() was called before the eval().

Definition at line 162 of file Measure.h.

template<typename TSet>
Set::Size DGtal::Measure< TSet >::mySetSize
private

Copy of the set size.

Definition at line 159 of file Measure.h.


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