DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ReducedMedialAxis.h
1
16
17
#pragma once
18
33
34
#if defined(ReducedMedialAxis_RECURSES)
35
#error Recursive header files inclusion detected in ReducedMedialAxis.h
36
#else
// defined(ReducedMedialAxis_RECURSES)
38
#define ReducedMedialAxis_RECURSES
39
40
#if !defined ReducedMedialAxis_h
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> >
97
struct
ReducedMedialAxis
98
{
99
//MA Container
100
typedef
Image<TImageContainer>
Type
;
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 ) )
123
<
NumberTraits<typename TPowerMap::PowerSeparableMetric::Value>::ZERO
)
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)
DGtal::ImageContainerBySTLMap
Definition
ImageContainerBySTLMap.h:98
DGtal::ImageContainerBySTLVector::setValue
void setValue(const Point &aPoint, const Value &aValue)
DGtal::Image
Aim: implements association between points lying in a digital domain and values.
Definition
Image.h:70
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::NumberTraitsImpl< std::decay< T >::type >::ZERO
static const T ZERO
Definition
NumberTraits.h:100
DGtal::ReducedMedialAxis
Aim: Implementation of the separable medial axis extraction.
Definition
ReducedMedialAxis.h:98
DGtal::ReducedMedialAxis::getReducedMedialAxisFromPowerMap
static Type getReducedMedialAxisFromPowerMap(const TPowerMap &aPowerMap)
Definition
ReducedMedialAxis.h:112
DGtal::ReducedMedialAxis::Type
Image< TImageContainer > Type
Definition
ReducedMedialAxis.h:100
TImageContainer
ImageContainerBySTLVector< HyperRectDomain< Z2i::Space >, std::unordered_set< Z2i::Point > > TImageContainer
Definition
testVoronoiMapComplete.cpp:48
src
DGtal
geometry
volumes
distance
ReducedMedialAxis.h
Generated on
for DGtal by
1.18.0