Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Main.js
DGtal 2.0.0
DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache > Class Template Reference

Aim: Use Ponca library to perform a local sphere fitting. More...

#include <DGtal/geometry/surfaces/estimation/estimationFunctors/SphereFittingEstimator.h>

Data Structures

class  PoncaPoint
struct  Quantity
 Quantity type: a 3-sphere (model of CQuantity) More...

Public Types

typedef TSurfel Surfel
typedef TEmbedder SCellEmbedder
typedef SCellEmbedder::RealPoint RealPoint
typedef TNormalVectorEstimatorCache NormalVectorEstimatorCache
typedef PoncaPoint::Scalar Scalar
typedef PoncaPoint::VectorType VectorType
typedef Ponca::DistWeightFunc< PoncaPoint, Ponca::SmoothWeightKernel< Scalar > > WeightFunc
typedef Ponca::Basket< PoncaPoint, WeightFunc, Ponca::OrientedSphereFit, Ponca::GLSParam > Fit

Public Member Functions

 SphereFittingEstimator (ConstAlias< SCellEmbedder > anEmbedder, const double h, const double radius, ConstAlias< NormalVectorEstimatorCache > anEstimator)
 ~SphereFittingEstimator ()
void pushSurfel (const Surfel &aSurf, const double aDistance)
Quantity eval ()
void reset ()

Private Attributes

const SCellEmbeddermyEmbedder
 Alias of the geometrical embedder.
FitmyFit
 Fitting object.
double myH
 Grid step.
bool myFirstPoint
 Boolean for initial point.
const NormalVectorEstimatorCachemyNormalEsitmatorCache
 NormalVectorCache.
const WeightFuncmyWeightFunction
 const WeightFunction

Detailed Description

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
class DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >

Aim: Use Ponca library to perform a local sphere fitting.

Description of template class 'SphereFittingEstimator'

Given a kernel radius, this functor performs a sphere fitting and outputs the parameters of an AlgebraicSphere (please see Ponca documentation for details).

Model of concepts::CLocalEstimatorFromSurfelFunctor.

Template Parameters
TSurfeltype of surfels
TEmbeddertype of functors which embed surfel to \mathbb{R}^3.
TNormalVectorEstimatorCachethe type of normal vector cache to consider (see EstimatorCache class).
See also
testSphereFitting.cpp

Definition at line 88 of file SphereFittingEstimator.h.

Member Typedef Documentation

◆ Fit

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef Ponca::Basket<PoncaPoint, WeightFunc, Ponca::OrientedSphereFit, Ponca::GLSParam> DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Fit

Definition at line 126 of file SphereFittingEstimator.h.

◆ NormalVectorEstimatorCache

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef TNormalVectorEstimatorCache DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::NormalVectorEstimatorCache

Definition at line 120 of file SphereFittingEstimator.h.

◆ RealPoint

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef SCellEmbedder::RealPoint DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::RealPoint

Definition at line 118 of file SphereFittingEstimator.h.

◆ Scalar

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef PoncaPoint::Scalar DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Scalar

Definition at line 122 of file SphereFittingEstimator.h.

◆ SCellEmbedder

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef TEmbedder DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::SCellEmbedder

Definition at line 117 of file SphereFittingEstimator.h.

◆ Surfel

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef TSurfel DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Surfel

Definition at line 116 of file SphereFittingEstimator.h.

◆ VectorType

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef PoncaPoint::VectorType DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::VectorType

Definition at line 123 of file SphereFittingEstimator.h.

◆ WeightFunc

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
typedef Ponca::DistWeightFunc<PoncaPoint, Ponca::SmoothWeightKernel<Scalar> > DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::WeightFunc

Definition at line 125 of file SphereFittingEstimator.h.

Constructor & Destructor Documentation

◆ SphereFittingEstimator()

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::SphereFittingEstimator ( ConstAlias< SCellEmbedder > anEmbedder,
const double h,
const double radius,
ConstAlias< NormalVectorEstimatorCache > anEstimator )
inline

Constructor.

Parameters
[in]anEmbedderembedder to map surfel to R^n.
[in]hgridstep.
[in]radiusradius of the convolution kernel (in \mathbb{Z}^n space).
[in]anEstimatornormal vector estimator on the surface.

Definition at line 158 of file SphereFittingEstimator.h.

161 :
163 {
164 //From Mellado's example
165 myFit = new Fit();
167 myFit->setWeightFunc(*myWeightFunction);
168 }
Aim: Use Ponca library to perform a local sphere fitting.
Ponca::DistWeightFunc< PoncaPoint, Ponca::SmoothWeightKernel< Scalar > > WeightFunc
const NormalVectorEstimatorCache * myNormalEsitmatorCache
NormalVectorCache.
Ponca::Basket< PoncaPoint, WeightFunc, Ponca::OrientedSphereFit, Ponca::GLSParam > Fit
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
const WeightFunc * myWeightFunction
const WeightFunction

