66 using namespace DGtal;
77 for (
Image::Iterator it = image.begin(), itend = image.end();it != itend; ++it)
81 image.setValue(
Point(16,2), 0);
82 image.setValue(
Point(2,11), 0);
83 image.setValue(
Point(30,15), 0);
91 Display2DFactory::drawImage<Gray>(board, image, (
unsigned int)0, (
unsigned int)129);
92 board.
saveSVG(
"toric-inputShape.svg");
97 PointPredicate predicate(image,0);
105 DTL2 dtL2(image.domain(), predicate, l2Metric);
107 DTL2Toric dtL2Toric(image.domain(), predicate, l2Metric, {{true, true}} );
115 DTL2ToricX dtL2ToricX( image.domain(), predicate, l2Metric, {{true, false}} );
117 DTL2ToricY dtL2ToricY( image.domain(), predicate, l2Metric, {{false, true}} );
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()));
127 const auto maxvall =
std::max( { maxv2, maxvtoric, maxvtoricX, maxvtoricY } );
136 Display2DFactory::drawImage<HueTwice>(board, dtL2, 0.0, maxvall + 1);
137 board.
saveSVG (
"toric-example-DT-L2.svg" );
139 trace.
warning() <<
"Full toric maxValue= " << maxvtoric << endl;
141 Display2DFactory::drawImage<HueTwice>(board, dtL2Toric, 0.0, maxvall + 1);
142 board.
saveSVG (
"toric-example-DT-L2-toric.svg" );
144 trace.
warning() <<
"1th dimension periodic maxValue= " << maxvtoricX << endl;
146 Display2DFactory::drawImage<HueTwice>(board, dtL2ToricX, 0.0, maxvall + 1);
147 board.
saveSVG (
"toric-example-DT-L2-toricX.svg" );
149 trace.
warning() <<
"2nd dimension periodic maxValue= " << maxvtoricY << endl;
151 Display2DFactory::drawImage<HueTwice>(board, dtL2ToricY, 0.0, maxvall + 1);
152 board.
saveSVG (
"toric-example-DT-L2-toricY.svg" );
157 ticked.addRegularTicks(3, 0.5);
159 ticked.colormap()->addColor( Color::Red );
160 ticked.colormap()->addColor( Color::Black );
162 for (
auto it = dtL2.domain().begin(), itend = dtL2.domain().end();it != itend; ++it)
167 board.
saveSVG(
"toric-example-DT-L2-ticked.svg");
170 for (
auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
175 board.
saveSVG(
"toric-example-DT-L2-ticked-toric.svg");
178 for (
auto it = dtL2ToricX.domain().begin(), itend = dtL2ToricX.domain().end();it != itend; ++it)
183 board.
saveSVG(
"toric-example-DT-L2-ticked-toricX.svg");
186 for (
auto it = dtL2ToricY.domain().begin(), itend = dtL2ToricY.domain().end();it != itend; ++it)
191 board.
saveSVG(
"toric-example-DT-L2-ticked-toricY.svg");
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");
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");
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");
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");
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");
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: implements association bewteen points lying in a digital domain and values.
Aim: This class adapts any colormap to add "ticks" in the colormap colors.
void beginBlock(const std::string &keyword="")
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
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 ...
void draw(const Iterator &itb, const Iterator &ite, Board &aBoard)
ImageContainerBySTLVector< Domain, Value > Image
HyperRectDomain< Space > Domain