DGtal  1.5.beta
IntegralInvariantCovarianceEstimator.h
1 
17 #pragma once
18 
34 #if defined(IntegralInvariantCovarianceEstimator_RECURSES)
35 #error Recursive header files inclusion detected in IntegralInvariantCovarianceEstimator.h
36 #else // defined(IntegralInvariantCovarianceEstimator_RECURSES)
38 #define IntegralInvariantCovarianceEstimator_RECURSES
39 
40 #if !defined IntegralInvariantCovarianceEstimator_h
42 #define IntegralInvariantCovarianceEstimator_h
43 
45 // Inclusions
46 #include <iostream>
47 #include "DGtal/base/Common.h"
48 
49 #include "DGtal/kernel/CPointPredicate.h"
50 #include "DGtal/kernel/BasicPointFunctors.h"
51 #include "DGtal/topology/CCellFunctor.h"
52 #include "DGtal/topology/CCellularGridSpaceND.h"
53 #include "DGtal/geometry/surfaces/FunctorOnCells.h"
54 
55 #include "DGtal/shapes/GaussDigitizer.h"
56 #include "DGtal/shapes/Shapes.h"
57 
58 #include "DGtal/geometry/surfaces/DigitalSurfaceConvolver.h"
59 #include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
60 #include "DGtal/shapes/EuclideanShapesDecorator.h"
61 
62 #include "DGtal/shapes/implicit/ImplicitBall.h"
64 
65 
66 namespace DGtal
67 {
68 
70 // template class IntegralInvariantCovarianceEstimator
114 template <typename TKSpace, typename TPointPredicate, typename TCovarianceMatrixFunctor>
116 {
117 public:
119  typedef TKSpace KSpace;
120  typedef TPointPredicate PointPredicate;
121  typedef TCovarianceMatrixFunctor CovarianceMatrixFunctor;
122 
125 
126  typedef typename KSpace::Space Space;
128  typedef typename Space::Point Point;
129  typedef typename Space::RealPoint RealPoint;
130  typedef typename Space::RealVector RealVector;
132  typedef typename KSpace::SCell Spel;
133  typedef typename KSpace::Surfel Surfel;
134  typedef typename KSpace::SurfelSet SurfelSet;
135  typedef typename SurfelSet::const_iterator ConstIteratorKernel;
136 
138  typedef typename CovarianceMatrixFunctor::Quantity Quantity;
140  typedef int Value;
141 
148 
149 
155 
160  typedef typename Matrix::Component Component;
161  typedef double Scalar;
165  typename CovarianceMatrixFunctor::Argument >::value ));
166 
167 
168  // ----------------------- Standard services ------------------------------
169 public:
170 
179 
190  ConstAlias< PointPredicate > aPointPredicate,
192 
197 
203 
209  Self& operator= ( const Self& other );
210 
214  void clear();
215 
216  // ----------------------- Interface --------------------------------------
217 public:
218 
220  Scalar h() const;
221 
230  ConstAlias<PointPredicate> aPointPredicate );
231 
237  void setParams( const double dRadius );
238 
247  template <typename SurfelConstIterator>
248  void init( const double _h, SurfelConstIterator itb, SurfelConstIterator ite );
249 
264  template< typename SurfelConstIterator >
265  Quantity eval ( SurfelConstIterator it ) const;
266 
267 
288  template <typename OutputIterator, typename SurfelConstIterator>
289  OutputIterator eval( SurfelConstIterator itb,
290  SurfelConstIterator ite,
291  OutputIterator result ) const;
292 
297  void selfDisplay ( std::ostream & out ) const;
298 
303  bool isValid() const;
304 
305  // ------------------------- Private Datas --------------------------------
306 private:
307 
310  std::vector< PairIterators > myKernels;
311  std::vector< DigitalSet * > myKernelsSet;
321 
322 private:
323 
324 
325 }; // end of class IntegralInvariantCovarianceEstimator
326 
333  template <typename TKSpace, typename TPointPredicate, typename TCovarianceMatrixFunctor>
334  std::ostream&
335  operator<< ( std::ostream & out,
337 
338 } // namespace DGtal
339 
340 
342 // Includes inline functions.
343 #include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.ih"
344 
345 // //
347 
348 #endif // !defined IntegralInvariantCovarianceEstimator_h
349 
350 #undef IntegralInvariantCovarianceEstimator_RECURSES
351 #endif // else defined(IntegralInvariantCovarianceEstimator_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
Aim: Constructive Solid Geometry (CSG) between models of CEuclideanBoundedShape and CEuclideanOriente...
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
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
void selfDisplay(std::ostream &out) const
std::vector< PairIterators > myKernels
array of begin/end iterator of shifting masks.
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
IntegralInvariantCovarianceEstimator(const Self &other)
void setParams(const double dRadius)
CountedPtr< ShapeSpelFunctor > myShapeSpelFunctor
Smart pointer on functor spel -> {0,1}.
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< typename Convolver::CovarianceMatrix, typename CovarianceMatrixFunctor::Argument >::value))
CountedPtr< ShapePointFunctor > myShapePointFunctor
Smart pointer on functor point -> {0,1}.
const KernelSpelFunctor myKernelFunctor
Kernel functor (on Spel)
EuclideanShapesCSG< KernelSupport, KernelSupport > EuclideanMinus
CovarianceMatrixFunctor::Quantity Quantity
The returned type of the estimator, depends on the functor.
CountedPtr< KernelSupport > myKernel
Euclidean kernel.
Quantity eval(SurfelConstIterator it) const
DigitalSurfaceConvolver< ShapeSpelFunctor, KernelSpelFunctor, KSpace, DigitalShapeKernel > Convolver
OutputIterator eval(SurfelConstIterator itb, SurfelConstIterator ite, OutputIterator result) const
CountedPtr< DigitalShapeKernel > myDigKernel
Digital kernel.
Scalar myRadius
"digital" radius of the kernel (but may be non integer).
IntegralInvariantCovarianceEstimator(CovarianceMatrixFunctor fct=CovarianceMatrixFunctor())
void init(const double _h, SurfelConstIterator itb, SurfelConstIterator ite)
CountedConstPtrOrConstPtr< PointPredicate > myPointPredicate
Smart pointer (if required) on a point predicate.
FunctorOnCells< ShapePointFunctor, KSpace > ShapeSpelFunctor
std::vector< DigitalSet * > myKernelsSet
Array of shifting masks. Size = 9 for each shifting (0-adjacent and full kernel included)
void attach(ConstAlias< KSpace > K, ConstAlias< PointPredicate > aPointPredicate)
DigitalSetSelector< Domain, BIG_DS+HIGH_VAR_DS >::Type DigitalSet
IntegralInvariantCovarianceEstimator(ConstAlias< KSpace > K, ConstAlias< PointPredicate > aPointPredicate, CovarianceMatrixFunctor fct=CovarianceMatrixFunctor())
IntegralInvariantCovarianceEstimator< TKSpace, TPointPredicate, TCovarianceMatrixFunctor > Self
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< CovarianceMatrixFunctor, Matrix, Quantity >))
functors::PointFunctorFromPointPredicateAndDomain< PointPredicate, Domain, unsigned int > ShapePointFunctor
CovarianceMatrixFunctor myFct
The covariance matrix functor that transforms the II covariance matrix into a quantity.
CountedPtr< Domain > myShapeDomain
Smart pointer on domain
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< ShapeSpelFunctor >))
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< KSpace >))
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
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 ATu0v1< TKSpace, TLinearAlgebra > &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.
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
Create a point functor from a point predicate and a domain.
KSpace K