DGtal 1.4.0
Loading...
Searching...
No Matches
testImplicitShape.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/shapes/ShapeFactory.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/colormaps/GrayscaleColorMap.h"
#include "DGtal/io/writers/VolWriter.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
Include dependency graph for testImplicitShape.cpp:

Go to the source code of this file.

Functions

bool testImplicitShape ()
 
bool testImplicitShape3D ()
 
int main (int argc, char **argv)
 

Detailed Description

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
2011/03/22

Functions for testing class ImplicitShape.

This file is part of the DGtal library.

Definition in file testImplicitShape.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 138 of file testImplicitShape.cpp.

139{
140 trace.beginBlock ( "Testing class ImplicitShape" );
141 trace.info() << "Args:";
142 for ( int i = 0; i < argc; ++i )
143 trace.info() << " " << argv[ i ];
144 trace.info() << endl;
145
146 bool res = testImplicitShape() && testImplicitShape3D(); // && ... other tests
147 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
148 trace.endBlock();
149 return res ? 0 : 1;
150}
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition Common.h:153
bool testImplicitShape()
bool testImplicitShape3D()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testImplicitShape(), testImplicitShape3D(), and DGtal::trace.

◆ testImplicitShape()

bool testImplicitShape ( )

Example of a test. To be completed.

Definition at line 52 of file testImplicitShape.cpp.

53{
54 trace.beginBlock ( "Testing implicit shaper ..." );
55 Z2i::Point a(0,0);
56 Z2i::Point b(64,64);
57 Z2i::Point c(32,32);
58
59 Board2D board;
60
63
66 board << set;
67 board.saveSVG("implicitball.svg");
68
69 set.clear();
70 board.clear();
73 board << set;
74 board.saveSVG("implicitcube.svg");
75
76
77 set.clear();
78 board.clear();
81 board << set;
82 board.saveSVG("implicitlosange.svg");
83
84 set.clear();
85 board.clear();
88 board << set;
89 board.saveSVG("implicitrounded-1.svg");
90
91
92 set.clear();
93 board.clear();
96 board << set;
97 board.saveSVG("implicitrounded-2.5.svg");
98
99
100 return true;
101}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition Board2D.h:71
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create an hypercube in n...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball for the L_...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
static void euclideanShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0)
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition Board.cpp:151
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition Board.cpp:1011
Domain domain

References DGtal::Trace::beginBlock(), LibBoard::Board::clear(), domain, DGtal::Shapes< TDomain >::euclideanShaper(), LibBoard::Board::saveSVG(), and DGtal::trace.

Referenced by main().

◆ testImplicitShape3D()

bool testImplicitShape3D ( )

Example of a test. To be completed.

Definition at line 106 of file testImplicitShape.cpp.

107{
108 trace.beginBlock ( "Testing implicit shaper in 3D..." );
109 Z3i::Point a(0,0);
110 Z3i::Point b(64,64,64);
111 Z3i::Point c(32,32,32);
112
113 Z3i::Domain domain(a,b);
114
116
117 Image image(domain);
119
122
123 for(Z3i::DigitalSet::ConstIterator it=set.begin(), itend=set.end();
124 it != itend;
125 ++it)
126 {
127 image.setValue((*it), 128);
128 }
129
130 VolWriter<Image>::exportVol("implicitrounded.vol",image);
131
132 return true;
133}
Container::const_iterator ConstIterator
ConstIterator type of the container;.
Aim: implements association bewteen points lying in a digital domain and values.
Definition Image.h:70
static bool exportVol(const std::string &filename, const Image &aImage, const bool compressed=true, const Functor &aFunctor=Functor())
ImageContainerBySTLVector< Domain, Value > Image

References DGtal::Trace::beginBlock(), domain, DGtal::Shapes< TDomain >::euclideanShaper(), DGtal::VolWriter< TImage, TFunctor >::exportVol(), and DGtal::trace.

Referenced by main().