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/DomainMetricAdjacency.h"
40 #include "DGtal/topology/DomainAdjacency.h"
41 #include "DGtal/topology/DigitalTopology.h"
42 #include "DGtal/topology/Object.h"
43 #include "DGtal/graph/Expander.h"
44 #include "DGtal/io/boards/Board2D.h"
45 #include "DGtal/io/colormaps/GradientColorMap.h"
46 #include "DGtal/io/Color.h"
47 #include "DGtal/helpers/StdDefs.h"
51 using namespace DGtal;
57 virtual void setStyle(
Board2D & aboard)
const
65 virtual void setStyle(
Board2D & aboard)
const
110 for (
int k = -3; k < 3 ; k++)
123 ObjectType house8( dt8_4, houseSet );
124 ObjectType houseCompl8( dt8_4, houseSetCompl );
125 ObjectTypeReverseTopo house4(dt4_8, houseSet);
126 ObjectTypeReverseTopo houseCompl4( dt4_8, houseSetCompl );
136 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
137 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
138 while (!expander.finished())
141 it != expander.end();
143 std::cout <<
" " << *it;
145 expander.nextLayer();
147 board <<
CustomStyle(expander.core().className(),
new MyStyleCustom) << expander.core();
153 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
154 ObjectExpander expander8(houseCompl8,
Point(0, 0));
155 while (!expander8.finished())
158 it != expander8.end();
160 std::cout <<
" " << *it;
162 expander8.nextLayer();
164 board <<
CustomStyle(expander8.core().className(),
new MyStyleCustom) << expander8.core();
170 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
171 ObjectExpander expander88(houseCompl8,
Point(0, 0));
172 while (!expander88.finished())
175 it != expander88.end();
177 std::cout <<
" " << *it;
179 expander88.nextLayer();
181 board <<
CustomStyle(expander88.core().className(),
new MyStyleCustom) << expander88.core();
187 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
188 ObjectExpanderReverseTopo expander84(houseCompl4,
Point(0, 0));
189 while (!expander84.finished())
192 it != expander84.end();
194 std::cout <<
" " << *it;
196 expander84.nextLayer();
198 board <<
CustomStyle(expander.core().className(),
new MyStyleCustom) << expander84.core();
235 for (
int k = -3; k < 3 ; k++)
248 ObjectType house8( dt8_4, houseSet );
249 ObjectType houseCompl8( dt8_4, houseSetCompl );
250 ObjectTypeReverseTopo house4( dt4_8, houseSet);
251 ObjectTypeReverseTopo houseCompl4( dt4_8, houseSetCompl );
261 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
262 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
266 while (!expander.finished())
269 it != expander.end();
271 std::cout <<
" " << *it;
272 board <<
CustomStyle( expander.layer().className(),
276 expander.nextLayer();
278 board.
saveSVG(
"house-layers4-4.svg");
283 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
284 ObjectExpander expander8(houseCompl8,
Point(0, 0));
288 while (!expander8.finished())
291 it != expander8.end();
293 std::cout <<
" " << *it;
295 board <<
CustomStyle( expander8.layer().className(),
297 ( cmap_grad( expander8.distance() ) ) )
298 << expander8.layer();
299 expander8.nextLayer();
301 board.
saveSVG(
"house-layers4-8.svg");
309 int main(
int argc,
char** argv )
312 for (
int i = 0; i < argc; ++i )
318 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
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...
void assignFromComplement(const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
void insert(const Point &p)
Aim: Represents a digital topology as a couple of adjacency relations.
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'.
std::string className() const
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...
void beginBlock(const std::string &keyword="")
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
MyDigitalSurface::ConstIterator ConstIterator
Z2i this namespace gathers the standard of types for 2D imagery.
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.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
bool testSimpleExpander()
int main(int argc, char **argv)
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet