DGtal  1.4.beta
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,
98  {
99  //MA Container
101 
111  static
112  Type getReducedMedialAxisFromPowerMap(const TPowerMap &aPowerMap)
113  {
114  TImageContainer *computedMA = new TImageContainer( aPowerMap.domain() );
115 
116  for (typename TPowerMap::Domain::ConstIterator it = aPowerMap.domain().begin(),
117  itend = aPowerMap.domain().end(); it != itend; ++it)
118  {
119  const auto v = aPowerMap( *it );
120  const auto pv = aPowerMap.projectPoint( v );
121 
122  if ( aPowerMap.metricPtr()->powerDistance( *it, v, aPowerMap.weightImagePtr()->operator()( pv ) )
124  computedMA->setValue( v, aPowerMap.weightImagePtr()->operator()( pv ) );
125  }
126 
127  return Type( computedMA );
128  }
129  }; // end of class ReducedMedialAxis
130 
131 
132 
133 } // namespace DGtal
134 
135 // //
137 
138 #endif // !defined ReducedMedialAxis_h
139 
140 #undef ReducedMedialAxis_RECURSES
141 #endif // else defined(ReducedMedialAxisdesign pa_RECURSES)
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::ReducedMedialAxis::getReducedMedialAxisFromPowerMap
static Type getReducedMedialAxisFromPowerMap(const TPowerMap &aPowerMap)
Definition: ReducedMedialAxis.h:112
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
DGtal::NumberTraits
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:562
DGtal::ImageContainerBySTLVector::setValue
void setValue(const Point &aPoint, const Value &aValue)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Domain
HyperRectDomain< Space > Domain
Definition: testSimpleRandomAccessRangeFromPoint.cpp:44
DGtal::Image
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
DGtal::ReducedMedialAxis::Type
Image< TImageContainer > Type
Definition: ReducedMedialAxis.h:100
DGtal::ReducedMedialAxis
Aim: Implementation of the separable medial axis extraction.
Definition: ReducedMedialAxis.h:97
TImageContainer
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer
Definition: testVoronoiMapComplete.cpp:49
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38