DGtal 2.2.0
Loading...
Searching...
No Matches
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 SCellEmbedder * myEmbedder
 Alias of the geometrical embedder.
Fit * myFit
 Fitting object.
double myH
 Grid step.
double myRadius
 Radius.
bool myFirstPoint
 Boolean for initial point.
const NormalVectorEstimatorCache * myNormalEsitmatorCache
 NormalVectorCache.

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 myFit = new Fit();
165 }
Aim: Use Ponca library to perform a local sphere fitting.
const NormalVectorEstimatorCache * myNormalEsitmatorCache
NormalVectorCache.
Ponca::Basket< PoncaPoint, WeightFunc, Ponca::OrientedSphereFit, Ponca::GLSParam > Fit
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.

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

◆ ~SphereFittingEstimator()

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

Destructor.

Definition at line 171 of file SphereFittingEstimator.h.

172 {
173 delete myFit ;
174 }

References myFit.

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 218 of file SphereFittingEstimator.h.

219 {
220 myFit->finalize();
221
222#ifdef DGTAL_DEV_VERBOSE
223 trace.info() <<std::endl;
224
225 //Test if the fitting ended without errors
226 if(myFit->isStable())
227 {
228 std::cout << "Center: [" << myFit->center().transpose() << "] ; radius: " << myFit->radius() << std::endl;
229
230 std::cout << "Pratt normalization"
231 << (myFit->applyPrattNorm() ? " is now done." : " has already been applied.") << std::endl;
232
233
234 std::cout << "Fitted Sphere: " << std::endl
235 << "\t Tau : " << myFit->tau() << std::endl
236 << "\t Eta : " << myFit->eta().transpose() << std::endl
237 << "\t Kappa: " << myFit->kappa() << std::endl;
238
239 }
240 else
241 {
242 std::cout << "Ooops... not stable result"<<std::endl;
243 }
244#endif
246 res.center = RealPoint((myFit->center())(0),
247 (myFit->center())(1),
248 (myFit->center())(2));
249 res.radius = myFit->radius();
250 res.tau = myFit->tau();
251 res.kappa = myFit->kappa();
252 res.eta = RealPoint((myFit->eta())(0),
253 (myFit->eta())(1),
254 (myFit->eta())(2));
255 return res;
256 }
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::Trace::info(), 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 183 of file SphereFittingEstimator.h.

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

References DGtal::Trace::info(), myEmbedder, myFirstPoint, myFit, myH, myNormalEsitmatorCache, myRadius, 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 263 of file SphereFittingEstimator.h.

264 {
265 delete myFit;
266 myFit = new Fit();
267 myFirstPoint = true;
268 }

References myFirstPoint, and myFit.

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 274 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 286 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 277 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 280 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 289 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and SphereFittingEstimator().

◆ myRadius

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

Radius.

Definition at line 283 of file SphereFittingEstimator.h.

Referenced by pushSurfel(), and SphereFittingEstimator().


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