Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal
2.0.0
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
x
Variables
a
b
d
e
f
h
i
l
m
n
o
p
s
t
v
w
x
Typedefs
a
b
c
d
e
i
k
l
n
o
p
r
s
u
v
z
Enumerations
Enumerator
a
b
c
d
e
g
h
i
j
n
o
p
s
t
u
z
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
c
d
e
f
h
l
m
n
o
p
r
s
t
u
Enumerator
a
b
c
d
e
f
g
l
m
o
p
r
s
t
u
v
x
y
z
Related Symbols
a
b
c
d
e
f
g
i
k
l
m
o
p
s
t
u
Examples
DGtal
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
volDTGranulo-template.cpp
Go to the documentation of this file.
1
16
30
32
#include <iostream>
33
#include <fstream>
34
#include <algorithm>
36
38
#include "DGtal/base/Common.h"
39
#include "DGtal/helpers/StdDefs.h"
40
41
#include "DGtal/images/ImageContainerBySTLVector.h"
42
43
#include "DGtal/io/readers/VolReader.h"
44
#include "DGtal/io/writers/VolWriter.h"
45
46
#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
47
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
48
#include "DGtal/shapes/implicit/ImplicitBall.h"
49
#include "DGtal/base/BasicFunctors.h"
51
53
#include "DGtal/io/viewers/PolyscopeViewer.h"
54
#include "DGtal/io/colormaps/GradientColorMap.h"
56
57
using namespace
DGtal
;
58
59
int
main
(
int
argc,
char
** argv)
60
{
61
63
//Load a vol image and store it into a ImageContainerBySTLVector
64
//
65
// ...
66
//
67
68
70
//Visualization 2
71
//
72
74
//Create a new viewer instance
75
PolyscopeViewer<>
viewer;
77
78
// - iterate over the loaded image domain and send strictly positive
79
// values to the viewer
80
//
81
// If needed, to not forget to a viewer.allowReuseList to group values togethe
82
// Do not forget a viewer.show(); when you're done.
83
84
86
//Distance transformation
87
88
//Create a Point Predicate from the input image and a thresholder
89
// (see SimpleThresholdForegroundPredicate)
90
91
// ...
92
93
94
// Compute the distance map for the L2 metric
95
96
// ...
97
99
100
102
//Visualization 2
103
//
104
105
// Create a new instance of PolyscopeViewer
106
108
//Create the colormap from the maximal distance value
109
//and a GradientColorMap
110
DT::Value maxDT = (*boost::first_max_element(distancemap.constRange().begin(),
111
distancemap.constRange().end()));
112
GradientColorMap<DT::Value>
gradient( 0, maxDT);
113
gradient.
addColor
(
DGtal::Color::Blue
);
114
gradient.
addColor
(
DGtal::Color::Green
);
115
gradient.
addColor
(
DGtal::Color::Yellow
);
116
gradient.
addColor
(
DGtal::Color::Red
);
118
119
120
122
//Granulometry
123
124
125
//Create an empty image with the same size as the input one
126
127
//...
128
129
130
//Compute the granulometry function
131
132
//...
133
134
135
//Export the granulometry map to a vol
137
VolWriter<Image, CastFunctor<unsigned char>
>::exportVol(
"granulo.vol"
, imageGranulo);
139
140
141
143
//Visualization 3
144
//
145
// Create a visualization of the granulometry function
146
147
return
0;
148
}
59
int
main
(
int
argc,
char
** argv) {
…
}
DGtal::Color::Red
static const Color Red
Definition
Color.h:425
DGtal::Color::Blue
static const Color Blue
Definition
Color.h:428
DGtal::Color::Yellow
static const Color Yellow
Definition
Color.h:431
DGtal::Color::Green
static const Color Green
Definition
Color.h:426
DGtal::GradientColorMap
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Definition
GradientColorMap.h:120
DGtal::GradientColorMap::addColor
void addColor(const Color &color)
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:52
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::VolWriter
Aim: Export a 3D Image using the Vol formats.
Definition
VolWriter.h:69
main
int main()
Definition
testBits.cpp:56
examples
tutorial-examples
volDTGranulo-template.cpp
Generated on
for DGtal by
1.14.0