Data Structures | Public Member Functions | Private Member Functions | Private Attributes

DGtal::GreedyDecomposition< Contour, Primitive > Class Template Reference

Aim: Computes the greedy decomposition of a contour into primitives (the last point of the primitive i is the first point of the primitive i+1). More...

#include <GreedyDecomposition.h>

Data Structures

class  ConstIterator

Public Member Functions

 ~GreedyDecomposition ()
 GreedyDecomposition (const Contour &aContour)
GreedyDecomposition::ConstIterator begin () const
GreedyDecomposition::ConstIterator end () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Member Functions

 GreedyDecomposition (const GreedyDecomposition &other)
GreedyDecompositionoperator= (const GreedyDecomposition &other)

Private Attributes

const Contour * myContour

Detailed Description

template<typename Contour, typename Primitive>
class DGtal::GreedyDecomposition< Contour, Primitive >

Aim: Computes the greedy decomposition of a contour into primitives (the last point of the primitive i is the first point of the primitive i+1).

Description of template class 'GreedyDecomposition'

The contour must provide a constIterator as a way of scanning its points and must be able to return its size. The primitive must have a method addFront() to check whether the primitive can be extended at the front or not.

Here is an example of how to use this class to decompose a contour into DSSs :

   typedef int Coordinate;
   typedef PointVector<2,Coordinate> Point;
   
   //Define the primitive as a standard DSS
   typedef ArithmeticalDSS<StandardBase<Coordinate> > PrimitiveType;
   
   // Define the contour as a FreemanChain
   typedef FreemanChain<Coordinate> ContourType; 
   
   // Open the contour file
   std::string filename = "myContour.fc";
   std::fstream fst;
   fst.open (filename.c_str(), std::ios::in);
   ContourType theContour(fst);
   
   // Decomposition of the contour into DSSs
   GreedyDecomposition<ContourType,PrimitiveType> theDecomposition(theContour);
Examples:

dgtalboard-5-greedy-dss.cpp, and DSS.cpp.


Constructor & Destructor Documentation

template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::~GreedyDecomposition (  ) 

Destructor.

template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::GreedyDecomposition ( const Contour &  aContour  ) 

Constructor.

Parameters:
aContour,the contour whose decomposition is computed
template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::GreedyDecomposition ( const GreedyDecomposition< Contour, Primitive > &  other  )  [private]

Copy constructor.

Parameters:
other the object to clone. Forbidden by default.

Member Function Documentation

template<typename Contour, typename Primitive>
GreedyDecomposition::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::begin (  )  const

Iterator service.

Returns:
an iterator pointing on the first primitive of the contour.

Referenced by main().

template<typename Contour, typename Primitive>
GreedyDecomposition::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::end (  )  const

Iterator service.

Returns:
an iterator pointing after the last primitive of the contour.

Referenced by main().

template<typename Contour, typename Primitive>
bool DGtal::GreedyDecomposition< Contour, Primitive >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename Contour, typename Primitive>
GreedyDecomposition& DGtal::GreedyDecomposition< Contour, Primitive >::operator= ( const GreedyDecomposition< Contour, Primitive > &  other  )  [private]

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename Contour, typename Primitive>
void DGtal::GreedyDecomposition< Contour, Primitive >::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.

Field Documentation

template<typename Contour, typename Primitive>
const Contour* DGtal::GreedyDecomposition< Contour, Primitive >::myContour [private]

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