[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

Namespaces | Functions
Convolution filters for multi-dimensional arrays.

Namespaces

namespace  vigra::detail

Functions

template<... >
void convolveMultiArrayOneDimension (...)
 Convolution along a single dimension of a multi-dimensional arrays.
template<... >
void gaussianGradientMultiArray (...)
 Calculate Gaussian gradient of a multi-dimensional arrays.
template<... >
void gaussianSmoothMultiArray (...)
 Isotropic Gaussian smoothing of a multi-dimensional arrays.
template<... >
void hessianOfGaussianMultiArray (...)
 Calculate Hessian matrix of a N-dimensional arrays using Gaussian derivative filters.
template<... >
void laplacianOfGaussianMultiArray (...)
 Calculate Laplacian of a N-dimensional arrays using Gaussian derivative filters.
template<... >
void separableConvolveMultiArray (...)
 Separated convolution on multi-dimensional arrays.
template<... >
void structureTensorMultiArray (...)
 Calculate th structure tensor of a multi-dimensional arrays.
template<... >
void symmetricGradientMultiArray (...)
 Calculate gradient of a multi-dimensional arrays using symmetric difference filters.

Detailed Description

These functions realize a separable convolution on an arbitrary dimensional array that is specified by iterators (compatible to Multi-dimensional Array Iterators) and shape objects. It can therefore be applied to a wide range of data structures (vigra::MultiArrayView, vigra::MultiArray etc.).


Function Documentation

void vigra::separableConvolveMultiArray (   ...)

Separated convolution on multi-dimensional arrays.

This function computes a separated convolution on all dimensions of the given multi-dimensional array. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size.

There are two variants of this functions: one takes a single kernel of type vigra::Kernel1D which is then applied to all dimensions, whereas the other requires an iterator referencing a sequence of vigra::Kernel1D objects, one for every dimension of the data. Then the first kernel in this sequence is applied to the innermost dimension (e.g. the x-dimension of an image), while the last is applied to the outermost dimension (e.g. the z-dimension in a 3D image).

This function may work in-place, which means that siter == diter is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause round-off errors (i.e. if typeid(typename NumericTraits<typename DestAccessor::value_type>::RealPromote) != typeid(typename DestAccessor::value_type).

Declarations:

pass arguments explicitly:

    namespace vigra {
        // apply the same kernel to all dimensions
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class T>
        void
        separableConvolveMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                    DestIterator diter, DestAccessor dest,
                                    Kernel1D<T> const & kernel);

        // apply each kernel from the sequence 'kernels' in turn
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class KernelIterator>
        void
        separableConvolveMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                    DestIterator diter, DestAccessor dest,
                                    KernelIterator kernels);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        // apply the same kernel to all dimensions
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class T>
        void
        separableConvolveMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                    pair<DestIterator, DestAccessor> const & dest,
                                    Kernel1D<T> const & kernel);

        // apply each kernel from the sequence 'kernels' in turn
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class KernelIterator>
        void
        separableConvolveMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                    pair<DestIterator, DestAccessor> const & dest,
                                    KernelIterator kernels);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, unsigned char>::size_type shape(width, height, depth);
    MultiArray<3, unsigned char> source(shape);
    MultiArray<3, float> dest(shape);
    ...
    Kernel1D<float> gauss;
    gauss.initGaussian(sigma);
    // create 3 Gauss kernels, one for each dimension
    ArrayVector<Kernel1D<float> > kernels(3, gauss);

    // perform Gaussian smoothing on all dimensions
    separableConvolveMultiArray(srcMultiArrayRange(source), destMultiArray(dest), 
                                kernels.begin());
See also:
vigra::Kernel1D, convolveLine()
void vigra::convolveMultiArrayOneDimension (   ...)

Convolution along a single dimension of a multi-dimensional arrays.

