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

#include <FMMPointFunctors.h>

Public Types

typedef TImage Image
typedef Image::Point Point
typedef Image::Value Value
typedef TSet Set

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CImage< TImage >))
 BOOST_CONCEPT_ASSERT ((CDigitalSet< TSet >))
 BOOST_STATIC_ASSERT ((boost::is_same< Point, typename TSet::Point >::value))
 L1LocalDistance (Image &aImg, TSet &aSet)
 L1LocalDistance (const L1LocalDistance &other)
L1LocalDistanceoperator= (const L1LocalDistance &other)
 ~L1LocalDistance ()
Value operator() (const Point &aPoint)
void selfDisplay (std::ostream &out) const

Data Fields

ImagemyImgPtr
SetmySetPtr

Private Types

typedef std::vector< ValueValues

Private Member Functions

Value compute (Values &aValueList) const

Detailed Description

template<typename TImage, typename TSet>
class DGtal::L1LocalDistance< TImage, TSet >

Aim: Class for the computation of the L1-distance at some point p, from the available distance values of some points lying in the 1-neighborhood of p (ie. points at a L1-distance to p equal to 1).

Description of template class 'L1LocalDistance'

The computed value is merely the minimum over all the available distance values in the 1-neighborhood of p, plus one.

It is a model of CPointFunctor.

Template Parameters:
TImagemodel of CImage used for the mapping point-distance value
TSetmodel of CDigitalSet for storing points whose distance value is known
See also:
FMM

Definition at line 471 of file FMMPointFunctors.h.


Member Typedef Documentation

template<typename TImage, typename TSet>
typedef TImage DGtal::L1LocalDistance< TImage, TSet >::Image

Definition at line 479 of file FMMPointFunctors.h.

template<typename TImage, typename TSet>
typedef Image::Point DGtal::L1LocalDistance< TImage, TSet >::Point

Definition at line 480 of file FMMPointFunctors.h.

template<typename TImage, typename TSet>
typedef TSet DGtal::L1LocalDistance< TImage, TSet >::Set

Definition at line 485 of file FMMPointFunctors.h.

template<typename TImage, typename TSet>
typedef Image::Value DGtal::L1LocalDistance< TImage, TSet >::Value

Definition at line 481 of file FMMPointFunctors.h.

template<typename TImage, typename TSet>
typedef std::vector<Value> DGtal::L1LocalDistance< TImage, TSet >::Values
private

Definition at line 490 of file FMMPointFunctors.h.


Constructor & Destructor Documentation

template<typename TImage , typename TSet>
DGtal::L1LocalDistance< TImage, TSet >::L1LocalDistance ( Image aImg,
TSet &  aSet 
)
inline

Constructor from an image and a set. NB: only pointers are stored

Parameters:
aImgany distance map
aSetany digital set

Definition at line 603 of file FMMPointFunctors.ih.

: myImgPtr(&aImg), mySetPtr(&aSet)
{
ASSERT( myImgPtr );
ASSERT( mySetPtr );
}
template<typename TImage , typename TSet>
DGtal::L1LocalDistance< TImage, TSet >::L1LocalDistance ( const L1LocalDistance< TImage, TSet > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 613 of file FMMPointFunctors.ih.

: myImgPtr(other.myImgPtr), mySetPtr(other.mySetPtr)
{
ASSERT( myImgPtr );
ASSERT( mySetPtr );
}
template<typename TImage , typename TSet >
DGtal::L1LocalDistance< TImage, TSet >::~L1LocalDistance ( )
inline

Destructor. Does nothing.

Definition at line 640 of file FMMPointFunctors.ih.

{
}

Member Function Documentation

template<typename TImage, typename TSet>
DGtal::L1LocalDistance< TImage, TSet >::BOOST_CONCEPT_ASSERT ( (CImage< TImage >)  )

image

template<typename TImage, typename TSet>
DGtal::L1LocalDistance< TImage, TSet >::BOOST_CONCEPT_ASSERT ( (CDigitalSet< TSet >)  )

set

template<typename TImage, typename TSet>
DGtal::L1LocalDistance< TImage, TSet >::BOOST_STATIC_ASSERT ( (boost::is_same< Point, typename TSet::Point >::value)  )
template<typename TImage , typename TSet >
DGtal::L1LocalDistance< TImage, TSet >::Value DGtal::L1LocalDistance< TImage, TSet >::compute ( Values aValueList) const
inlineprivate

Returns the L1-distance at some point, knowing the distance of its neighbors

Parameters:
aValueListthe distance of (some of) the neighbors
Returns:
the computed distance.

Definition at line 691 of file FMMPointFunctors.ih.

{
ASSERT(aValueList.size() > 0);
//min (in absolute values)
typename Values::iterator it =
std::min_element( aValueList.begin(), aValueList.end(), absComparator<Value> );
Value vmin = *it;
//sign
if (vmin >= 0)
return vmin + 1;
else
return vmin - 1;
}
template<typename TImage , typename TSet >
DGtal::L1LocalDistance< TImage, TSet >::Value DGtal::L1LocalDistance< TImage, TSet >::operator() ( const Point aPoint)
inline

L1-distance computation at aPoint , from the available distance values of the 1-neighbors of aPoint .

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

Definition at line 648 of file FMMPointFunctors.ih.

References DGtal::findAndGetValue().

{
//distance values
Values v;
v.reserve(2*Point::dimension);
//two 1-neighbors
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;
*it1 = (c+1);
*it2 = (c-1);
//neighboring values
Value d1, d2 = 0;
bool flag1 = findAndGetValue( *myImgPtr, *mySetPtr, neighbor1, d1 );
bool flag2 = findAndGetValue( *myImgPtr, *mySetPtr, neighbor2, d2 );
if (flag1) v.push_back( d1 );
if (flag2) v.push_back( d2 );
*it1 = c;
*it2 = c;
} //end for each dimension
//computation of the new value
return this->compute(v);
}
template<typename TImage , typename TSet >
DGtal::L1LocalDistance< TImage, TSet > & DGtal::L1LocalDistance< TImage, TSet >::operator= ( const L1LocalDistance< TImage, TSet > &  other)
inline

Assignment.

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

Definition at line 624 of file FMMPointFunctors.ih.

References DGtal::L1LocalDistance< TImage, TSet >::myImgPtr, and DGtal::L1LocalDistance< TImage, TSet >::mySetPtr.

{
if( this != &other)
{
myImgPtr = other.myImgPtr;
mySetPtr = other.mySetPtr;
ASSERT( myImgPtr );
ASSERT( mySetPtr );
}
return *this;
}
template<typename TImage , typename TSet >
void DGtal::L1LocalDistance< TImage, TSet >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 712 of file FMMPointFunctors.ih.

{
out << "L1";
}

Field Documentation

template<typename TImage, typename TSet>
Image* DGtal::L1LocalDistance< TImage, TSet >::myImgPtr

Aliasing pointer on the underlying image.

Definition at line 495 of file FMMPointFunctors.h.

Referenced by DGtal::L1LocalDistance< TImage, TSet >::operator=().

template<typename TImage, typename TSet>
Set* DGtal::L1LocalDistance< TImage, TSet >::mySetPtr

Aliasing pointer on the underlying set.

Definition at line 497 of file FMMPointFunctors.h.

Referenced by DGtal::L1LocalDistance< TImage, TSet >::operator=().


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