Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
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
57using namespace DGtal;
58
59int 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);
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}
static const Color Red
Definition Color.h:425
static const Color Blue
Definition Color.h:428
static const Color Yellow
Definition Color.h:431
static const Color Green
Definition Color.h:426
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Export a 3D Image using the Vol formats.
Definition VolWriter.h:69
int main()
Definition testBits.cpp:56