DGtal
1.3.beta
|
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators. The last element of a given segment is the first one one of the next segment. More...
#include <DGtal/geometry/curves/GreedySegmentation.h>
Data Structures | |
class | SegmentComputerIterator |
Aim: Specific iterator to visit all the segments of a greedy segmentation. More... | |
Public Types | |
typedef TSegmentComputer | SegmentComputer |
typedef SegmentComputer::ConstIterator | ConstIterator |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CForwardSegmentComputer< TSegmentComputer >)) | |
GreedySegmentation () | |
GreedySegmentation (const ConstIterator &itb, const ConstIterator &ite, const SegmentComputer &aSegmentComputer) | |
void | setSubRange (const ConstIterator &itb, const ConstIterator &ite) |
void | setMode (const std::string &aMode) |
~GreedySegmentation () | |
GreedySegmentation::SegmentComputerIterator | begin () const |
GreedySegmentation::SegmentComputerIterator | end () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Member Functions | |
GreedySegmentation (const GreedySegmentation &other) | |
GreedySegmentation & | operator= (const GreedySegmentation &other) |
Private Attributes | |
ConstIterator | myBegin |
ConstIterator | myEnd |
ConstIterator | myStart |
ConstIterator | myStop |
std::string | myMode |
SegmentComputer | mySegmentComputer |
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators. The last element of a given segment is the first one one of the next segment.
Description of template class 'GreedySegmentation'
This class is a model of CSegmentation.
TSegmentComputer | at least a model of concepts::CForwardSegmentComputer (an online algorithm for the recognition of a given class of segments). |
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.
If you want to get the DSSs segmentation of the digital curve when it is scanned in the reverse way, you can use the reverse iterator of the STL vector:
If you want to get the DSSs segmentation of a part of the digital curve (not the whole digital curve), you can give the range to process as a pair of iterators when calling the setSubRange() method as follow:
Obviously, [beginIt, endIt) has to be a valid range included in the wider range [curve.begin(), curve.end()).
Moreover, a part of a digital curve may be processed either as an independant (open) digital curve or as a part whose segmentation at the ends depends of the underlying digital curve. That's why 3 processing modes are available:
In order to set a mode (before getting a SegmentComputerIterator), use the setMode() method as follow:
Note that the default mode will be used for any unknown modes.
Definition at line 149 of file GreedySegmentation.h.
typedef SegmentComputer::ConstIterator DGtal::GreedySegmentation< TSegmentComputer >::ConstIterator |
Definition at line 156 of file GreedySegmentation.h.
typedef TSegmentComputer DGtal::GreedySegmentation< TSegmentComputer >::SegmentComputer |
Definition at line 155 of file GreedySegmentation.h.
|
inline |
DGtal::GreedySegmentation< TSegmentComputer >::GreedySegmentation | ( | const ConstIterator & | itb, |
const ConstIterator & | ite, | ||
const SegmentComputer & | aSegmentComputer | ||
) |
Constructor.
itb | begin iterator of the underlying range |
ite | end iterator of the underlying range |
aSegmentComputer | an online segment recognition algorithm. |
DGtal::GreedySegmentation< TSegmentComputer >::~GreedySegmentation | ( | ) |
Destructor.
|
private |
Copy constructor.
other | the object to clone. |
GreedySegmentation::SegmentComputerIterator DGtal::GreedySegmentation< TSegmentComputer >::begin | ( | ) | const |
ConstIterator service.
DGtal::GreedySegmentation< TSegmentComputer >::BOOST_CONCEPT_ASSERT | ( | (concepts::CForwardSegmentComputer< TSegmentComputer >) | ) |
GreedySegmentation::SegmentComputerIterator DGtal::GreedySegmentation< TSegmentComputer >::end | ( | ) | const |
ConstIterator service.
bool DGtal::GreedySegmentation< TSegmentComputer >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
private |
Assignment.
other | the object to copy. |
void DGtal::GreedySegmentation< TSegmentComputer >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::GreedySegmentation< TSegmentComputer >::setMode | ( | const std::string & | aMode | ) |
Set processing mode
aMode | one of the 3 available modes : "Truncate" (default), "Truncate+1", "DoNotTruncate". |
void DGtal::GreedySegmentation< TSegmentComputer >::setSubRange | ( | const ConstIterator & | itb, |
const ConstIterator & | ite | ||
) |
Set a sub-range to process.
itb | begin iterator the range to processed |
ite | end iterator the range to processed |
Nb: must be a valid range included in the underlying range.
|
private |
Begin iterator of the underlying range
Definition at line 454 of file GreedySegmentation.h.
|
private |
End iterator of the underlying range
Definition at line 459 of file GreedySegmentation.h.
|
private |
Mode: either "Truncate" (default), "Truncate+1", or "DoNotTruncate".
Definition at line 474 of file GreedySegmentation.h.
|
private |
the segment computer.
Definition at line 479 of file GreedySegmentation.h.
|
private |
Begin iterator of the subrange to segment
Definition at line 464 of file GreedySegmentation.h.
|
private |
End iterator of the subrange to segment
Definition at line 469 of file GreedySegmentation.h.