DGtal  0.9.2
IntegralInvariantNormalVectorEstimator.h
1 
17 #pragma once
18 
38 #if defined(IntegralInvariantNormalVectorEstimator_RECURSES)
39 #error Recursive header files inclusion detected in IntegralInvariantNormalVectorEstimator.h
40 #else // defined(IntegralInvariantNormalVectorEstimator_RECURSES)
41 
42 #define IntegralInvariantNormalVectorEstimator_RECURSES
43 
44 #if !defined IntegralInvariantNormalVectorEstimator_h
45 
46 #define IntegralInvariantNormalVectorEstimator_h
47 
49 // Inclusions
50 #include <iostream>
51 #include "DGtal/base/Common.h"
52 
53 #include "DGtal/kernel/CPointPredicate.h"
54 #include "DGtal/kernel/BasicPointFunctors.h"
55 #include "DGtal/topology/CCellFunctor.h"
56 #include "DGtal/topology/CCellularGridSpaceND.h"
57 #include "DGtal/geometry/surfaces/FunctorOnCells.h"
58 
59 #include "DGtal/shapes/GaussDigitizer.h"
60 #include "DGtal/shapes/Shapes.h"
61 
62 #include "DGtal/geometry/surfaces/DigitalSurfaceConvolver.h"
63 #include "DGtal/shapes/EuclideanShapesDecorator.h"
64 
65 #include "DGtal/shapes/implicit/ImplicitBall.h"
67 
68 
69 namespace DGtal
70 {
71 
72 namespace deprecated
73 {
74 
76 // template class IntegralInvariantNormalVectorEstimator
103 template <typename TKSpace, typename TPointPredicate>
105 {
106 public:
108  typedef TKSpace KSpace;
109  typedef TPointPredicate PointPredicate;
110 
113 
114  typedef typename KSpace::Space Space;
116  typedef typename Space::Point Point;
117  typedef typename Space::RealPoint RealPoint;
118  typedef typename Space::RealVector RealVector;
120  typedef typename KSpace::SCell Spel;
121  typedef typename KSpace::Surfel Surfel;
122  typedef typename KSpace::SurfelSet SurfelSet;
123  typedef typename SurfelSet::const_iterator ConstIteratorKernel;
124 
126  typedef RealVector Quantity;
128  typedef int Value;
129 
132  typedef PointFunctorFromPointPredicateAndDomain< PointPredicate, Domain, unsigned int > ShapePointFunctor;
136 
137 
143 
145  KSpace, DigitalShapeKernel> Convolver;
148  typedef typename Matrix::Component Component;
149  typedef double Scalar;
151 
157  typedef Matrix Argument;
158  typedef Quantity Value;
161  CovarianceMatrix2NormalDirectionFunctor( const Self& /* other */ ) {}
162  Self& operator=( const Self& /* other */ ) { return *this; }
163  Value operator()( const Argument& arg ) const
164  {
167  return eigenVectors.column( 0 ); // normal vector is associated to smallest eigenvalue.
168  }
169  mutable Matrix eigenVectors;
170  mutable RealVector eigenValues;
171  };
172 
173  // ----------------------- Standard services ------------------------------
174 public:
175 
181 
190  ConstAlias< PointPredicate > aPointPredicate );
191 
196 
201  IntegralInvariantNormalVectorEstimator ( const Self& other );
202 
208  Self& operator= ( const Self& other );
209 
213  void clear();
214 
215  // ----------------------- Interface --------------------------------------
216 public:
217 
219  Scalar h() const;
220 
228  void attach( ConstAlias< KSpace > K,
229  ConstAlias<PointPredicate> aPointPredicate );
230 
236  void setParams( const double dRadius );
237 
246  template <typename SurfelConstIterator>
247  void init( const double _h, SurfelConstIterator itb, SurfelConstIterator ite );
248 
263  template< typename SurfelConstIterator >
264  Quantity eval ( SurfelConstIterator it ) const;
265 
266 
284  template <typename OutputIterator, typename SurfelConstIterator>
285  OutputIterator eval( SurfelConstIterator itb,
286  SurfelConstIterator ite,
287  OutputIterator result ) const;
288 
293  void selfDisplay ( std::ostream & out ) const;
294 
299  bool isValid() const;
300 
301  // ------------------------- Private Datas --------------------------------
302 private:
303 
304  const KernelSpelFunctor myKernelFunctor;
305  std::vector< PairIterators > myKernels;
306  std::vector< DigitalSet * > myKernelsSet;
314  Scalar myH;
315  Scalar myRadius;
316 
317 private:
318 
319 
320 }; // end of class IntegralInvariantNormalVectorEstimator
321 
322 } // namespace deprecated
323 
330  template <typename TKSpace, typename TPointPredicate>
331  std::ostream&
332  operator<< ( std::ostream & out,
334 
335 } // namespace DGtal
336 
337 
339 // Includes inline functions.
340 #include "DGtal/geometry/surfaces/estimation/IntegralInvariantNormalVectorEstimator.ih"
341 
342 // //
344 
345 #endif // !defined IntegralInvariantNormalVectorEstimator_h
346 
347 #undef IntegralInvariantNormalVectorEstimator_RECURSES
348 #endif // else defined(IntegralInvariantNormalVectorEstimator_RECURSES)
DigitalSurfaceConvolver< ShapeSpelFunctor, KernelSpelFunctor, KSpace, DigitalShapeKernel > Convolver
std::pair< KernelConstIterator, KernelConstIterator > PairIterators
Aim: Smart pointer based on reference counts.
Definition: CountedPtr.h:79
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
Quantity eval(SurfelConstIterator it) const
CountedPtr< ShapePointFunctor > myShapePointFunctor
Smart pointer on functor point -> {0,1}.
Aim: Defines a functor on cells.
Definition: CCellFunctor.h:89
CountedPtr< ShapeSpelFunctor > myShapeSpelFunctor
Smart pointer on functor spel -> {0,1}.
EuclideanShapesMinus< KernelSupport, KernelSupport > EuclideanMinus
Aim: This class provides methods to compute the eigen decomposition of a matrix. Its objective is to ...
Aim: Minus between two models of CEuclideanBoundedShape and CEuclideanOrientedShape.
RealVector Quantity
The returned type of the estimator : a real-value vector.
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:75
void attach(ConstAlias< KSpace > K, ConstAlias< PointPredicate > aPointPredicate)
Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell.
PointFunctorFromPointPredicateAndDomain< PointPredicate, Domain, unsigned int > ShapePointFunctor
TComponent Component
Definition: SimpleMatrix.h:79
Aim: Defines a predicate on a point.
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
std::vector< PairIterators > myKernels
array of begin/end iterator of shifting masks.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD...
Definition: ImplicitBall.h:64
DigitalSetSelector< Domain, BIG_DS+HIGH_VAR_DS >::Type DigitalSet
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
IntegralInvariantNormalVectorEstimator< TKSpace, TPointPredicate > Self
ColumnVector column(const DGtal::Dimension j) const
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< KSpace >))
Aim: Define a simple functor that returns a constant quantity (0 by default).
std::vector< DigitalSet * > myKernelsSet
Array of shifting masks. Size = 9 for each shifting (0-adjacent and full kernel included) ...
CountedConstPtrOrConstPtr< PointPredicate > myPointPredicate
Smart pointer (if required) on a point predicate.
Aim: This class implement an Integral Invariant normal vector estimator.
Scalar myRadius
"digital" radius of the kernel (buy may be non integer).