DGtal
0.6.devel
|
#include <DistanceTransformation.h>
Public Types | |
typedef TSpace | Space |
typedef TPointPredicate | PointPredicate |
typedef HyperRectDomain< Space > | Domain |
typedef ImageContainerBySTLVector < Domain, IntegerLong > | OutputImage |
typedef Space::Vector | Vector |
typedef Space::Point | Point |
typedef Space::Dimension | Dimension |
typedef Space::Size | Size |
typedef Space::Point::Coordinate | Abscissa |
typedef SeparableMetricHelper < Point, IntegerLong, p > | SeparableMetric |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CSignedInteger< IntegerLong >)) | |
BOOST_CONCEPT_ASSERT ((CSpace< TSpace >)) | |
BOOST_CONCEPT_ASSERT ((CPointPredicate< TPointPredicate >)) | |
DistanceTransformation (const Domain &aDomain, const PointPredicate &predicate) | |
~DistanceTransformation () | |
OutputImage | compute () |
bool | checkTypesValidity () const |
Protected Member Functions | |
DistanceTransformation () |
Private Member Functions | |
void | computeFirstStep (OutputImage &output) const |
void | computeFirstStep1D (OutputImage &output, const Point &startingPoint) const |
void | computeOtherSteps (const OutputImage &inputImage, OutputImage &output, const Dimension dim) const |
void | computeOtherStep1D (const OutputImage &input, OutputImage &output, const Point &row, const Size dim, Abscissa s[], Abscissa t[]) const |
Private Attributes | |
SeparableMetric | myMetric |
const Domain & | myDomain |
const PointPredicate & | myPointPredicate |
Point | myLowerBoundCopy |
Point | myUpperBoundCopy |
Vector | myDisplacementVector |
Point | myExtent |
IntegerLong | myInfinity |
Aim: Implementation of the linear in time distance transformation for separable metrics.
Description of template class 'DistanceTransformation'
Given a point predicate and a domain, the compute() method returns for each point of the domain, the closest distance to a point in the domain for which the predicate is false. The result is given as a map point<->values implemented as an image model OutputImage.
The point predicate could be:
TSpace | type of Digital Space (model of CSpace). |
TPointPredicate | point predicate returning true for points from which we compute the distance (model of CPointPredicate) |
p | the static integer value to define the l_p metric. |
IntegerLong | (optional) type used to represent exact distance value according to p (default: DGtal::uint64_t) |
Definition at line 94 of file DistanceTransformation.h.
typedef Space::Point::Coordinate DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Abscissa |
Definition at line 121 of file DistanceTransformation.h.
typedef Space::Dimension DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Dimension |
Definition at line 119 of file DistanceTransformation.h.
typedef HyperRectDomain<Space> DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Domain |
Definition of the underlying domain type.
Definition at line 111 of file DistanceTransformation.h.
typedef ImageContainerBySTLVector< Domain, IntegerLong > DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::OutputImage |
Type of resulting image.
Definition at line 115 of file DistanceTransformation.h.
typedef Space::Point DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Point |
Definition at line 118 of file DistanceTransformation.h.
typedef TPointPredicate DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::PointPredicate |
Copy of the point predicate type.
Definition at line 108 of file DistanceTransformation.h.
typedef SeparableMetricHelper< Point , IntegerLong , p > DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::SeparableMetric |
We construct the type associated to the separable metric.
Definition at line 124 of file DistanceTransformation.h.
typedef Space::Size DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Size |
Definition at line 120 of file DistanceTransformation.h.
typedef TSpace DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Space |
Copy of the space type.
Definition at line 105 of file DistanceTransformation.h.
typedef Space::Vector DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::Vector |
Definition at line 117 of file DistanceTransformation.h.
|
inline |
|
inline |
|
protected |
Default Constructor.
DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::BOOST_CONCEPT_ASSERT | ( | (CSignedInteger< IntegerLong >) | ) |
DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::BOOST_CONCEPT_ASSERT | ( | (CSpace< TSpace >) | ) |
DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::BOOST_CONCEPT_ASSERT | ( | (CPointPredicate< TPointPredicate >) | ) |
|
inline |
Check the validity of the transformation. For instance, we check that the output image pixel range is ok with respect to the domain extent and the SeparableMetric.
Warning and advices are printed in the trace system.
Definition at line 69 of file DistanceTransformation.ih.
References DGtal::trace, and DGtal::Trace::warning().
|
inline |
Compute the Distance Transformation of a set of point using a SeparableMetric metric. The method associates to each point with value satisfying the foreground predicate, its distance to the closest background point. This algorithm is O(d.|domain size|).
Definition at line 96 of file DistanceTransformation.ih.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::translateDomain().
|
inlineprivate |
Compute the first step of the separable distance transformation.
output | the output image with the first step DT values |
Definition at line 148 of file DistanceTransformation.ih.
References DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::end(), DGtal::Trace::endBlock(), DGtal::HyperRectDomain< TSpace >::subRange(), and DGtal::trace.
|
private |
Compute the 1D DT associated to the first step.
output | the output image with the first step DT values |
startingPoint | a point to specify the starting point of the 1D row |
Definition at line 227 of file DistanceTransformation.ih.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue().
|
private |
Compute the 1D DT associated to the steps except the first one.
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) |
Definition at line 277 of file DistanceTransformation.ih.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::spanBegin(), and DGtal::ImageContainerBySTLVector< TDomain, TValue >::spanEnd().
|
inlineprivate |
Compute the other steps of the separable distance transformation.
inputImage | the image resulting of the first (or intermediate) step |
output | the output image |
dim | the dimension to process |
Definition at line 180 of file DistanceTransformation.ih.
References DGtal::HyperRectDomain< TSpace >::ConstSubRange::begin(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::ConstSubRange::end(), DGtal::Trace::endBlock(), DGtal::HyperRectDomain< TSpace >::subRange(), and DGtal::trace.
|
private |
Displacement vector to translate temporary images.
Definition at line 245 of file DistanceTransformation.h.
|
private |
Copy of the computation domain.
Definition at line 233 of file DistanceTransformation.h.
|
private |
Copy of the domain extent.
Definition at line 248 of file DistanceTransformation.h.
|
private |
Value to act as a +infinity value.
Definition at line 251 of file DistanceTransformation.h.
|
private |
Copy of the image lower bound.
Definition at line 239 of file DistanceTransformation.h.
|
private |
The separable metric instance.
Definition at line 230 of file DistanceTransformation.h.
|
private |
Copy of the computation domain.
Definition at line 236 of file DistanceTransformation.h.
|
private |
Copy of the image lower bound.
Definition at line 242 of file DistanceTransformation.h.