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
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator > Class Template Reference

#include <MostCenteredMaximalSegmentEstimator.h>

Collaboration diagram for DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >:
Collaboration graph
[legend]

Public Types

typedef
SegmentComputer::ConstIterator 
ConstIterator
typedef SCEstimator::Quantity Quantity
typedef SaturatedSegmentation
< SegmentComputer > 
Segmentation
typedef
Segmentation::SegmentComputerIterator 
SegmentIterator

Public Member Functions

 MostCenteredMaximalSegmentEstimator ()
 MostCenteredMaximalSegmentEstimator (const SegmentComputer &aSegmentComputer, const SCEstimator &aSCEstimator)
 ~MostCenteredMaximalSegmentEstimator ()
void init (const double h, const ConstIterator &itb, const ConstIterator &ite)
Quantity eval (const ConstIterator &it)
template<typename OutputIterator >
OutputIterator eval (const ConstIterator &itb, const ConstIterator &ite, OutputIterator result)
bool isValid () const

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CForwardSegmentComputer< SegmentComputer >))
 BOOST_CONCEPT_ASSERT ((CSegmentComputerEstimator< SCEstimator >))
 BOOST_STATIC_ASSERT ((boost::is_same< SegmentComputer, typename SCEstimator::SegmentComputer >::value))
template<typename OutputIterator >
OutputIterator endEval (const ConstIterator &itb, const ConstIterator &ite, ConstIterator &itCurrent, SegmentIterator &first, SegmentIterator &last, OutputIterator result)
template<typename OutputIterator >
OutputIterator endEval (const ConstIterator &, const ConstIterator &ite, ConstIterator &itCurrent, SegmentIterator &, SegmentIterator &last, OutputIterator result, IteratorType)
template<typename OutputIterator >
OutputIterator endEval (const ConstIterator &itb, const ConstIterator &ite, ConstIterator &itCurrent, SegmentIterator &first, SegmentIterator &last, OutputIterator result, CirculatorType)
 MostCenteredMaximalSegmentEstimator (const MostCenteredMaximalSegmentEstimator &other)
MostCenteredMaximalSegmentEstimatoroperator= (const MostCenteredMaximalSegmentEstimator &other)

Private Attributes

double myH
ConstIterator myBegin
ConstIterator myEnd
SegmentComputer mySC
SCEstimator mySCEstimator

Detailed Description

template<typename SegmentComputer, typename SCEstimator>
class DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >

Aim: A model of CLocalCurveGeometricEstimator that assigns to each element of a (sub)range a quantity estimated from the most centered maximal segment passing through this element.

Description of template class 'MostCenteredMaximalSegmentEstimator'

Here is a basic example of curvature estimation:

Definition at line 83 of file MostCenteredMaximalSegmentEstimator.h.


Member Typedef Documentation

template<typename SegmentComputer, typename SCEstimator>
typedef SegmentComputer::ConstIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::ConstIterator

Definition at line 94 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
typedef SCEstimator::Quantity DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::Quantity

Definition at line 95 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
typedef SaturatedSegmentation<SegmentComputer> DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::Segmentation

Definition at line 97 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
typedef Segmentation::SegmentComputerIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::SegmentIterator

Definition at line 98 of file MostCenteredMaximalSegmentEstimator.h.


Constructor & Destructor Documentation

template<typename SegmentComputer , typename SCEstimator >
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::MostCenteredMaximalSegmentEstimator ( )
inline

Default constructor. Not valid.

Definition at line 45 of file MostCenteredMaximalSegmentEstimator.ih.

{}
template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::MostCenteredMaximalSegmentEstimator ( const SegmentComputer &  aSegmentComputer,
const SCEstimator &  aSCEstimator 
)
inline

Constructor.

Parameters:
aSegmentComputer
aSCEstimator

Definition at line 52 of file MostCenteredMaximalSegmentEstimator.ih.

: myH(0), mySC(aSegmentComputer), mySCEstimator(aSCEstimator)
{}
template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::~MostCenteredMaximalSegmentEstimator ( )
inline

Destructor.

Definition at line 119 of file MostCenteredMaximalSegmentEstimator.h.

