DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator Class Reference

#include <SaturatedSegmentation.h>

Public Types

typedef
SaturatedSegmentation::SegmentComputer 
SegmentComputer
typedef
SegmentComputer::ConstIterator 
ConstIterator

Public Member Functions

 SegmentComputerIterator (const SaturatedSegmentation< TSegmentComputer > *aSegmentation, const TSegmentComputer &aSegmentComputer, const bool &aFlag)
 SegmentComputerIterator (const SegmentComputerIterator &aOther)
SegmentComputerIteratoroperator= (const SegmentComputerIterator &aOther)
 ~SegmentComputerIterator ()
bool isValid () const
const SegmentComputeroperator* () const
SegmentComputer get () const
const SegmentComputeroperator-> () const
SegmentComputerIteratoroperator++ ()
bool operator== (const SegmentComputerIterator &aOther) const
bool operator!= (const SegmentComputerIterator &aOther) const
bool intersectNext () const
bool intersectPrevious () const
const ConstIterator begin () const
const ConstIterator end () const

Private Member Functions

bool doesIntersectNext (const ConstIterator &it, const ConstIterator &itb, const ConstIterator &ite)
bool doesIntersectNext (const ConstIterator &it, const ConstIterator &itb, const ConstIterator &ite, IteratorType)
bool doesIntersectNext (const ConstIterator &it, const ConstIterator &itb, const ConstIterator &ite, CirculatorType)
bool doesIntersectNext (const ConstIterator &it)
void nextMaximalSegment ()
void initFirstMaximalSegment ()
void initLastMaximalSegment ()

Private Attributes

const SaturatedSegmentation
< TSegmentComputer > * 
myS
SegmentComputer mySegmentComputer
bool myFlagIsValid
ConstIterator myLastMaximalSegmentBegin
ConstIterator myLastMaximalSegmentEnd
bool myFlagIntersectNext
bool myFlagIntersectPrevious
bool myFlagIsLast

Friends

class SaturatedSegmentation< TSegmentComputer >

Detailed Description

template<typename TSegmentComputer>
class DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator

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

Description of template class 'SaturatedSegmentation::SegmentComputerIterator'

Definition at line 179 of file SaturatedSegmentation.h.


Member Typedef Documentation

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

Definition at line 186 of file SaturatedSegmentation.h.

Definition at line 185 of file SaturatedSegmentation.h.


Constructor & Destructor Documentation

template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator ( const SaturatedSegmentation< TSegmentComputer > *  aSegmentation,
const TSegmentComputer &  aSegmentComputer,
const bool &  aFlag 
)
inline

Constructor.

Nb: complexity in O(n).

Parameters:
aSegmentationthe object that knows the range bounds
aSegmentComputeran online segment recognition algorithm
aFlag'true' to build a valid object, 'false' otherwise

