DGtal  1.0.0
Functions
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="")
Trace trace
Definition: Common.h:144
bool testImplicitShape3D()
double endBlock()
std::ostream & emphase()
std::ostream & info()
bool testImplicitShape()

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 
61  Z2i::Domain domain(a,b);
63 
65  ImplicitBall<Z2i::Space>( c, 10));
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 }
void beginBlock(const std::string &keyword="")
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
Trace trace
Definition: Common.h:144
Domain domain
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball for the L_...
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Definition: ImplicitBall.h:64
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create an hypercube in n...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70

References DGtal::Trace::beginBlock(), LibBoard::Board::clear(), domain, 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);
118  Z3i::DigitalSet set(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 }
void beginBlock(const std::string &keyword="")
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
Trace trace
Definition: Common.h:144
Aim: Export a 3D Image using the Vol formats.
Definition: VolWriter.h:68
Domain domain
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
ImageContainerBySTLVector< Domain, Value > Image
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Container::const_iterator ConstIterator
ConstIterator type of the container;.
Image image(domain)

References DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::begin(), DGtal::Trace::beginBlock(), domain, DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::end(), image(), and DGtal::trace.

Referenced by main().