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"
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())
140 for ( ObjectExpander::ConstIterator it = expander.begin();
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())
157 for ( ObjectExpander::ConstIterator it = expander8.begin();
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())
174 for ( ObjectExpander::ConstIterator it = expander88.begin();
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())
191 for ( ObjectExpander::ConstIterator it = expander84.begin();
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())
268 for ( ObjectExpander::ConstIterator it = expander.begin();
269 it != expander.end();
271 std::cout <<
" " << *it;
272 board <<
CustomStyle( expander.layer().className(),
274 ( cmap_grad( expander.distance() ) ) )
277 expander.nextLayer();
279 board.
saveSVG(
"house-layers4-4.svg");
284 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
285 ObjectExpander expander8(houseCompl8,
Point(0, 0));
289 while (!expander8.finished())
291 for ( ObjectExpander::ConstIterator it = expander8.begin();
292 it != expander8.end();
294 std::cout <<
" " << *it;
296 board <<
CustomStyle( expander8.layer().className(),
298 ( cmap_grad( expander8.distance() ) ) )
299 << expander8.layer();
300 expander8.nextLayer();
302 board.
saveSVG(
"house-layers4-8.svg");
310int main(
int argc,
char** argv )
313 for (
int i = 0; i < argc; ++i )
319 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
Z2i this namespace gathers the standard of types for 2D imagery.
DigitalTopology< Adj8, Adj4 > DT8_4
MetricAdjacency< Space, 1 > Adj4
MetricAdjacency< Space, 2 > Adj8
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
HyperRectDomain< Space > Domain
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
virtual void setStyle(Board2D &) const
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
bool testSimpleExpander()