DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue > Class Template Reference

Aim: This class represents a 2D contour convolved by some binomial. It computes first and second order derivatives so as to be able to estimate tangent and curvature. In particular, it smoothes digital contours but could be used for other kind of contours. More...

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

Public Types

typedef TValue Value
 
typedef TConstIteratorOnPoints ConstIteratorOnPoints
 
typedef ConstIteratorOnPoints::value_type Point
 

Public Member Functions

 BinomialConvolver (unsigned int n=1)
 
 ~BinomialConvolver ()
 
void setSize (unsigned int n)
 
unsigned int size () const
 
void init (const double h, const ConstIteratorOnPoints &itb, const ConstIteratorOnPoints &ite, const bool isClosed)
 
int index (const ConstIteratorOnPoints &it) const
 
std::pair< Value, Valuex (int i) const
 
std::pair< Value, Valuedx (int i) const
 
std::pair< Value, Valued2x (int i) const
 
std::pair< Value, Valuetangent (int i) const
 
Value curvature (int i) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Member Functions

static unsigned int suggestedSize (const double h, const ConstIteratorOnPoints &itb, const ConstIteratorOnPoints &ite)
 

Protected Attributes

unsigned int myN
 
double myH
 
Signal< ValuemyX
 
Signal< ValuemyY
 
Signal< ValuemyDX
 
Signal< ValuemyDY
 
Signal< ValuemyDDX
 
Signal< ValuemyDDY
 
ConstIteratorOnPoints myBegin
 Copy of the begin iterator. More...
 
ConstIteratorOnPoints myEnd
 Copy of the end iterator. More...
 
std::map< ConstIteratorOnPoints, int > myMapIt2Idx
 

Private Member Functions

 BinomialConvolver (const BinomialConvolver &other)
 
BinomialConvolveroperator= (const BinomialConvolver &other)
 

Detailed Description

template<typename TConstIteratorOnPoints, typename TValue = double>
class DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >

Aim: This class represents a 2D contour convolved by some binomial. It computes first and second order derivatives so as to be able to estimate tangent and curvature. In particular, it smoothes digital contours but could be used for other kind of contours.

Description of template class 'BinomialConvolver'.

Template Parameters
TConstIteratorOnPointsthe type that represents an iterator in a sequence of points. Each component of Point must be convertible into a double.
TValuethe type for storing the convolved versions of the contour (double as default).
See also
testBinomialConvolver.cpp

Definition at line 73 of file BinomialConvolver.h.

Member Typedef Documentation

◆ ConstIteratorOnPoints

template<typename TConstIteratorOnPoints , typename TValue = double>
typedef TConstIteratorOnPoints DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::ConstIteratorOnPoints

Definition at line 78 of file BinomialConvolver.h.

◆ Point

template<typename TConstIteratorOnPoints , typename TValue = double>
typedef ConstIteratorOnPoints::value_type DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::Point

Definition at line 79 of file BinomialConvolver.h.

◆ Value

template<typename TConstIteratorOnPoints , typename TValue = double>
typedef TValue DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::Value

Definition at line 77 of file BinomialConvolver.h.

Constructor & Destructor Documentation

◆ BinomialConvolver() [1/2]

template<typename TConstIteratorOnPoints , typename TValue = double>
DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::BinomialConvolver ( unsigned int  n = 1)

Constructor. The object is not valid.

Parameters
nthe parameter for the size of the binomial kernel (which is then 2^n).
See also
init

◆ ~BinomialConvolver()

template<typename TConstIteratorOnPoints , typename TValue = double>
DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::~BinomialConvolver ( )

Destructor.

◆ BinomialConvolver() [2/2]

