DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer > Class Template Reference

Aim: Implementation of the linear in time distance transformation for separable metrics. More...

#include <DGtal/geometry/volumes/distance/DistanceTransformation.h>

Inheritance diagram for DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >:
DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >

Public Types

typedef TSeparableMetric SeparableMetric
 Separable Metric type. More...
 
typedef TSpace Space
 Separable Metric type. More...
 
typedef TSpace::Vector Vector
 Separable Metric type. More...
 
typedef TPointPredicate PointPredicate
 Point Predicate type. More...
 
typedef SeparableMetric::Value Value
 Definition of the image value type. More...
 
typedef SeparableMetric::Point Point
 Definition of the image value type. More...
 
typedef DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric > Self
 Definition of the image. More...
 
typedef VoronoiMap< TSpace, TPointPredicate, TSeparableMetric > Parent
 
typedef DefaultConstImageRange< SelfConstRange
 Definition of the image constRange. More...
 
typedef VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Domain Domain
 Definition of the image value type. More...
 
- Public Types inherited from DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >
typedef TSpace Space
 Copy of the space type. More...
 
typedef TPointPredicate PointPredicate
 Copy of the point predicate type. More...
 
typedef TImageContainer::Domain Domain
 Definition of the underlying domain type. More...
 
typedef TSeparableMetric SeparableMetric
 Definition of the separable metric type. More...
 
typedef DGtal::int64_t IntegerLong
 Large integer type for SeparableMetricHelper construction. More...
 
typedef Space::Vector Vector
 
typedef Space::Point Point
 
typedef Space::Dimension Dimension
 
typedef Space::Size Size
 
typedef Space::Point::Coordinate Abscissa
 
typedef TImageContainer OutputImage
 Type of resulting image. More...
 
typedef Vector Value
 Definition of the image value type. More...
 
typedef OutputImage::ConstRange ConstRange
 Definition of the image value type. More...
 
typedef VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainerSelf
 Self type. More...
 
typedef std::array< bool, Space::dimensionPeriodicitySpec
 Periodicity specification type. More...
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CPointPredicate< TPointPredicate >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CSeparableMetric< TSeparableMetric >))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename Space::Point, typename SeparableMetric::Point >::value))
 
 DistanceTransformation (ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric)
 
 DistanceTransformation (ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric, typename Parent::PeriodicitySpec const &aPeriodicitySpec)
 
 ~DistanceTransformation ()
 
const Domaindomain () const
 
ConstRange constRange () const
 
Value operator() (const Point &aPoint) const
 
Vector getVoronoiSite (const Point &aPoint) const
 
const SeparableMetricmetric () const
 
void selfDisplay (std::ostream &out) const
 
- Public Member Functions inherited from DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >
 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CPointPredicate< TPointPredicate >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CSeparableMetric< TSeparableMetric >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename TSpace::Point, typename TPointPredicate::Point >::value))
 Both Space points and PointPredicate points must be the same. More...
 
 BOOST_STATIC_ASSERT ((boost::is_same< TSpace, typename TImageContainer::Domain::Space >::value))
 
 BOOST_STATIC_ASSERT ((boost::is_same< typename TSpace::Vector, typename TImageContainer::Value >::value))
 
 BOOST_STATIC_ASSERT ((boost::is_same< HyperRectDomain< TSpace >, typename TImageContainer::Domain >::value))
 
 VoronoiMap (ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric)
 
 VoronoiMap (ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric, PeriodicitySpec const &aPeriodicitySpec)
 
 ~VoronoiMap ()=default
 
 VoronoiMap ()=delete
 
Selfoperator= (const Self &aOtherVoronoiMap)=default
 
const Domaindomain () const
 
ConstRange constRange () const
 
Value operator() (const Point &aPoint) const
 
const SeparableMetricmetric () const
 
PeriodicitySpec const & getPeriodicitySpec () const
 
bool isPeriodic (const Dimension n) const
 
Point projectPoint (Point aPoint) const
 
void selfDisplay (std::ostream &out) const
 

