DGtal 1.3.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DGtal::SaturatedSegmentation< TSegmentComputer > Class Template Reference

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). More...

#include <DGtal/geometry/curves/SaturatedSegmentation.h>

Data Structures

class  SegmentComputerIterator
 Aim: Specific iterator to visit all the maximal segments of a saturated segmentation. More...
 

Public Types

typedef TSegmentComputer SegmentComputer
 
typedef SegmentComputer::ConstIterator ConstIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CForwardSegmentComputer< TSegmentComputer >))
 
 SaturatedSegmentation ()
 
 SaturatedSegmentation (const ConstIterator &itb, const ConstIterator &ite, const SegmentComputer &aSegmentComputer)
 
void setSubRange (const ConstIterator &itb, const ConstIterator &ite)
 
void setMode (const std::string &aMode)
 
 ~SaturatedSegmentation ()
 
SaturatedSegmentation::SegmentComputerIterator begin () const
 
SaturatedSegmentation::SegmentComputerIterator end () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Private Types

typedef TSegmentComputer::Reverse ReverseSegmentComputer
 
typedef ReverseSegmentComputer::ConstIterator ConstReverseIterator
 

Private Member Functions

 SaturatedSegmentation (const SaturatedSegmentation &other)
 
SaturatedSegmentationoperator= (const SaturatedSegmentation &other)
 

Private Attributes

ConstIterator myBegin
 
ConstIterator myEnd
 
ConstIterator myStart
 
ConstIterator myStop
 
std::string myMode
 
SegmentComputer mySegmentComputer
 

Detailed Description

template<typename TSegmentComputer>
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
TSegmentComputerat 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 maximal 8-connected DSSs whose parameters are sent to the standard output.

//types definition
typedef std::vector<Point> Range;
typedef Range::const_iterator ConstIterator;
//input points
Range 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
SegmentComputer recognitionAlgorithm;
Segmentation theSegmentation(curve.begin(), curve.end(), recognitionAlgorithm);
for ( ; i != end; ++i) {
SegmentComputer current(*i);
trace.info() << current << std::endl; //standard output
}
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Aim: Specific iterator to visit all the maximal segments of a saturated segmentation.
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
SaturatedSegmentation::SegmentComputerIterator end() const
SegmentComputer::ConstIterator ConstIterator
Aim: model of CBidirectionalRangeFromPoint that adapts any range of elements bounded by two iterators...
std::ostream & info()
Trace trace
Definition: Common.h:154
SaturatedSegmentation< SegmentComputer > Segmentation
MyPointD Point
Definition: testClone2.cpp:383

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:

theSegmentation.setSubRange(beginIt, endIt);

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:

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:

theSegmentation.setMode("First");
See also
testSegmentation.cpp
Examples
geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleLMST2D.cpp, and geometry/curves/exampleAlphaThickSegmentTgtCover.cpp.

Definition at line 153 of file SaturatedSegmentation.h.

Member Typedef Documentation

◆ ConstIterator

template<typename TSegmentComputer >
typedef SegmentComputer::ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::ConstIterator

Definition at line 160 of file SaturatedSegmentation.h.

◆ ConstReverseIterator

template<typename TSegmentComputer >
typedef ReverseSegmentComputer::ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::ConstReverseIterator
private

Definition at line 165 of file SaturatedSegmentation.h.

◆ ReverseSegmentComputer

template<typename TSegmentComputer >
typedef TSegmentComputer::Reverse DGtal::SaturatedSegmentation< TSegmentComputer >::ReverseSegmentComputer
private

Definition at line 164 of file SaturatedSegmentation.h.

◆ SegmentComputer

template<typename TSegmentComputer >
typedef TSegmentComputer DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputer

Definition at line 159 of file SaturatedSegmentation.h.

Constructor & Destructor Documentation

◆ SaturatedSegmentation() [1/3]

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SaturatedSegmentation ( )
inline

Default constructor.

Nb: not valid

Definition at line 406 of file SaturatedSegmentation.h.

406{};

◆ SaturatedSegmentation() [2/3]

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SaturatedSegmentation ( const ConstIterator itb,
const ConstIterator ite,
const SegmentComputer aSegmentComputer 
)

Constructor.

Parameters
itbbegin iterator of the underlying range
iteend iterator of the underlying range
aSegmentComputeran online segment recognition algorithm.

◆ ~SaturatedSegmentation()

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::~SaturatedSegmentation ( )

Destructor.

◆ SaturatedSegmentation() [3/3]

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SaturatedSegmentation ( const SaturatedSegmentation< TSegmentComputer > &  other)
private

Copy constructor.

Parameters
otherthe object to clone.

Member Function Documentation

◆ begin()

template<typename TSegmentComputer >
SaturatedSegmentation::SegmentComputerIterator DGtal::SaturatedSegmentation< TSegmentComputer >::begin ( ) const

ConstIterator service.

Returns
an iterator pointing on the first segment of a digital curve.

Referenced by main(), TEST_CASE(), and testSegmentation().

◆ BOOST_CONCEPT_ASSERT()

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::BOOST_CONCEPT_ASSERT ( (concepts::CForwardSegmentComputer< TSegmentComputer >)  )

◆ end()

template<typename TSegmentComputer >
SaturatedSegmentation::SegmentComputerIterator DGtal::SaturatedSegmentation< TSegmentComputer >::end ( ) const

ConstIterator service.

Returns
an iterator pointing after the last segment of a digital curve.

Referenced by main(), TEST_CASE(), and testSegmentation().

◆ isValid()

template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ operator=()

template<typename TSegmentComputer >
SaturatedSegmentation & DGtal::SaturatedSegmentation< TSegmentComputer >::operator= ( const SaturatedSegmentation< TSegmentComputer > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ selfDisplay()

template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setMode()

template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::setMode ( const std::string &  aMode)

Set processing mode

Parameters
aModeone of the 3 available modes : "Truncate" (default), "Truncate+1", "DoNotTruncate".

Referenced by testSegmentation().

◆ setSubRange()

template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::setSubRange ( const ConstIterator itb,
const ConstIterator ite 
)

Set a subrange to process

Parameters
itbbegin iterator the range to processed
iteend iterator the range to processed

Nb: must be a valid range included in the underlying range.

Field Documentation

◆ myBegin

template<typename TSegmentComputer >
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::myBegin
private

Begin iterator of the underlying range

Definition at line 475 of file SaturatedSegmentation.h.

◆ myEnd

template<typename TSegmentComputer >
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::myEnd
private

End iterator of the underlying range

Definition at line 480 of file SaturatedSegmentation.h.

◆ myMode

template<typename TSegmentComputer >
std::string DGtal::SaturatedSegmentation< TSegmentComputer >::myMode
private

Mode: either "First", "MostCentered" (default), "Last"

Definition at line 495 of file SaturatedSegmentation.h.

◆ mySegmentComputer

template<typename TSegmentComputer >
SegmentComputer DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer
private

the segment computer.

Definition at line 500 of file SaturatedSegmentation.h.

◆ myStart

template<typename TSegmentComputer >
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::myStart
private

Begin iterator of the subrange to segment

Definition at line 485 of file SaturatedSegmentation.h.

◆ myStop

template<typename TSegmentComputer >
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::myStop
private

End iterator of the subrange to segment

Definition at line 490 of file SaturatedSegmentation.h.


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