DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Data Fields
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor > Class Template Reference

#include <FMMPointFunctors.h>

Public Types

typedef TDistanceImage DistanceImage
typedef DistanceImage::Point Point
typedef DistanceImage::Value DistanceValue
typedef TSpeedFunctor SpeedFunctor
typedef SpeedFunctor::Value Value
typedef TSet Set

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CImage< TDistanceImage >))
 BOOST_CONCEPT_ASSERT ((CPointFunctor< TSpeedFunctor >))
 BOOST_STATIC_ASSERT ((boost::is_same< Point, typename SpeedFunctor::Point >::value))
 BOOST_CONCEPT_ASSERT ((CDigitalSet< TSet >))
 BOOST_STATIC_ASSERT ((boost::is_same< Point, typename TSet::Point >::value))
 SpeedExtrapolator (const DistanceImage &aDistImg, const TSet &aSet, SpeedFunctor &aSpeedFunc)
 SpeedExtrapolator (const SpeedExtrapolator &other)
SpeedExtrapolatoroperator= (const SpeedExtrapolator &other)
 ~SpeedExtrapolator ()
Value operator() (const Point &aPoint)

Data Fields

const DistanceImagemyDistImgPtr
const SetmySetPtr
SpeedFunctormySpeedFuncPtr

Detailed Description

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
class DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >

Aim: Class for the computation of the a speed value at some point p, from the available distance values and speed values of some points lying in the 1-neighborhood of p (ie. points at a L1-distance to p equal to 1) in order to extrapolate a speed field in the normal direction to the interface.

Description of template class 'SpeedExtrapolator' <p>
The computed value is such that the dot product of the gradients
of the speed function and of the distance function is zero, ie. 

\( \nabla S . \nabla \Phi = 0 \).

@note see [Adalsteinsson and Sethian, Fast Construction of 
Extension Velocities in Level Set Methods, J. Comput. Phys. 148, 2-22, 1999]

It is a model of CPointFunctor.

@tparam TDistanceImage model of CImage used for the mapping point-distance value
@tparam TSet model of CDigitalSet for storing points whose distance value is known
@tparam TSpeedFunctor model of CImage used for the mapping point-speed value

@see FMM

Definition at line 702 of file FMMPointFunctors.h.


Member Typedef Documentation

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef TDistanceImage DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::DistanceImage

Definition at line 711 of file FMMPointFunctors.h.

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef DistanceImage::Value DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::DistanceValue

Definition at line 713 of file FMMPointFunctors.h.

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef DistanceImage::Point DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::Point

Definition at line 712 of file FMMPointFunctors.h.

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef TSet DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::Set

Definition at line 721 of file FMMPointFunctors.h.

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef TSpeedFunctor DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::SpeedFunctor

Definition at line 715 of file FMMPointFunctors.h.

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
typedef SpeedFunctor::Value DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::Value

Definition at line 717 of file FMMPointFunctors.h.


Constructor & Destructor Documentation

template<typename TDistanceImage , typename TSet, typename TSpeedFunctor >
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::SpeedExtrapolator ( const DistanceImage aDistImg,
const TSet &  aSet,
SpeedFunctor aSpeedFunc 
)
inline

Constructor from images and set. NB: only pointers are stored

Parameters:
aDistImgany distance map
aSetany digital set
aSpeedFuncany speed map

Definition at line 909 of file FMMPointFunctors.ih.

