35#if defined(DigitalSurfaceConvolver_RECURSES)
36#error Recursive header files inclusion detected in DigitalSurfaceConvolver.h
39#define DigitalSurfaceConvolver_RECURSES
41#if !defined DigitalSurfaceConvolver_h
43#define DigitalSurfaceConvolver_h
48#include "DGtal/base/Common.h"
49#include "DGtal/kernel/PointVector.h"
50#include "DGtal/math/linalg/SimpleMatrix.h"
51#include "DGtal/base/ConstAlias.h"
52#include "DGtal/base/Alias.h"
53#include "DGtal/base/Clone.h"
54#include "DGtal/topology/CCellFunctor.h"
55#include "DGtal/topology/CanonicSCellEmbedder.h"
56#include "DGtal/topology/SCellsFunctors.h"
75template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel, Dimension dimension = TKSpace::dimension >
94 typedef typename KSpace::Space::RealPoint
RealPoint;
97 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
149 ConstAlias< std::vector< PairIterators > > masks );
168 ConstAlias< std::vector< PairIterators > > masks );
179 template<
typename SurfelIterator >
194 template<
typename SurfelIterator,
typename EvalFunctor >
195 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
196 EvalFunctor functor )
const;
209 template<
typename SurfelIterator,
typename OutputIterator >
210 void eval (
const SurfelIterator & itbegin,
211 const SurfelIterator & itend,
212 OutputIterator & result )
const;
226 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
227 void eval (
const SurfelIterator & itbegin,
228 const SurfelIterator & itend,
229 OutputIterator & result,
230 EvalFunctor functor )
const;
242 template<
typename SurfelIterator >
256 template<
typename SurfelIterator,
typename EvalFunctor >
258 EvalFunctor functor )
const;
270 template<
typename SurfelIterator,
typename OutputIterator >
272 const SurfelIterator & itend,
273 OutputIterator & result )
const;
287 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
289 const SurfelIterator & itend,
290 OutputIterator & result,
291 EvalFunctor functor )
const;
354 template<
typename SurfelIterator >
358 bool useLastResults =
false,
378 template<
typename SurfelIterator >
382 bool useLastResults =
false,
439template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel >
463 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
514 ConstAlias< std::vector< PairIterators > > masks );
533 ConstAlias< std::vector< PairIterators > > masks );
544 template<
typename SurfelIterator >
559 template<
typename SurfelIterator,
typename EvalFunctor >
560 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
561 EvalFunctor functor )
const;
574 template<
typename SurfelIterator,
typename OutputIterator >
575 void eval (
const SurfelIterator & itbegin,
576 const SurfelIterator & itend,
577 OutputIterator & result )
const;
591 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
592 void eval (
const SurfelIterator & itbegin,
593 const SurfelIterator & itend,
594 OutputIterator & result,
595 EvalFunctor functor )
const;
607 template<
typename SurfelIterator >
621 template<
typename SurfelIterator,
typename EvalFunctor >
623 EvalFunctor functor )
const;
635 template<
typename SurfelIterator,
typename OutputIterator >
637 const SurfelIterator & itend,
638 OutputIterator & result )
const;
652 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
654 const SurfelIterator & itend,
655 OutputIterator & result,
656 EvalFunctor functor )
const;
719 template<
typename SurfelIterator >
723 bool useLastResults =
false,
743 template<
typename SurfelIterator >
747 bool useLastResults =
false,
806template<
typename TFunctor,
typename TKernelFunctor,
typename TKSpace,
typename TDigitalKernel >
831 typedef std::pair< KernelConstIterator, KernelConstIterator >
PairIterators;
884 ConstAlias< std::vector< PairIterators > > masks );
903 ConstAlias< std::vector< PairIterators > > masks );
914 template<
typename SurfelIterator >
929 template<
typename SurfelIterator,
typename EvalFunctor >
930 typename EvalFunctor::Value
eval (
const SurfelIterator & it,
931 EvalFunctor functor )
const;
944 template<
typename SurfelIterator,
typename OutputIterator >
945 void eval (
const SurfelIterator & itbegin,
946 const SurfelIterator & itend,
947 OutputIterator & result )
const;
961 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
962 void eval (
const SurfelIterator & itbegin,
963 const SurfelIterator & itend,
964 OutputIterator & result,
965 EvalFunctor functor )
const;
977 template<
typename SurfelIterator >
991 template<
typename SurfelIterator,
typename EvalFunctor >
993 EvalFunctor functor )
const;
1005 template<
typename SurfelIterator,
typename OutputIterator >
1007 const SurfelIterator & itend,
1008 OutputIterator & result )
const;
1022 template<
typename SurfelIterator,
typename OutputIterator,
typename EvalFunctor >
1024 const SurfelIterator & itend,
1025 OutputIterator & result,
1026 EvalFunctor functor )
const;
1090 template<
typename SurfelIterator >
1094 bool useLastResults =
false,
1114 template<
typename SurfelIterator >
1118 bool useLastResults =
false,
1184template<
typename TF,
typename TKF,
typename TKS,
typename TDK, Dimension dimension >
1188template<
typename TF,
typename TKF,
typename TKS,
typename TDK >
1192template<
typename TF,
typename TKF,
typename TKS,
typename TDK >
1202#include "DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih"
1210#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.