template<typename TConstIteratorOnPoints , typename TValue = double>
DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::BinomialConvolver ( const BinomialConvolver< TConstIteratorOnPoints, TValue > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ curvature()

template<typename TConstIteratorOnPoints , typename TValue = double>
Value DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::curvature ( int  i) const
Parameters
iany index.
Returns
the curvature of the signal (0 is the first point).

NB: depends on the gridstep.

◆ d2x()

template<typename TConstIteratorOnPoints , typename TValue = double>
std::pair< Value, Value > DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::d2x ( int  i) const
Parameters
iany index.
Returns
the second derivative of the position (x''[ i ],y''[ i ]) (0 is the first point).

◆ dx()

template<typename TConstIteratorOnPoints , typename TValue = double>
std::pair< Value, Value > DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::dx ( int  i) const
Parameters
iany index.
Returns
the derivative of the position (x'[ i ],y'[ i ]) (0 is the first point).

◆ index()

template<typename TConstIteratorOnPoints , typename TValue = double>
int DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::index ( const ConstIteratorOnPoints it) const

Given a valid iterator [it], return the corresponding index position in the binomial convolver in logarithmic time. The method init should have been called before.

See also
init
Parameters
itany valid iterator
Returns
its index for accessing geometric data.

◆ init()

template<typename TConstIteratorOnPoints , typename TValue = double>
void DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::init ( const double  h,
const ConstIteratorOnPoints itb,
const ConstIteratorOnPoints ite,
const bool  isClosed 
)

Initializes the convolver with some sequence of points.

Parameters
hgrid size (must be >0).
itbbegin iterator
iteend iterator
isClosedtrue if the input range is viewed as closed.

The object is then valid.

◆ isValid()

template<typename TConstIteratorOnPoints , typename TValue = double>
bool DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ operator=()

template<typename TConstIteratorOnPoints , typename TValue = double>
BinomialConvolver & DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::operator= ( const BinomialConvolver< TConstIteratorOnPoints, TValue > &  other)
private

Assignment.

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

◆ selfDisplay()

template<typename TConstIteratorOnPoints , typename TValue = double>
void DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setSize()

template<typename TConstIteratorOnPoints , typename TValue = double>
void DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::setSize ( unsigned int  n)
Parameters
nthe parameter for the size of the binomial kernel (which is then 2^n).

◆ size()

template<typename TConstIteratorOnPoints , typename TValue = double>
unsigned int DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::size ( ) const
Returns
the parameter for the size of the binomial kernel (which is then 2^n).

◆ suggestedSize()

template<typename TConstIteratorOnPoints , typename TValue = double>
static unsigned int DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::suggestedSize ( const double  h,
const ConstIteratorOnPoints itb,
const ConstIteratorOnPoints ite 
)
static
Returns
the suggested size for the binomial convolver as ceil( d / pow( h, 1.0/3.0 ) ), with d the diameter of the contour.

◆ tangent()

template<typename TConstIteratorOnPoints , typename TValue = double>
std::pair< Value, Value > DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::tangent ( int  i) const
Parameters
iany index.
Returns
the normalized tangent vector (x'[ i ],y'[ i ]) (0 is the first point).

◆ x()

template<typename TConstIteratorOnPoints , typename TValue = double>
std::pair< Value, Value > DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::x ( int  i) const
Parameters
iany index.
Returns
the position vector (x[ i ],y[ i ]) (0 is the first point).

Field Documentation

◆ myBegin

template<typename TConstIteratorOnPoints , typename TValue = double>
ConstIteratorOnPoints DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myBegin
protected

Copy of the begin iterator.

Definition at line 213 of file BinomialConvolver.h.

◆ myDDX

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myDDX
protected

Definition at line 209 of file BinomialConvolver.h.

◆ myDDY

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myDDY
protected

Definition at line 210 of file BinomialConvolver.h.

◆ myDX

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myDX
protected

Definition at line 207 of file BinomialConvolver.h.

◆ myDY

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myDY
protected

Definition at line 208 of file BinomialConvolver.h.

◆ myEnd

template<typename TConstIteratorOnPoints , typename TValue = double>
ConstIteratorOnPoints DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myEnd
protected

Copy of the end iterator.

Definition at line 216 of file BinomialConvolver.h.

◆ myH

template<typename TConstIteratorOnPoints , typename TValue = double>
double DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myH
protected

Definition at line 204 of file BinomialConvolver.h.

◆ myMapIt2Idx

template<typename TConstIteratorOnPoints , typename TValue = double>
std::map<ConstIteratorOnPoints,int> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myMapIt2Idx
protected

Definition at line 219 of file BinomialConvolver.h.

◆ myN

template<typename TConstIteratorOnPoints , typename TValue = double>
unsigned int DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myN
protected

Definition at line 203 of file BinomialConvolver.h.

◆ myX

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myX
protected

Definition at line 205 of file BinomialConvolver.h.

◆ myY

template<typename TConstIteratorOnPoints , typename TValue = double>
Signal<Value> DGtal::BinomialConvolver< TConstIteratorOnPoints, TValue >::myY
protected

Definition at line 206 of file BinomialConvolver.h.


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