DGtal 1.3.0
Loading...
Searching...
No Matches
DistanceTransformation.h
1
17#pragma once
18
34#if defined(DistanceTransformation_RECURSES)
35#error Recursive header files inclusion detected in DistanceTransformation.h
36#else // defined(DistanceTransformation_RECURSES)
38#define DistanceTransformation_RECURSES
39
40#if !defined DistanceTransformation_h
42#define DistanceTransformation_h
43
45// Inclusions
46#include <iostream>
47#include <vector>
48#include "DGtal/base/Common.h"
49#include "DGtal/kernel/NumberTraits.h"
50#include "DGtal/kernel/CPointPredicate.h"
51#include "DGtal/geometry/volumes/distance/CSeparableMetric.h"
52#include "DGtal/geometry/volumes/distance/VoronoiMap.h"
53#include "DGtal/images/DefaultConstImageRange.h"
54#include "DGtal/kernel/domains/HyperRectDomain.h"
55#include "DGtal/base/ConstAlias.h"
57
58namespace DGtal
59{
60
62 // template class DistanceTransformation
91 template < typename TSpace,
92 typename TPointPredicate,
93 typename TSeparableMetric,
94 typename TImageContainer =
95 ImageContainerBySTLVector< HyperRectDomain<TSpace>,
96 typename TSpace::Vector >
97 >
99 : public VoronoiMap<TSpace,TPointPredicate, TSeparableMetric, TImageContainer>
100 {
101
102 public:
106
108 typedef TSeparableMetric SeparableMetric;
109
111 typedef TSpace Space;
112
114 typedef typename TSpace::Vector Vector;
115
117 typedef TPointPredicate PointPredicate;
118
120 typedef typename SeparableMetric::Value Value;
121
123 typedef typename SeparableMetric::Point Point;
124 BOOST_STATIC_ASSERT((boost::is_same< typename Space::Point,
125 typename SeparableMetric::Point>::value));
126
129
131
134
135
137 typedef typename VoronoiMap<TSpace,TPointPredicate,
139
148 VoronoiMap<TSpace,TPointPredicate,TSeparableMetric,TImageContainer>(aDomain,
149 predicate,
150 aMetric)
151 {}
152
161 typename Parent::PeriodicitySpec const & aPeriodicitySpec)
162 : VoronoiMap<TSpace,TPointPredicate,TSeparableMetric,TImageContainer>(aDomain,
163 predicate,
164 aMetric,
165 aPeriodicitySpec)
166 {}
167
172
173 // ------------------- Private functions ------------------------
174 public:
175
180 const Domain & domain() const
181 {
182 return Parent::domain();
183 }
184
190 {
191 return ConstRange(*this);
192 }
193
201 {
202 return this->myMetricPtr->operator()(aPoint,
203 this->myImagePtr->operator()(aPoint));
204 }
205
212 Vector getVoronoiSite(const Point &aPoint) const
213 {
214 return this->myImagePtr->operator()(aPoint);
215 }
216
220 const SeparableMetric* metric() const
221 {
222 return Parent::metric();
223 }
224
230 void selfDisplay ( std::ostream & out ) const
231 {
232 out << "[DistanceTransformation] underlying VoronoiMap={";
234 out << "}";
235 }
236
237 // ------------------- protected methods ------------------------
238 protected:
239
245
246
247 // ------------------- Private members ------------------------
248 private:
249
250 }; // end of class DistanceTransformation
251
252
253// // //
254// ///////////////////////////////////////////////////////////////////////////////
255
256 template <typename S,typename P,typename TSep>
257 inline
258 std::ostream&
259 operator<< ( std::ostream & out,
260 const DistanceTransformation<S,P,TSep> & object )
261 {
262 object.selfDisplay( out );
263 return out;
264 }
265
266
267
268} // namespace DGtal
269
270// //
272
273#endif // !defined DistanceTransformation_h
274
275#undef DistanceTransformation_RECURSES
276#endif // else defined(DistanceTransformation_RECURSES)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterat...
Aim: Implementation of the linear in time distance transformation for separable metrics.
TPointPredicate PointPredicate
Point Predicate type.
DistanceTransformation< TSpace, TPointPredicate, TSeparableMetric > Self
Definition of the image.
VoronoiMap< TSpace, TPointPredicate, TSeparableMetric > Parent
TSpace Space
Separable Metric type.
Vector getVoronoiSite(const Point &aPoint) const
VoronoiMap< TSpace, TPointPredicate, TSeparableMetric, TImageContainer >::Domain Domain
Definition of the image value type.
TSeparableMetric SeparableMetric
Separable Metric type.
const SeparableMetric * metric() const
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPointPredicate >))
Value operator()(const Point &aPoint) const
TSpace::Vector Vector
Separable Metric type.
DistanceTransformation(ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric)
DefaultConstImageRange< Self > ConstRange
Definition of the image constRange.
SeparableMetric::Point Point
Definition of the image value type.
DistanceTransformation(ConstAlias< Domain > aDomain, ConstAlias< PointPredicate > predicate, ConstAlias< SeparableMetric > aMetric, typename Parent::PeriodicitySpec const &aPeriodicitySpec)
void selfDisplay(std::ostream &out) const
SeparableMetric::Value Value
Definition of the image value type.
BOOST_CONCEPT_ASSERT((concepts::CSeparableMetric< TSeparableMetric >))
BOOST_STATIC_ASSERT((boost::is_same< typename Space::Point, typename SeparableMetric::Point >::value))
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
PointVector< dim, Integer > Point
Points in DGtal::SpaceND.
Definition: SpaceND.h:110
Aim: Implementation of the linear in time Voronoi map construction.
Definition: VoronoiMap.h:127
std::array< bool, Space::dimension > PeriodicitySpec
Periodicity specification type.
Definition: VoronoiMap.h:187
CountedPtr< OutputImage > myImagePtr
Voronoi map image.
Definition: VoronoiMap.h:409
void selfDisplay(std::ostream &out) const
const SeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition: VoronoiMap.h:406
const SeparableMetric * metric() const
Definition: VoronoiMap.h:293
const Domain & domain() const
Definition: VoronoiMap.h:265
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Defines a predicate on a point.
Aim: defines the concept of separable metrics.
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
const Point aPoint(3, 4)
HyperRectDomain< Space > Domain