DGtal  1.5.beta
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)
35 #define TrueDigitalSurfaceLocalEstimator_RECURSES
36 
37 #if !defined TrueDigitalSurfaceLocalEstimator_h
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 
133 
139  Self& operator=( const Self & other );
140 
142  Scalar h() const;
143 
150  void attach( ConstAlias<Shape> aShape );
151 
169  const int maxIter = 20,
170  const Scalar accuracy = 0.0001,
171  const Scalar gamma = 0.5 );
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:
239  bool myNearest;
240 
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&
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)
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Definition: Clone.h:267
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
Aim: An estimator on digital surfaces that returns the reference local geometric quantity....
void init(const Scalar _h, SurfelConstIterator itb, SurfelConstIterator ite)
Quantity eval(SurfelConstIterator it) const
RealPoint embed(Surfel surfel) const
TrueDigitalSurfaceLocalEstimator(const Self &other)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
void selfDisplay(std::ostream &out) const
bool myNearest
Tells if we look for nearest point.
TrueDigitalSurfaceLocalEstimator< TKSpace, TShape, TGeometricFunctor > Self
int myMaxIter
fixes the maximum number of steps (0: takes the point as is).
Scalar myGamma
coefficient associated with the gradient (size of each step).
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< GeometricFunctor, RealPoint, Quantity >))
Self & operator=(const Self &other)
CountedConstPtrOrConstPtr< KSpace > myKSpace
The cellular space.
SCellEmbedder myEmbedder
The surfel embedder. /!\ For now, it is multiplied by myH.
OutputIterator eval(SurfelConstIterator itb, SurfelConstIterator ite, OutputIterator result) const
Scalar myAccuracy
distance criterion to stop the descent (proximity of implicit function).
void setParams(ConstAlias< KSpace > ks, Clone< GeometricFunctor > fct, const int maxIter=20, const Scalar accuracy=0.0001, const Scalar gamma=0.5)
void attach(ConstAlias< Shape > aShape)
CowPtr< GeometricFunctor > myFct
The functor RealPoint -> Quantity returning some geometric quantity.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90