DGtal  0.9.2
ReducedMedialAxis.h
1 
17 #pragma once
18 
34 #if defined(ReducedMedialAxis_RECURSES)
35 #error Recursive header files inclusion detected in ReducedMedialAxis.h
36 #else // defined(ReducedMedialAxis_RECURSES)
37 
38 #define ReducedMedialAxis_RECURSES
39 
40 #if !defined ReducedMedialAxis_h
41 
42 #define ReducedMedialAxis_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/ImageContainerBySTLMap.h"
55 #include "DGtal/images/CImage.h"
56 #include "DGtal/images/Image.h"
58 
59 namespace DGtal
60 {
61 
63  // template class ReducedMedialAxis
94  template <typename TPowerMap,
95  typename TImageContainer = ImageContainerBySTLMap<typename TPowerMap::Domain,
96  typename TPowerMap::PowerSeparableMetric::Value> >
98  {
99  //MA Container
101 
111  static
112  Type getReducedMedialAxisFromPowerMap(const TPowerMap &aPowerMap)
113  {
114  typename TPowerMap::Value v;
115  TImageContainer *computedMA = new TImageContainer( aPowerMap.domain() );
116  for (typename TPowerMap::Domain::ConstIterator it = aPowerMap.domain().begin(),
117  itend = aPowerMap.domain().end(); it != itend; ++it)
118  {
119  v = aPowerMap(*it);
120  if (aPowerMap.metricPtr()->powerDistance(*it,
121  v,
122  aPowerMap.weightImagePtr()->operator()( v ))
124 
125  computedMA->setValue( v,
126  aPowerMap.weightImagePtr()->operator()( v ));
127 
128  }
129  return Type( computedMA );
130  }
131  }; // end of class ReducedMedialAxis
132 
133 
134 
135 } // namespace DGtal
136 
137 // //
139 
140 #endif // !defined ReducedMedialAxis_h
141 
142 #undef ReducedMedialAxis_RECURSES
143 #endif // else defined(ReducedMedialAxisdesign pa_RECURSES)
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
Image< TImageContainer > Type
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:69
DGtal is the top-level namespace which contains all DGtal functions and types.
static Type getReducedMedialAxisFromPowerMap(const TPowerMap &aPowerMap)
Aim: Implementation of the separable medial axis extraction.