32#include "DGtal/base/Common.h"
33#include "DGtal/kernel/SpaceND.h"
34#include "DGtal/kernel/domains/DomainPredicate.h"
35#include "DGtal/kernel/domains/HyperRectDomain.h"
36#include "DGtal/kernel/sets/DigitalSetSelector.h"
37#include "DGtal/kernel/sets/DigitalSetConverter.h"
38#include "DGtal/topology/MetricAdjacency.h"
39#include "DGtal/topology/DomainAdjacency.h"
40#include "DGtal/topology/DigitalTopology.h"
41#include "DGtal/topology/Object.h"
42#include "DGtal/graph/Expander.h"
43#include "DGtal/io/boards/Board2D.h"
44#include "DGtal/io/colormaps/GradientColorMap.h"
45#include "DGtal/io/Color.h"
46#include "DGtal/helpers/StdDefs.h"
78 trace.beginBlock (
"(4,8) Filling ..." );
109 for (
int k = -3; k < 3 ; k++)
122 ObjectType house8(
dt8_4, houseSet );
123 ObjectType houseCompl8(
dt8_4, houseSetCompl );
124 ObjectTypeReverseTopo house4(
dt4_8, houseSet);
125 ObjectTypeReverseTopo houseCompl4(
dt4_8, houseSetCompl );
135 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
136 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
137 while (!expander.finished())
139 for ( ObjectExpander::ConstIterator it = expander.begin();
140 it != expander.end();
142 std::cout <<
" " << *it;
144 expander.nextLayer();
152 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
153 ObjectExpander expander8(houseCompl8,
Point(0, 0));
154 while (!expander8.finished())
156 for ( ObjectExpander::ConstIterator it = expander8.begin();
157 it != expander8.end();
159 std::cout <<
" " << *it;
161 expander8.nextLayer();
169 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
170 ObjectExpander expander88(houseCompl8,
Point(0, 0));
171 while (!expander88.finished())
173 for ( ObjectExpander::ConstIterator it = expander88.begin();
174 it != expander88.end();
176 std::cout <<
" " << *it;
178 expander88.nextLayer();
186 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
187 ObjectExpanderReverseTopo expander84(houseCompl4,
Point(0, 0));
188 while (!expander84.finished())
190 for ( ObjectExpander::ConstIterator it = expander84.begin();
191 it != expander84.end();
193 std::cout <<
" " << *it;
195 expander84.nextLayer();
218 trace.beginBlock (
"(4,8) Filling ..." );
234 for (
int k = -3; k < 3 ; k++)
247 ObjectType house8(
dt8_4, houseSet );
248 ObjectType houseCompl8(
dt8_4, houseSetCompl );
249 ObjectTypeReverseTopo house4(
dt4_8, houseSet);
250 ObjectTypeReverseTopo houseCompl4(
dt4_8, houseSetCompl );
260 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
261 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
265 while (!expander.finished())
267 for ( ObjectExpander::ConstIterator it = expander.begin();
268 it != expander.end();
270 std::cout <<
" " << *it;
271 board <<
CustomStyle( expander.layer().className(),
275 expander.nextLayer();
277 board.
saveSVG(
"house-layers4-4.svg");
282 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
283 ObjectExpander expander8(houseCompl8,
Point(0, 0));
287 while (!expander8.finished())
289 for ( ObjectExpander::ConstIterator it = expander8.begin();
290 it != expander8.end();
292 std::cout <<
" " << *it;
294 board <<
CustomStyle( expander8.layer().className(),
296 ( cmap_grad( expander8.distance() ) ) )
297 << expander8.layer();
298 expander8.nextLayer();
300 board.
saveSVG(
"house-layers4-8.svg");
308int main(
int argc,
char** argv )
310 trace.info() <<
"Args:";
311 for (
int i = 0; i < argc; ++i )
312 trace.info() <<
" " << argv[ i ];
313 trace.info() << endl;
317 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
308int main(
int argc,
char** argv ) {
…}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
void assignFromComplement(const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
void insert(const Point &p)
DigitalTopology< BackgroundAdjacency, ForegroundAdjacency > ReverseTopology
Aim: This class is useful to visit an object by adjacencies, layer by layer.
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: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
PointVector< dim, Integer > Point
void clear(const DGtal::Color &color=DGtal::Color::None)
Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Z2i this namespace gathers the standard of types for 2D imagery.
Object< DT8_4, DigitalSet > Object8_4
DigitalTopology< Adj8, Adj4 > DT8_4
MetricAdjacency< Space, 1 > Adj4
Object< DT4_8, DigitalSet > Object4_8
MetricAdjacency< Space, 2 > Adj8
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > Type
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
virtual void setStyle(Board2D &aboard) const
virtual void setStyle(Board2D &aboard) const
bool testSimpleExpander()