32#include "DGtal/base/Common.h"
33#include "ConfigTest.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/geometry/surfaces/estimation/EstimatorCache.h"
38#include "DGtal/shapes/implicit/ImplicitBall.h"
41#include "DGtal/shapes/GaussDigitizer.h"
42#include "DGtal/topology/LightImplicitDigitalSurface.h"
43#include "DGtal/topology/DigitalSurface.h"
44#include "DGtal/graph/DepthFirstVisitor.h"
45#include "DGtal/graph/GraphVisitorRange.h"
48#include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
49#include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h"
66 unsigned int nbok = 0;
75 typedef VisitorRange::ConstIterator VisitorConstIterator;
94 trace.
error() <<
"Problem with Khalimsky space" << std::endl;
106 VisitorRange range(
new Visitor( surf, *surf.
begin() ));
107 VisitorConstIterator ibegin = range.begin();
108 VisitorConstIterator iend = range.end();
110 MyIICurvatureFunctor curvatureFunctor;
111 curvatureFunctor.init( h, re );
113 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
114 curvatureEstimator.attach(
K, dshape );
115 curvatureEstimator.setParams( re/h );
116 curvatureEstimator.init( h, ibegin, iend );
118 std::vector<MyIICurvatureEstimator::Quantity> results;
119 std::back_insert_iterator< std::vector<MyIICurvatureEstimator::Quantity> > itback(results);
121 curvatureEstimator.eval(ibegin,iend,itback);
122 trace.
info() <<
"Number of values = "<< results.size()<<std::endl;
126 VisitorRange range2(
new Visitor( surf, *surf.
begin() ));
127 VisitorConstIterator ibegin2 = range2.begin();
128 VisitorConstIterator iend2 = range2.end();
134 GaussianCache cache( curvatureEstimator );
135 cache.init( h, ibegin2, iend2 );
136 trace.
info() <<
"Number of cached values = "<< cache.size()<<std::endl;
138 trace.
info() <<
"Value at begin="<< cache.eval(surf.
begin())<<
" expected = "<< curvatureEstimator.eval(surf.
begin())<<std::endl;
146 if ( cache.eval(it) != curvatureEstimator.eval(it) )
149 trace.
error() <<
"Incorrect values at "<<*it<<
" read " <<cache.eval(it)<<
" and expecting "<<curvatureEstimator.eval(it)<<std::endl;
157 if ( cache.eval(it) == 12345678 )
161 trace.
error() <<
"Incorrect values at "<<*it<<std::endl;
167 GaussianCache cache2(cache);
168 trace.
info() <<
"Number of cached values = "<< cache.size()<<std::endl;
169 trace.
info() <<
"Value at begin="<< cache2.eval(surf.
begin())<<
" expected = "<< curvatureEstimator.eval(surf.
begin())<<std::endl;
172 if ( cache.eval(it) == 12345678 )
176 trace.
error() <<
"Incorrect values at "<<*it<<std::endl;
185 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
186 <<
"cache == eval" << std::endl;
194int main(
int argc,
char** argv )
198 for (
int i = 0; i < argc; ++i )
203 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class is useful to perform a depth-first exploration of a graph given a starting point or s...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
ConstIterator begin() const
ConstIterator end() const
Aim: this class adapts any local surface estimator to cache the estimated values in a associative con...
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
const Point & getUpperBound() const
void attach(ConstAlias< EuclideanShape > shape)
const Point & getLowerBound() const
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: Transforms a graph visitor into a single pass input range.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: Implements basic operations that will be used in Point and Vector classes.
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
BreadthFirstVisitor< MyDigitalSurface > Visitor
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This concept describes an object that can process a range of surfels (that are supposed to belon...
Aim: A functor Matrix -> Real that returns the Gaussian curvature by diagonalizing the given covarian...
bool testEstimatorCache(double h)