References myEmbedder, myFit, myH, myNormalEsitmatorCache, and myWeightFunction.

◆ ~SphereFittingEstimator()

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::~SphereFittingEstimator ( )
inline

Destructor.

Definition at line 174 of file SphereFittingEstimator.h.

175 {
176 delete myWeightFunction;
177 delete myFit ;
178 }

References myFit, and myWeightFunction.

Member Function Documentation

◆ eval()

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
Quantity DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::eval ( )
inline

Evaluate the sphere fitting.

Returns
the fitted sphere

Definition at line 221 of file SphereFittingEstimator.h.

222 {
223 myFit->finalize();
224
225#ifdef DEBUG_VERBOSE
226 trace.info() <<std::endl;
227
228 //Test if the fitting ended without errors
229 if(myFit->isStable())
230 {
231 std::cout << "Center: [" << myFit->center().transpose() << "] ; radius: " << myFit->radius() << std::endl;
232
233 std::cout << "Pratt normalization"
234 << (myFit->applyPrattNorm() ? " is now done." : " has already been applied.") << std::endl;
235
236
237 std::cout << "Fitted Sphere: " << std::endl
238 << "\t Tau : " << myFit->tau() << std::endl
239 << "\t Eta : " << myFit->eta().transpose() << std::endl
240 << "\t Kappa: " << myFit->kappa() << std::endl;
241
242 }
243 else
244 {
245 std::cout << "Ooops... not stable result"<<std::endl;
246 }
247#endif
249 res.center = RealPoint((myFit->center())(0),
250 (myFit->center())(1),
251 (myFit->center())(2));
252 res.radius = myFit->radius();
253 res.tau = myFit->tau();
254 res.kappa = myFit->kappa();
255 res.eta = RealPoint((myFit->eta())(0),
256 (myFit->eta())(1),
257 (myFit->eta())(2));
258 return res;
259 }
Quantity type: a 3-sphere (model of CQuantity)

References DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::center, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::eta, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::kappa, myFit, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::radius, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::tau, and DGtal::trace.

◆ pushSurfel()

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
void DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::pushSurfel ( const Surfel & aSurf,
const double aDistance )
inline

Add the geometrical embedding of a surfel to the point list

Parameters
[in]aSurfa surfel to add
[in]aDistanceof aSurf to the neighborhood boundary

Definition at line 187 of file SphereFittingEstimator.h.

189 {
191
192 RealPoint p = myEmbedder->operator()(aSurf);
195 pp(0) = p[0]*myH;
196 pp(1) = p[1]*myH;
197 pp(2) = p[2]*myH;
199 normal(0) = norm[0];
200 normal(1) = norm[1];
201 normal(2) = norm[2];
203 if (myFirstPoint)
204 {
205 myFirstPoint = false;
206 myFit->init(pp);
207 }
208 else
209 myFit->addNeighbor(point);
210
211#ifdef DEBUG_VERBOSE
212 trace.info() <<"#";
213#endif
214 }
bool myFirstPoint
Boolean for initial point.

References myEmbedder, myFirstPoint, myFit, myH, myNormalEsitmatorCache, and DGtal::trace.

◆ reset()

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
void DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::reset ( )
inline

Reset the point list.

Definition at line 266 of file SphereFittingEstimator.h.

267 {
268 delete myFit;
269 myFit = new Fit();
270 myFirstPoint = true;
271 myFit->setWeightFunc(*myWeightFunction);
272 }

References myFirstPoint, myFit, and myWeightFunction.

Field Documentation

◆ myEmbedder

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
const SCellEmbedder* DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myEmbedder
private

Alias of the geometrical embedder.

Definition at line 278 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and SphereFittingEstimator().

◆ myFirstPoint

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
bool DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFirstPoint
private

Boolean for initial point.

Definition at line 287 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and reset().

◆ myFit

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
Fit* DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFit
private

Fitting object.

Definition at line 281 of file SphereFittingEstimator.h.

Referenced by eval(), pushSurfel(), reset(), SphereFittingEstimator(), and ~SphereFittingEstimator().

◆ myH

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
double DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myH
private

Grid step.

Definition at line 284 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and SphereFittingEstimator().

◆ myNormalEsitmatorCache

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
const NormalVectorEstimatorCache* DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myNormalEsitmatorCache
private

NormalVectorCache.

Definition at line 290 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and SphereFittingEstimator().

◆ myWeightFunction

template<typename TSurfel, typename TEmbedder, typename TNormalVectorEstimatorCache>
const WeightFunc* DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myWeightFunction
private

const WeightFunction

Definition at line 293 of file SphereFittingEstimator.h.

Referenced by reset(), SphereFittingEstimator(), and ~SphereFittingEstimator().


The documentation for this class was generated from the following file: