34#if defined(DigitalSurfaceConvolver_RECURSES)
35#error Recursive header files inclusion detected in DigitalSurfaceConvolver.h
38#define DigitalSurfaceConvolver_RECURSES
40#if !defined DigitalSurfaceConvolver_h
42#define DigitalSurfaceConvolver_h
47#include "DGtal/base/Common.h"
48#include "DGtal/kernel/PointVector.h"
49#include "DGtal/math/linalg/SimpleMatrix.h"
50#include "DGtal/base/ConstAlias.h"
51#include "DGtal/base/Alias.h"
52#include "DGtal/base/Clone.h"
53#include "DGtal/topology/CCellFunctor.h"
54#include "DGtal/topology/CanonicSCellEmbedder.h"
55#include "DGtal/topology/SCellsFunctors.h"
74template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel, Dimension dimension = TKSpace::dimension >
93 typedef typename KSpace::Space::RealPoint
RealPoint;
96 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
148 ConstAlias< std::vector< PairIterators > > masks );
167 ConstAlias< std::vector< PairIterators > > masks );
178 template<
typename SurfelIterator >
193 template<
typename SurfelIterator,
typename EvalFunctor >
194 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
195 EvalFunctor functor )
const;
208 template<
typename SurfelIterator,
typename OutputIterator >
209 void eval (
const SurfelIterator & itbegin,
210 const SurfelIterator & itend,
211 OutputIterator & result )
const;
225 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
226 void eval (
const SurfelIterator & itbegin,
227 const SurfelIterator & itend,
228 OutputIterator & result,
229 EvalFunctor functor )
const;
241 template<
typename SurfelIterator >
255 template<
typename SurfelIterator,
typename EvalFunctor >
257 EvalFunctor functor )
const;
269 template<
typename SurfelIterator,
typename OutputIterator >
271 const SurfelIterator & itend,
272 OutputIterator & result )
const;
286 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
288 const SurfelIterator & itend,
289 OutputIterator & result,
290 EvalFunctor functor )
const;
353 template<
typename SurfelIterator >
357 bool useLastResults =
false,
377 template<
typename SurfelIterator >
381 bool useLastResults =
false,
438template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel >
462 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
513 ConstAlias< std::vector< PairIterators > > masks );
532 ConstAlias< std::vector< PairIterators > > masks );
543 template<
typename SurfelIterator >
558 template<
typename SurfelIterator,
typename EvalFunctor >
559 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
560 EvalFunctor functor )
const;
573 template<
typename SurfelIterator,
typename OutputIterator >
574 void eval (
const SurfelIterator & itbegin,
575 const SurfelIterator & itend,
576 OutputIterator & result )
const;
590 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
591 void eval (
const SurfelIterator & itbegin,
592 const SurfelIterator & itend,
593 OutputIterator & result,
594 EvalFunctor functor )
const;
606 template<
typename SurfelIterator >
620 template<
typename SurfelIterator,
typename EvalFunctor >
622 EvalFunctor functor )
const;
634 template<
typename SurfelIterator,
typename OutputIterator >
636 const SurfelIterator & itend,
637 OutputIterator & result )
const;
651 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
653 const SurfelIterator & itend,
654 OutputIterator & result,
655 EvalFunctor functor )
const;
718 template<
typename SurfelIterator >
722 bool useLastResults =
false,
742 template<
typename SurfelIterator >
746 bool useLastResults =
false,
805template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel >
830 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
883 ConstAlias< std::vector< PairIterators > > masks );
902 ConstAlias< std::vector< PairIterators > > masks );
913 template<
typename SurfelIterator >
928 template<
typename SurfelIterator,
typename EvalFunctor >
929 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
930 EvalFunctor functor )
const;
943 template<
typename SurfelIterator,
typename OutputIterator >
944 void eval (
const SurfelIterator & itbegin,
945 const SurfelIterator & itend,
946 OutputIterator & result )
const;
960 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
961 void eval (
const SurfelIterator & itbegin,
962 const SurfelIterator & itend,
963 OutputIterator & result,
964 EvalFunctor functor )
const;
976 template<
typename SurfelIterator >
990 template<
typename SurfelIterator,
typename EvalFunctor >
992 EvalFunctor functor )
const;
1004 template<
typename SurfelIterator,
typename OutputIterator >
1006 const SurfelIterator & itend,
1007 OutputIterator & result )
const;
1021 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
1023 const SurfelIterator & itend,
1024 OutputIterator & result,
1025 EvalFunctor functor )
const;
1089 template<
typename SurfelIterator >
1093 bool useLastResults =
false,
1113 template<
typename SurfelIterator >
1117 bool useLastResults =
false,
1183template<
typename TF,
typename TKF,
typename TKS,
typename TDK, Dimension dimension >
1187template<
typename TF,
typename TKF,
typename TKS,
typename TDK >
1191template<
typename TF,
typename TKF,
typename TKS,
typename TDK >
1201#include "DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih"
1209#undef DigitalSurfaceConvolver_RECURSES
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Container::const_iterator ConstIterator
ConstIterator type of the container;.
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
const Dimension dimension
Current dimension (= 2)
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
Z2i::DigitalSet::ConstIterator KernelConstIterator
KSpace::Space::RealPoint RealPoint
void init(const Point &pOrigin, ConstAlias< PairIterators > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< Functor >))
EvalFunctor::Value eval(const SurfelIterator &it, EvalFunctor functor) const
DigitalSurfaceConvolver(ConstAlias< Functor > f, ConstAlias< KernelFunctor > g, ConstAlias< KSpace > space)
const KSpace & myKSpace
Const ref of the shape Kspace.
CanonicSCellEmbedder< KSpace > Embedder
SimpleMatrix< double, 2, 2 > CovarianceMatrix
CovarianceMatrix evalCovarianceMatrix(const SurfelIterator &it) const
const DigitalKernel * myKernel
Two choice to iterate over the full kernel. See init() for more information.
bool core_eval(const SurfelIterator &it, Quantity &innerSum, Quantity &outerSum, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity &lastInnerSum=defaultInnerSum, Quantity &lastOuterSum=defaultOuterSum) const
core_eval method used ( in intern by eval() ) to compute the Quantity on a given surfel (*it)
static Spel defaultOuterSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
TDigitalKernel DigitalKernel
std::pair< KernelConstIterator, KernelConstIterator > PairIterators
void computeCovarianceMatrix(const Quantity *aMomentMatrix, CovarianceMatrix &aCovarianceMatrix) const
computeCovarianceMatrix compute the covariance matrix from matrix of moments.
const KernelFunctor & myGFunctor
Const ref of the kernel functor.
DigitalSurfaceConvolver(const DigitalSurfaceConvolver &other)
Quantity eval(const SurfelIterator &it) const
static Quantity defaultOuterSum
default Quantity, used as default parameter in core_eval function
TKernelFunctor KernelFunctor
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
void fillMoments(Quantity *aMomentMatrix, const Spel &aSpel, double direction) const
fillMoments fill the matrix of moments with a given spel.
Embedder myEmbedder
Converter Digital point -> Euclidean point.
EvalFunctor::Value evalCovarianceMatrix(const SurfelIterator &it, EvalFunctor functor) const
Spel myKernelSpelOrigin
Copy of the origin cell of the kernel.
static Quantity defaultInnerSum
default Quantity, used as default parameter in core_eval function
bool isInitFullMasks
If the user uses init with masks. See init() for more information.
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
const std::vector< PairIterators > * myMasks
Pointer of vector of iterators for kernel partial masks.
bool core_evalCovarianceMatrix(const SurfelIterator &it, CovarianceMatrix &innerMatrix, CovarianceMatrix &outerMatrix, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity *lastInnerMoments=defaultInnerMoments, Quantity *lastOuterMoments=defaultOuterMoments) const
core_evalCovarianceMatrix method used ( in intern by evalCovarianceMatrix() ) to compute the covarian...
bool isInitKernelAndMasks
If the user uses init with masks and digital (full) kernel. See init() for more information.
static Spel defaultInnerSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
static const int nbMoments
the number of moments is dependent to the dimension. In 2D, they are 6 moments such that p+q <= 2....
const PairIterators * myKernelMask
Two choice to iterate over the full kernel. See init() for more information.
DigitalSurfaceConvolver()
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< KernelFunctor >))
PointVector< 2, Quantity > VectorQuantity
const Functor & myFFunctor
Const ref of the shape functor.
~DigitalSurfaceConvolver()
SimpleMatrix< Quantity, 2, 2 > MatrixQuantity
void init(const Point &pOrigin, ConstAlias< DigitalKernel > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
CanonicSCellEmbedder< KSpace > Embedder
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
std::pair< KernelConstIterator, KernelConstIterator > PairIterators
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< KernelFunctor >))
~DigitalSurfaceConvolver()
static Quantity defaultOuterSum
default Quantity, used as default parameter in core_eval function
const PairIterators * myKernelMask
Two choice to iterate over the full kernel. See init() for more information.
const KernelFunctor & myGFunctor
Const ref of the kernel functor.
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
TKernelFunctor KernelFunctor
bool core_evalCovarianceMatrix(const SurfelIterator &it, CovarianceMatrix &innerMatrix, CovarianceMatrix &outerMatrix, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity *lastInnerMoments=defaultInnerMoments, Quantity *lastOuterMoments=defaultOuterMoments) const
core_evalCovarianceMatrix method used ( in intern by evalCovarianceMatrix() ) to compute the covarian...
void init(const Point &pOrigin, ConstAlias< DigitalKernel > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
bool core_eval(const SurfelIterator &it, Quantity &innerSum, Quantity &outerSum, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity &lastInnerSum=defaultInnerSum, Quantity &lastOuterSum=defaultOuterSum) const
core_eval method used ( in intern by eval() ) to compute the Quantity on a given surfel (*it)
const KSpace & myKSpace
Const ref of the shape Kspace.
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
const std::vector< PairIterators > * myMasks
Pointer of vector of iterators for kernel partial masks.
PointVector< 3, Quantity > VectorQuantity
void computeCovarianceMatrix(const Quantity *aMomentMatrix, CovarianceMatrix &aCovarianceMatrix) const
computeCovarianceMatrix compute the covariance matrix from matrix of moments.
SimpleMatrix< Quantity, 3, 3 > MatrixQuantity
CovarianceMatrix evalCovarianceMatrix(const SurfelIterator &it) const
DigitalSurfaceConvolver()
SimpleMatrix< double, 3, 3 > CovarianceMatrix
EvalFunctor::Value evalCovarianceMatrix(const SurfelIterator &it, EvalFunctor functor) const
static Quantity defaultInnerSum
default Quantity, used as default parameter in core_eval function
Quantity eval(const SurfelIterator &it) const
DigitalSurfaceConvolver(const DigitalSurfaceConvolver &other)
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
bool isInitFullMasks
If the user uses init with masks. See init() for more information.
Z3i::DigitalSet::ConstIterator KernelConstIterator
bool isInitKernelAndMasks
If the user uses init with masks and digital (full) kernel. See init() for more information.
KSpace::Space::RealPoint RealPoint
Embedder myEmbedder
Converter Digital point -> Euclidean point.
static const int nbMoments
the number of moments is dependent to the dimension. In 3D, they are 10 moments such that p+q+s <= 2 ...
const Functor & myFFunctor
Const ref of the shape functor.
const DigitalKernel * myKernel
Two choice to iterate over the full kernel. See init() for more information.
DigitalSurfaceConvolver(ConstAlias< Functor > f, ConstAlias< KernelFunctor > g, ConstAlias< KSpace > space)
void init(const Point &pOrigin, ConstAlias< PairIterators > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
TDigitalKernel DigitalKernel
Spel myKernelSpelOrigin
Copy of the origin cell of the kernel.
static Spel defaultInnerSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
EvalFunctor::Value eval(const SurfelIterator &it, EvalFunctor functor) const
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< Functor >))
static Spel defaultOuterSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
void fillMoments(Quantity *aMomentMatrix, const Spel &aSpel, double direction) const
fillMoments fill the matrix of moments with a given spel.
const Dimension dimension
Current dimension (= 3)
void computeCovarianceMatrix(const Quantity *aMomentMatrix, CovarianceMatrix &aCovarianceMatrix) const
computeCovarianceMatrix compute the covariance matrix from matrix of moments.
static Quantity defaultOuterSum
default Quantity, used as default parameter in core_eval function
TDigitalKernel DigitalKernel
static const int nbMoments
the number of moments is dependent to the dimension. In 2D, they are 6 moments such that p+q <= 2 (se...
~DigitalSurfaceConvolver()
const Functor & myFFunctor
Const ref of the shape functor.
std::pair< KernelConstIterator, KernelConstIterator > PairIterators
Embedder myEmbedder
Converter Digital point -> Euclidean point.
bool isInitKernelAndMasks
If the user uses init with masks and digital (full) kernel. See init() for more information.
static Quantity defaultInnerMoments[6]
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function
Quantity eval(const SurfelIterator &it) const
static Quantity defaultInnerSum
default Quantity, used as default parameter in core_eval function
Z2i::DigitalSet::ConstIterator KernelConstIterator
Spel myKernelSpelOrigin
Copy of the origin cell of the kernel.
static Quantity defaultOuterMoments[6]
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function
DigitalSurfaceConvolver()
void init(const Point &pOrigin, ConstAlias< DigitalKernel > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
bool core_eval(const SurfelIterator &it, Quantity &innerSum, Quantity &outerSum, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity &lastInnerSum=defaultInnerSum, Quantity &lastOuterSum=defaultOuterSum) const
core_eval method used ( in intern by eval() ) to compute the Quantity on a given surfel (*it)
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
const DigitalKernel * myKernel
Two choice to iterate over the full kernel. See init() for more information.
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< Functor >))
const KernelFunctor & myGFunctor
Const ref of the kernel functor.
const std::vector< PairIterators > * myMasks
Pointer of vector of iterators for kernel partial masks.
static Spel defaultOuterSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
void init(const Point &pOrigin, ConstAlias< PairIterators > fullKernel, ConstAlias< std::vector< PairIterators > > masks)
bool core_evalCovarianceMatrix(const SurfelIterator &it, CovarianceMatrix &innerMatrix, CovarianceMatrix &outerMatrix, bool useLastResults=false, Spel &lastInnerSpel=defaultInnerSpel, Spel &lastOuterSpel=defaultOuterSpel, Quantity *lastInnerMoments=defaultInnerMoments, Quantity *lastOuterMoments=defaultOuterMoments) const
core_evalCovarianceMatrix method used ( in intern by evalCovarianceMatrix() ) to compute the covarian...
PointVector< dimension, Quantity > VectorQuantity
SimpleMatrix< Quantity, dimension, dimension > MatrixQuantity
const PairIterators * myKernelMask
Two choice to iterate over the full kernel. See init() for more information.
const KSpace & myKSpace
Const ref of the shape Kspace.
EvalFunctor::Value eval(const SurfelIterator &it, EvalFunctor functor) const
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const
void eval(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
BOOST_CONCEPT_ASSERT((concepts::CCellFunctor< KernelFunctor >))
DigitalSurfaceConvolver(ConstAlias< Functor > f, ConstAlias< KernelFunctor > g, ConstAlias< KSpace > space)
static Spel defaultInnerSpel
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
bool isInitFullMasks
If the user uses init with masks. See init() for more information.
CovarianceMatrix evalCovarianceMatrix(const SurfelIterator &it) const
EvalFunctor::Value evalCovarianceMatrix(const SurfelIterator &it, EvalFunctor functor) const
KSpace::Space::RealPoint RealPoint
DigitalSurfaceConvolver(const DigitalSurfaceConvolver &other)
void evalCovarianceMatrix(const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const
TKernelFunctor KernelFunctor
SimpleMatrix< double, dimension, dimension > CovarianceMatrix
DigitalSurfaceConvolver & operator=(const DigitalSurfaceConvolver &other)
void fillMoments(Quantity *aMomentMatrix, const Spel &aSpel, double direction) const
fillMoments fill the matrix of moments with a given spel.
CanonicSCellEmbedder< KSpace > Embedder
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: implements basic MxN Matrix services (M,N>=1).
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Aim: Defines a functor on cells.