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

| MultiArrayView Class Template Reference |
--- | --- | ---

Base class for, and view to, vigra::MultiArray. More...

`#include "vigra/multi_array.hxx"`

## Public Types
typedef T | value_type
typedef value_type & | reference
typedef const value_type & | const_reference
typedef value_type * | pointer
typedef const value_type * | const_pointer
typedef TinyVector< int, actual_dimension > | size_type
typedef TinyVector< int, actual_dimension > | difference_type
typedef detail::MultiIteratorChooser< C >::template Traverser< actual_dimension, T, T &, T * >::type | traverser
typedef detail::MultiIteratorChooser< C >::template Traverser< actual_dimension, T, T const &, T const * >::type | const_traverser
typedef MultiArrayView< N, T, C > | view_type
typedef MultiArray< N, T > | matrix_type
enum | ActualDimension
## Public Methods
| MultiArrayView ()
| MultiArrayView (const difference_type &shape, pointer ptr)
| MultiArrayView (const difference_type &shape, const difference_type &stride, pointer ptr)
reference | operator[] (const difference_type &d)
const_reference | operator[] (const difference_type &d) const
reference | operator() (int x)
reference | operator() (int x, int y)
reference | operator() (int x, int y, int z)
reference | operator() (int x, int y, int z, int u)
reference | operator() (int x, int y, int z, int u, int v)
const_reference | operator() (int x) const
const_reference | operator() (int x, int y) const
const_reference | operator() (int x, int y, int z) const
const_reference | operator() (int x, int y, int z, int u) const
const_reference | operator() (int x, int y, int z, int u, int v) const
template<class U> void | init (const U &init)
template<class U, class CN> void | copy (const MultiArrayView< N, U, CN > &rhs)
template<unsigned int M> MultiArrayView< N-M, T, C > | bindOuter (const TinyVector< int, M > &d) const
template<unsigned int M> MultiArrayView< N-M, T, StridedArrayTag > | bindInner (const TinyVector< int, M > &d) const
template<unsigned int M> MultiArrayView< N-1, T, typename detail::MaybeStrided< M >::type > | bind (int d) const
MultiArrayView< N-1, T, C > | bindOuter (int d) const
MultiArrayView< N-1, T, StridedArrayTag > | bindInner (int d) const
MultiArrayView< N-1, T, StridedArrayTag > | bindAt (int m, int d) const
MultiArrayView | subarray (const difference_type &p, const difference_type &q) const
MultiArrayView< N, T, StridedArrayTag > | stridearray (const difference_type &s) const
std::size_t | elementCount () const
const size_type & | size () const
const difference_type & | shape () const
int | size (int n) const
int | shape (int n) const
const difference_type & | stride () const
int | stride (int n) const
pointer | data () const
traverser | traverser_begin ()
const_traverser | traverser_begin () const
traverser | traverser_end ()
const_traverser | traverser_end () const
## Protected Attributes
difference_type | m_shape
difference_type | m_stride
pointer | m_ptr

## Detailed Description

### template<unsigned int N, class T, class C>
class vigra::MultiArrayView< N, T, C >

Base class for, and view to, vigra::MultiArray.

This class implements the interface of both MultiArray and MultiArrayView. By default, MultiArrayViews are tagged as unstrided. If necessary, strided arrays are constructed automatically by calls to a variant of the bind...() function.

If you want to apply an algorithm requiring an image to a `MultiArrayView` of appropriate (2-dimensional) shape, you can create a vigra::BasicImageView that acts as a wrapper with the necessary interface -- see Wrap a \ref vigra::MultiArrayView in.

The template parameter are as follows

        N: the array dimension

        T: the type of the array elements

        C: a tag determining whether the array's inner dimension is strided
           or not. An array is unstrided if the array elements occupy consecutive
           memory location, strided if there is an offset in between (e.g.
           when a view is created that skips every other array element).
           The compiler can generate faster code for unstrided arrays.
           Possible values: UnstridedArrayTag (default), StridedArrayTag

#include "vigra/multi_array.hxx"

Namespace: vigra

## Member Typedef Documentation

typedef const value_type* const_pointer

| const pointer type Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef const value_type& const_reference

| const reference type (result of operator[] const) Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef detail::MultiIteratorChooser< C>::template Traverser<actual_dimension, T, T const &, T const *>::type const_traverser

| const traverser (MultiIterator) type Reimplemented in MultiArray, and MultiArray< 2, T, ALLOC >.

typedef TinyVector<int, actual_dimension> difference_type

| difference type (used for offsetting) Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef MultiArray<N, T> matrix_type

| the matrix type associated with this array. Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef value_type* pointer

| pointer type Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef value_type& reference

| reference type (result of operator[]) Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef TinyVector<int, actual_dimension> size_type

| size type Reimplemented in MultiArray, and MultiArray< 2, T, ALLOC >.

typedef detail::MultiIteratorChooser< C>::template Traverser<actual_dimension, T, T &, T *>::type traverser

| traverser (MultiIterator) type Reimplemented in MultiArray, and MultiArray< 2, T, ALLOC >.

typedef T value_type

| the array's value type Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

typedef MultiArrayView<N, T, C> view_type

| the view type associated with this array. Reimplemented in Matrix, MultiArray, and MultiArray< 2, T, ALLOC >.

## Member Enumeration Documentation

enum ActualDimension

| the array's actual dimensionality. This ensures that MultiArrayView can also be used for scalars (that is, when `N == 0`). Calculated as:
                actual_dimension = (N==0) ? 1 : N

## Constructor & Destructor Documentation

