30#include "DGtal/base/Common.h"
33#include "DGtal/io/readers/VolReader.h"
34#include "DGtal/images/ImageSelector.h"
35#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
36#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
37#include "DGtal/topology/SurfelAdjacency.h"
38#include "DGtal/topology/helpers/Surfaces.h"
39#include "DGtal/topology/LightImplicitDigitalSurface.h"
40#include "DGtal/images/ImageHelper.h"
41#include "DGtal/topology/DigitalSurface.h"
42#include "DGtal/graph/DepthFirstVisitor.h"
43#include "DGtal/graph/GraphVisitorRange.h"
44#include "DGtal/shapes/Shapes.h"
46#include "DGtal/geometry/surfaces/estimation/LocalEstimatorFromSurfelFunctorAdapter.h"
47#include "DGtal/geometry/volumes/distance/LpMetric.h"
49#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingGaussianCurvatureEstimator.h"
50#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingMeanCurvatureEstimator.h"
51#include "DGtal/geometry/surfaces/estimation/estimationFunctors/MongeJetFittingNormalVectorEstimator.h"
52#include "DGtal/geometry/surfaces/estimation/estimationFunctors/LinearLeastSquareFittingNormalVectorEstimator.h"
54#include "DGtal/geometry/surfaces/estimation/estimationFunctors/ElementaryConvolutionNormalVectorEstimator.h"
55#include "DGtal/base/BasicFunctors.h"
63template <
typename TPo
int3>
64struct ImplicitDigitalEllipse3 {
65 typedef TPoint3
Point;
67 ImplicitDigitalEllipse3(
double a,
double b,
double c )
68 : myA( a ), myB( b ), myC( c )
71 bool operator()(
const TPoint3 & p )
const
73 double x = ( (double) p[ 0 ] / myA );
74 double y = ( (double) p[ 1 ] / myB );
75 double z = ( (double) p[ 2 ] / myC );
76 return ( x*x + y*y + z*z ) <= 1.0;
86 typedef ImplicitDigitalEllipse3<Point> ImplicitDigitalEllipse;
89 typedef SurfaceContainer::Surfel
Surfel;
91 Point p1( -10, -10, -10 );
92 Point p2( 10, 10, 10 );
94 K.
init( p1, p2,
true );
95 ImplicitDigitalEllipse ellipse( 6.0, 4.5, 3.4 );
97 SurfaceContainer* surfaceContainer =
new SurfaceContainer
99 Surface surface( surfaceContainer );
131 FunctorGaussian estimatorK(embedder,1.0);
132 FunctorMean estimatorH(embedder, 1.0);
133 FunctorNormal estimatorN(embedder,1.0);
134 FunctorNormalLeast estimatorL(embedder,1.0);
136 ConstFunctor constFunctor(1.0);
140 ReporterNormal reporterN;
141 ReporterNormalLeast reporterL;
145 FunctorNormalElem estimatorNormalElem(embedder,1.0);
148 ReporterNormalElem reporterElem(surface, l2,
149 estimatorNormalElem, gaussian);
154 reporterK.attach(surface);
155 reporterH.attach(surface);
156 reporterN.attach(surface);
157 reporterL.attach(surface);
159 reporterK.init(1, surface.begin(), surface.end());
160 reporterH.init(1, surface.begin(), surface.end());
161 reporterN.init(1, surface.begin(), surface.end());
162 reporterL.init(1, surface.begin(), surface.end());
164 reporterK.setParams(l2, estimatorK, constFunctor, 5.0);
165 reporterH.setParams(l2, estimatorH, constFunctor, 5.0);
166 reporterN.setParams(l2, estimatorN, constFunctor, 5.0);
167 reporterL.setParams(l2, estimatorL, constFunctor, 5.0);
169 FunctorGaussian::Quantity valK = reporterK.eval( surface.begin());
170 FunctorMean::Quantity valH = reporterH.eval( surface.begin());
171 FunctorNormal::Quantity valN = reporterN.eval( surface.begin());
172 FunctorNormalLeast::Quantity valL = reporterL.eval( surface.begin());
175 reporterElem.attach(surface);
176 reporterElem.setParams(l2,
177 estimatorNormalElem, gaussian, 5.0);
178 reporterElem.init(1.0, surface.begin(), surface.end());
179 FunctorNormalElem::Quantity valElem = reporterElem.eval( surface.begin());
182 trace.
info() <<
"Gaussian = "<<valK <<std::endl;
183 trace.
info() <<
"Mean = "<<valH<< std::endl;
184 trace.
info() <<
"Normal Vector (from Monge form) = "<<valN<< std::endl;
185 trace.
info() <<
"Normal Vector (linear least square) = "<<valL<< std::endl;
187 trace.
info() <<
"Normal Vector (Elementary conv) = "<<valElem<< std::endl;
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
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....
Aim: implements l_p metrics.
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...
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: Estimates normal vector using CGAL linear least squares plane fitting.
Aim: Estimates Gaussian curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates Mean curvature using CGAL Jet Fitting and Monge Form.
Aim: Estimates normal vector using CGAL Jet Fitting and Monge Form.
SH3::DigitalSurface Surface
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....
int main(int argc, char **argv)