[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Point operators for multi-dimensional arrays. |
Functions | |
template<... > | |
void | combineThreeMultiArrays (...) |
Combine three multi-dimensional arrays into one using a ternary function or functor. More... | |
template<... > | |
void | combineTwoMultiArrays (...) |
Combine two multi-dimensional arrays into one using a binary function or functor. More... | |
template<... > | |
void | copyMultiArray (...) |
Copy a multi-dimensional array. More... | |
template<... > | |
void | initMultiArray (...) |
Write a value to every element in a multi-dimensional array. More... | |
template<... > | |
void | initMultiArrayBorder (...) |
Write values to the specified border values in the array. More... | |
template<... > | |
void | inspectMultiArray (...) |
Call an analyzing functor at every element of a multi-dimensional array. More... | |
template<... > | |
void | inspectTwoMultiArrays (...) |
Call an analyzing functor at all corresponding elements of two multi-dimensional arrays. More... | |
template<... > | |
void | tensorDeterminantMultiArray (...) |
Calculate the tensor determinant for every element of a ND tensor array. More... | |
template<... > | |
void | tensorEigenvaluesMultiArray (...) |
Calculate the tensor eigenvalues for every element of a N-D tensor array. More... | |
template<... > | |
void | tensorTraceMultiArray (...) |
Calculate the tensor trace for every element of a N-D tensor array. More... | |
template<... > | |
void | transformMultiArray (...) |
Transform a multi-dimensional array with a unary function or functor. More... | |
template<... > | |
void | vectorToTensorMultiArray (...) |
Calculate the tensor (outer) product of a N-D vector with itself. More... | |
Copy, transform, and inspect arbitrary dimensional arrays which are represented by iterators compatible to Multi-dimensional Array Iterators. Note that are range is here specified by a pair: an iterator referring to the first point of the array and a shape object specifying the size of the (rectangular) ROI.
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
void vigra::initMultiArray | ( | ... | ) |
Write a value to every element in a multi-dimensional array.
The initial value can either be a constant of appropriate type (compatible with the destination's value_type), or a functor with compatible result_type. These two cases are automatically distinguished when FunctorTraits<FUNCTOR>::isInitializer
yields VigraTrueType
. Since the functor is passed by const
reference, its operator()
must be const, and its internal state may need to be mutable
.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
void vigra::initMultiArrayBorder | ( | ... | ) |
Write values to the specified border values in the array.
This functions is similar to initMultiArray(), but it initializes only the array elements whose distance from any array border is at most border_width.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
void vigra::copyMultiArray | ( | ... | ) |
Copy a multi-dimensional array.
This function can be applied in two modes:
The arrays must be represented by iterators compatible with vigra::MultiIterator, and the iteration range is specified by means of shape objects. If only the source shape is given the destination array is assumed to have the same shape, and standard mode is applied. If two shapes are given, the size of corresponding dimensions must be either equal (standard copy), or the source length must be 1 (expanding copy).
Declarations:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
pass arbitrary-dimensional array views:
Usage - Standard Mode:
Usage - Expanding Mode:
The source array is effectively only a 2D image (it has a 3D shape, but 'depth' is a singleton dimension with length 1). Thus, the destination will contain 50 identical copies of this image:
void vigra::transformMultiArray | ( | ... | ) |
Transform a multi-dimensional array with a unary function or functor.
Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.
This function can be applied in three modes:
std::accumulate()
. The arrays must be represented by MultiArrayViews. If source and destination shapes match, standard mode is applied. If the shapes differ, the size of corresponding dimensions must either be equal, or the source length must be 1 (expand mode), or the destination length must be 1 (reduce mode). However, reduction and expansion cannot be executed at the same time, so the latter conditions are mutual exclusive, even if they apply to different dimensions.
Declarations:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
pass arbitrary-dimensional array views:
Usage - Standard Mode:
Source and destination array have the same size.
Usage - Expand Mode:
The source array is effectively only a 2D image(it has a 3D shape, but depth is a singleton dimension with length 1). Thus, the destination will contain 50 identical copies of the transformed source image.
Usage - Reduce Mode:
The destination array is effectively only 1D (it's width and height are singleton dimensions). Thus, it will contain accumulated data for every slice of the source volume (or for every frame, if the source is interpreted as an image sequence). In the example, we use the functor vigra::FindAverage to calculate the average gray value of every slice.
Note that the functor must define the appropriate traits described below in order to be recognized as a reduce functor. This is most easily achieved by deriving from UnaryReduceFunctorTag
(see vigra::FunctorTraits).
Required Interface:
In standard and expand mode, the functor must be a model of UnaryFunction (i.e. support one-argument function call which accepts values of type T1
and a return value that is convertible into T2
.
In reduce mode, it must be a model of UnaryAnalyser (i.e. support function call with one argument and no return value functor(arg)
) and Initializer (i.e. support function call with no argument, but return value res = functor()
). Internally, such functors are recognized by the meta functions FunctorTraits<FUNCTOR>::isUnaryAnalyser
and FunctorTraits<FUNCTOR>::isInitializer
which must both yield VigraTrueType
. Make sure that your functor correctly defines FunctorTraits
because otherwise reduce mode will not work. This is most easily achieved by deriving the functor from UnaryReduceFunctorTag
(see vigra::FunctorTraits). In addition, the functor must be copy constructible in order to start each reduction with a fresh functor.
void vigra::combineTwoMultiArrays | ( | ... | ) |
Combine two multi-dimensional arrays into one using a binary function or functor.
Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.
This function can be applied in three modes:
std::accumulate()
. The arrays must be represented by MultiArrayViews. If all shapes are identical, standard mode is applied. If the shapes differ, the size of corresponding dimensions must either be equal, or the length of this dimension must be 1 in one or both source arrays (expand mode), or the destination length must be 1 (reduce mode). However, reduction and expansion cannot be executed at the same time, so the latter conditions are mutual exclusive, even if they apply to different dimensions.
Declarations:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
pass arbitrary-dimensional array views:
Usage - Standard Mode:
Source and destination arrays have the same size.
Usage - Expand Mode:
One source array is effectively only a 2D image (it has depth 1). This image will be added to every slice of the other source array, and the result is written into the corresponding destination slice.
Usage - Reduce Mode:
The destination array is only 1D (it's width and height are singleton dimensions). Thus, it will contain accumulated data for every slice of the source volumes (or for every frame, if the sources are interpreted as image sequences). In the example, we use vigra::ReduceFunctor together with a functor expression (see Functor Expressions) to calculate the total absolute difference of the gray values in every pair of source slices.
Note that the functor must define the appropriate traits described below in order to be recognized as a reduce functor. This is most easily achieved by deriving from BinaryReduceFunctorTag
(see vigra::FunctorTraits).
Required Interface:
In standard and expand mode, the functor must be a model of BinaryFunction (i.e. support function call with two arguments and a return value which is convertible into T2
: T2 res = functor(arg1, arg2)
):
In reduce mode, it must be a model of BinaryAnalyser (i.e. support function call with two arguments and no return value functor(arg1, arg2)
) and Initializer (i.e. support function call with no argument, but return value res = functor()
). Internally, such functors are recognized by the meta functions FunctorTraits<FUNCTOR>::isBinaryAnalyser
and FunctorTraits<FUNCTOR>::isInitializer
which must both yield VigraTrueType
. Make sure that your functor correctly defines FunctorTraits
because otherwise reduce mode will not work. This is most easily achieved by deriving the functor from BinaryReduceFunctorTag
(see vigra::FunctorTraits). In addition, the functor must be copy constructible in order to start each reduction with a fresh functor.
void vigra::combineThreeMultiArrays | ( | ... | ) |
Combine three multi-dimensional arrays into one using a ternary function or functor.
Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.
Except for the fact that it operates on three input arrays, this function is identical to the standard mode of combineTwoMultiArrays() (reduce and expand modes are not supported).
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
void vigra::inspectMultiArray | ( | ... | ) |
Call an analyzing functor at every element of a multi-dimensional array.
This function can be used to collect statistics of the array etc. The results must be stored in the functor, which serves as a return value (therefore, it is passed to the function by reference). The array must be represented as a MultiArrayView.
For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
The functor must support function call with one argument.
void vigra::inspectTwoMultiArrays | ( | ... | ) |
Call an analyzing functor at all corresponding elements of two multi-dimensional arrays.
This function can be used to collect statistics over tow arrays. For example, one can holde data, and the other region labels or weights. The results must be stored in the functor, which serves as a return value (and is therefore passed by reference). The arrays must be represented by MultiArrayViews.
For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_pointoperators.hxx>
Namespace: vigra
The functor must support function call with two arguments.
void vigra::vectorToTensorMultiArray | ( | ... | ) |
Calculate the tensor (outer) product of a N-D vector with itself.
This function is useful to transform vector arrays into a tensor representation that can be used as input to tensor based processing and analysis functions (e.g. tensor smoothing). When the input array has N dimensions, the input value_type must be a vector of length N, whereas the output value_type mus be vectors of length N*(N-1)/2 which will represent the upper triangular part of the resulting (symmetric) tensor. That is, for 2D arrays the output contains the elements [t11, t12 == t21, t22]
in this order, whereas it contains the elements [t11, t12, t13, t22, t23, t33]
for 3D arrays.
Currently, N <= 3
is required.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra
void vigra::tensorTraceMultiArray | ( | ... | ) |
Calculate the tensor trace for every element of a N-D tensor array.
This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into a scalar array holding the tensor trace.
Currently, N <= 3
is required.
Declarations:
pass arbitrary-dimensional array views:
Usage:
#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra
Preconditions:
N == 2
or N == 3
void vigra::tensorEigenvaluesMultiArray | ( | ... | ) |
Calculate the tensor eigenvalues for every element of a N-D tensor array.
This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into a vector-valued array holding the tensor eigenvalues (thus, the destination value_type must be vectors of length N).
Currently, N <= 3
is required.
Declarations:
pass arbitrary-dimensional array views:
Usage (MultiArrayView API):
#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra
Preconditions:
N == 2
or N == 3
void vigra::tensorDeterminantMultiArray | ( | ... | ) |
Calculate the tensor determinant for every element of a ND tensor array.
This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into the a scalar array holding the tensor determinant.
Currently, N <= 3
is required.
Declarations:
pass arbitrary-dimensional array views:
Usage (MultiArrayView API):
#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra
Preconditions:
N == 2
or N == 3
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|