DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ReverseDistanceTransformation.h
1 
17 #pragma once
18 
31 #if defined(ReverseDistanceTransformation_RECURSES)
32 #error Recursive header files inclusion detected in ReverseDistanceTransformation.h
33 #else // defined(ReverseDistanceTransformation_RECURSES)
34 
35 #define ReverseDistanceTransformation_RECURSES
36 
37 #if !defined ReverseDistanceTransformation_h
38 
39 #define ReverseDistanceTransformation_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/kernel/NumberTraits.h"
47 #include "DGtal/images/CImage.h"
48 #include "DGtal/geometry/volumes/distance/SeparableMetricHelper.h"
49 #include "DGtal/kernel/NumberTraits.h"
50 #include "DGtal/kernel/domains/HyperRectDomain.h"
51 #include "DGtal/kernel/sets/CDigitalSet.h"
53 
54 namespace DGtal
55 {
56 
58  // template class ReverseDistanceTransformation
74  template <typename Image, DGtal::uint32_t p, typename IntegerShort = DGtal::int8_t >
76  {
77 
78  public:
79 
80  //BOOST_CONCEPT_ASSERT(( CImage<Image> ));
82 
83 
86 
87  typedef typename Image::Value Value;
88  typedef typename Image::Point Point;
89  typedef typename Image::Vector Vector;
90  typedef typename Image::Dimension Dimension;
91  typedef typename Image::Size Size;
92  typedef typename Image::Integer Integer;
93  typedef typename Image::Domain Domain;
94  typedef typename Image::Domain::Space::Point::Coordinate Coordinate;
95 
98 
99 
108  ReverseDistanceTransformation(const IntegerShort defaultForeground = NumberTraits< IntegerShort >::ONE,
109  const IntegerShort defaultBackground = NumberTraits< IntegerShort >::ZERO);
110 
115 
116  public:
117 
125  OutputImage reconstruction(const Image & inputImage);
126 
135  template<typename DigitalSet>
136  void reconstructionAsSet(DigitalSet &aSet, const Image &inputImage);
137 
138 
139 
140 
141  // ------------------- Private functions ------------------------
142  private:
143 
144 
154  bool reconstructionInternal(const Image &aImage, Image &output, Image &swap);
155 
167  OutputImage castValues(const Image &input) const;
168 
178  void computeSteps(const Image & inputImage,
179  Image & output,
180  const Dimension dim)const;
181 
190  void computeSteps1D (const Image & input,
191  Image & output,
192  const Point &startingPoint,
193  const Size dim,
194  Integer s[], Integer t[]) const;
195 
196 
197  // ------------------- Private members ------------------------
198  private:
201 
204 
207 
210 
213 
215  IntegerShort myForegroundValue;
216 
218  IntegerShort myBackgroundValue;
219 
220  }; // end of class ReverseDistanceTransformation
221 
222 } // namespace DGtal
223 
224 
226 // Includes inline functions.
227 #include "DGtal/geometry/volumes/distance/ReverseDistanceTransformation.ih"
228 
229 // //
231 
232 #endif // !defined ReverseDistanceTransformation_h
233 
234 #undef ReverseDistanceTransformation_RECURSES
235 #endif // else defined(ReverseDistanceTransformation_RECURSES)