DGtal  1.4.beta
testEmbedder.cpp
Go to the documentation of this file.
1 
30 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/kernel/CPointEmbedder.h"
35 #include "DGtal/kernel/CWithGradientMap.h"
36 #include "DGtal/kernel/CanonicEmbedder.h"
37 #include "DGtal/topology/CanonicCellEmbedder.h"
38 #include "DGtal/topology/CanonicSCellEmbedder.h"
39 #include "DGtal/topology/CanonicDigitalSurfaceEmbedder.h"
40 #include "DGtal/kernel/RegularPointEmbedder.h"
41 #include "DGtal/topology/CCellEmbedder.h"
42 #include "DGtal/topology/CSCellEmbedder.h"
43 #include "DGtal/topology/CDigitalSurfaceEmbedder.h"
44 #include "DGtal/topology/DigitalSetBoundary.h"
45 #include "DGtal/topology/DigitalSurface.h"
46 #include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.h"
47 #include "DGtal/shapes/implicit/ImplicitFunctionLinearCellEmbedder.h"
48 #include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.h"
49 #include "DGtal/geometry/surfaces/estimation/BasicConvolutionWeights.h"
50 #include "DGtal/geometry/surfaces/estimation/LocalConvolutionNormalVectorEstimator.h"
51 #include "DGtal/geometry/surfaces/estimation/DigitalSurfaceEmbedderWithNormalVectorEstimator.h"
53 
54 using namespace std;
55 using namespace DGtal;
56 using namespace DGtal::concepts;
57 
59 // Functions for testing class Embedder.
61 
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 }
124 
126 // Standard services - public :
127 
128 int main( int argc, char** argv )
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 }
141 // //
DGtal::CanonicCellEmbedder
Aim: A trivial embedder for signed and unsigned cell, which corresponds to the canonic injection of c...
Definition: CanonicCellEmbedder.h:65
DGtal::deprecated::ConstantConvolutionWeights
Aim: implement a trivial constant convolution kernel which returns 1 to each distance.
Definition: BasicConvolutionWeights.h:67
DGtal::deprecated::LocalConvolutionNormalVectorEstimator
Aim: Computes the normal vector at a surface element by convolution of elementary normal vector to ad...
Definition: LocalConvolutionNormalVectorEstimator.h:85
DGtal::concepts::CDigitalSurfaceEmbedder
Aim: A digital surface embedder is a specialized mapping from signed cells to Euclidean points....
Definition: CDigitalSurfaceEmbedder.h:96
DGtal::HyperRectDomain< Space >
DGtal::Trace::endBlock
double endBlock()
DGtal::DigitalSurface
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Definition: DigitalSurface.h:139
DGtal::CanonicDigitalSurfaceEmbedder
Aim: A trivial embedder for digital surfaces, which corresponds to the canonic injection of cell cent...
Definition: CanonicDigitalSurfaceEmbedder.h:65
DGtal::KhalimskySpaceND::init
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
main
int main(int argc, char **argv)
Definition: testEmbedder.cpp:128
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::DigitalSetBoundary
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Definition: DigitalSetBoundary.h:69
DGtal::concepts::CPointEmbedder
Aim: A point embedder is a mapping from digital points to Euclidean points. It adds inner types to fu...
Definition: CPointEmbedder.h:95
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::RegularPointEmbedder< Space >
DGtal::concepts::CWithGradientMap
Aim: Such object provides a gradient map that associates to each argument some real vector.
Definition: CWithGradientMap.h:91
KSpace
Z3i::KSpace KSpace
Definition: testArithmeticalDSSComputerOnSurfels.cpp:48
DGtal::Trace::info
std::ostream & info()
DGtal::concepts
Aim: Gathers several functions useful for concept checks.
Definition: CPositiveIrreducibleFraction.h:54
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Domain
HyperRectDomain< Space > Domain
Definition: testSimpleRandomAccessRangeFromPoint.cpp:44
DGtal::CanonicEmbedder
Aim: A trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn.
Definition: CanonicEmbedder.h:64
DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator
Aim: Combines a digital surface embedder with a normal vector estimator to get a model of CDigitalSur...
Definition: DigitalSurfaceEmbedderWithNormalVectorEstimator.h:74
DGtal::ImplicitPolynomial3Shape
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Definition: ImplicitPolynomial3Shape.h:67
testEmbedder
bool testEmbedder()
Definition: testEmbedder.cpp:65
Vector
FreemanChain< int >::Vector Vector
Definition: testCombinDSS.cpp:60
DGtal::ImplicitFunctionDiff1LinearCellEmbedder
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible,...
Definition: ImplicitFunctionDiff1LinearCellEmbedder.h:79
domain
Domain domain
Definition: testProjection.cpp:88
DGtal::ImplicitFunctionLinearCellEmbedder
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible,...
Definition: ImplicitFunctionLinearCellEmbedder.h:70
Space
SpaceND< 2 > Space
Definition: testSimpleRandomAccessRangeFromPoint.cpp:42
DGtal::CanonicSCellEmbedder< KSpace >
Point
MyPointD Point
Definition: testClone2.cpp:383
DigitalSet
Z2i::DigitalSet DigitalSet
Definition: testVoronoiMapComplete.cpp:41
MyDigitalSurface
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
Definition: greedy-plane-segmentation-ex2.cpp:92
DGtal::DigitalSetByAssociativeContainer
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Definition: DigitalSetByAssociativeContainer.h:89
DGtal::concepts::CSCellEmbedder
Aim: A cell embedder is a mapping from signed cells to Euclidean points. It adds inner types to funct...
Definition: CSCellEmbedder.h:97
DGtal::KhalimskySpaceND
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Definition: KhalimskySpaceND.h:64
DGtal::concepts::CCellEmbedder
Aim: A cell embedder is a mapping from unsigned cells to Euclidean points. It adds inner types to fun...
Definition: CCellEmbedder.h:96