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...
template<typename TSegmentComputer>
class DGtal::GreedySegmentation< TSegmentComputer >
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.
- Template Parameters
-
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.
typedef std::vector<Point>
Range;
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));
}
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators....
GreedySegmentation::SegmentComputerIterator end() const
TSegmentComputer SegmentComputer
SegmentComputer::ConstIterator ConstIterator
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Specific iterator to visit all the maximal segments of a saturated segmentation.
const ConstIterator end() const
const ConstIterator begin() const
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
SaturatedSegmentation< SegmentComputer > Segmentation
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:
typedef Range::const_reverse_iterator ConstReverseIterator;
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:
theSegmentation.setSubRange(beginIt, endIt);
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:
- "Truncate" (default), the extension of the last segment (and the segmentation) stops just before endIt.
- "Truncate+1", the last segment is extended to endIt too if it is possible, provided that endIt != curve.end().
- "DoNotTruncate", the last segment is extended as far as possible, provided that curve.end() is not reached.
In order to set a mode (before getting a SegmentComputerIterator), use the setMode() method as follow:
theSegmentation.setMode("DoNotTruncate");
Note that the default mode will be used for any unknown modes.
- See also
- testSegmentation.cpp
- Examples
- geometry/curves/exampleArithDSS3d.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/greedy-dss-decomposition.cpp, and geometry/curves/greedyAlphaThickDecomposition.cpp.
Definition at line 149 of file GreedySegmentation.h.