45#include "DGtal/base/Common.h"
46#include "DGtal/topology/KhalimskySpaceND.h"
47#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
48#include "DGtal/images/ImageSelector.h"
49#include "DGtal/helpers/StdDefs.h"
50#include "DGtal/topology/helpers/Surfaces.h"
52#include "DGtal/io/readers/PGMReader.h"
53#include "DGtal/io/colormaps/GradientColorMap.h"
54#include "DGtal/io/boards/Board2D.h"
55#include "DGtal/io/Color.h"
57#include "ConfigExamples.h"
72 std::string inputFilename = examplesPath +
"samples/circleR10modif.pgm";
78 board << image.domain() << set2d;
81 board2 << image.domain() << set2d;
84 board3 << image.domain() << set2d;
89 bool space_ok = ks.
init( image.domain().lowerBound(), image.domain().upperBound(),
true );
97 std::vector<Z2i::SCell> vectBdrySCell;
100 ks, SAdj, set2d, aCell );
102 board <<
CustomStyle( (*(vectBdrySCell.begin())).className(),
104 Color( 192, 192, 0 ) ));
112 std::vector<Z2i::SCell>::iterator it;
113 for ( it=vectBdrySCell.begin() ; it != vectBdrySCell.end(); it++ ){
116 cmap_grad( d )))<< *it;
122 std::set<Z2i::SCell> bdry;
130 std::set<Z2i::SCell>::iterator itB;
131 for ( itB=bdry.begin() ; itB != bdry.end(); itB++ ){
134 cmap_grad( d )))<< *itB;
138 std::vector< std::vector<Z2i::SCell> > vectContoursBdrySCell;
150 for(
unsigned int i=0; i< vectContoursBdrySCell.size(); i++){
152 for(
unsigned int j=0; j< vectContoursBdrySCell.at(i).size(); j++){
153 board3<<
CustomStyle(vectContoursBdrySCell.at(i).at(j).className() ,
155 cmap_grad3( d )))<<vectContoursBdrySCell.at(i).at(j) ;
167 board2.
saveEPS(
"ctopo-2d.eps");
168 board2.
saveFIG(
"ctopo-2d.fig");
170 board3.
saveEPS(
"ctopo-2e.eps");
171 board3.
saveFIG(
"ctopo-2e.fig");
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
Aim: implements association bewteen points lying in a digital domain and values.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
const Point & lowerBound() const
Return the lower bound for digital points in this space.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
const Point & upperBound() const
Return the upper bound for digital points in this space.
static void extractAll2DSCellContours(std::vector< std::vector< SCell > > &aVectSCellContour2D, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void track2DBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
void saveEPS(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 ...
ImageContainerBySTLVector< Domain, Value > Type
static ImageContainer importPGM(const std::string &aFilename, const Functor &aFunctor=Functor(), bool topbotomOrder=true)
static void append(Set &aSet, const ForegroundPredicate &isForeground, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
ImageContainerBySTLVector< Domain, Value > Image