DGtal  0.9.3
Functions
testEmbedder.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/kernel/CPointEmbedder.h"
#include "DGtal/kernel/CWithGradientMap.h"
#include "DGtal/kernel/CanonicEmbedder.h"
#include "DGtal/topology/CanonicCellEmbedder.h"
#include "DGtal/topology/CanonicSCellEmbedder.h"
#include "DGtal/topology/CanonicDigitalSurfaceEmbedder.h"
#include "DGtal/kernel/RegularPointEmbedder.h"
#include "DGtal/topology/CCellEmbedder.h"
#include "DGtal/topology/CSCellEmbedder.h"
#include "DGtal/topology/CDigitalSurfaceEmbedder.h"
#include "DGtal/topology/DigitalSetBoundary.h"
#include "DGtal/topology/DigitalSurface.h"
#include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.h"
#include "DGtal/shapes/implicit/ImplicitFunctionLinearCellEmbedder.h"
#include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.h"
#include "DGtal/geometry/surfaces/estimation/BasicConvolutionWeights.h"
#include "DGtal/geometry/surfaces/estimation/LocalConvolutionNormalVectorEstimator.h"
#include "DGtal/geometry/surfaces/estimation/DigitalSurfaceEmbedderWithNormalVectorEstimator.h"
Include dependency graph for testEmbedder.cpp:

Go to the source code of this file.

Functions

bool testEmbedder ()
 
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
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2012/04/16

Functions for testing class Embedder.

This file is part of the DGtal library.

Definition in file testEmbedder.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 128 of file testEmbedder.cpp.

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

129 {
130  trace.beginBlock ( "Testing class Embedder" );
131  trace.info() << "Args:";
132  for ( int i = 0; i < argc; ++i )
133  trace.info() << " " << argv[ i ];
134  trace.info() << endl;
135 
136  bool res = testEmbedder(); // && ... other tests
137  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
138  trace.endBlock();
139  return res ? 0 : 1;
140 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
double endBlock()
std::ostream & emphase()
bool testEmbedder()
std::ostream & info()

◆ testEmbedder()

bool testEmbedder ( )

Example of a test. To be completed.

Definition at line 65 of file testEmbedder.cpp.

References DGtal::Trace::beginBlock(), domain(), DGtal::Trace::endBlock(), DGtal::Trace::info(), K, and DGtal::trace.

Referenced by main().

66 {
67  unsigned int nbok = 0;
68  unsigned int nb = 0;
69 
70  using Z3i::Point;
71  using Z3i::Vector;
72  using Z3i::Domain;
73  using Z3i::Space;
74  using Z3i::KSpace;
75  using Z3i::DigitalSet;
76 
77  typedef CanonicEmbedder<Space> MyEmbedder1;
78  BOOST_CONCEPT_ASSERT(( CPointEmbedder< MyEmbedder1 > ));
79  typedef RegularPointEmbedder<Space> MyEmbedder2;
80  BOOST_CONCEPT_ASSERT(( CPointEmbedder< MyEmbedder2 > ));
83  < KSpace, ImplicitShape, MyEmbedder1 > MyCellEmbedder1;
84  BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder1 > ));
86  < KSpace, ImplicitShape, MyEmbedder2 > MyCellEmbedder2;
87  BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder2 > ));
88  BOOST_CONCEPT_ASSERT(( CWithGradientMap< MyCellEmbedder2 > ));
89  typedef CanonicCellEmbedder<KSpace> MyCellEmbedder3;
90  BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder3 > ));
91  typedef CanonicSCellEmbedder<KSpace> MySCellEmbedder1;
92  BOOST_CONCEPT_ASSERT(( CSCellEmbedder< MySCellEmbedder1 > ));
93  typedef DigitalSetBoundary<KSpace, DigitalSet> DigitalSurfaceContainer;
96  BOOST_CONCEPT_ASSERT(( CDigitalSurfaceEmbedder< MyDSEmbedder1 > ));
99  < MyDigitalSurface, Kernel > MyEstimator;
101  < MyDSEmbedder1, MyEstimator > MyDSEmbedder2;
102  BOOST_CONCEPT_ASSERT(( CDigitalSurfaceEmbedder< MyDSEmbedder2 > ));
103  BOOST_CONCEPT_ASSERT(( CWithGradientMap< MyDSEmbedder2 > ));
104 
105  trace.beginBlock ( "Testing block ..." );
106  KSpace K;
107  MyCellEmbedder3 cemb3( K );
108  MySCellEmbedder1 scemb1( K );
109  Domain domain( Point( 0, 0, 0 ), Point( 10, 10, 10 ) );
110  K.init( Point( 0, 0, 0 ), Point( 10, 10, 10 ), true );
111  DigitalSet dset( domain );
112  //dset.insert( Point( 3,3,2) );
113  DigitalSurfaceContainer dsc( K, dset );
114  MyDigitalSurface ds( dsc );
115  MyDSEmbedder1 dsemb1( ds );
116  nbok += true ? 1 : 0;
117  nb++;
118  trace.info() << "(" << nbok << "/" << nb << ") "
119  << "true == true" << std::endl;
120  trace.endBlock();
121 
122  return nbok == nb;
123 }
void beginBlock(const std::string &keyword="")
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Definition: StdDefs.h:100
Aim: Such object provides a gradient map that associates to each argument some real vector...
HyperRectDomain< Space > Domain
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible, assignable). Model of CCellEmbedder and CWithGradientMap.
const Domain domain(Point(1, 2), Point(6, 5))
Trace trace
Definition: Common.h:137
Aim: Computes the normal vector at a surface element by convolution of elementary normal vector to ad...
KhalimskySpaceND< 2, Integer > KSpace
Definition: StdDefs.h:77
double endBlock()
Aim: A cell embedder is a mapping from unsigned cells to Euclidean points. It adds inner types to fun...
Definition: CCellEmbedder.h:96
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Aim: A trivial embedder for digital surfaces, which corresponds to the canonic injection of cell cent...
Aim: A trivial embedder for signed and unsigned cell, which corresponds to the canonic injection of c...
Aim: A cell embedder is a mapping from signed cells to Euclidean points. It adds inner types to funct...
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
MyPointD Point
Definition: testClone2.cpp:383
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: A trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn...
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible, assignable). Model of CCellEmbedder.
std::ostream & info()
FreemanChain< int >::Vector Vector
Aim: implement a trivial constant convolution kernel which returns 1 to each distance.
Aim: A point embedder is a mapping from digital points to Euclidean points. It adds inner types to fu...
KSpace K
Aim: Combines a digital surface embedder with a normal vector estimator to get a model of CDigitalSur...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
Aim: A digital surface embedder is a specialized mapping from signed cells to Euclidean points...