{};
template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::MostCenteredMaximalSegmentEstimator ( const MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator > &  other)
private

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::BOOST_CONCEPT_ASSERT ( (CForwardSegmentComputer< SegmentComputer >)  )
private
template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::BOOST_CONCEPT_ASSERT ( (CSegmentComputerEstimator< SCEstimator >)  )
private
template<typename SegmentComputer, typename SCEstimator>
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::BOOST_STATIC_ASSERT ( (boost::is_same< SegmentComputer, typename SCEstimator::SegmentComputer >::value)  )
private
template<typename SegmentComputer , typename SCEstimator >
template<typename OutputIterator >
OutputIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::endEval ( const ConstIterator itb,
const ConstIterator ite,
ConstIterator itCurrent,
SegmentIterator first,
SegmentIterator last,
OutputIterator  result 
)
inlineprivate

Specialization of the end of the algorithm

Parameters:
itbsubrange begin iterator
itesubrange end iterator
itCurrentcurrent iterator
firstiterator on the first maximal segment
lastiterator on the last maximal segment
resultoutput iterator on the estimated quantity
Returns:
the estimated quantity from itCurrent till ite (excluded) NB: O(n)

Definition at line 90 of file MostCenteredMaximalSegmentEstimator.ih.

{
return endEval (itb, ite, itCurrent, first, last, result, Type() );
}
template<typename SegmentComputer , typename SCEstimator >
template<typename OutputIterator >
OutputIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::endEval ( const ConstIterator ,
const ConstIterator ite,
ConstIterator itCurrent,
SegmentIterator ,
SegmentIterator last,
OutputIterator  result,
IteratorType   
)
inlineprivate

Definition at line 104 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::eval().

{
mySCEstimator.attach( *last );
result = mySCEstimator.eval( itCurrent, ite, result );
return result;
}
template<typename SegmentComputer , typename SCEstimator >
template<typename OutputIterator >
OutputIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::endEval ( const ConstIterator itb,
const ConstIterator ite,
ConstIterator itCurrent,
SegmentIterator first,
SegmentIterator last,
OutputIterator  result,
CirculatorType   
)
inlineprivate