Protected Member Functions

 DistanceTransformation ()
 

Additional Inherited Members

- Protected Attributes inherited from DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >
const SeparableMetricmyMetricPtr
 Pointer to the separable metric instance. More...
 
CountedPtr< OutputImagemyImagePtr
 Voronoi map image. More...
 
PeriodicitySpec myPeriodicitySpec
 Periodicity along each dimension. More...
 

Detailed Description

template<typename TSpace, typename TPointPredicate, typename TSeparableMetric, typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
class DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >

Aim: Implementation of the linear in time distance transformation for separable metrics.

Description of template class 'DistanceTransformation'

This class is a wrapper around a Voronoi map construction (see VoronoiMap). More precisely, at a point p, since the VoronoiMap at p returns a vector to the closest site, this class adapts the operator() in order to returns the distance to the closest site for the considered metric.

Please refer to VoronoiMap documentation for details on the computational cost and parameter description.

This class is a model of concepts::CConstImage.

Template Parameters
TSpacetype of Digital Space (model of concepts::CSpace).
TPointPredicatepoint predicate returning false for points from which we compute the distance (model of concepts::CPointPredicate)
TSeparableMetrica model of concepts::CSeparableMetric
TImageContainerany model of concepts::CImage to store the VoronoiMap (default: ImageContainerBySTLVector). The space of the image container and the TSpace should match. Furthermore the container value type must be TSpace::Vector.
See also
distancetransform2D.cpp
distancetransform3D.cpp
Examples
geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/distancetransform3D.cpp, geometry/volumes/distance/toricdomainvolumetric.cpp, geometry/volumes/distance/voronoimap2D.cpp, and tutorial-examples/volDTGranulo.cpp.

Definition at line 98 of file DistanceTransformation.h.

Member Typedef Documentation

◆ ConstRange

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef DefaultConstImageRange<Self> DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::ConstRange

Definition of the image constRange.

Definition at line 133 of file DistanceTransformation.h.

◆ Domain

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef VoronoiMap<TSpace,TPointPredicate,TSeparableMetric,TImageContainer>::Domain DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Domain

Definition of the image value type.

Definition at line 138 of file DistanceTransformation.h.

◆ Parent

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef VoronoiMap<TSpace,TPointPredicate,TSeparableMetric> DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Parent

Definition at line 130 of file DistanceTransformation.h.

◆ Point

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef SeparableMetric::Point DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Point

Definition of the image value type.

Definition at line 123 of file DistanceTransformation.h.

◆ PointPredicate

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef TPointPredicate DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::PointPredicate

Point Predicate type.

Definition at line 117 of file DistanceTransformation.h.

◆ Self

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef DistanceTransformation<TSpace,TPointPredicate,TSeparableMetric> DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Self

Definition of the image.

Definition at line 128 of file DistanceTransformation.h.

◆ SeparableMetric

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef TSeparableMetric DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::SeparableMetric

Separable Metric type.

Definition at line 108 of file DistanceTransformation.h.

◆ Space

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef TSpace DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Space

Separable Metric type.

Definition at line 111 of file DistanceTransformation.h.

◆ Value

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef SeparableMetric::Value DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Value

Definition of the image value type.

Definition at line 120 of file DistanceTransformation.h.

◆ Vector

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
typedef TSpace::Vector DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Vector

Separable Metric type.

Definition at line 114 of file DistanceTransformation.h.

Constructor & Destructor Documentation

