Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
testEmbedder.cpp
Go to the documentation of this file.
1
16
29
31#include <iostream>
32#include "DGtal/base/Common.h"
33#include "DGtal/base/BasicFunctors.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/kernel/CPointEmbedder.h"
36#include "DGtal/kernel/CWithGradientMap.h"
37#include "DGtal/kernel/CanonicEmbedder.h"
38#include "DGtal/topology/CanonicCellEmbedder.h"
39#include "DGtal/topology/CanonicSCellEmbedder.h"
40#include "DGtal/topology/CanonicDigitalSurfaceEmbedder.h"
41#include "DGtal/kernel/RegularPointEmbedder.h"
42#include "DGtal/topology/CCellEmbedder.h"
43#include "DGtal/topology/CSCellEmbedder.h"
44#include "DGtal/topology/CDigitalSurfaceEmbedder.h"
45#include "DGtal/topology/DigitalSetBoundary.h"
46#include "DGtal/topology/DigitalSurface.h"
47#include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.h"
48#include "DGtal/shapes/implicit/ImplicitFunctionLinearCellEmbedder.h"
49#include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.h"
50#include "DGtal/geometry/volumes/distance/LpMetric.h"
51#include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
52#include "DGtal/geometry/surfaces/estimation/DigitalSurfaceEmbedderWithNormalVectorEstimator.h"
53#include "DGtal/geometry/surfaces/estimation/estimationFunctors/ElementaryConvolutionNormalVectorEstimator.h"
55
56using namespace std;
57using namespace DGtal;
58using namespace DGtal::concepts;
59
61// Functions for testing class Embedder.
63
68{
69 unsigned int nbok = 0;
70 unsigned int nb = 0;
71
72 using Z3i::Point;
73 using Z3i::Vector;
74 using Z3i::Domain;
75 using Z3i::Space;
76 using Z3i::KSpace;
77 using Z3i::DigitalSet;
78
79 typedef CanonicEmbedder<Space> MyEmbedder1;
80 BOOST_CONCEPT_ASSERT(( CPointEmbedder< MyEmbedder1 > ));
81 typedef RegularPointEmbedder<Space> MyEmbedder2;
82 BOOST_CONCEPT_ASSERT(( CPointEmbedder< MyEmbedder2 > ));
85 < KSpace, ImplicitShape, MyEmbedder1 > MyCellEmbedder1;
86 BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder1 > ));
88 < KSpace, ImplicitShape, MyEmbedder2 > MyCellEmbedder2;
89 BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder2 > ));
90 BOOST_CONCEPT_ASSERT(( CWithGradientMap< MyCellEmbedder2 > ));
91 typedef CanonicCellEmbedder<KSpace> MyCellEmbedder3;
92 BOOST_CONCEPT_ASSERT(( CCellEmbedder< MyCellEmbedder3 > ));
93 typedef CanonicSCellEmbedder<KSpace> MySCellEmbedder1;
94 BOOST_CONCEPT_ASSERT(( CSCellEmbedder< MySCellEmbedder1 > ));
95 typedef DigitalSetBoundary<KSpace, DigitalSet> DigitalSurfaceContainer;
98 BOOST_CONCEPT_ASSERT(( CDigitalSurfaceEmbedder< MyDSEmbedder1 > ));
99
101 typedef DGtal::functors::ConstValue< double > ConvFunctor;
104 Functor, ConvFunctor> MyEstimator;
105
107 < MyDSEmbedder1, MyEstimator > MyDSEmbedder2;
108 BOOST_CONCEPT_ASSERT(( CDigitalSurfaceEmbedder< MyDSEmbedder2 > ));
109 BOOST_CONCEPT_ASSERT(( CWithGradientMap< MyDSEmbedder2 > ));
110
111 trace.beginBlock ( "Testing block ..." );
112 KSpace K;
113 MyCellEmbedder3 cemb3( K );
114 MySCellEmbedder1 scemb1( K );
115 Domain domain( Point( 0, 0, 0 ), Point( 10, 10, 10 ) );
116 K.init( Point( 0, 0, 0 ), Point( 10, 10, 10 ), true );
117 DigitalSet dset( domain );
118 //dset.insert( Point( 3,3,2) );
119 DigitalSurfaceContainer dsc( K, dset );
120 MyDigitalSurface ds( dsc );
121 MyDSEmbedder1 dsemb1( ds );
122 nbok += true ? 1 : 0;
123 nb++;
124 trace.info() << "(" << nbok << "/" << nb << ") "
125 << "true == true" << std::endl;
126 trace.endBlock();
127
128 return nbok == nb;
129}
130
132// Standard services - public :
133
134int main( int argc, char** argv )
135{
136 trace.beginBlock ( "Testing class Embedder" );
137 trace.info() << "Args:";
138 for ( int i = 0; i < argc; ++i )
139 trace.info() << " " << argv[ i ];
140 trace.info() << endl;
141
142 bool res = testEmbedder(); // && ... other tests
143 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
144 trace.endBlock();
145 return res ? 0 : 1;
146}
147// //
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
Aim: Combines a digital surface embedder with a normal vector estimator to get a model of CDigitalSur...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible,...
Aim: a cellular embedder for implicit functions, (default constructible, copy constructible,...
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Aim: A simple point embedder where grid steps are given for each axis. Note that the real point (0,...
Aim: Define a simple functor that returns a constant value (0 by default).
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
HyperRectDomain< Space > Domain
Definition StdDefs.h:172
SpaceND< 3, Integer > Space
Definition StdDefs.h:144
KhalimskySpaceND< 3, Integer > KSpace
Definition StdDefs.h:146
Space::Point Point
Definition StdDefs.h:168
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Definition StdDefs.h:173
Space::Vector Vector
Definition StdDefs.h:169
Aim: Gathers several functions useful for concept checks.
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
STL namespace.
Aim: A trivial embedder for signed and unsigned cell, which corresponds to the canonic injection of c...
Aim: A trivial embedder for digital surfaces, which corresponds to the canonic injection of cell cent...
Aim: A trivial embedder for digital points, which corresponds to the canonic injection of Zn into Rn.
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
Aim: A cell embedder is a mapping from unsigned cells to Euclidean points. It adds inner types to fun...
Aim: A digital surface embedder is a specialized mapping from signed cells to Euclidean points....
Aim: A point embedder is a mapping from digital points to Euclidean points. It adds inner types to fu...
Aim: A cell embedder is a mapping from signed cells to Euclidean points. It adds inner types to funct...
Aim: Such object provides a gradient map that associates to each argument some real vector.
int main()
Definition testBits.cpp:56
MyPointD Point
KSpace K
bool testEmbedder()
ImplicitPolynomial3Shape< Space > ImplicitShape
Domain domain
Z2i::DigitalSet DigitalSet