This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
- Author
- Bertrand Kerautret (
kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr
) LORIA (CNRS, UMR 7503), University of Nancy, France
- Date
- 2011/04/28
An example file named ctopo-2.
This file is part of the DGtal library.
Definition in file ctopo-2.cpp.
int main |
( |
int |
, |
|
|
char ** |
|
|
) |
| |
Definition at line 69 of file ctopo-2.cpp.
References DGtal::GradientColorMap< PValue, PDefaultPreset, PDefaultFirstColor, PDefaultLastColor >::addColor(), image(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().
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 ) ));
108 cmap_grad.addColor(
Color( 255, 0, 0 ) );
109 cmap_grad.addColor(
Color( 255, 255, 10 ) );
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;
143 cmap_grad3.addColor(
Color( 255, 0, 0 ) );
144 cmap_grad3.addColor(
Color( 20, 200, 0 ) );
145 cmap_grad3.addColor(
Color( 200, 200, 200 ) );
146 cmap_grad3.addColor(
Color( 20, 200, 200 ) );
147 cmap_grad3.addColor(
Color( 200, 20, 200 ) );
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) ;
164 board.saveEPS(
"ctopo-2.eps");
165 board.saveFIG(
"ctopo-2.fig");
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 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).
const Point & upperBound() const
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 ...
bool init(const Point &lower, const Point &upper, bool isClosed)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
const Point & lowerBound() const
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...
ImageContainerBySTLVector< Domain, Value > Image
Structure representing an RGB triple with alpha component.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...