Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes

DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric > Class Template Reference

Aim: Implementation of the linear in time distance transformation for a class of separable metrics (see SeparableMetric). More...

#include <DistanceTransformation.h>

Data Structures

struct  DefaultForegroundPredicate

Public Types

typedef TImage Image
typedef TImageOutput ImageOutput
typedef TSeparableMetric SeparableMetric
typedef
TSeparableMetric::InternalValueType 
InternalValueType
typedef Image::ValueType ValueType
typedef Image::Point Point
typedef Image::Dimension Dimension
typedef Image::Size Size
typedef Image::Integer Integer
typedef Image::Domain Domain

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CSeparableMetric< TSeparableMetric >))
 DistanceTransformation ()
 ~DistanceTransformation ()
void checkTypesValidity (const Image &aImage)
template<typename ForegroundPredicate >
ImageOutput compute (const Image &inputImage, const ForegroundPredicate &predicate)
ImageOutput compute (const Image &inputImage)

Private Member Functions

template<typename ForegroundPredicate >
void computeFirstStep (const Image &aImage, ImageOutput &output, const ForegroundPredicate &predicate) const
template<typename ForegroundPredicate >
void computeFirstStep1D (const Image &aImage, ImageOutput &output, const Point &row, const ForegroundPredicate &predicate) const
void computeOtherSteps (const ImageOutput &inputImage, ImageOutput &output, const Dimension dim) const
void computeOtherStep1D (const ImageOutput &input, ImageOutput &output, const Point &row, const Size dim, Integer s[], Integer t[]) const

Private Attributes

SeparableMetric myMetric
Point myLowerBoundCopy
Point myUpperBoundCopy
Point myExtent
InternalValueType myInfinity

Detailed Description

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
class DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >

Aim: Implementation of the linear in time distance transformation for a class of separable metrics (see SeparableMetric).

Description of template class 'DistanceTransformation'

Example:

 //Types definition
 typedef ImageSelector<Domain, unsigned int>::Type Image; //image with "unsigned in value type
 typedef ImageSelector<Domain, long int>::Type ImageLong; //output image with long int value type

 typedef SeparableMetricTraits<DGtal::int32_t, DGtal::uint32_t,2> L_2; //L_2 = Euclidean metric

 DistanceTransformation<Image, ImageLong, L_2> dt; 

 // ...
 //Construction of an instance "image" of Image (with an io reader for instance)
 // ...

 //EDT computation
 ImageLong result = dt.compute(image);
Examples:

distancetransform2D.cpp.


Member Typedef Documentation

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::Dimension DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Dimension
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::Domain DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Domain
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef TImage DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Image
Todo:
check image concept
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef TImageOutput DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::ImageOutput
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::Integer DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Integer
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef TSeparableMetric::InternalValueType DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::InternalValueType
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::Point DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Point
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef TSeparableMetric DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::SeparableMetric
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::Size DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::Size
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
typedef Image::ValueType DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::ValueType

Constructor & Destructor Documentation

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::DistanceTransformation (  ) 

Default Constructor

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::~DistanceTransformation (  ) 

Default destructor


Member Function Documentation

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::BOOST_CONCEPT_ASSERT ( (CSeparableMetric< TSeparableMetric >)   ) 
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
void DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::checkTypesValidity ( const Image aImage  ) 

Check the validity of the transformation. For instance, we check that the output image pixel range is ok with respect to the input image range and the SeparableMetric.

Warning and advices are print in the trace system.

Parameters:
aImage the image used to check the type consistency.

Referenced by testChessboard(), testDistanceTransformation(), testDistanceTransformation3D(), testDistanceTransformationBorder(), and testTypeValidity().

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
ImageOutput DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::compute ( const Image inputImage  )  [inline]

Compute the Distance Transformation of an image with the SeparableMetric metric. The method associates to each point with value satisfying the foreground predicate, its distance to the closest background point.

Parameters:
inputImage the input image
Returns:
the distance transformation image with the Internal format.
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
template<typename ForegroundPredicate >
ImageOutput DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::compute ( const Image inputImage,
const ForegroundPredicate &  predicate 
)

Compute the Distance Transformation of an image with the SeparableMetric metric. The method associates to each point with value satisfying the foreground predicate, its distance to the closest background point.

Parameters:
inputImage the input image
foregroundPredicate a predicate to detect foreground point from the image valuetype
Returns:
the distance transformation image with the Internal format.

Referenced by testChessboard(), testDistanceTransformation(), testDistanceTransformation3D(), and testDistanceTransformationBorder().

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
template<typename ForegroundPredicate >
void DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::computeFirstStep ( const Image aImage,
ImageOutput output,
const ForegroundPredicate &  predicate 
) const [private]

Compute the first step of the separable distance transformation.

Parameters:
aImage the input image
output the output image with the first step DT values
predicate the predicate to characterize the foreground (e.g. !=0, see DefaultForegroundPredicate)
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
template<typename ForegroundPredicate >
void DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::computeFirstStep1D ( const Image aImage,
ImageOutput output,
const Point row,
const ForegroundPredicate &  predicate 
) const [private]

Compute the 1D DT associated to the first step.

Parameters:
aImage the input image
output the output image with the first step DT values
row a point to specify the starting point of the 1D row
predicate the predicate to characterize the foreground (e.g. !=0, see DefaultForegroundPredicate)
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
void DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::computeOtherStep1D ( const ImageOutput input,
ImageOutput output,
const Point row,
const Size  dim,
Integer  s[],
Integer  t[] 
) const [private]

Compute the 1D DT associated to the steps except the first one.

Parameters:
aImage the input image
output the output image with the DT values
row a point to specify the starting point of the 1D row
dim the dimension to process
predicate the predicate to characterize the foreground (e.g. !=0, see DefaultForegroundPredicate)
template<typename TImage, typename TImageOutput, typename TSeparableMetric>
void DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::computeOtherSteps ( const ImageOutput inputImage,
ImageOutput output,
const Dimension  dim 
) const [private]

Compute the other steps of the separable distance transformation.

Parameters:
inputImage the image resulting of the first (or intermediate) step
output the output image
dim the dimension to process

Field Documentation

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
Point DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::myExtent [private]

Copy of the image extent.

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
InternalValueType DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::myInfinity [private]

Value to act as a +infinity value.

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
Point DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::myLowerBoundCopy [private]

Copy of the image lower bound.

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
SeparableMetric DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::myMetric [private]

The separable metric instance.

template<typename TImage, typename TImageOutput, typename TSeparableMetric>
Point DGtal::DistanceTransformation< TImage, TImageOutput, TSeparableMetric >::myUpperBoundCopy [private]

Copy of the image lower bound.


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