DGtal  1.2.0
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)
42 #define IntegralInvariantNormalVectorEstimator_RECURSES
43 
44 #if !defined IntegralInvariantNormalVectorEstimator_h
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 
128  typedef int Value;
129 
132  typedef PointFunctorFromPointPredicateAndDomain< PointPredicate, Domain, unsigned int > ShapePointFunctor;
136 
137 
143 
148  typedef typename Matrix::Component Component;
149  typedef double Scalar;
151 
157  typedef Matrix Argument;
158  typedef Quantity Value;
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  }
171  };
172 
173  // ----------------------- Standard services ------------------------------
174 public:
175 
181 
190  ConstAlias< PointPredicate > aPointPredicate );
191 
196 
202 
208  Self& operator= ( const Self& other );
209 
213  void clear();
214 
215  // ----------------------- Interface --------------------------------------
216 public:
217 
219  Scalar h() const;
220 
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 
305  std::vector< PairIterators > myKernels;
306  std::vector< DigitalSet * > myKernelsSet;
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)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
Aim: Smart pointer based on reference counts.
Definition: CountedPtr.h:80
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
std::pair< KernelConstIterator, KernelConstIterator > PairIterators
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell.
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Definition: ImplicitBall.h:65
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:76
TComponent Component
Definition: SimpleMatrix.h:79
ColumnVector column(const DGtal::Dimension j) const
Aim: Minus between two models of CEuclideanBoundedShape and CEuclideanOrientedShape.
Aim: This class implement an Integral Invariant normal vector estimator.
std::vector< DigitalSet * > myKernelsSet
Array of shifting masks. Size = 9 for each shifting (0-adjacent and full kernel included)
RealVector Quantity
The returned type of the estimator : a real-value vector.
DigitalSetSelector< Domain, BIG_DS+HIGH_VAR_DS >::Type DigitalSet
PointFunctorFromPointPredicateAndDomain< PointPredicate, Domain, unsigned int > ShapePointFunctor
Quantity eval(SurfelConstIterator it) const
CountedPtr< ShapePointFunctor > myShapePointFunctor
Smart pointer on functor point -> {0,1}.
IntegralInvariantNormalVectorEstimator< TKSpace, TPointPredicate > Self
CountedConstPtrOrConstPtr< PointPredicate > myPointPredicate
Smart pointer (if required) on a point predicate.
std::vector< PairIterators > myKernels
array of begin/end iterator of shifting masks.
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
EuclideanShapesMinus< KernelSupport, KernelSupport > EuclideanMinus
DigitalSurfaceConvolver< ShapeSpelFunctor, KernelSpelFunctor, KSpace, DigitalShapeKernel > Convolver
Scalar myRadius
"digital" radius of the kernel (buy may be non integer).
OutputIterator eval(SurfelConstIterator itb, SurfelConstIterator ite, OutputIterator result) const
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< ShapeSpelFunctor >))
void attach(ConstAlias< KSpace > K, ConstAlias< PointPredicate > aPointPredicate)
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
CountedPtr< ShapeSpelFunctor > myShapeSpelFunctor
Smart pointer on functor spel -> {0,1}.
IntegralInvariantNormalVectorEstimator(ConstAlias< KSpace > K, ConstAlias< PointPredicate > aPointPredicate)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< KSpace >))
Aim: Define a simple functor that returns a constant quantity (0 by default).
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: Defines a functor on cells.
Definition: CCellFunctor.h:90
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: Defines a predicate on a point.
KSpace K