Definition at line 119 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::begin(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::end(), DGtal::getMiddleIterator(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::intersectNext(), and DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::intersectPrevious().

{
if ( (itb == ite) && (first.intersectPrevious() && last.intersectNext() ) )
{//if first and last segment intersect (whole range)
//last segment
ConstIterator itEnd = getMiddleIterator( first->begin(), last->end() );//(floor)
++itEnd; //(ceil)
mySCEstimator.attach( *last );
result = mySCEstimator.eval( itCurrent, itEnd, result );
itCurrent = itEnd;
if (itCurrent != ite)
{
//first segment
mySCEstimator.attach( *first );
result = mySCEstimator.eval( itCurrent, ite, result );
}
}
else
{ //(sub range)
mySCEstimator.attach( *last );
result = mySCEstimator.eval( itCurrent, ite, result );
}
return result;
}
template<typename SegmentComputer , typename SCEstimator >
DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::Quantity DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::eval ( const ConstIterator it)
inline

Unique estimation

Parameters:
itany valid iterator
Returns:
the estimated quantity at *it

NB: the whole range [myBegin , myEnd)| is scanned in the worst case

Definition at line 228 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::isNotEmpty(), and DGtal::mostCenteredMaximalSegment().

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

{
if ( this->isValid() )
{
if (isNotEmpty(it,myEnd))
{
mySCEstimator.attach( mySC );
return mySCEstimator.eval( it );
}
else
{
std::cerr << "[DGtal::MostCenteredMaximalSegmentEstimator<SegmentComputer,SCEstimator>::eval(const ConstIterator& it)]"
<< " ERROR. Iterator is invalid (==myEnd)." << std::endl;
throw InputException();
return Quantity();
}
}
else
{
std::cerr << "[DGtal::MostCenteredMaximalSegmentEstimator<SegmentComputer,SCEstimator>::eval(const ConstIterator& it)]"
<< " ERROR. Object is not initialized." << std::endl;
throw InputException();
return Quantity();
}
}
template<typename SegmentComputer , typename SCEstimator >
template<typename OutputIterator >
OutputIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::eval ( const ConstIterator itb,
const ConstIterator ite,
OutputIterator  result 
)
inline

Estimation for a subrange [itb , ite )

Parameters:
itbsubrange begin iterator
itesubrange end iterator
resultoutput iterator on the estimated quantity
Returns:
the estimated quantity from itb till ite (excluded)

NB: the whole range [myBegin , myEnd)| is scanned in the worst case

Definition at line 152 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::begin(), DGtal::SaturatedSegmentation< TSegmentComputer >::begin(), DGtal::SaturatedSegmentation< TSegmentComputer >::SegmentComputerIterator::end(), DGtal::SaturatedSegmentation< TSegmentComputer >::end(), DGtal::getMiddleIterator(), DGtal::SaturatedSegmentation< TSegmentComputer >::setMode(), and DGtal::SaturatedSegmentation< TSegmentComputer >::setSubRange().

{
seg.setSubRange(itb, ite);
if ((myBegin != itb) || (myEnd != ite))
{ //if subrange
seg.setMode("MostCentered++");
}
else
{//whole range
seg.setMode("MostCentered");
}
if (this->isValid()) {
SegmentIterator segItBegin = seg.begin();
SegmentIterator segItEnd = seg.end();
SegmentIterator segIt = segItBegin;
SegmentIterator nextSegIt = segIt;
if (nextSegIt != segItEnd )
{ //at least one maximal segment
++nextSegIt;
if (nextSegIt == segItEnd )
{ //only one maximal segment
mySCEstimator.attach( *segIt );
result = mySCEstimator.eval( itb, ite, result );
}
else
{ //strictly more than one maximal segment
ConstIterator itCurrent = itb;
//main loop
while (nextSegIt != segItEnd)
{
ConstIterator itEnd = getMiddleIterator( nextSegIt->begin(), segIt->end() );//(floor)
++itEnd;//(ceil)
mySCEstimator.attach( *segIt );
result = mySCEstimator.eval( itCurrent, itEnd, result );
itCurrent = itEnd;
segIt = nextSegIt;
++nextSegIt;
}
//end
result = endEval(itb, ite, itCurrent, segItBegin, segIt, result);
}//end one or more maximal segments test
}//end zero or one maximal segment test
return result;
}
else
{//nothing is done without correct initialization
std::cerr << "[DGtal::MostCenteredMaximalSegmentEstimator<SegmentComputer,SCEstimator>::eval(const ConstIterator& itb, const ConstIterator& ite,OutputIterator result)]"
<< " ERROR. Object is not initialized." << std::endl;
throw InputException();
return result;
}
}
template<typename SegmentComputer , typename SCEstimator >
void DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::init ( const double  h,
const ConstIterator itb,
const ConstIterator ite 
)
inline

Initialisation.

Parameters:
hgrid size (must be >0).
itb,beginiterator
ite,enditerator

Definition at line 63 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::init().

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

{
myH = h;
myBegin = itb;
myEnd = ite;
if (this->isValid())
}
template<typename SegmentComputer , typename SCEstimator >
bool DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 79 of file MostCenteredMaximalSegmentEstimator.ih.

References DGtal::isNotEmpty().

{
return ( (myH > 0)&&(isNotEmpty(myBegin, myEnd)) );
}
template<typename SegmentComputer, typename SCEstimator>
MostCenteredMaximalSegmentEstimator& DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::operator= ( const MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator > &  other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.

Field Documentation

template<typename SegmentComputer, typename SCEstimator>
ConstIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::myBegin
private

begin and end iterators

Definition at line 176 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
ConstIterator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::myEnd
private

Definition at line 176 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
double DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::myH
private

grid step

Definition at line 173 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
SegmentComputer DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::mySC
private

segmentComputer used to segment

Definition at line 179 of file MostCenteredMaximalSegmentEstimator.h.

template<typename SegmentComputer, typename SCEstimator>
SCEstimator DGtal::MostCenteredMaximalSegmentEstimator< SegmentComputer, SCEstimator >::mySCEstimator
private

object estimating the quantity from segmentComputer

Definition at line 182 of file MostCenteredMaximalSegmentEstimator.h.


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