DGtal 1.3.0
|
#include <DGtal/geometry/surfaces/DigitalSurfaceConvolver.h>
Public Types | |
typedef TFunctor | Functor |
typedef TKSpace | KSpace |
typedef TKernelFunctor | KernelFunctor |
typedef TDigitalKernel | DigitalKernel |
typedef Z3i::Domain | Domain |
typedef double | Quantity |
typedef PointVector< 3, Quantity > | VectorQuantity |
typedef SimpleMatrix< Quantity, 3, 3 > | MatrixQuantity |
typedef SimpleMatrix< double, 3, 3 > | CovarianceMatrix |
typedef KSpace::SCell | Spel |
typedef KSpace::Point | Point |
typedef KSpace::Space::RealPoint | RealPoint |
typedef Z3i::DigitalSet::ConstIterator | KernelConstIterator |
typedef std::pair< KernelConstIterator, KernelConstIterator > | PairIterators |
typedef CanonicSCellEmbedder< KSpace > | Embedder |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CCellFunctor< Functor >)) | |
BOOST_CONCEPT_ASSERT ((concepts::CCellFunctor< KernelFunctor >)) | |
DigitalSurfaceConvolver (ConstAlias< Functor > f, ConstAlias< KernelFunctor > g, ConstAlias< KSpace > space) | |
DigitalSurfaceConvolver (const DigitalSurfaceConvolver &other) | |
~DigitalSurfaceConvolver () | |
void | init (const Point &pOrigin, ConstAlias< PairIterators > fullKernel, ConstAlias< std::vector< PairIterators > > masks) |
void | init (const Point &pOrigin, ConstAlias< DigitalKernel > fullKernel, ConstAlias< std::vector< PairIterators > > masks) |
template<typename SurfelIterator > | |
Quantity | eval (const SurfelIterator &it) const |
template<typename SurfelIterator , typename EvalFunctor > | |
EvalFunctor::Value | eval (const SurfelIterator &it, EvalFunctor functor) const |
template<typename SurfelIterator , typename OutputIterator > | |
void | eval (const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const |
template<typename SurfelIterator , typename OutputIterator , typename EvalFunctor > | |
void | eval (const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const |
template<typename SurfelIterator > | |
CovarianceMatrix | evalCovarianceMatrix (const SurfelIterator &it) const |
template<typename SurfelIterator , typename EvalFunctor > | |
EvalFunctor::Value | evalCovarianceMatrix (const SurfelIterator &it, EvalFunctor functor) const |
template<typename SurfelIterator , typename OutputIterator > | |
void | evalCovarianceMatrix (const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result) const |
template<typename SurfelIterator , typename OutputIterator , typename EvalFunctor > | |
void | evalCovarianceMatrix (const SurfelIterator &itbegin, const SurfelIterator &itend, OutputIterator &result, EvalFunctor functor) const |
bool | isValid () const |
Protected Member Functions | |
void | computeCovarianceMatrix (const Quantity *aMomentMatrix, CovarianceMatrix &aCovarianceMatrix) const |
computeCovarianceMatrix compute the covariance matrix from matrix of moments. More... | |
void | fillMoments (Quantity *aMomentMatrix, const Spel &aSpel, double direction) const |
fillMoments fill the matrix of moments with a given spel. More... | |
template<typename SurfelIterator > | |
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) More... | |
template<typename SurfelIterator > | |
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 covariance matrix on a given surfel (*it) More... | |
DigitalSurfaceConvolver () | |
Static Protected Attributes | |
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 (see method fillMoments()) More... | |
static Spel | defaultInnerSpel |
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions More... | |
static Spel | defaultOuterSpel |
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions More... | |
static Quantity | defaultInnerMoments [10] |
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function More... | |
static Quantity | defaultOuterMoments [10] |
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function More... | |
static Quantity | defaultInnerSum |
default Quantity, used as default parameter in core_eval function More... | |
static Quantity | defaultOuterSum |
default Quantity, used as default parameter in core_eval function More... | |
Private Member Functions | |
DigitalSurfaceConvolver & | operator= (const DigitalSurfaceConvolver &other) |
Private Attributes | |
const Dimension | dimension |
Current dimension (= 3) More... | |
const Functor & | myFFunctor |
Const ref of the shape functor. More... | |
const KernelFunctor & | myGFunctor |
Const ref of the kernel functor. More... | |
const KSpace & | myKSpace |
Const ref of the shape Kspace. More... | |
Embedder | myEmbedder |
Converter Digital point -> Euclidean point. More... | |
bool | isInitFullMasks |
If the user uses init with masks. See init() for more information. More... | |
bool | isInitKernelAndMasks |
If the user uses init with masks and digital (full) kernel. See init() for more information. More... | |
const std::vector< PairIterators > * | myMasks |
Pointer of vector of iterators for kernel partial masks. More... | |
const DigitalKernel * | myKernel |
Two choice to iterate over the full kernel. See init() for more information. More... | |
const PairIterators * | myKernelMask |
Two choice to iterate over the full kernel. See init() for more information. More... | |
Spel | myKernelSpelOrigin |
Copy of the origin cell of the kernel. More... | |
Definition at line 807 of file DigitalSurfaceConvolver.h.
typedef SimpleMatrix< double, 3, 3 > DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::CovarianceMatrix |
Definition at line 823 of file DigitalSurfaceConvolver.h.
typedef TDigitalKernel DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::DigitalKernel |
Definition at line 816 of file DigitalSurfaceConvolver.h.
typedef Z3i::Domain DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Domain |
Definition at line 818 of file DigitalSurfaceConvolver.h.
typedef CanonicSCellEmbedder< KSpace > DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Embedder |
Definition at line 832 of file DigitalSurfaceConvolver.h.
typedef TFunctor DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Functor |
Definition at line 813 of file DigitalSurfaceConvolver.h.
typedef Z3i::DigitalSet::ConstIterator DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::KernelConstIterator |
Definition at line 828 of file DigitalSurfaceConvolver.h.
typedef TKernelFunctor DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::KernelFunctor |
Definition at line 815 of file DigitalSurfaceConvolver.h.
typedef TKSpace DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::KSpace |
Definition at line 814 of file DigitalSurfaceConvolver.h.
typedef SimpleMatrix< Quantity, 3, 3 > DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::MatrixQuantity |
Definition at line 822 of file DigitalSurfaceConvolver.h.
typedef std::pair< KernelConstIterator, KernelConstIterator > DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::PairIterators |
Definition at line 831 of file DigitalSurfaceConvolver.h.
typedef KSpace::Point DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Point |
Definition at line 826 of file DigitalSurfaceConvolver.h.
typedef double DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Quantity |
Definition at line 820 of file DigitalSurfaceConvolver.h.
typedef KSpace::Space::RealPoint DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::RealPoint |
Definition at line 827 of file DigitalSurfaceConvolver.h.
typedef KSpace::SCell DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::Spel |
Definition at line 825 of file DigitalSurfaceConvolver.h.
typedef PointVector< 3, Quantity > DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::VectorQuantity |
Definition at line 821 of file DigitalSurfaceConvolver.h.
DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::DigitalSurfaceConvolver | ( | ConstAlias< Functor > | f, |
ConstAlias< KernelFunctor > | g, | ||
ConstAlias< KSpace > | space | ||
) |
Constructor.
[in] | f | a functor f(x). |
[in] | g | a functor g(x). |
[in] | space | space in which the shape is defined. |
DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::DigitalSurfaceConvolver | ( | const DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 > & | other | ) |
Copy constructor.
other | the object to clone. |
|
inline |
|
protected |
Constructor. Forbidden by default (protected to avoid g++ warnings).
DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CCellFunctor< Functor >) | ) |
DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::BOOST_CONCEPT_ASSERT | ( | (concepts::CCellFunctor< KernelFunctor >) | ) |
|
protected |
computeCovarianceMatrix compute the covariance matrix from matrix of moments.
[in] | aMomentMatrix | a matrix of digital moments [ sum(1) sum(z) sum(y) sum (x) sum(y*z) sum(x*z) sum(x*y) sum(z*z) sum(y*y) sum(x*x) ] |
[out] | aCovarianceMatrix | the result covariance matrix |
|
protected |
core_eval method used ( in intern by eval() ) to compute the Quantity on a given surfel (*it)
[in] | it | (iterator of a) surfel of the shape where the convolution is computed. |
[out] | innerSum | the result Quantity when centering with the innerSpel. |
[out] | outerSum | the result Quantity when centering with the outerSpel. |
[in] | useLastResults | if we can use last results (optimisation with masks) |
[in,out] | lastInnerSpel | last inner spel. Override at end of function with current inner spel (from surfel *it). Set empty if useLastResults is false. |
[in,out] | lastOuterSpel | last outer spel. Override at end of function with current outer spel (from surfel *it). Set empty if useLastResults is false. |
[in] | lastInnerSum | last Quantity when centering with inner spel. Set empty if useLastResults is false. |
[in] | lastOuterSum | last Quantity when centering with outer spel. Set empty if useLastResults is false. |
SurfelIterator | type of iterator on surfel |
|
protected |
core_evalCovarianceMatrix method used ( in intern by evalCovarianceMatrix() ) to compute the covariance matrix on a given surfel (*it)
[in] | it | (iterator of a) surfel of the shape where the convolution is computed. |
[out] | innerMatrix | the result covariance matrix when centering with the innerSpel. |
[out] | outerMatrix | the result covariance matrix when centering with the outerSpel. |
[in] | useLastResults | if we can use last results (optimisation with masks) |
[in,out] | lastInnerSpel | last inner spel. Override at end of function with current inner spel (from surfel *it). Set empty if useLastResults is false. |
[in,out] | lastOuterSpel | last outer spel. Override at end of function with current outer spel (from surfel *it). Set empty if useLastResults is false. |
[in,out] | lastInnerMoments | last inner moments when centering with inner spel. Override at end of function with current inner moments (from surfel *it). Set empty if useLastResults is false. |
[in,out] | lastOuterMoments | last inner moments when centering with inner spel. Override at end of function with current outer moments (from surfel *it). Set empty if useLastResults is false. |
SurfelIterator | type of iterator on surfel |
Quantity DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::eval | ( | const SurfelIterator & | it | ) | const |
Convolve the kernel at a position it.
[in] | it | (iterator of a) surfel of the shape where the convolution is computed. |
SurfelIterator | type of iterator of a surfel on the shape. |
EvalFunctor::Value DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::eval | ( | const SurfelIterator & | it, |
EvalFunctor | functor | ||
) | const |
Convolve the kernel at a position it and applies the functor functor on the result.
[in] | it | (iterator of a) surfel of the shape where the convolution is computed. |
[in] | functor | functor called with the result of the convolution. |
SurfelIterator | type of iterator of a surfel on the shape. |
EvalFunctor | type of functor on Quantity. |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::eval | ( | const SurfelIterator & | itbegin, |
const SurfelIterator & | itend, | ||
OutputIterator & | result | ||
) | const |
Convolve the kernel at all positions of the range [itBegin, itEnd[ and outputs results sequentially with result iterator.
[in] | itbegin | (iterator of the) first surfel of the shape where the convolution is computed. |
[in] | itend | (iterator of the) last (excluded) surfel of the shape where the convolution is computed. |
[out] | result | iterator of an array where estimates quantities are set ( the estimated quantity from *itbegin till *itend (excluded)). |
SurfelIterator | type of iterator of a surfel on the shape. |
OutputIterator | type of iterator on an array when Quantity are stored. |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::eval | ( | const SurfelIterator & | itbegin, |
const SurfelIterator & | itend, | ||
OutputIterator & | result, | ||
EvalFunctor | functor | ||
) | const |
Convolve the kernel at all positions of the range [itBegin, itEnd[ and applies the functor functor on results outputed sequentially with result iterator.
[in] | itbegin | (iterator of the) first surfel of the shape where the convolution is computed. |
[in] | itend | (iterator of the) last (excluded) surfel of the shape where the convolution is computed. |
[out] | result | iterator of an array where estimates quantities are set ( the estimated quantity from *itbegin till *itend (excluded)). |
[in] | functor | functor called with the result of the convolution. |
SurfelIterator | type of iterator of a surfel on the shape. |
OutputIterator | type of iterator on an array when Quantity are stored. |
EvalFunctor | type of functor on Quantity. |
CovarianceMatrix DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::evalCovarianceMatrix | ( | const SurfelIterator & | it | ) | const |
Convolve the kernel at a position it.
[in] | it | (iterator of a) surfel of the shape where the covariance matrix is computed. |
SurfelIterator | type of iterator of a surfel on the shape. |
EvalFunctor::Value DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::evalCovarianceMatrix | ( | const SurfelIterator & | it, |
EvalFunctor | functor | ||
) | const |
Convolve the kernel at a position it and applies the functor functor on the result.
[in] | it | (iterator of a) surfel of the shape where the covariance matrix is computed. |
[in] | functor | functor called with the result of the convolution. |
SurfelIterator | type of iterator of a surfel on the shape. |
EvalFunctor | type of functor on CovarianceMatrix. |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::evalCovarianceMatrix | ( | const SurfelIterator & | itbegin, |
const SurfelIterator & | itend, | ||
OutputIterator & | result | ||
) | const |
Convolve the kernel at all positions of the range [itBegin, itEnd[ and outputs results sequentially with result iterator.
[in] | itbegin | (iterator of the) first surfel of the shape where the covariance matrix is computed. |
[in] | itend | (iterator of the) last (excluded) surfel of the shape where the covariance matrix is computed. |
[out] | result | iterator of an array where estimates covariance matrix are set ( the covariance matrix from *itbegin till *itend (excluded)). |
SurfelIterator | type of iterator of a surfel on the shape. |
OutputIterator | type of iterator on an array when Quantity are stored. |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::evalCovarianceMatrix | ( | const SurfelIterator & | itbegin, |
const SurfelIterator & | itend, | ||
OutputIterator & | result, | ||
EvalFunctor | functor | ||
) | const |
Convolve the kernel at all positions of the range [itBegin, itEnd[ and applies the functor functor on results outputed sequentially with result iterator.
[in] | itbegin | (iterator of the) first surfel of the shape where the covariance matrix is computed. |
[in] | itend | (iterator of the) last (excluded) surfel of the shape where the covariance matrix is computed. |
[out] | result | iterator of an array where results of functor are set. |
[in] | functor | functor called with the result of the convolution. |
SurfelIterator | type of iterator of a surfel on the shape. |
OutputIterator | type of iterator on an array when Quantity are stored. |
EvalFunctor | type of functor on CovarianceMatrix. |
|
protected |
fillMoments fill the matrix of moments with a given spel.
[out] | aMomentMatrix | a matrix of digital moments [ sum(1) sum(z) sum(y) sum (x) sum(y*z) sum(x*z) sum(x*y) sum(z*z) sum(y*y) sum(x*x) ] |
[in] | aSpel | current spel |
[in] | direction | true if we add the current spel, false if we remove it. |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::init | ( | const Point & | pOrigin, |
ConstAlias< DigitalKernel > | fullKernel, | ||
ConstAlias< std::vector< PairIterators > > | masks | ||
) |
Intitialize the convolver using masks - allow to use the optimization with adjacent cells.
Stores the kernel implicitly: choose this init if you have not a lot of memory available or if your kernel size is big.
[in] | pOrigin | center (digital point) of the kernel support. |
[in] | fullKernel | pointer of the digital (full) kernel. |
[in] | masks | Vector of iterators (of spel) of the first and last spel of each masks. They must be ordered using a trit ({0,1,2}) encoded array. trit 0 => shifting_coord = -1 trit 1 => shifting_coord = 0 trit 2 => shifting_coord = 1 Example in 3D : zyx x y z mask[0] : base3(0) = 000 => shifting = {-1,-1,-1} mask[5] : base3(5) = 012 => shifting = { 1, 0,-1} |
void DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::init | ( | const Point & | pOrigin, |
ConstAlias< PairIterators > | fullKernel, | ||
ConstAlias< std::vector< PairIterators > > | masks | ||
) |
Initialize the convolver using masks - allow to use the optimization with adjacent cells.
Stores the full kernel explicitly: choose this init if you have a lot of memory or if your kernel is small
[in] | pOrigin | center (digital point) of the kernel support. |
[in] | fullKernel | pair of iterators of the full kernel. first is the first iterator (of spel) of the kernel support, second is the last iterator (of spel, excluded). |
[in] | masks | Vector of iterators (of spel) of the first and last spel of each masks. They must be ordered using a trit ({0,1,2}) encoded array. trit 0 => shifting_coord = -1 trit 1 => shifting_coord = 0 trit 2 => shifting_coord = 1 Example in 3D : zyx x y z mask[0] : base3(0) = 000 => shifting = {-1,-1,-1} mask[5] : base3(5) = 012 => shifting = { 1, 0,-1} |
bool DGtal::DigitalSurfaceConvolver< TFunctor, TKernelFunctor, TKSpace, TDigitalKernel, 3 >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
|
private |
Assignment.
other | the object to copy. |
|
staticprotected |
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function
Definition at line 1071 of file DigitalSurfaceConvolver.h.
|
staticprotected |
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
Definition at line 1069 of file DigitalSurfaceConvolver.h.
|
staticprotected |
default Quantity, used as default parameter in core_eval function
Definition at line 1073 of file DigitalSurfaceConvolver.h.
|
staticprotected |
default array of Quantity, used as default parameter in core_evalCovarianceMatrix function
Definition at line 1072 of file DigitalSurfaceConvolver.h.
|
staticprotected |
default Spel, used as default parameter in core_eval and core_evalCovarianceMatrix functions
Definition at line 1070 of file DigitalSurfaceConvolver.h.
|
staticprotected |
default Quantity, used as default parameter in core_eval function
Definition at line 1074 of file DigitalSurfaceConvolver.h.
|
private |
Current dimension (= 3)
Definition at line 1129 of file DigitalSurfaceConvolver.h.
|
private |
If the user uses init with masks. See init() for more information.
Definition at line 1140 of file DigitalSurfaceConvolver.h.
|
private |
If the user uses init with masks and digital (full) kernel. See init() for more information.
Definition at line 1142 of file DigitalSurfaceConvolver.h.
|
private |
Converter Digital point -> Euclidean point.
Definition at line 1138 of file DigitalSurfaceConvolver.h.
|
private |
Const ref of the shape functor.
Definition at line 1131 of file DigitalSurfaceConvolver.h.
|
private |
Const ref of the kernel functor.
Definition at line 1133 of file DigitalSurfaceConvolver.h.
|
private |
Two choice to iterate over the full kernel. See init() for more information.
Definition at line 1146 of file DigitalSurfaceConvolver.h.
|
private |
Two choice to iterate over the full kernel. See init() for more information.
Definition at line 1147 of file DigitalSurfaceConvolver.h.
|
private |
Copy of the origin cell of the kernel.
Definition at line 1149 of file DigitalSurfaceConvolver.h.
|
private |
Const ref of the shape Kspace.
Definition at line 1136 of file DigitalSurfaceConvolver.h.
|
private |
Pointer of vector of iterators for kernel partial masks.
Definition at line 1144 of file DigitalSurfaceConvolver.h.
|
staticprotected |
the number of moments is dependent to the dimension. In 3D, they are 10 moments such that p+q+s <= 2 (see method fillMoments())
Definition at line 1067 of file DigitalSurfaceConvolver.h.