VIGRA - Convolution filters for multi-dimensional arrays.

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

| Convolution filters for multi-dimensional arrays. |
--- | --- | ---

## Functions
template<...> void | separableConvolveMultiArray (SrcIterator s, SrcShape const &shape, SrcAccessor src, DestIterator d, DestAccessor dest, KernelIterator kernels)
| Separated convolution on multi-dimensional arrays.
template<...> void | convolveMultiArrayOneDimension (SrcIterator s, SrcShape const &shape, SrcAccessor src, DestIterator d, DestAccessor dest, unsigned int dim, vigra::Kernel1D< T > const &kernel)
| Convolution along a single dimension of a multi-dimensional arrays.
template<...> void | gaussianSmoothMultiArray (SrcIterator s, SrcShape const &shape, SrcAccessor src, DestIterator d, DestAccessor dest, double sigma)
| Isotropic Gaussian smoothing of a multi-dimensional arrays.
template<...> void | gaussianGradientMultiArray (SrcIterator si, SrcShape const &shape, SrcAccessor src, DestIterator di, DestAccessor dest, double sigma)
| Calculate Gaussian gradient of a multi-dimensional arrays.
template<...> void | symmetricGradientMultiArray (SrcIterator si, SrcShape const &shape, SrcAccessor src, DestIterator di, DestAccessor dest)
| 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 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 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 convolveImage(), in addition:
        int dimension = 0;
        VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also: separableConvolveMultiArray()

void 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 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 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 convolveImage(), in addition:
        int dimension = 0;
        VectorElementAccessor<DestAccessor> elementAccessor(0, dest);
See also: convolveMultiArrayOneDimension()

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.5.0 (7 Dec 2006)