Definition at line 209 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::doesIntersectNext(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::initFirstMaximalSegment(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::initLastMaximalSegment(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIntersectNext, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIntersectPrevious, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIsLast, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIsValid, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myLastMaximalSegmentBegin, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myLastMaximalSegmentEnd, DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myS, and DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::mySegmentComputer.

: myS( s ),
mySegmentComputer( aSegmentComputer ),
myFlagIsValid( aIsValid ),
myFlagIsLast( false )
{
if ( isNotEmpty<ConstIterator>(myS->myStart, myS->myStop) )
{ //if at least one element
{ //if only one segment
myFlagIsLast = true;
} else //otherwise
{
}
}
else
{
myFlagIsValid = false;
}
}
}
template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator ( const SegmentComputerIterator aOther)
inline

Copy constructor.

Parameters:
otherthe iterator to clone.

Definition at line 253 of file SaturatedSegmentation.ih.

: myS( other.myS ),
mySegmentComputer( other.mySegmentComputer ),
myFlagIsValid( other.myFlagIsValid ),
myLastMaximalSegmentBegin( other.myLastMaximalSegmentBegin ),
myLastMaximalSegmentEnd( other.myLastMaximalSegmentEnd ),
myFlagIntersectNext( other.myFlagIntersectNext ),
myFlagIntersectPrevious( other.myFlagIntersectPrevious ) ,
myFlagIsLast( other.myFlagIsLast )
{
}
template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::~SegmentComputerIterator ( )
inline

Destructor. Does nothing.

Definition at line 289 of file SaturatedSegmentation.ih.

{
}

Member Function Documentation

template<typename TSegmentComputer >
const DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::begin ( ) const
inline
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::doesIntersectNext ( const ConstIterator it,
const ConstIterator itb,
const ConstIterator ite 
)
inlineprivate

Checks if the current segment intersects the next one.

Parameters:
itend of the current segment
itbbegin iterator of the underlying range
iteend iterator of the underlying range
Returns:
'true' if it != itb and it != ite and –it and it form a valid segment, false otherwise

Definition at line 51 of file SaturatedSegmentation.ih.

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator().

{
typedef typename IteratorCirculatorTraits<typename SegmentComputer::ConstIterator>::Type Type;
return this->doesIntersectNext( it, itb, ite, Type() );
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::doesIntersectNext ( const ConstIterator it,
const ConstIterator itb,
const ConstIterator ite,
IteratorType   
)
inlineprivate

Definition at line 61 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
ConstIterator previousIt(it);
if ( (it != itb)&&(it != ite) ) {
--previousIt;
SegmentComputer tmpSegmentComputer=mySegmentComputer.getSelf();
tmpSegmentComputer.init(previousIt);
return tmpSegmentComputer.extendForward();
}
else
{
return false;
}
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::doesIntersectNext ( const ConstIterator it,
const ConstIterator itb,
const ConstIterator ite,
CirculatorType   
)
inlineprivate

Definition at line 79 of file SaturatedSegmentation.ih.

{
return this->doesIntersectNext(it);
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::doesIntersectNext ( const ConstIterator it)
inlineprivate

Checks if the current segment intersects the next one (if exists).

Parameters:
itend of the current segment
Returns:
'true' if –it and it form a valid segment, false otherwise

NB: no verification

Definition at line 91 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
ConstIterator previousIt(it); --previousIt;
SegmentComputer tmpSegmentComputer=mySegmentComputer.getSelf();
tmpSegmentComputer.init(previousIt);
return tmpSegmentComputer.extendForward();
}
template<typename TSegmentComputer >
const DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::end ( ) const
inline
template<typename TSegmentComputer >
TSegmentComputer DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::get ( ) const
inline
Returns:
the current segment.

Definition at line 319 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
}
template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::initFirstMaximalSegment ( )
inlineprivate

Computes the first maximal segment of the segmentation.

Definition at line 104 of file SaturatedSegmentation.ih.

References DGtal::firstMaximalSegment(), DGtal::lastMaximalSegment(), DGtal::mostCenteredMaximalSegment(), and DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator().

{
if ( (myS->myMode == "First") || (myS->myMode == "First++") ) {
DGtal::firstMaximalSegment(mySegmentComputer, myS->myStart, myS->myBegin, myS->myEnd);
}
else
if ( (myS->myMode == "Last") || (myS->myMode == "Last++") ) {
DGtal::lastMaximalSegment(mySegmentComputer, myS->myStart, myS->myBegin, myS->myEnd);
}
else { // (myS->myMode == "MostCentered") or (myS->myMode == "MostCentered++")
}
}
template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::initLastMaximalSegment ( )
inlineprivate

Computes the last maximal segment of the segmentation.

Definition at line 122 of file SaturatedSegmentation.ih.

References DGtal::firstMaximalSegment(), DGtal::isNotEmpty(), DGtal::lastMaximalSegment(), DGtal::mostCenteredMaximalSegment(), DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer, DGtal::nextMaximalSegment(), and DGtal::previousMaximalSegment().

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator().

{
ConstIterator i(myS->myStop);
if (isNotEmpty(myS->myStop,myS->myEnd)) {
if ((myS->myMode == "First")||(myS->myMode == "First++")) {
}
else
if ((myS->myMode == "Last")||(myS->myMode == "Last++")) {
}
else { // (myS->myMode == "MostCentered") or (myS->myMode == "MostCentered++")
}
} else { //processing of a whole linear range
--i; //set i to the last point (not past-to-last)
if ((myS->myMode == "First")||(myS->myMode == "First++")) {
}
else
if ((myS->myMode == "Last")||(myS->myMode == "Last++")) {
}
else { // (myS->myMode == "MostCentered") or (myS->myMode == "MostCentered++")
}
}
if ((myS->myMode == "MostCentered++") || (myS->myMode == "First++") || (myS->myMode == "Last++"))
{ //take the next maximal segment in the "++" modes
}
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::intersectNext ( ) const
inline
Returns:
TRUE if the current segment intersects the next one, FALSE otherwise.

Definition at line 366 of file SaturatedSegmentation.ih.

Referenced by DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::endEval().

{
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::intersectPrevious ( ) const
inline
Returns:
TRUE if the current segment intersects the previous one, FALSE otherwise.

Definition at line 374 of file SaturatedSegmentation.ih.

Referenced by DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::endEval().

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

Checks the validity/consistency of the object.

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

Definition at line 278 of file SaturatedSegmentation.h.

References DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIsValid.

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator==().

{ return myFlagIsValid; }
template<typename TSegmentComputer >
void DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::nextMaximalSegment ( )
inlineprivate

Goes to the next maximal segment (if possible).

Definition at line 173 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer, and DGtal::nextMaximalSegment().

{
if ( myFlagIsLast ) { //if end
myFlagIsValid = false;
} else { //otherwise
&&(mySegmentComputer.end() == myLastMaximalSegmentEnd) ) { //if only one segment
myFlagIsLast = true;
} else { //otherwise
}
}
}
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator!= ( const SegmentComputerIterator aOther) const
inline

Inequality operator.

Parameters:
aOtherthe iterator to compare with
Returns:
'true' if their current positions differs. (different front and back iterators)

Definition at line 354 of file SaturatedSegmentation.ih.

{
return !(*this == other);
}
template<typename TSegmentComputer >
const TSegmentComputer & DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator* ( ) const
inline
Returns:
a constant reference to the current segment

Definition at line 301 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
}
template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator & DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator++ ( )
inline

Pre-increment. Goes to the next maximal segment (if possible).

Nb: complexity in O(n).

Definition at line 328 of file SaturatedSegmentation.ih.

References DGtal::nextMaximalSegment().

{
return *this;
}
template<typename TSegmentComputer >
const TSegmentComputer * DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator-> ( ) const
inline
Returns:
a constant pointer to the current segment

Definition at line 310 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
}
template<typename TSegmentComputer >
DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator & DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator= ( const SegmentComputerIterator aOther)
inline
template<typename TSegmentComputer >
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator== ( const SegmentComputerIterator aOther) const
inline

Equality operator.

Parameters:
aOtherthe iterator to compare with
Returns:
'true' if their current positions coincide. (same front and back iterators)

Definition at line 339 of file SaturatedSegmentation.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::isValid(), DGtal::SaturatedSegmentation< TSegmentComputer >::isValid(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::mySegmentComputer, and DGtal::SaturatedSegmentation< TSegmentComputer >::mySegmentComputer.

{
if ( isValid() )
return ( (other.isValid() ) &&
( mySegmentComputer.begin() == other.mySegmentComputer.begin() ) &&
( mySegmentComputer.end() == other.mySegmentComputer.end() ) );
else
return ( ! other.isValid() );
}

Friends And Related Function Documentation

template<typename TSegmentComputer>
friend class SaturatedSegmentation< TSegmentComputer >
friend

Definition at line 239 of file SaturatedSegmentation.h.


Field Documentation

template<typename TSegmentComputer>
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIntersectNext
private

A flag equal to TRUE if the current segment intersects the next one, FALSE otherwise (and FALSE if the current segment is the last one)

Definition at line 220 of file SaturatedSegmentation.h.

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator=(), and DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator().

template<typename TSegmentComputer>
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIntersectPrevious
private

A flag equal to TRUE if the current segment intersects the previous one, FALSE otherwise (and FALSE if the current segment is the first one)

Definition at line 227 of file SaturatedSegmentation.h.

Referenced by DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::operator=(), and DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::SegmentComputerIterator().

template<typename TSegmentComputer>
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIsLast
private
template<typename TSegmentComputer>
bool DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myFlagIsValid
private
template<typename TSegmentComputer>
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myLastMaximalSegmentBegin
private
template<typename TSegmentComputer>
ConstIterator DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myLastMaximalSegmentEnd
private
template<typename TSegmentComputer>
const SaturatedSegmentation<TSegmentComputer>* DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::myS
private
template<typename TSegmentComputer>
SegmentComputer DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::mySegmentComputer
private

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