48#include "DGtal/base/Common.h"
51#include "DGtal/kernel/SpaceND.h"
52#include "DGtal/kernel/domains/HyperRectDomain.h"
53#include "DGtal/kernel/sets/DigitalSetFromMap.h"
54#include "DGtal/images/ImageContainerBySTLMap.h"
55#include "DGtal/topology/SCellsFunctors.h"
58#include "DGtal/shapes/ShapeFactory.h"
59#include "DGtal/shapes/Shapes.h"
60#include "DGtal/helpers/StdDefs.h"
61#include "DGtal/topology/helpers/Surfaces.h"
62#include "DGtal/shapes/GaussDigitizer.h"
67#include "DGtal/geometry/volumes/distance/FMM.h"
71#include "DGtal/io/colormaps/HueShadeColorMap.h"
72#include "DGtal/io/boards/Board2D.h"
88template<
typename TImage >
89void draw(
const TImage aImg,
const double& aMaxValue, std::string aBasename)
91 typedef typename TImage::Domain::ConstIterator ConstIteratorOnPoints;
92 typedef typename TImage::Domain::Point
Point;
98 for (ConstIteratorOnPoints it = aImg.domain().begin(), itEnd = aImg.domain().end();
108 s << aBasename <<
".eps";
111 #ifdef DGTAL_WITH_CAIRO
114 s << aBasename <<
".png";
89void draw(
const TImage aImg,
const double& aMaxValue, std::string aBasename) {
…}
127 trace.beginBlock (
"DT by FMM from one point" );
142 DistanceImage distanceImage(
domain );
143 AcceptedPointSet set( distanceImage );
148 set.insert( origin );
149 distanceImage.setValue( origin, 0.0 );
153 FMM fmm( distanceImage, set,
domain.predicate() );
156 trace.info() <<
"Init: " << fmm << std::endl;
162 trace.info() <<
"End: " << fmm << std::endl;
167 s <<
"DTbyFMM-" << size;
168 draw(distanceImage, fmm.
max(), s.str());
181int main (
int argc,
char** argv )
183 trace.beginBlock (
"Example 2d FMM" );
184 trace.info() <<
"Args:";
185 for (
int i = 0; i < argc; ++i )
186 trace.info() <<
" " << argv[ i ];
187 trace.info() << endl;
181int main (
int argc,
char** argv ) {
…}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: An adapter for viewing an associative image container like ImageContainerBySTLMap as a simple di...
Aim: Fast Marching Method (FMM) for nd distance transforms.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
functors::IsWithinPointPredicate< Point > Predicate
static Self diagonal(Component val=1)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
void draw(const TImage aImg, const double &aMaxValue, std::string aBasename)
void example()
We use FMM to compute a distance field from a given point.
HyperRectDomain< Space > Domain
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.