47 #include "DGtal/base/Common.h"
48 #include "DGtal/helpers/StdDefs.h"
49 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
50 #include "DGtal/io/colormaps/HueShadeColorMap.h"
51 #include "DGtal/io/colormaps/TickedColorMap.h"
52 #include "DGtal/io/colormaps/GradientColorMap.h"
53 #include "DGtal/io/boards/Board2D.h"
54 #include "DGtal/images/ImageSelector.h"
55 #include "DGtal/images/SimpleThresholdForegroundPredicate.h"
56 #include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
60 using namespace DGtal;
71 template<
typename Image>
74 typename Image::Point p, low = image.domain().lowerBound();
79 for (
unsigned int k = 0 ; k < nb; k++)
81 for (
unsigned int dim = 0;
dim < Image::dimension;
dim++)
84 image.setValue(p, value);
101 for (
Image::Iterator it = image.begin(), itend = image.end();it != itend; ++it)
111 Display2DFactory::drawImage<Gray>(board, image, (
unsigned int)0, (
unsigned int)129);
112 board.
saveSVG(
"inputShape.svg");
117 PointPredicate predicate(image,0);
125 DTL2 dtL2(image.domain(), predicate, Z2i::l2Metric);
126 DTL1 dtL1(image.domain(), predicate, Z2i::l1Metric);
133 if ( (*it) > maxv2) maxv2 = (*it);
138 if ( (*it) > maxv1) maxv1 = (*it);
150 Display2DFactory::drawImage<HueTwice>(board, dtL2, 0.0, maxv2 + 1);
151 board.
saveSVG (
"example-DT-L2.svg" );
155 Display2DFactory::drawImage<HueTwice>(board, dtL1, 0.0, maxv1 + 1);
156 board.
saveSVG (
"example-DT-L1.svg" );
164 ticked.
colormap()->addColor( Color::Red );
165 ticked.
colormap()->addColor( Color::Black );
171 board.
saveSVG(
"example-DT-L2-ticked.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.
ColorMap * colormap() const
void addRegularTicks(const unsigned int nbTicks, const Value thickness)
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
MyDigitalSurface::ConstIterator ConstIterator
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 ...
ImageContainerBySTLVector< Domain, Value > Image
unsigned int dim(const Vector &z)