DGtal  1.4.beta
testKanungo.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/geometry/volumes/KanungoNoise.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/kernel/CPointPredicate.h"
Include dependency graph for testKanungo.cpp:

Go to the source code of this file.

Functions

bool testKanungo2D ()
 
bool CheckingConcept ()
 
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
2013/03/06

Functions for testing class Kanungo.

This file is part of the DGtal library.

Definition in file testKanungo.cpp.

Function Documentation

◆ CheckingConcept()

bool CheckingConcept ( )

Definition at line 96 of file testKanungo.cpp.

97 {
99  return true;
100 }
Aim: From a point predicate (model of concepts::CPointPredicate), this class constructs another point...
Definition: KanungoNoise.h:85
Aim: Defines a predicate on a point.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 106 of file testKanungo.cpp.

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 }
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition: Common.h:153
bool testKanungo2D()
Definition: testKanungo.cpp:50
bool CheckingConcept()
Definition: testKanungo.cpp:96

References DGtal::Trace::beginBlock(), CheckingConcept(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testKanungo2D(), and DGtal::trace.

◆ testKanungo2D()

bool testKanungo2D ( )

Example of a test. To be completed.

Definition at line 50 of file testKanungo.cpp.

51 {
52  unsigned int nbok = 0;
53  unsigned int nb = 0;
54 
55  trace.beginBlock ( "Testing 2DNoise ..." );
56 
57  Z2i::Domain domain(Z2i::Point(0,0), Z2i::Point(128,128));
58 
60 
62 
63  Board2D board;
64  board << domain << set;
65  board.saveSVG("input-set-kanungo.svg");
66 
67  board.clear();
68 
69  //Noisification
70  KanungoNoise<Z2i::DigitalSet, Z2i::Domain> nosifiedObject(set,domain,0.5);
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
80  KanungoNoise<Z2i::DigitalSet, Z2i::Domain> nosifiedObject2(set,domain,0.1);
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;
91  trace.endBlock();
92 
93  return nbok == nb;
94 }
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 & end() const
const ConstIterator & begin() const
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
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::HyperRectDomain< TSpace >::begin(), DGtal::Trace::beginBlock(), LibBoard::Board::clear(), domain, DGtal::HyperRectDomain< TSpace >::end(), DGtal::Trace::endBlock(), DGtal::Trace::info(), LibBoard::Board::saveSVG(), and DGtal::trace.

Referenced by main().