DGtal  0.9.2
PowerMap.h
1 
17 #pragma once
18 
33 #if defined(PowerMap_RECURSES)
34 #error Recursive header files inclusion detected in PowerMap.h
35 #else // defined(PowerMap_RECURSES)
36 
37 #define PowerMap_RECURSES
38 
39 #if !defined PowerMap_h
40 
41 #define PowerMap_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <utility>
47 #include <vector>
48 #include "DGtal/base/Common.h"
49 #include "DGtal/base/CountedPtr.h"
50 #include "DGtal/base/ConstAlias.h"
51 #include "DGtal/images/ImageContainerBySTLVector.h"
52 #include "DGtal/kernel/domains/HyperRectDomain.h"
53 #include "DGtal/images/CConstImage.h"
54 #include "DGtal/geometry/volumes/distance/CPowerSeparableMetric.h"
55 #include "DGtal/kernel/domains/HyperRectDomain.h"
57 
58 namespace DGtal
59 {
60 
62  // template class PowerMap
93  template < typename TWeightImage,
94  typename TPowerSeparableMetric,
95  typename TImageContainer =
96  ImageContainerBySTLVector<HyperRectDomain<typename TWeightImage::Domain::Space>,
97  typename TWeightImage::Domain::Space::Vector> >
98  class PowerMap
99  {
100 
101  public:
102 
105 
107  typedef TWeightImage WeightImage;
108  typedef typename TWeightImage::Value Weight;
109  typedef typename WeightImage::Domain::Space Space;
110  typedef typename Space::Vector Vector;
111  typedef typename Space::Point Point;
112  typedef typename Space::Dimension Dimension;
113  typedef typename Space::Size Size;
115 
116  //ImageContainer::Domain::Space must match with TSpace
117  BOOST_STATIC_ASSERT ((boost::is_same< typename TWeightImage::Domain::Space,
118  typename TImageContainer::Domain::Space >::value ));
119 
120  //ImageContainer value type must be TSpace::Vector
121  BOOST_STATIC_ASSERT ((boost::is_same< typename TWeightImage::Domain::Space::Vector,
122  typename TImageContainer::Value >::value ));
123 
124  //ImageContainer domain type must be HyperRectangular
126  typename TImageContainer::Domain >::value ));
127 
129  typedef typename TImageContainer::Domain Domain;
130 
132  typedef TPowerSeparableMetric PowerSeparableMetric;
133 
135  typedef TImageContainer OutputImage;
136 
138  typedef Vector Value;
140  typedef typename OutputImage::ConstRange ConstRange;
141 
144 
145 
164  ConstAlias<WeightImage> aWeightImage,
166 
170  ~PowerMap();
171 
172  public:
173  // ------------------- ConstImage model ------------------------
174 
181  Self & operator=(const Self &aOtherPowerMap );
182 
187  const Domain & domain() const
188  {
189  return *myDomainPtr;
190  }
191 
192 
197  ConstRange constRange() const
198  {
199  return myImagePtr->constRange();
200  }
201 
207  Value operator()(const Point &aPoint) const
208  {
209  return myImagePtr->operator()(aPoint);
210  }
211 
215  const PowerSeparableMetric* metricPtr() const
216  {
217  return myMetricPtr;
218  }
219 
223  const WeightImage* weightImagePtr() const
224  {
225  return myWeightImagePtr;
226  }
227 
233  void selfDisplay ( std::ostream & out ) const;
234 
235  // ------------------- Private functions ------------------------
236  private:
237 
244  void compute ( ) ;
245 
246 
252  void computeOtherSteps(const Dimension dim) const;
262  void computeOtherStep1D (const Point &row,
263  const Dimension dim) const;
264 
265  // ------------------- protected methods ------------------------
266  protected:
267 
272  PowerMap();
273 
274 
275  // ------------------- Private members ------------------------
276  private:
277 
279  const Domain * myDomainPtr;
280 
283 
286 
288  Point myInfinity;
289 
290  protected:
292  const PowerSeparableMetric * myMetricPtr;
293 
296 
298  const WeightImage * myWeightImagePtr;
299 
300 
301  }; // end of class PowerMap
302 
309  template <typename W,
310  typename Sep,
311  typename Image>
312  std::ostream&
313  operator<< ( std::ostream & out, const PowerMap<W,Sep,Image> & object );
314 
315 } // namespace DGtal
316 
317 
319 // Includes inline functions.
320 #include "DGtal/geometry/volumes/distance/PowerMap.ih"
321 
322 // //
324 
325 #endif // !defined PowerMap_h
326 
327 #undef PowerMap_RECURSES
328 #endif // else defined(PowerMap_RECURSES)
TWeightImage WeightImage
Copy of the distance image types.
Definition: PowerMap.h:107
BOOST_STATIC_ASSERT((boost::is_same< typename TWeightImage::Domain::Space, typename TImageContainer::Domain::Space >::value))
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
OutputImage::ConstRange ConstRange
Definition of the image value type.
Definition: PowerMap.h:140
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
Space::Vector Vector
Definition: PowerMap.h:110
const PowerSeparableMetric * metricPtr() const
Definition: PowerMap.h:215
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
Value operator()(const Point &aPoint) const
Definition: PowerMap.h:207
Point myInfinity
Value to act as a +infinity value.
Definition: PowerMap.h:288
WeightImage::Domain::Space Space
Definition: PowerMap.h:109
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
void selfDisplay(std::ostream &out) const
void computeOtherSteps(const Dimension dim) const
TWeightImage::Value Weight
Definition: PowerMap.h:108
void computeOtherStep1D(const Point &row, const Dimension dim) const
DGtal::Dimension Dimension
Copy of the type used for the dimension.
Definition: SpaceND.h:129
const Domain * myDomainPtr
Pointer to the computation domain.
Definition: PowerMap.h:279
CountedPtr< OutputImage > myImagePtr
Power map image.
Definition: PowerMap.h:295
Self & operator=(const Self &aOtherPowerMap)
ConstRange constRange() const
Definition: PowerMap.h:197
BOOST_CONCEPT_ASSERT((concepts::CConstImage< TWeightImage >))
Point myUpperBoundCopy
Copy of the image lower bound.
Definition: PowerMap.h:285
Aim: Implementation of the linear in time Power map construction.
Definition: PowerMap.h:98
Aim: defines the concept of separable metrics.
const WeightImage * myWeightImagePtr
Pointer to the point predicate.
Definition: PowerMap.h:298
const Domain & domain() const
Definition: PowerMap.h:187
Point myLowerBoundCopy
Copy of the image lower bound.
Definition: PowerMap.h:282
DGtal is the top-level namespace which contains all DGtal functions and types.
UnsignedInteger Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
Space::Dimension Dimension
Definition: PowerMap.h:112
TImageContainer::Domain Domain
Definition of the underlying domain type.
Definition: PowerMap.h:129
Space::Point::Coordinate Abscissa
Definition: PowerMap.h:114
PointVector< dim, Integer > Point
Points in DGtal::SpaceND.
Definition: SpaceND.h:110
const PowerSeparableMetric * myMetricPtr
Pointer to the separable metric instance.
Definition: PowerMap.h:292
TPowerSeparableMetric PowerSeparableMetric
We construct the type associated to the separable metric.
Definition: PowerMap.h:132
TImageContainer OutputImage
Type of resulting image.
Definition: PowerMap.h:135
PowerMap< TWeightImage, TPowerSeparableMetric, TImageContainer > Self
Self type.
Definition: PowerMap.h:143
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94
const WeightImage * weightImagePtr() const
Definition: PowerMap.h:223
Space::Size Size
Definition: PowerMap.h:113
Vector Value
Definition of the image model value type.
Definition: PowerMap.h:138
Space::Point Point
Definition: PowerMap.h:111