This function computes a convolution along one dimension (specified by the parameter dim of the given multi-dimensional array with the given kernel. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size.

This function may work in-place, which means that siter == diter is allowed.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class T>
        void
        convolveMultiArrayOneDimension(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                       DestIterator diter, DestAccessor dest,
                                       unsigned int dim, vigra::Kernel1D<T> const & kernel);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor, class T>
        void
        convolveMultiArrayOneDimension(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                       pair<DestIterator, DestAccessor> const & dest,
                                       unsigned int dim, vigra::Kernel1D<T> const & kernel);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, unsigned char>::size_type shape(width, height, depth);
    MultiArray<3, unsigned char> source(shape);
    MultiArray<3, float> dest(shape);
    ...
    Kernel1D<float> gauss;
    gauss.initGaussian(sigma);

    // perform Gaussian smoothing along dimensions 1 (height)
    convolveMultiArrayOneDimension(srcMultiArrayRange(source), destMultiArray(dest), 1, gauss);
See also:
separableConvolveMultiArray()
void vigra::gaussianSmoothMultiArray (   ...)

Isotropic Gaussian smoothing of a multi-dimensional arrays.

This function computes an isotropic convolution of the given multi-dimensional array with a Gaussian filter at the given standard deviation sigma. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size. This function may work in-place, which means that siter == diter is allowed. It is implemented by a call to separableConvolveMultiArray() with the appropriate kernel. If the data are anisotropic (different pixel size along different dimensions) you should call separableConvolveMultiArray() directly with the appropriate anisotropic Gaussians.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        gaussianSmoothMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                 DestIterator diter, DestAccessor dest,
                                 double sigma);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        gaussianSmoothMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                 pair<DestIterator, DestAccessor> const & dest,
                                 double sigma);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, unsigned char>::size_type shape(width, height, depth);
    MultiArray<3, unsigned char> source(shape);
    MultiArray<3, float> dest(shape);
    ...
    // perform isotropic Gaussian smoothing at scale 'sigma'
    gaussianSmoothMultiArray(srcMultiArrayRange(source), destMultiArray(dest), sigma);
See also:
separableConvolveMultiArray()
void vigra::gaussianGradientMultiArray (   ...)

Calculate Gaussian gradient of a multi-dimensional arrays.

This function computes the Gaussian gradient of the given multi-dimensional array with a sequence of first-derivative-of-Gaussian filters at the given standard deviation sigma (differentiation is applied to each dimension in turn, starting with the innermost dimension). Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to have a vector valued pixel type with as many elements as the number of dimensions. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels. If the data are anisotropic (different pixel size along different dimensions) you should call separableConvolveMultiArray() directly with the appropriate anisotropic Gaussian derivatives.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        gaussianGradientMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                   DestIterator diter, DestAccessor dest,
                                   double sigma);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        gaussianGradientMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                   pair<DestIterator, DestAccessor> const & dest,
                                   double sigma);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, unsigned char>::size_type shape(width, height, depth);
    MultiArray<3, unsigned char> source(shape);
    MultiArray<3, TinyVector<float, 3> > dest(shape);
    ...
    // compute Gaussian gradient at scale sigma
    gaussianGradientMultiArray(srcMultiArrayRange(source), destMultiArray(dest), sigma);

Required Interface:

see separableConvolveMultiArray(), in addition:

    int dimension = 0;
    VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also:
separableConvolveMultiArray()
void vigra::symmetricGradientMultiArray (   ...)

Calculate gradient of a multi-dimensional arrays using symmetric difference filters.

This function computes the gradient of the given multi-dimensional array with a sequence of symmetric difference filters a (differentiation is applied to each dimension in turn, starting with the innermost dimension). Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to have a vector valued pixel type with as many elements as the number of dimensions. This function is implemented by calls to convolveMultiArrayOneDimension() with the symmetric difference kernel.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        symmetricGradientMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                    DestIterator diter, DestAccessor dest);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        symmetricGradientMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                    pair<DestIterator, DestAccessor> const & dest);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, unsigned char>::size_type shape(width, height, depth);
    MultiArray<3, unsigned char> source(shape);
    MultiArray<3, TinyVector<float, 3> > dest(shape);
    ...
    // compute gradient
    symmetricGradientMultiArray(srcMultiArrayRange(source), destMultiArray(dest));

