33 #include "DGtal/base/Common.h"
34 #include "DGtal/topology/KhalimskySpaceND.h"
35 #include "DGtal/images/imagesSetsUtils/SetFromImage.h"
36 #include "DGtal/images/ImageSelector.h"
37 #include "DGtal/helpers/StdDefs.h"
38 #include "DGtal/topology/helpers/Surfaces.h"
40 #include "DGtal/io/readers/PGMReader.h"
41 #include "DGtal/io/colormaps/GradientColorMap.h"
42 #include "DGtal/io/boards/Board2D.h"
43 #include "DGtal/io/Color.h"
45 #include "ConfigExamples.h"
53 using namespace DGtal;
57 int main(
int ,
char** )
60 std::string inputFilename = examplesPath +
"samples/circleR10modif.pgm";
66 board << image.domain() << set2d;
69 board2 << image.domain() << set2d;
72 board3 << image.domain() << set2d;
77 bool space_ok = ks.
init( image.domain().lowerBound(), image.domain().upperBound(), true );
85 std::vector<Z2i::SCell> vectBdrySCell;
88 ks, SAdj, set2d, aCell );
90 board <<
CustomStyle( (*(vectBdrySCell.begin())).className(),
92 Color( 192, 192, 0 ) ));
96 cmap_grad.addColor(
Color( 255, 0, 0 ) );
97 cmap_grad.addColor(
Color( 255, 255, 10 ) );
100 std::vector<Z2i::SCell>::iterator it;
101 for ( it=vectBdrySCell.begin() ; it != vectBdrySCell.end(); it++ ){
104 cmap_grad( d )))<< *it;
110 std::set<Z2i::SCell> bdry;
118 std::set<Z2i::SCell>::iterator itB;
119 for ( itB=bdry.begin() ; itB != bdry.end(); itB++ ){
122 cmap_grad( d )))<< *itB;
126 std::vector< std::vector<Z2i::SCell> > vectContoursBdrySCell;
131 cmap_grad3.addColor(
Color( 255, 0, 0 ) );
132 cmap_grad3.addColor(
Color( 20, 200, 0 ) );
133 cmap_grad3.addColor(
Color( 200, 200, 200 ) );
134 cmap_grad3.addColor(
Color( 20, 200, 200 ) );
135 cmap_grad3.addColor(
Color( 200, 20, 200 ) );
138 for(
unsigned int i=0; i< vectContoursBdrySCell.size(); i++){
140 for(
unsigned int j=0; j< vectContoursBdrySCell.at(i).size(); j++){
141 board3<<
CustomStyle(vectContoursBdrySCell.at(i).at(j).className() ,
143 cmap_grad3( d )))<<vectContoursBdrySCell.at(i).at(j) ;
152 board.saveEPS(
"ctopo-2.eps");
153 board.saveFIG(
"ctopo-2.fig");
155 board2.
saveEPS(
"ctopo-2d.eps");
156 board2.
saveFIG(
"ctopo-2d.fig");
158 board3.
saveEPS(
"ctopo-2e.eps");
159 board3.
saveFIG(
"ctopo-2e.fig");
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: implements association bewteen points lying in a digital domain and values.
Aim: Import a 2D or 3D using the Netpbm formats (ASCII mode).
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
void addColor(const Color &color)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
const Point & lowerBound() const
bool init(const Point &lower, const Point &upper, bool isClosed)
const Point & upperBound() const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Define utilities to convert a digital set into an image.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value...
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Structure representing an RGB triple with alpha component.
const Domain & domain() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...