DGtal
0.6.devel
|
#include <GreedyDecomposition.h>
Data Structures | |
class | SegmentIterator |
Public Types | |
typedef TSegment | Segment |
typedef Segment::ConstIterator | Iterator |
Public Member Functions | |
GreedyDecomposition () | |
GreedyDecomposition (const Iterator &aBegin, const Iterator &aEnd, const Segment &aSegment, const bool &aFlag) | |
void | init (const Iterator &aBegin, const Iterator &aEnd, const Segment &aSegment, const bool &aFlag) |
~GreedyDecomposition () | |
GreedyDecomposition::SegmentIterator | begin () const |
GreedyDecomposition::SegmentIterator | end () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
GreedyDecomposition (const GreedyDecomposition &other) | |
GreedyDecomposition & | operator= (const GreedyDecomposition &other) |
Private Attributes | |
Iterator | myBegin |
Iterator | myEnd |
Segment | mySegment |
bool | isClosed |
Aim: Computes the greedy decomposition of a sequence into segments (the last element of a given segment is the first one one of the next segment).
@warning This class is deprecated since GreedySegmentation has been created. This class is used in @href testDecomposition.cpp @href DSSLengthEstimator.ih and @href displayContours.cpp, but GreedySegmentation will be preferred in the future. Description of template class 'GreedyDecomposition' <p> This class is a model of CDecomposition. This class is templated by 'TSegment', a model of CSegmentComputer that is able to manage the on-line recognition of a given class of segments (4-connected DSS, 8-connected DSS, thick segment, etc.) 'TSegment' must have an internal type 'ConstIterator' that is a means of of accessing the sequence elements. 'TSegment' must have the methods init() and extendForward() taking as input a parameter of type 'Iterator'. The extend method must return a boolean equal to TRUE if the extension is possible and has been successfully performed and FALSE otherwise. In the short example below, a digital curve stored in a STL vector is decomposed into 8-connected DSSs whose parameters are sent to the standard output. @code
//types definition typedef PointVector<2,int> Point; typedef std::vector<Point> Sequence; typedef Sequence::const_iterator ConstIterator; typedef ArithmeticalDSS<ConstIterator,int,8> DSS; typedef GreedyDecomposition<DSS> Decomposition;
//sequence of input points Sequence curve; curve.push_back(Point(1,1)); curve.push_back(Point(2,1)); curve.push_back(Point(3,2)); curve.push_back(Point(4,2)); curve.push_back(Point(5,2)); curve.push_back(Point(6,2)); curve.push_back(Point(7,2)); curve.push_back(Point(8,1)); curve.push_back(Point(9,1));
//Segmentation DSS dssRecognition; Decomposition theDecomposition(curve.begin(), curve.end(), dssRecognition, false);
Decomposition::SegmentIterator i = theDecomposition.begin(); for ( ; i != theDecomposition.end(); ++i) { DSS currentSegment(*i); trace.info() << currentSegment << std::endl; //standard output }
If you want to get the DSSs decomposition of the digital curve when it is scanned in the reverse way, you can use the reverse iterator of the STL vector:
Definition at line 125 of file GreedyDecomposition.h.
typedef Segment::ConstIterator DGtal::deprecated::GreedyDecomposition< TSegment >::Iterator |
Definition at line 131 of file GreedyDecomposition.h.
typedef TSegment DGtal::deprecated::GreedyDecomposition< TSegment >::Segment |
Definition at line 130 of file GreedyDecomposition.h.
|
inline |
DGtal::deprecated::GreedyDecomposition< TSegment >::GreedyDecomposition | ( | const Iterator & | aBegin, |
const Iterator & | aEnd, | ||
const Segment & | aSegment, | ||
const bool & | aFlag | ||
) |
Constructor. Nb: The digital curve is decompose as a closed one by default.
aBegin,begin | iterator on a digital curve |
aEnd,end | iterator on a digital curve |
aSegment,a | segment computer |
aFlag | a boolean equal to TRUE to decompose the digital curve as a closed one, FALSE otherwise |
Constructor.
aBegin,begin | iterator on a digital curve |
aEnd,end | iterator on a digital curve |
Definition at line 358 of file GreedyDecomposition.ih.
|
inline |
|
private |
Copy constructor.
other | the object to clone. |
|
inline |
Iterator service.
Iterator service.
Definition at line 400 of file GreedyDecomposition.ih.
References DGtal::deprecated::GreedyDecomposition< TSegment >::myBegin, and DGtal::deprecated::GreedyDecomposition< TSegment >::mySegment.
Referenced by DGtal::DSSLengthEstimator< TConstIterator >::init().
|
inline |
Iterator service.
Iterator service.
Definition at line 413 of file GreedyDecomposition.ih.
References DGtal::deprecated::GreedyDecomposition< TSegment >::myEnd, and DGtal::deprecated::GreedyDecomposition< TSegment >::mySegment.
Referenced by DGtal::DSSLengthEstimator< TConstIterator >::init().
|
inline |
Init. Nb: The digital curve is decompose as a closed one by default.
aBegin,begin | iterator on a digital curve |
aEnd,end | iterator on a digital curve |
aSegment,a | segment computer |
aFlag | a boolean equal to TRUE to decompose the digital curve as a closed one, FALSE otherwise |
Init.
aBegin,begin | iterator on a digital curve |
aEnd,end | iterator on a digital curve |
Definition at line 375 of file GreedyDecomposition.ih.
References DGtal::deprecated::GreedyDecomposition< TSegment >::isClosed, DGtal::deprecated::GreedyDecomposition< TSegment >::myBegin, DGtal::deprecated::GreedyDecomposition< TSegment >::myEnd, and DGtal::deprecated::GreedyDecomposition< TSegment >::mySegment.
Referenced by DGtal::deprecated::GreedyDecomposition< TSegment >::SegmentIterator::doesIntersectNext().
|
inline |
Checks the validity/consistency of the object.
Definition at line 438 of file GreedyDecomposition.ih.
|
private |
Assignment.
other | the object to copy. |
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 426 of file GreedyDecomposition.ih.
|
private |
Definition at line 391 of file GreedyDecomposition.h.
Referenced by DGtal::deprecated::GreedyDecomposition< TSegment >::init().
|
private |
Definition at line 387 of file GreedyDecomposition.h.
Referenced by DGtal::deprecated::GreedyDecomposition< TSegment >::begin(), and DGtal::deprecated::GreedyDecomposition< TSegment >::init().
|
private |
Definition at line 387 of file GreedyDecomposition.h.
Referenced by DGtal::deprecated::GreedyDecomposition< TSegment >::end(), and DGtal::deprecated::GreedyDecomposition< TSegment >::init().
|
private |
Definition at line 389 of file GreedyDecomposition.h.
Referenced by DGtal::deprecated::GreedyDecomposition< TSegment >::begin(), DGtal::deprecated::GreedyDecomposition< TSegment >::end(), DGtal::deprecated::GreedyDecomposition< TSegment >::SegmentIterator::get(), DGtal::deprecated::GreedyDecomposition< TSegment >::init(), DGtal::deprecated::GreedyDecomposition< TSegment >::SegmentIterator::longestSegment(), DGtal::deprecated::GreedyDecomposition< TSegment >::SegmentIterator::operator*(), and DGtal::deprecated::GreedyDecomposition< TSegment >::SegmentIterator::operator=().