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
- David Coeurjolly (
david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr
) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
- Date
- 2010/09/20
Functions for testing class SimpleExpander.
This file is part of the DGtal library.
Definition in file testSimpleExpander.cpp.
Definition at line 209 of file testSimpleExpander.cpp.
213 cmap_grad.addColor(
Color( 128, 128, 255 ) );
214 cmap_grad.addColor(
Color( 255, 255, 128 ) );
215 cmap_grad.addColor(
Color( 128, 255, 128 ) );
216 cmap_grad.addColor(
Color( 128, 128, 128 ) );
235 for (
int k = -3; k < 3 ; k++)
237 houseSet.insert(
Point(k, -3));
238 houseSet.insert(
Point(-3, k));
239 houseSet.insert(
Point(3, k));
240 houseSet.insert(
Point(k, 3));
245 houseSetCompl.assignFromComplement( houseSet );
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");
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...
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...
std::string className() const
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)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
MyDigitalSurface::ConstIterator ConstIterator
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....
References DGtal::GradientColorMap< PValue, PDefaultPreset, PDefaultFirstColor, PDefaultLastColor >::addColor(), DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::assignFromComplement(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), LibBoard::Board::clear(), domain, DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insert(), LibBoard::Board::saveSVG(), LibBoard::Board::setUnit(), DGtal::trace, and LibBoard::Board::UCentimeter.
Referenced by main().
bool testSimpleExpander |
( |
| ) |
|
Example of a test. To be completed.
Definition at line 77 of file testSimpleExpander.cpp.
104 DT8_4 dt8_4(adj8, adj4, JORDAN_DT );
110 for (
int k = -3; k < 3 ; k++)
112 houseSet.insert(
Point(k, -3));
113 houseSet.insert(
Point(-3, k));
114 houseSet.insert(
Point(3, k));
115 houseSet.insert(
Point(k, 3));
120 houseSetCompl.assignFromComplement( houseSet );
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();
Aim: Represents a digital topology as a couple of adjacency relations.
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet
References DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::assignFromComplement(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), LibBoard::Board::clear(), domain, DGtal::Trace::endBlock(), DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insert(), DGtal::JORDAN_DT, LibBoard::Board::saveSVG(), LibBoard::Board::setUnit(), DGtal::trace, and LibBoard::Board::UCentimeter.
Referenced by main().