Required Interface:

see convolveMultiArrayOneDimension(), in addition:

    int dimension = 0;
    VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also:
convolveMultiArrayOneDimension()
void vigra::laplacianOfGaussianMultiArray (   ...)

Calculate Laplacian of a N-dimensional arrays using Gaussian derivative filters.

This function computes the Laplacian the given N-dimensional array with a sequence of second-derivative-of-Gaussian filters at the given standard deviation sigma. Both source and destination arrays are represented by iterators, shape objects and accessors. Both source and destination arrays must have scalar value_type. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels, followed by summation.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        laplacianOfGaussianMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                      DestIterator diter, DestAccessor dest,
                                      double sigma);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        laplacianOfGaussianMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                      pair<DestIterator, DestAccessor> const & dest,
                                      double sigma);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, float> source(shape);
    MultiArray<3, float> laplacian(shape);
    ...
    // compute Laplacian at scale sigma
    laplacianOfGaussianMultiArray(srcMultiArrayRange(source), destMultiArray(laplacian), sigma);

Required Interface:

see separableConvolveMultiArray(), in addition:

    int dimension = 0;
    VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also:
separableConvolveMultiArray()
void vigra::hessianOfGaussianMultiArray (   ...)

Calculate Hessian matrix of a N-dimensional arrays using Gaussian derivative filters.

This function computes the Hessian matrix the given scalar N-dimensional array with a sequence of second-derivative-of-Gaussian filters at the given standard deviation sigma. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array must have a vector valued element type with N*(N+1)/2 elements (it represents the upper triangular part of the symmetric Hessian matrix). This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        hessianOfGaussianMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                    DestIterator diter, DestAccessor dest,
                                    double sigma);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        hessianOfGaussianMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                    pair<DestIterator, DestAccessor> const & dest,
                                    double sigma);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, float> source(shape);
    MultiArray<3, TinyVector<float, 6> > dest(shape);
    ...
    // compute Hessian at scale sigma
    hessianOfGaussianMultiArray(srcMultiArrayRange(source), destMultiArray(dest), sigma);

Required Interface:

see separableConvolveMultiArray(), in addition:

    int dimension = 0;
    VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also:
separableConvolveMultiArray(), vectorToTensorMultiArray()
void vigra::structureTensorMultiArray (   ...)

Calculate th structure tensor of a multi-dimensional arrays.

This function computes the gradient (outer product) tensor for each element of the given N-dimensional array with first-derivative-of-Gaussian filters at the given innerScale, followed by Gaussian smoothing at outerScale. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array must have a vector valued pixel type with N*(N+1)/2 elements (it represents the upper triangular part of the symmetric structure tensor matrix). If the source array is also vector valued, the resulting structure tensor is the sum of the individual tensors for each channel. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        structureTensorMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
                                  DestIterator diter, DestAccessor dest,
                                  double innerScale, double outerScale);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcShape, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        structureTensorMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
                                  pair<DestIterator, DestAccessor> const & dest,
                                  double innerScale, double outerScale);
    }

Usage:

#include <vigra/multi_convolution.hxx>

    MultiArray<3, RGBValue<float> > source(shape);
    MultiArray<3, TinyVector<float, 6> > dest(shape);
    ...
    // compute structure tensor at scales innerScale and outerScale
    structureTensorMultiArray(srcMultiArrayRange(source), destMultiArray(dest), innerScale, outerScale);

Required Interface:

see separableConvolveMultiArray(), in addition:

    int dimension = 0;
    VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also:
separableConvolveMultiArray(), vectorToTensorMultiArray()

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.7.0 (Thu Aug 25 2011)