DGtal  1.5.beta
DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache > Class Template Reference

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

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

Data Structures

class  PatatePoint
 
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 PatatePoint::Scalar Scalar
 
typedef PatatePoint::VectorType VectorType
 
typedef Grenaille::DistWeightFunc< PatatePoint, Grenaille::SmoothWeightKernel< Scalar > > WeightFunc
 
typedef Grenaille::Basket< PatatePoint, WeightFunc, Grenaille::OrientedSphereFit, Grenaille::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. More...
 
FitmyFit
 Fitting object. More...
 
double myH
 Grid step. More...
 
bool myFirstPoint
 Boolean for initial point. More...
 
const NormalVectorEstimatorCachemyNormalEsitmatorCache
 NormalVectorCache. More...
 
const WeightFuncmyWeightFunction
 const WeightFunction More...
 

Detailed Description

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

Aim: Use Patate 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 Patate 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 Grenaille::Basket<PatatePoint,WeightFunc,Grenaille::OrientedSphereFit, Grenaille::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 PatatePoint::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 PatatePoint::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 Grenaille::DistWeightFunc<PatatePoint,Grenaille::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  :
162  myEmbedder(&anEmbedder), myH(h), myNormalEsitmatorCache(&anEstimator)
163  {
164  //From Mellado's example
165  myFit = new Fit();
166  myWeightFunction = new WeightFunc(radius);
167  myFit->setWeightFunc(*myWeightFunction);
168  }
const NormalVectorEstimatorCache * myNormalEsitmatorCache
NormalVectorCache.
Grenaille::DistWeightFunc< PatatePoint, Grenaille::SmoothWeightKernel< Scalar > > WeightFunc
const SCellEmbedder * myEmbedder
Alias of the geometrical embedder.
const WeightFunc * myWeightFunction
const WeightFunction
Grenaille::Basket< PatatePoint, WeightFunc, Grenaille::OrientedSphereFit, Grenaille::GLSParam > Fit

References DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFit, and DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myWeightFunction.

◆ ~SphereFittingEstimator()

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

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
248  Quantity res;
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  }
std::ostream & info()
Trace trace
Definition: Common.h:153

References DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::Quantity::center, DGtal::Trace::info(), DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFit, 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  {
190  BOOST_VERIFY(aDistance==aDistance);
191 
192  RealPoint p = myEmbedder->operator()(aSurf);
193  RealPoint norm = myNormalEsitmatorCache->eval(aSurf);
194  VectorType pp;
195  pp(0) = p[0]*myH;
196  pp(1) = p[1]*myH;
197  pp(2) = p[2]*myH;
198  VectorType normal;
199  normal(0) = norm[0];
200  normal(1) = norm[1];
201  normal(2) = norm[2];
202  PatatePoint point(pp, normal);
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.
PointVector< 3, double > RealPoint

References DGtal::Trace::info(), DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myEmbedder, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFirstPoint, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myFit, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myH, DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::myNormalEsitmatorCache, and DGtal::trace.

◆ reset()

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

Field Documentation

◆ myEmbedder

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

◆ myFirstPoint

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

◆ myFit

◆ myH

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

◆ myNormalEsitmatorCache

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

◆ myWeightFunction


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