DGtal  0.9.2
TrueDigitalSurfaceLocalEstimator.h
1 
17 #pragma once
18 
31 #if defined(TrueDigitalSurfaceLocalEstimator_RECURSES)
32 #error Recursive header files inclusion detected in TrueDigitalSurfaceLocalEstimator.h
33 #else // defined(TrueDigitalSurfaceLocalEstimator_RECURSES)
34 
35 #define TrueDigitalSurfaceLocalEstimator_RECURSES
36 
37 #if !defined TrueDigitalSurfaceLocalEstimator_h
38 
39 #define TrueDigitalSurfaceLocalEstimator_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/base/CountedConstPtrOrConstPtr.h"
47 #include "DGtal/topology/CanonicSCellEmbedder.h"
49 
50 namespace DGtal
51 {
52 
54  // template class TrueDigitalSurfaceLocalEstimator
96  template <typename TKSpace, typename TShape, typename TGeometricFunctor>
98  {
100 
101  public:
103  typedef TKSpace KSpace;
104  typedef TShape Shape;
105  typedef TGeometricFunctor GeometricFunctor;
106  typedef typename KSpace::Space Space;
107  typedef typename KSpace::SCell SCell;
108  typedef typename KSpace::Surfel Surfel;
109  typedef typename Space::RealPoint RealPoint;
110  typedef typename RealPoint::Coordinate Scalar;
111  typedef typename GeometricFunctor::Quantity Quantity;
114 
115  // ----------------------- Standard services ------------------------------
116  public:
117 
122 
127 
132  TrueDigitalSurfaceLocalEstimator( const Self & other );
133 
139  Self& operator=( const Self & other );
140 
142  Scalar h() const;
143 
150  void attach( ConstAlias<Shape> aShape );
151 
167  void setParams( ConstAlias<KSpace> ks,
169  const int maxIter = 0,
170  const Scalar accuracy = 0.1,
171  const Scalar gamma = 0.01 );
172 
181  template <typename SurfelConstIterator>
182  void init( const Scalar _h,
183  SurfelConstIterator itb,
184  SurfelConstIterator ite );
185 
190  template <typename SurfelConstIterator>
191  Quantity eval( SurfelConstIterator it ) const;
192 
200  template <typename OutputIterator, typename SurfelConstIterator>
201  OutputIterator eval( SurfelConstIterator itb,
202  SurfelConstIterator ite,
203  OutputIterator result ) const;
204 
209  RealPoint embed( Surfel surfel ) const;
210 
211  // ----------------------- Interface --------------------------------------
212  public:
213 
218  void selfDisplay ( std::ostream & out ) const;
219 
224  bool isValid() const;
225 
226  // ------------------------- Protected Datas ------------------------------
227  protected:
233  SCellEmbedder myEmbedder;
237  Scalar myH;
239  bool myNearest;
240 
244  Scalar myAccuracy;
246  Scalar myGamma;
247 
248  // ------------------------- Private Datas --------------------------------
249  private:
250 
251  // ------------------------- Hidden services ------------------------------
252  protected:
253 
254  private:
255 
256 
257  // ------------------------- Internals ------------------------------------
258  private:
259 
260  }; // end of class TrueDigitalSurfaceLocalEstimator
261 
262 
269  template <typename TKSpace, typename TShape, typename TGeometricFunctor>
270  std::ostream&
271  operator<< ( std::ostream & out, const TrueDigitalSurfaceLocalEstimator<TKSpace, TShape, TGeometricFunctor> & object );
272 
273 } // namespace DGtal
274 
275 
277 // Includes inline functions.
278 #include "DGtal/geometry/surfaces/estimation/TrueDigitalSurfaceLocalEstimator.ih"
279 
280 // //
282 
283 #endif // !defined TrueDigitalSurfaceLocalEstimator_h
284 
285 #undef TrueDigitalSurfaceLocalEstimator_RECURSES
286 #endif // else defined(TrueDigitalSurfaceLocalEstimator_RECURSES)
void init(const Scalar _h, SurfelConstIterator itb, SurfelConstIterator ite)
RealPoint embed(Surfel surfel) const
void attach(ConstAlias< Shape > aShape)
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
Quantity eval(SurfelConstIterator it) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
SCellEmbedder myEmbedder
The surfel embedder. /!\ For now, it is multiplied by myH.
CountedConstPtrOrConstPtr< KSpace > myKSpace
The cellular space.
bool myNearest
Tells if we look for nearest point.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
void selfDisplay(std::ostream &out) const
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
Self & operator=(const Self &other)
TrueDigitalSurfaceLocalEstimator< TKSpace, TShape, TGeometricFunctor > Self
void setParams(ConstAlias< KSpace > ks, Clone< GeometricFunctor > fct, const int maxIter=0, const Scalar accuracy=0.1, const Scalar gamma=0.01)
CowPtr< GeometricFunctor > myFct
The functor RealPoint -> Quantity returning some geometric quantity.
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:266
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
DGtal is the top-level namespace which contains all DGtal functions and types.
int myMaxIter
fixes the maximum number of steps (0: takes the point as is).
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
Aim: An estimator on digital surfaces that returns the reference local geometric quantity. This is used for comparing estimators.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Scalar myGamma
coefficient associated with the gradient (size of each step).
Scalar myAccuracy
distance criterion to stop the descent (proximity of implicit function).