62{
63
66 using namespace DGtal;
68
71
72
75
76
78 (*it)=128;
79
80
85
86 trace.beginBlock (
"Example toricdomainvolumetric" );
87
92 board.
saveSVG(
"toric-inputShape.svg");
93
95
97 PointPredicate predicate(
image,0);
99
103
104
105 DTL2 dtL2(
image.domain(), predicate, l2Metric);
106
107 DTL2Toric dtL2Toric(
image.domain(), predicate, l2Metric, {{true, true}} );
109
113
114
115 DTL2ToricX dtL2ToricX(
image.domain(), predicate, l2Metric, {{true, false}} );
116
117 DTL2ToricY dtL2ToricY(
image.domain(), predicate, l2Metric, {{false, true}} );
119
120
121 const DTL2::Value maxv2 = * (boost::first_max_element(dtL2.constRange().begin(), dtL2.constRange().end()));
122 const DTL2Toric::Value maxvtoric = * (boost::first_max_element(dtL2Toric.constRange().begin(), dtL2Toric.constRange().end()));
123 const DTL2ToricX::Value maxvtoricX = * (boost::first_max_element(dtL2ToricX.constRange().begin(), dtL2ToricX.constRange().end()));
124 const DTL2ToricY::Value maxvtoricY = * (boost::first_max_element(dtL2ToricY.constRange().begin(), dtL2ToricY.constRange().end()));
125
126
127 const auto maxvall = std::max( { maxv2, maxvtoric, maxvtoricX, maxvtoricY } );
128
130
133
134 trace.warning() <<
"DT maxValue= " << maxv2 << endl;
137 board.
saveSVG (
"toric-example-DT-L2.svg" );
138
139 trace.warning() <<
"Full toric maxValue= " << maxvtoric << endl;
142 board.
saveSVG (
"toric-example-DT-L2-toric.svg" );
143
144 trace.warning() <<
"1th dimension periodic maxValue= " << maxvtoricX << endl;
147 board.
saveSVG (
"toric-example-DT-L2-toricX.svg" );
148
149 trace.warning() <<
"2nd dimension periodic maxValue= " << maxvtoricY << endl;
152 board.
saveSVG (
"toric-example-DT-L2-toricY.svg" );
153
154
155
157 ticked.addRegularTicks(3, 0.5);
158 ticked.finalize();
162 for ( auto it = dtL2.domain().begin(), itend = dtL2.domain().end();it != itend; ++it)
163 {
165 board << *it;
166 }
167 board.
saveSVG(
"toric-example-DT-L2-ticked.svg");
168
170 for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
171 {
173 board << *it;
174 }
175 board.
saveSVG(
"toric-example-DT-L2-ticked-toric.svg");
176
178 for ( auto it = dtL2ToricX.domain().begin(), itend = dtL2ToricX.domain().end();it != itend; ++it)
179 {
181 board << *it;
182 }
183 board.
saveSVG(
"toric-example-DT-L2-ticked-toricX.svg");
184
186 for ( auto it = dtL2ToricY.domain().begin(), itend = dtL2ToricY.domain().end();it != itend; ++it)
187 {
189 board << *it;
190 }
191 board.
saveSVG(
"toric-example-DT-L2-ticked-toricY.svg");
192
193
195 board << dtL2.domain();
196 for ( auto it = dtL2.domain().begin(), itend = dtL2.domain().end();it != itend; ++it)
197 if ( dtL2.getVoronoiSite(*it) != *it )
199 board.
saveSVG(
"toric-example-Voro-L2.svg");
200
202 board << dtL2Toric.domain();
203 for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
204 if ( dtL2Toric.getVoronoiSite(*it) != *it )
206 board.
saveSVG(
"toric-example-Voro-L2-toric.svg");
207
209 board << dtL2Toric.domain();
210 for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
211 if ( dtL2Toric.getVoronoiSite(*it) != *it )
213 board.
saveSVG(
"toric-example-Voro-L2-toric-projected.svg");
214
216 board << dtL2ToricX.domain();
217 for ( auto it = dtL2ToricX.domain().begin(), itend = dtL2ToricX.domain().end();it != itend; ++it)
218 if ( dtL2ToricX.getVoronoiSite(*it) != *it )
220 board.
saveSVG(
"toric-example-Voro-L2-toricX.svg");
221
223 board << dtL2ToricY.domain();
224 for ( auto it = dtL2ToricY.domain().begin(), itend = dtL2ToricY.domain().end();it != itend; ++it)
225 if ( dtL2ToricY.getVoronoiSite(*it) != *it )
227 board.
saveSVG(
"toric-example-Voro-L2-toricY.svg");
228
230 return 0;
231}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: This class template may be used to (linearly) convert scalar values in a given range into gray l...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
std::vector< Value >::iterator Iterator
Aim: This class adapts any colormap to add "ticks" in the colormap colors.
Aim: Define a simple Foreground predicate thresholding image values given a single thresold....
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
static void drawImage(DGtal::Board2D &board, const Image &i, const typename Image::Value &minV, const typename Image::Value &maxV)
static void draw(DGtal::Board2D &board, const DGtal::DiscreteExteriorCalculus< dimEmbedded, dimAmbient, TLinearAlgebraBackend, TInteger > &calculus)
ImageContainerBySTLVector< Domain, Value > Type
ImageContainerBySTLVector< Domain, Value > Image
HyperRectDomain< Space > Domain