DGtal 1.3.0
Loading...
Searching...
No Matches
testKanungo.cpp
Go to the documentation of this file.
1
31#include <iostream>
32#include "DGtal/base/Common.h"
33#include "DGtal/geometry/volumes/KanungoNoise.h"
34#include "DGtal/io/boards/Board2D.h"
35#include "DGtal/helpers/StdDefs.h"
36#include "DGtal/shapes/Shapes.h"
37#include "DGtal/kernel/CPointPredicate.h"
39
40using namespace std;
41using namespace DGtal;
42
44// Functions for testing class Kanungo.
46
51{
52 unsigned int nbok = 0;
53 unsigned int nb = 0;
54
55 trace.beginBlock ( "Testing 2DNoise ..." );
56
58
60
62
63 Board2D board;
64 board << domain << set;
65 board.saveSVG("input-set-kanungo.svg");
66
67 board.clear();
68
69 //Noisification
71 board << domain ;
72 for(Z2i::Domain::ConstIterator it = domain.begin(), itend=domain.end(); it != itend; ++it)
73 if (nosifiedObject( * it ))
74 board << *it;
75 board.saveSVG("output-set-kanungo-0.5.svg");
76
77
78 board.clear();
79 //Noisification
81 board << domain ;
82 for(Z2i::Domain::ConstIterator it = domain.begin(), itend=domain.end(); it != itend; ++it)
83 if (nosifiedObject2( * it ))
84 board << *it;
85 board.saveSVG("output-set-kanungo-0.1.svg");
86
87 nbok ++;
88 nb++;
89 trace.info() << "(" << nbok << "/" << nb << ") "
90 << "true == true" << std::endl;
92
93 return nbok == nb;
94}
95
97{
99 return true;
100}
101
102
104// Standard services - public :
105
106int main( int argc, char** argv )
107{
108 trace.beginBlock ( "Testing class Kanungo" );
109 trace.info() << "Args:";
110 for ( int i = 0; i < argc; ++i )
111 trace.info() << " " << argv[ i ];
112 trace.info() << endl;
113
114 bool res = CheckingConcept() && testKanungo2D(); // && ... other tests
115 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
116 trace.endBlock();
117 return res ? 0 : 1;
118}
119// //
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...
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const
Aim: From a point predicate (model of concepts::CPointPredicate), this class constructs another point...
Definition: KanungoNoise.h:85
static void addNorm2Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
STL namespace.
Aim: Defines a predicate on a point.
int main()
Definition: testBits.cpp:56
bool testKanungo2D()
Definition: testKanungo.cpp:50
bool CheckingConcept()
Definition: testKanungo.cpp:96
Domain domain