MultiArrayView | ( |  | ) | `[inline]`

| default constructor: create an empty image of size 0.

MultiArrayView | ( | const difference_type & | shape,
|  | pointer | ptr
| ) |

| construct from shape and pointer

MultiArrayView | ( | const difference_type & | shape,
|  | const difference_type & | stride,
|  | pointer | ptr
| ) |

| construct from shape, strides (offset of a sample to the next) for every dimension) and pointer

## Member Function Documentation

MultiArrayView< N-1, T, typename detail::MaybeStrided< M >::type > bind | ( | int | d | ) | const

| bind dimension M to index d. this reduces the dimensionality of the image to max { 1, N-1 }

MultiArrayView< N-1, T, StridedArrayTag > bindAt | ( | int | m,
|  | int | d
| ) | const

| bind dimension m to index d. this reduces the dimensionality of the image to max { 1, N-1 }

MultiArrayView< N-1, T, StridedArrayTag > bindInner | ( | int | d | ) | const

| bind the innermost dimension to a certain index. this reduces the dimensionality of the image to max { 1, N-1 }

MultiArrayView< N-M, T, StridedArrayTag > bindInner | ( | const TinyVector< int, M > & | d | ) | const

| bind the M innermost dimensions to certain indices. this reduces the dimensionality of the image to max { 1, N-M }

MultiArrayView< N-1, T, C > bindOuter | ( | int | d | ) | const

| bind the outmost dimension to a certain index. this reduces the dimensionality of the image to max { 1, N-1 }

MultiArrayView< N-M, T, C > bindOuter | ( | const TinyVector< int, M > & | d | ) | const

| bind the M outmost dimensions to certain indices. this reduces the dimensionality of the image to max { 1, N-M }

void copy | ( | const MultiArrayView< N, U, CN > & | rhs | ) |

| Copy the data of the right-hand array (array shapes must match).

pointer data | ( |  | ) | const`[inline]`

| return the pointer to the image data

std::size_t elementCount | ( |  | ) | const`[inline]`

| number of the elements in the array. Reimplemented in Matrix.

void init | ( | const U & | init | ) |

| Init with a constant.

const_reference operator() | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | u,
|  | int | v
| ) | const`[inline]`

| 5D const array access. Use only if N == 5.

const_reference operator() | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | u
| ) | const`[inline]`

| 4D const array access. Use only if N == 4.

const_reference operator() | ( | int | x,
|  | int | y,
|  | int | z
| ) | const`[inline]`

| 3D const array access. Use only if N == 3.

const_reference operator() | ( | int | x,
|  | int | y
| ) | const`[inline]`

| 2D const array access. Use only if N == 2.

const_reference operator() | ( | int | x | ) | const`[inline]`

| 1D const array access. Use only if N == 1.

reference operator() | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | u,
|  | int | v
| ) | `[inline]`

| 5D array access. Use only if N == 5.

reference operator() | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | u
| ) | `[inline]`

| 4D array access. Use only if N == 4.

reference operator() | ( | int | x,
|  | int | y,
|  | int | z
| ) | `[inline]`

| 3D array access. Use only if N == 3.

reference operator() | ( | int | x,
|  | int | y
| ) | `[inline]`

| 2D array access. Use only if N == 2.

reference operator() | ( | int | x | ) | `[inline]`

| 1D array access. Use only if N == 1.

const_reference operator[] | ( | const difference_type & | d | ) | const`[inline]`

| array access.

reference operator[] | ( | const difference_type & | d | ) | `[inline]`

| array access.

int shape | ( | int | n | ) | const`[inline]`

| return the array's shape at a certain dimension (same as `size(n)`).

const difference_type& shape | ( |  | ) | const`[inline]`

| return the array's shape (same as the `size()`).

int size | ( | int | n | ) | const`[inline]`

| return the array's size at a certain dimension.

const size_type& size | ( |  | ) | const`[inline]`

| return the array's size.

int stride | ( | int | n | ) | const`[inline]`

| return the array's stride at a certain dimension.

const difference_type& stride | ( |  | ) | const`[inline]`

| return the array's stride for every dimension.

MultiArrayView<N, T, StridedArrayTag> stridearray | ( | const difference_type & | s | ) | const`[inline]`

| apply an additional striding to the image, thereby reducing the shape of the array. for example, multiplying the stride of dimension one by three turns an appropriately layed out (interleaved) rgb image into a single band image.

MultiArrayView subarray | ( | const difference_type & | p,
|  | const difference_type & | q
| ) | const`[inline]`

| create a rectangular subarray that spans between the points p and q, where p is in the subarray, q not.

const_traverser traverser_begin | ( |  | ) | const`[inline]`

| returns the N-dimensional MultiIterator pointing to the const first element in every dimension.

traverser traverser_begin | ( |  | ) | `[inline]`

| returns the N-dimensional MultiIterator pointing to the first element in every dimension.

const_traverser traverser_end | ( |  | ) | const`[inline]`

| returns the N-dimensional const MultiIterator pointing beyond the last element in dimension N, and to the first element in every other dimension.

traverser traverser_end | ( |  | ) | `[inline]`

| returns the N-dimensional MultiIterator pointing beyond the last element in dimension N, and to the first element in every other dimension.

## Member Data Documentation

pointer m_ptr`[protected]`

| pointer to the image.

difference_type m_shape`[protected]`

| the shape of the image pointed to is stored here.

difference_type m_stride`[protected]`

| the strides (offset of a sample to the next) for every dimension are stored here.

The documentation for this class was generated from the following file:

- vigra/multi_array.hxx

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.3.2 (27 Jan 2005)