class DGtal::SaturatedSegmentation< TSegmentComputer >
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range given by a pair of ConstIterators (maximal segments are segments that cannot be included in greater segments).
Description of template class 'SaturatedSegmentation'
This class is a model of CSegmentation.
- Template Parameters
|TSegmentComputer||at least a model of 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 maximal 8-connected DSSs whose parameters are sent to the standard output.
typedef PointVector<2,int> Point;
typedef SaturatedSegmentation<SegmentComputer> Segmentation;
Segmentation::SegmentComputerIterator i = theSegmentation.begin
Segmentation::SegmentComputerIterator end = theSegmentation.end();
If you want to get the saturated 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, the segmentation at the ends depends of the underlying digital curve. Among the whole set of maximal segments that pass through the first (resp. last) element of the range, one maximal segment must be chosen as the first (resp. last) retrieved maximal segments. Several processing modes are therefore available:
- "First" and "First++"
- "MostCentered" (default) and "MostCentered++"
- "Last" and "Last++"
The mode i indicates that the segmentation begins with the i maximal segment passing through the first element and ends with the i maximal segment passing through the last element. The last retrieved segment of the segmentation is not included in the simple "XXX" modes, but is included in the "XXX++" modes.
For instance, in the default mode "MostCentered", the segmentation begins with the most centered maximal segment passing through the first element and ends (without including it) with the most centered maximal segment passing through the last element. This mode is basically used to process a whole circular structure so that the first maximal segment is not retrieved twice. However, in order to include the most centered maximal segment passing through the last element in a subpart, you should use the "MostCentered++" mode.
In order to set a mode (before getting a SegmentComputerIterator), use the setMode() method as follow:
- See also
- geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleLMST2D.cpp, geometry/curves/estimation/exampleLMST3D.cpp, and geometry/curves/exampleAlphaThickSegmentTgtCover.cpp.
Definition at line 153 of file SaturatedSegmentation.h.