DGtal
0.6.devel
|
#include <VoronoiMap.h>
Public Types | |
typedef TSpace | Space |
typedef TPointPredicate | PointPredicate |
typedef HyperRectDomain< Space > | Domain |
typedef DGtal::int64_t | IntegerLong |
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 |
typedef ImageContainerBySTLVector < Domain, Point > | OutputImage |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CSpace< TSpace >)) | |
BOOST_CONCEPT_ASSERT ((CPointPredicate< TPointPredicate >)) | |
BOOST_STATIC_ASSERT ((boost::is_same< typename TSpace::Point, typename TPointPredicate::Point >::value)) | |
VoronoiMap (const Domain &aDomain, const PointPredicate &predicate) | |
~VoronoiMap () | |
OutputImage | compute () |
Protected Member Functions | |
VoronoiMap () |
Private Member Functions | |
void | computeOtherSteps (OutputImage &output, const Dimension dim) const |
void | computeOtherStep1D (OutputImage &output, const Point &row, const Size dim, std::vector< Point > &Sites) const |
Private Attributes | |
SeparableMetric | myMetric |
const Domain & | myDomain |
const PointPredicate & | myPointPredicate |
Point | myLowerBoundCopy |
Point | myUpperBoundCopy |
Point | myInfinity |
Aim: Implementation of the linear in time Voronoi map construction.
Description of template class 'VoronoiMap'
The algorithm uses a sperable process to construct partial Voronoi maps which has been described in:
Maurer, C., Qi, R., & Raghavan, V. (2003). A Linear Time Algorithm for Computing Exact Euclidean Distance Transforms of Binary Images in Arbitrary Dimensions. IEEE Trans. Pattern Analysis and Machine Intelligence, 25pp265-270.
and
Coeurjolly, D. (2002). Algorithmique et géométrie discrète pour la caractérisation des courbes et des surfaces. PhD Thesis, Université Lumière Lyon 2.
Given a domain and a point predicate, the compute() method returns, for each point in the domain, the closest point for which the predicate if false. Following Computational Geometry terminoliogy, points for which the predicate is false are "sites" for the Voronoi map construction.
The metric is specified by the p template parameter which defines a l_p separable metric.
If a point is equi-distant to two sites (e.g. if the digital point belong to a Voronoi cell boundary in the Euclidean space), this Voronoi map construction will only keep one of them.
Hence, the result is given as a map (point from the domain, closest site) implemented using an ImageContainerBySTLVector whose value type is the type of Point of the predicate.
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 109 of file VoronoiMap.h.
typedef Space::Point::Coordinate DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Abscissa |
Definition at line 136 of file VoronoiMap.h.
typedef Space::Dimension DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Dimension |
Definition at line 134 of file VoronoiMap.h.
typedef HyperRectDomain<Space> DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Domain |
Definition of the underlying domain type.
Definition at line 127 of file VoronoiMap.h.
typedef DGtal::int64_t DGtal::VoronoiMap< TSpace, TPointPredicate, p >::IntegerLong |
Large integer type for SeparableMetricHelper construction.
Definition at line 130 of file VoronoiMap.h.
typedef ImageContainerBySTLVector< Domain, Point > DGtal::VoronoiMap< TSpace, TPointPredicate, p >::OutputImage |
Type of resulting image.
Definition at line 143 of file VoronoiMap.h.
typedef Space::Point DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Point |
Definition at line 133 of file VoronoiMap.h.
typedef TPointPredicate DGtal::VoronoiMap< TSpace, TPointPredicate, p >::PointPredicate |
Copy of the point predicate type.
Definition at line 124 of file VoronoiMap.h.
typedef SeparableMetricHelper< Point , IntegerLong , p > DGtal::VoronoiMap< TSpace, TPointPredicate, p >::SeparableMetric |
We construct the type associated to the separable metric.
Definition at line 139 of file VoronoiMap.h.
typedef Space::Size DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Size |
Definition at line 135 of file VoronoiMap.h.
typedef TSpace DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Space |
Copy of the space type.
Definition at line 121 of file VoronoiMap.h.
typedef Space::Vector DGtal::VoronoiMap< TSpace, TPointPredicate, p >::Vector |
Definition at line 132 of file VoronoiMap.h.
|
inline |
|
inline |
|
protected |
Default Constructor.
DGtal::VoronoiMap< TSpace, TPointPredicate, p >::BOOST_CONCEPT_ASSERT | ( | (CSpace< TSpace >) | ) |
DGtal::VoronoiMap< TSpace, TPointPredicate, p >::BOOST_CONCEPT_ASSERT | ( | (CPointPredicate< TPointPredicate >) | ) |
DGtal::VoronoiMap< TSpace, TPointPredicate, p >::BOOST_STATIC_ASSERT | ( | (boost::is_same< typename TSpace::Point, typename TPointPredicate::Point >::value) | ) |
Both Space points and PointPredicate points must be the same.
|
inline |
Compute the Voronoi Map of a set of point sites using a SeparableMetric metric. The method associates to each point satisfying the foreground predicate, the closest site for which the predicate is false. This algorithm is O(d.|domain size|).
Definition at line 66 of file VoronoiMap.ih.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue().
|
private |
Given a voronoi map valid at dimension dim-1, this method updates the map to make it consistent at dimension dim along the 1D span starting at row along the dimension dim.
output | the Voronoi map to update. |
row | starting point of the 1D process. |
dim | dimension of the update. |
Sites | stack of sites (pass as an argument for performance purposes). |
Definition at line 138 of file VoronoiMap.ih.
References DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue().
|
inlineprivate |
Compute the other steps of the separable Voronoi map.
output | the output map |
dim | the dimension to process |
Definition at line 99 of file VoronoiMap.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 |
Copy of the computation domain.
Definition at line 214 of file VoronoiMap.h.
|
private |
Value to act as a +infinity value.
Definition at line 226 of file VoronoiMap.h.
|
private |
Copy of the image lower bound.
Definition at line 220 of file VoronoiMap.h.
|
private |
The separable metric instance.
Definition at line 211 of file VoronoiMap.h.
|
private |
Copy of the computation domain.
Definition at line 217 of file VoronoiMap.h.
|
private |
Copy of the image lower bound.
Definition at line 223 of file VoronoiMap.h.