DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::DSSLengthLessEqualFilter< DSS > Class Template Reference

#include <DGtal/geometry/curves/estimation/FunctorsLambdaMST.h>

Public Types

typedef DSS DSSType
 
typedef IteratorCirculatorTraits< typenameDSSType::ConstIterator >::Value Point
 

Public Member Functions

 DSSLengthLessEqualFilter ()
 
void init (double threshold)
 
bool operator() (const DSSType &dss) const
 
bool admissibility (const DSSType &dss, const Point &p) const
 
long int position (const DSSType &dss, const Point &p) const
 

Private Attributes

double lenThreshold
 
bool initThreshold
 

Detailed Description

template<typename DSS>
class DGtal::DSSLengthLessEqualFilter< DSS >

Description of class 'DSSLengthLessEqualFilter' – model of CLMSTDSSFilter. Aim: Provide a functor which allow for filtering DSSes of length lower than a given threshold.

Template Parameters
DSSdigital straight segment recognition algorithm

Definition at line 269 of file FunctorsLambdaMST.h.

Member Typedef Documentation

◆ DSSType

template<typename DSS >
typedef DSS DGtal::DSSLengthLessEqualFilter< DSS >::DSSType

Definition at line 273 of file FunctorsLambdaMST.h.

◆ Point

template<typename DSS >
typedef IteratorCirculatorTraits<typenameDSSType::ConstIterator>::Value DGtal::DSSLengthLessEqualFilter< DSS >::Point

Definition at line 274 of file FunctorsLambdaMST.h.

Constructor & Destructor Documentation

◆ DSSLengthLessEqualFilter()

template<typename DSS >
DGtal::DSSLengthLessEqualFilter< DSS >::DSSLengthLessEqualFilter ( )
inline

Member Function Documentation

◆ admissibility()

template<typename DSS >
bool DGtal::DSSLengthLessEqualFilter< DSS >::admissibility ( const DSSType & dss,
const Point & p ) const
inline

Checks if the DSS can be used for points that are not covered by any DSS longer than the threshold.

Parameters
dss- the DSS to be checked if it is close enough to the point p
p- the point that is not covered by a long enough DSS
Returns
true if the DSS (see dss) is close enough to the point (see p)

Definition at line 307 of file FunctorsLambdaMST.h.

308 {
309 return ( p - *dss.begin ( ) ).norm ( ) <= lenThreshold || ( p - *( dss.end ( ) - 1 ) ).norm ( ) <= lenThreshold;
310 }

References DGtal::DSSLengthLessEqualFilter< DSS >::lenThreshold.

◆ init()

template<typename DSS >
void DGtal::DSSLengthLessEqualFilter< DSS >::init ( double threshold)
inline

Filter initialization method, which has to be used before using the filter

Parameters
thresholdlength threshold used by the filter

Definition at line 281 of file FunctorsLambdaMST.h.

282 {
283 if ( threshold < 0. )
284 throw std::runtime_error ( "The threshold has to be positive!" );
285 lenThreshold = threshold;
286 initThreshold = true;
287 }

References DGtal::DSSLengthLessEqualFilter< DSS >::initThreshold, and DGtal::DSSLengthLessEqualFilter< DSS >::lenThreshold.

◆ operator()()

template<typename DSS >
bool DGtal::DSSLengthLessEqualFilter< DSS >::operator() ( const DSSType & dss) const
inline
Parameters
dss- the DSS to be checked by the filter
Returns
true if the dss length is smaller than the threshold

Definition at line 293 of file FunctorsLambdaMST.h.

294 {
295 if (! initThreshold )
296 throw std::runtime_error ( "The filter has to be initialized!" );
297
298 return std::distance ( dss.begin ( ), dss.end ( ) ) < lenThreshold;
299 }

References DGtal::DSSLengthLessEqualFilter< DSS >::initThreshold, and DGtal::DSSLengthLessEqualFilter< DSS >::lenThreshold.

◆ position()

template<typename DSS >
long int DGtal::DSSLengthLessEqualFilter< DSS >::position ( const DSSType & dss,
const Point & p ) const
inline

Returns position for an uncovered point i.e., point that is not covered by a DSS longer than the threshold, and a DSS that is long enough and it is in the vicinity of the point.

Parameters
dss- the DSS that does not cover the point but it is close enough to it
p- uncovered point
Returns
the position of p with respect to dss

Definition at line 319 of file FunctorsLambdaMST.h.

320 {
321 if ( ( p - *dss.begin ( ) ).norm ( ) <= lenThreshold )
322 return 1;
323 else if ( ( p - *( dss.end ( ) - 1 ) ).norm ( ) <= lenThreshold )
324 return std::distance ( dss.begin ( ), dss.end ( ) ) + 1;
325 else
326 throw std::runtime_error ( "The DSS and the point are not admissible!" );
327 }

References DGtal::DSSLengthLessEqualFilter< DSS >::lenThreshold.

Field Documentation

◆ initThreshold

template<typename DSS >
bool DGtal::DSSLengthLessEqualFilter< DSS >::initThreshold
private

◆ lenThreshold


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