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 79 unsigned int nbok = 0;
111 DigitalSet houseSet( domain );
113 for (
int k = -3; k < 3 ; k++)
122 DigitalSet houseSetCompl( domain);
126 ObjectType house8( dt8_4, houseSet );
127 ObjectType houseCompl8( dt8_4, houseSetCompl );
128 ObjectTypeReverseTopo house4(dt4_8, houseSet);
129 ObjectTypeReverseTopo houseCompl4( dt4_8, houseSetCompl );
139 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
140 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
141 while (!expander.finished())
144 it != expander.end();
146 std::cout <<
" " << *it;
148 expander.nextLayer();
150 board <<
CustomStyle(expander.core().className(),
new MyStyleCustom) << expander.core();
156 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
157 ObjectExpander expander8(houseCompl8,
Point(0, 0));
158 while (!expander8.finished())
161 it != expander8.end();
163 std::cout <<
" " << *it;
165 expander8.nextLayer();
167 board <<
CustomStyle(expander8.core().className(),
new MyStyleCustom) << expander8.core();
173 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
174 ObjectExpander expander88(houseCompl8,
Point(0, 0));
175 while (!expander88.finished())
178 it != expander88.end();
180 std::cout <<
" " << *it;
182 expander88.nextLayer();
184 board <<
CustomStyle(expander88.core().className(),
new MyStyleCustom) << expander88.core();
190 board <<
SetMode( house8.className(),
"DrawAdjacencies" ) << house8;
191 ObjectExpanderReverseTopo expander84(houseCompl4,
Point(0, 0));
192 while (!expander84.finished())
195 it != expander84.end();
197 std::cout <<
" " << *it;
199 expander84.nextLayer();
201 board <<
CustomStyle(expander.core().className(),
new MyStyleCustom) << expander84.core();
205 nbok +=
true ? 1 : 0;
207 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 208 <<
"true == true" << std::endl;
242 for (
int k = -3; k < 3 ; k++)
255 ObjectType house8( dt8_4, houseSet );
256 ObjectType houseCompl8( dt8_4, houseSetCompl );
257 ObjectTypeReverseTopo house4( dt4_8, houseSet);
258 ObjectTypeReverseTopo houseCompl4( dt4_8, houseSetCompl );
268 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
269 ObjectExpanderReverseTopo expander(houseCompl4,
Point(0, 0));
273 while (!expander.finished())
276 it != expander.end();
278 std::cout <<
" " << *it;
279 board <<
CustomStyle( expander.layer().className(),
281 ( cmap_grad( expander.distance() ) ) )
284 expander.nextLayer();
286 board.
saveSVG(
"house-layers4-4.svg");
291 board <<
SetMode( house4.className(),
"DrawAdjacencies" ) << house4;
292 ObjectExpander expander8(houseCompl8,
Point(0, 0));
296 while (!expander8.finished())
299 it != expander8.end();
301 std::cout <<
" " << *it;
303 board <<
CustomStyle( expander8.layer().className(),
305 ( cmap_grad( expander8.distance() ) ) )
306 << expander8.layer();
307 expander8.nextLayer();
309 board.
saveSVG(
"house-layers4-8.svg");
317 int main(
int argc,
char** argv )
320 for (
int i = 0; i < argc; ++i )
326 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
void beginBlock(const std::string &keyword="")
bool testSimpleExpander()
HyperRectDomain< Space > Domain
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Board & setFillColorRGBi(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
const Domain domain(Point(1, 2), Point(6, 5))
MyDigitalSurface::ConstIterator ConstIterator
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color...
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...
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Aim: This class is useful to visit an object by adjacencies, layer by layer.
Aim: Represents a digital topology as a couple of adjacency relations.
void clear(const DGtal::Color &color=DGtal::Color::None)
Z2i this namespace gathers the standard of types for 2D imagery.
std::string className() const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
void insert(const Point &p)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithBoard2D.
Structure representing an RGB triple with alpha component.
int main(int argc, char **argv)
void assignFromComplement(const DigitalSetByAssociativeContainer< Domain, Container > &other_set)
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...