DGtal 1.4.0
Loading...
Searching...
No Matches
ReverseDistanceTransformation.h
1
17#pragma once
18
34#if defined(ReverseDistanceTransformation_RECURSES)
35#error Recursive header files inclusion detected in ReverseDistanceTransformation.h
36#else // defined(ReverseDistanceTransformation_RECURSES)
38#define ReverseDistanceTransformation_RECURSES
39
40#if !defined ReverseDistanceTransformation_h
42#define ReverseDistanceTransformation_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/geometry/volumes/distance/CPowerSeparableMetric.h"
51#include "DGtal/geometry/volumes/distance/PowerMap.h"
52#include "DGtal/images/DefaultConstImageRange.h"
53#include "DGtal/kernel/domains/HyperRectDomain.h"
54#include "DGtal/images/ImageContainerBySTLVector.h"
55#include "DGtal/images/CImage.h"
56#include "DGtal/base/ConstAlias.h"
58
59namespace DGtal
60{
61
63 // template class ReverseDistanceTransformation
87 template < typename TWeightImage,
88 typename TPSeparableMetric,
89 typename TImageContainer =
90 ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>,
91 typename TWeightImage::Domain::Space::Vector>
92 >
94 : public PowerMap<TWeightImage, TPSeparableMetric, TImageContainer>
95 {
96
97 public:
98
100 typedef TWeightImage WeightImage;
101
103 typedef TPSeparableMetric PowerSeparableMetric;
104
108
110 typedef typename PowerSeparableMetric::Value Value;
111
113 typedef typename TWeightImage::Domain::Space::Point Point;
114
116 typedef typename TWeightImage::Domain::Space::Vector Vector;
117
119 typedef typename PowerSeparableMetric::Weight Weight;
120
122 typedef ReverseDistanceTransformation<TWeightImage,
123 TPSeparableMetric,
125
127
130
131
133 typedef typename PowerMap< TWeightImage,TPSeparableMetric,
135
136
143 ConstAlias<WeightImage> aWeightImage,
145 PowerMap<TWeightImage,TPSeparableMetric,TImageContainer>(aDomain,
146 aWeightImage,
147 aMetric)
148 {}
149
156 ConstAlias<WeightImage> aWeightImage,
158 typename Parent::PeriodicitySpec const & aPeriodicitySpec)
159 : PowerMap<TWeightImage,TPSeparableMetric,TImageContainer>(aDomain,
160 aWeightImage,
161 aMetric,
162 aPeriodicitySpec)
163 {}
164
169
170 // ------------------- Private functions ------------------------
171 public:
172
177 const Domain & domain() const
178 {
179 return Parent::domain();
180 }
181
187 {
188 return ConstRange(*this);
189 }
190
198 {
199 return this->myMetricPtr->powerDistance(aPoint,
200 this->myImagePtr->operator()(aPoint),
201 this->myWeightImagePtr->operator()( this->myImagePtr->operator()(aPoint)));
202 }
203
211 {
212 return this->myImagePtr->operator()(aPoint);
213 }
214
218 const PowerSeparableMetric* metricPtr() const
219 {
220 return Parent::metricPtr();
221 }
222
228 void selfDisplay ( std::ostream & out ) const
229 {
230 out << "[ReverseDistanceTransformation] underlying PowerMap={";
232 out << "}";
233 }
234
235 // ------------------- protected methods ------------------------
236 protected:
237
243
244
245 // ------------------- Private members ------------------------
246 private:
247
248 }; // end of class ReverseDistanceTransformation
249
250
251// // //
252// ///////////////////////////////////////////////////////////////////////////////
253
254 template <typename W,typename TSep>
255 inline
256 std::ostream&
257 operator<< ( std::ostream & out,
259 {
260 object.selfDisplay( out );
261 return out;
262 }
263
264
265
266} // namespace DGtal
267
268// //
270
271#endif // !defined ReverseDistanceTransformation_h
272
273#undef ReverseDistanceTransformation_RECURSES
274#endif // else defined(ReverseDistanceTransformation_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 Power map construction.
Definition PowerMap.h:111
std::array< bool, Space::dimension > PeriodicitySpec
Periodicity specification type.
Definition PowerMap.h:159
const PowerSeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition PowerMap.h:405
const Domain & domain() const
Definition PowerMap.h:239
const PowerSeparableMetric * metricPtr() const
Definition PowerMap.h:267
void selfDisplay(std::ostream &out) const
CountedPtr< OutputImage > myImagePtr
Power map image.
Definition PowerMap.h:408
Aim: Implementation of the linear in time reverse distance transformation for separable metrics.
PowerMap< TWeightImage, TPSeparableMetric, TImageContainer >::Domain Domain
Definition of the image value type.
const PowerSeparableMetric * metricPtr() const
TWeightImage WeightImage
Separable Metric type.
TImageContainer ImageContainer
Image Container type.
ReverseDistanceTransformation< TWeightImage, TPSeparableMetric, TImageContainer > Self
Definition of the image.
PowerSeparableMetric::Value Value
Separable Metric type value type.
ReverseDistanceTransformation(ConstAlias< Domain > aDomain, ConstAlias< WeightImage > aWeightImage, ConstAlias< PowerSeparableMetric > aMetric)
ReverseDistanceTransformation(ConstAlias< Domain > aDomain, ConstAlias< WeightImage > aWeightImage, ConstAlias< PowerSeparableMetric > aMetric, typename Parent::PeriodicitySpec const &aPeriodicitySpec)
BOOST_CONCEPT_ASSERT((concepts::CImage< ImageContainer >))
TWeightImage::Domain::Space::Vector Vector
Vector type.
TWeightImage::Domain::Space::Point Point
Point type.
TPSeparableMetric PowerSeparableMetric
Separable Metric type.
DefaultConstImageRange< Self > ConstRange
Definition of the image constRange.
PowerMap< TWeightImage, TPSeparableMetric > Parent
Vector getPowerVector(const Point &aPoint) const
PowerSeparableMetric::Weight Weight
Separable Metric type weight type.
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 the concept describing a read/write image, having an output iterator.
Definition CImage.h:103
const Point aPoint(3, 4)
HyperRectDomain< Space > Domain
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer