32#include "DGtal/base/Common.h"
33#include "DGtal/helpers/StdDefs.h"
34#include "DGtal/base/BasicFunctors.h"
35#include "DGtal/graph/GraphVisitorRange.h"
36#include "DGtal/io/boards/Board2D.h"
37#include "DGtal/io/Color.h"
38#include "DGtal/io/colormaps/GradientColorMap.h"
40#include "DGtal/shapes/Shapes.h"
41#include "DGtal/shapes/implicit/ImplicitBall.h"
42#include "DGtal/shapes/GaussDigitizer.h"
44#include "DGtal/topology/CanonicSCellEmbedder.h"
45#include "DGtal/graph/DistanceBreadthFirstVisitor.h"
46#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
47#include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
48#include "DGtal/geometry/surfaces/estimation/estimationFunctors/BasicEstimatorFromSurfelsFunctors.h"
49#include "DGtal/topology/LightImplicitDigitalSurface.h"
50#include "DGtal/geometry/surfaces/estimation/estimationFunctors/SphereFittingEstimator.h"
51#include "DGtal/geometry/surfaces/estimation/estimationFunctors/ElementaryConvolutionNormalVectorEstimator.h"
52#include "DGtal/geometry/surfaces/estimation/EstimatorCache.h"
69 unsigned int nbok = 0;
76 Point p1( -20, -20, -20 );
77 Point p2( 20, 20, 20 );
83 gauss.init(p1, p2, 1);
91 nbok +=
K.
init( p1, p2,
true ) ? 1 : 0;
93 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
94 <<
"K.init() is ok" << std::endl;
96 SurfaceContainer* surfaceContainer =
new SurfaceContainer
111 FunctorNormal functorNormal(embedder, 1.0);
112 ReporterNormal reporterNormal;
113 reporterNormal.attach(
surface);
114 reporterNormal.setParams(l2Metric, functorNormal, gaussKernelFunc, 5.0);
117 NormalCache normalCache(reporterNormal);
119 trace.
info() <<
"Normal vector field cached... "<< normalCache << std::endl;
122 trace.
beginBlock(
"Creating sphere fitting adapter from normal vector field");
127 Functor fitter(embedder,1.0, 5.0, normalCache);
128 ConvFunctor convFunc(1.0);
131 reporter.setParams(l2Metric, fitter , convFunc, 15.0);
136 Functor::Quantity val = reporter.eval( it );
137 trace.
info() <<
"Fitting = "<<val.center <<
" rad="<<val.radius<<std::endl;
144 nbok +=
true ? 1 : 0;
146 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
147 <<
"true == true" << std::endl;
155int main(
int argc,
char** argv )
159 for (
int i = 0; i < argc; ++i )
164 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::Surfel Surfel
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
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...
void attach(ConstAlias< EuclideanShape > shape)
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
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: this class adapts any local functor on digital surface element to define a local estimator....
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="")
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.
Aim: Use Patate library to perform a local sphere fitting.
CountedPtr< SH3::DigitalSurface > surface
SH3::DigitalSurface Surface
ExactPredicateLpSeparableMetric< Space, 2 > L2Metric
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: defines a functor on double numbers which corresponds to a Gaussian convolution kernel....
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
PointVector< 3, double > RealPoint