: myDistImgPtr(&aDistImg), mySetPtr(&aSet), mySpeedFuncPtr(&aSpeedFunc)
{
ASSERT( myDistImgPtr );
ASSERT( mySetPtr );
ASSERT( mySpeedFuncPtr );
}
template<typename TDistanceImage , typename TSet, typename TSpeedFunctor >
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::SpeedExtrapolator ( const SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 921 of file FMMPointFunctors.ih.

: myDistImgPtr(other.myDistImgPtr), mySetPtr(other.mySetPtr), mySpeedFuncPtr(other.mySpeedFuncPtr)
{
ASSERT( myDistImgPtr );
ASSERT( mySetPtr );
ASSERT( mySpeedFuncPtr );
}
template<typename TDistanceImage , typename TSet , typename TSpeedFunctor >
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::~SpeedExtrapolator ( )
inline

Destructor. Does nothing.

Definition at line 952 of file FMMPointFunctors.ih.

{
}

Member Function Documentation

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::BOOST_CONCEPT_ASSERT ( (CImage< TDistanceImage >)  )

image

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::BOOST_CONCEPT_ASSERT ( (CPointFunctor< TSpeedFunctor >)  )
template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::BOOST_CONCEPT_ASSERT ( (CDigitalSet< TSet >)  )

set

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::BOOST_STATIC_ASSERT ( (boost::is_same< Point, typename SpeedFunctor::Point >::value)  )
template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::BOOST_STATIC_ASSERT ( (boost::is_same< Point, typename TSet::Point >::value)  )
template<typename TDistanceImage , typename TSet , typename TSpeedFunctor >
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::Value DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::operator() ( const Point aPoint)
inline

Speed value computation at aPoint , from the available distance/speed values of the 1-neighbors of aPoint .

Parameters:
aPointthe point for which the speed is computed
Returns:
the speed value at aPoint.

Definition at line 961 of file FMMPointFunctors.ih.

References DGtal::findAndGetValue().

{
//speed values
Value num, den = 0;
//two 1-neighbors for one dimension
Point neighbor1 = aPoint;
Point neighbor2 = aPoint;
typename Point::Iterator it1 = neighbor1.begin();
typename Point::Iterator it2 = neighbor2.begin();
typename Point::ConstIterator it = aPoint.begin();
typename Point::ConstIterator itEnd = aPoint.end();
for ( ; it != itEnd; ++it, ++it1, ++it2)
{//for each dimension
typename Point::Coordinate c = *it;
//distance value
DistanceValue d = 0;
bool flag = findAndGetValue( *myDistImgPtr, *mySetPtr, aPoint, d );
ASSERT( flag );
//neighbors
*it1 = (c+1);
*it2 = (c-1);
//neighboring speed value
Value s = 0;
//neighboring distance values
DistanceValue d0, d1, d2 = 0;
bool flag1 = findAndGetValue( *myDistImgPtr, *mySetPtr, neighbor1, d1 );
bool flag2 = findAndGetValue( *myDistImgPtr, *mySetPtr, neighbor2, d2 );
if ( flag1 || flag2 )
{
if ( flag1 && flag2 )
{ //take the minimal value
if (std::abs(d1) < std::abs(d2))
{
d0 = d1;
s = (*mySpeedFuncPtr)( neighbor1 );
}
else
{
d0 = d2;
s = (*mySpeedFuncPtr)( neighbor2 );
}
} else
{
if (flag1)
{
d0 = d1;
s = (*mySpeedFuncPtr)( neighbor1 );
}
if (flag2)
{
d0 = d2;
s = (*mySpeedFuncPtr)( neighbor2 );
}
}
Value diff = static_cast<Value>(d - d0);
num += ( s * diff );
den += diff;
}
*it1 = c;
*it2 = c;
} //end for each dimension
//computation of the new value
ASSERT(den != 0);
return (num/den);
}
template<typename TDistanceImage , typename TSet , typename TSpeedFunctor >
DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor > & DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::operator= ( const SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor > &  other)
inline

Assignment.

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

Definition at line 934 of file FMMPointFunctors.ih.

References DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::myDistImgPtr, DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::mySetPtr, and DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::mySpeedFuncPtr.

{
if( this != &other)
{
myDistImgPtr = other.myDistImgPtr;
mySetPtr = other.mySetPtr;
mySpeedFuncPtr = other.mySpeedFuncPtr;
ASSERT( myDistImgPtr );
ASSERT( mySetPtr );
ASSERT( mySpeedFuncPtr );
}
return *this;
}

Field Documentation

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
const DistanceImage* DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::myDistImgPtr

Aliasing pointer on the underlying image of distance values.

Definition at line 727 of file FMMPointFunctors.h.

Referenced by DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::operator=().

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
const Set* DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::mySetPtr

Aliasing pointer on the underlying set of points whose distance value is known

Definition at line 730 of file FMMPointFunctors.h.

Referenced by DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::operator=().

template<typename TDistanceImage, typename TSet, typename TSpeedFunctor>
SpeedFunctor* DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::mySpeedFuncPtr

Aliasing pointer on the underlying image of speed values.

Definition at line 732 of file FMMPointFunctors.h.

Referenced by DGtal::SpeedExtrapolator< TDistanceImage, TSet, TSpeedFunctor >::operator=().


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