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/PNMReader.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 );
86 std::vector<Z2i::SCell> vectBdrySCell;
89 ks, SAdj, set2dPredicate, aCell );
91 board <<
CustomStyle( (*(vectBdrySCell.begin())).className(),
93 Color( 192, 192, 0 ) ));
97 cmap_grad.addColor(
Color( 255, 0, 0 ) );
98 cmap_grad.addColor(
Color( 255, 255, 10 ) );
101 std::vector<Z2i::SCell>::iterator it;
102 for ( it=vectBdrySCell.begin() ; it != vectBdrySCell.end(); it++ ){
105 cmap_grad( d )))<< *it;
111 std::set<Z2i::SCell> bdry;
119 std::set<Z2i::SCell>::iterator itB;
120 for ( itB=bdry.begin() ; itB != bdry.end(); itB++ ){
123 cmap_grad( d )))<< *itB;
127 std::vector< std::vector<Z2i::SCell> > vectContoursBdrySCell;
129 ks, SAdj, set2dPredicate );
132 cmap_grad3.addColor(
Color( 255, 0, 0 ) );
133 cmap_grad3.addColor(
Color( 20, 200, 0 ) );
134 cmap_grad3.addColor(
Color( 200, 200, 200 ) );
135 cmap_grad3.addColor(
Color( 20, 200, 200 ) );
136 cmap_grad3.addColor(
Color( 200, 20, 200 ) );
139 for(
unsigned int i=0; i< vectContoursBdrySCell.size(); i++){
141 for(
unsigned int j=0; j< vectContoursBdrySCell.at(i).size(); j++){
142 board3<<
CustomStyle(vectContoursBdrySCell.at(i).at(j).className() ,
144 cmap_grad3( d )))<<vectContoursBdrySCell.at(i).at(j) ;
153 board.saveEPS(
"ctopo-2.eps");
154 board.saveFIG(
"ctopo-2.fig");
156 board2.
saveEPS(
"ctopo-2d.eps");
157 board2.
saveFIG(
"ctopo-2d.fig");
159 board3.
saveEPS(
"ctopo-2e.eps");
160 board3.
saveFIG(
"ctopo-2e.fig");