◆ DistanceTransformation() [1/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::DistanceTransformation ( ConstAlias< Domain aDomain,
ConstAlias< PointPredicate predicate,
ConstAlias< SeparableMetric aMetric 
)
inline

Constructor in the non-periodic case.

See documentation of VoronoiMap constructor.

Definition at line 145 of file DistanceTransformation.h.

147 :
148 VoronoiMap<TSpace,TPointPredicate,TSeparableMetric,TImageContainer>(aDomain,
149 predicate,
150 aMetric)
151 {}

◆ DistanceTransformation() [2/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::DistanceTransformation ( ConstAlias< Domain aDomain,
ConstAlias< PointPredicate predicate,
ConstAlias< SeparableMetric aMetric,
typename Parent::PeriodicitySpec const &  aPeriodicitySpec 
)
inline

Constructor with periodicity specification.

See documentation of VoronoiMap constructor.

Definition at line 158 of file DistanceTransformation.h.

162 : VoronoiMap<TSpace,TPointPredicate,TSeparableMetric,TImageContainer>(aDomain,
163 predicate,
164 aMetric,
165 aPeriodicitySpec)
166 {}

◆ ~DistanceTransformation()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::~DistanceTransformation ( )
inline

Default destructor

Definition at line 171 of file DistanceTransformation.h.

171{};

◆ DistanceTransformation() [3/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::DistanceTransformation ( )
protected

Default Constructor.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CPointPredicate< TPointPredicate >)  )

◆ BOOST_CONCEPT_ASSERT() [2/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CSeparableMetric< TSeparableMetric >)  )

◆ BOOST_CONCEPT_ASSERT() [3/3]

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )

◆ BOOST_STATIC_ASSERT()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::BOOST_STATIC_ASSERT ( (boost::is_same< typename Space::Point, typename SeparableMetric::Point >::value)  )

◆ constRange()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
ConstRange DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::constRange ( ) const
inline

Returns a const range on the DistanceMap values.

Returns
a const range

Definition at line 189 of file DistanceTransformation.h.

190 {
191 return ConstRange(*this);
192 }
DefaultConstImageRange< Self > ConstRange
Definition of the image constRange.

◆ domain()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
const Domain & DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::domain ( ) const
inline

Returns a const range on the DistanceMap values.

Returns
a const range

Definition at line 180 of file DistanceTransformation.h.

181 {
182 return Parent::domain();
183 }
const Domain & domain() const
Definition: VoronoiMap.h:265

References DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::domain().

◆ getVoronoiSite()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
Vector DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::getVoronoiSite ( const Point aPoint) const
inline

Access to the Voronoi site inducing the DistanceMap value (a.k.a. the vector such that its norm is the DT value) at a point.

Parameters
[in]aPointthe point to probe.

Definition at line 212 of file DistanceTransformation.h.

213 {
214 return this->myImagePtr->operator()(aPoint);
215 }
CountedPtr< OutputImage > myImagePtr
Voronoi map image.
Definition: VoronoiMap.h:409
const Point aPoint(3, 4)

References aPoint(), and DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::myImagePtr.

◆ metric()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
const SeparableMetric * DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::metric ( ) const
inline
Returns
Returns the underlying metric.

Definition at line 220 of file DistanceTransformation.h.

221 {
222 return Parent::metric();
223 }
const SeparableMetric * metric() const
Definition: VoronoiMap.h:293

References DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::metric().

◆ operator()()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
Value DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::operator() ( const Point aPoint) const
inline

Access to a DistanceMap value (a.k.a. the norm of the associated Voronoi vector) at a point.

Parameters
aPointthe point to probe.

Definition at line 200 of file DistanceTransformation.h.

201 {
202 return this->myMetricPtr->operator()(aPoint,
203 this->myImagePtr->operator()(aPoint));
204 }
const SeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition: VoronoiMap.h:406

References aPoint(), DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::myImagePtr, and DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::myMetricPtr.

◆ selfDisplay()

template<typename TSpace , typename TPointPredicate , typename TSeparableMetric , typename TImageContainer = ImageContainerBySTLVector< HyperRectDomain<TSpace>, typename TSpace::Vector >>
void DGtal::DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::selfDisplay ( std::ostream &  out) const
inline

Self Display method.

Parameters
[out]outoutput stream

Definition at line 230 of file DistanceTransformation.h.

231 {
232 out << "[DistanceTransformation] underlying VoronoiMap={";
234 out << "}";
235 }
void selfDisplay(std::ostream &out) const

References DGtal::VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::selfDisplay().


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