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

MultiCoordinateNavigator< Dimensions, N > Class Template Reference

A navigator that provides access to the 1D subranges of an n-dimensional range given by an nD shape. More...

`#include <vigra/navigator.hxx>`

## Public Types

typedef MultiArrayShape< Dimensions >::type | value_type

## Public Member Functions

bool | atEnd () const
bool | hasMore () const
| MultiCoordinateNavigator (value_type const &shape, unsigned int inner_dimension)
void | operator++ ()
void | operator++ (int)

## Detailed Description

template<unsigned int Dimensions, unsigned int N = Dimensions>
class vigra::MultiCoordinateNavigator< Dimensions, N >

A navigator that provides access to the 1D subranges of an n-dimensional range given by an nD shape.

This class works similarly to MultiArrayNavigator, but instead of a 1-dimensional iterator pair, it returns a pair of shapes whose difference specifies a 1-dimensional range along the desired dimension. That is, when the navigator refers to dimension `d`, the difference between `end()` and `begin()` is `1` along all dimensions except `d`.

The template parameters specifies the dimension of the shape.

Usage:

#include <vigra/navigator.hxx>

Namespace: vigra

typedef vigra::MultiArrayShape<3>::type Shape;
typedef vigra::MultiArray<3, int> Array;
typedef vigra::MultiCoordinateNavigator<3> Navigator;
Array a(Shape(X, Y, Z));
for(int d=0; d<3; ++d)
{
// create Navigator for dimension d
Navigator nav(a.shape(), d);
// outer loop: move navigator to all starting points
// of 1D subsets that run parallel to coordinate axis d
for(; nav.hasMore(); ++nav)
{
// inner loop: linear iteration over current subset
// d == {0, 1, 2}: iterate along {x, y, z}-axis respectively
Shape point = nav.begin(), end = nav.end();
for(; point[d] != end[d]; ++point[d])
a[point] = 5;
}
}
vigra::RGBValue
Class for a single RGB value.
Definition rgbvalue.hxx:128
vigra::TinyVectorBase::end
iterator end()
Definition tinyvector.hxx:864
vigra::TinyVectorBase::begin
iterator begin()
Definition tinyvector.hxx:861
vigra::TinyVector
Class for fixed size vectors.
Definition tinyvector.hxx:1008

## Member Typedef Documentation

## ◆ value_type

template<unsigned int Dimensions, unsigned int N = Dimensions>

typedef MultiArrayShape<Dimensions>::type value_type

The shape type for the given iterator type.

## Constructor & Destructor Documentation

## ◆ MultiCoordinateNavigator()

template<unsigned int Dimensions, unsigned int N = Dimensions>

MultiCoordinateNavigator | ( | value_type const & | shape,
|  | unsigned int | inner_dimension
| ) |  |

Construct navigator for multi-dimensional iterator `i`, array shape `shape` and inner loop dimension `inner_dimension`.

## Member Function Documentation

## ◆ operator++() [1/2]

template<unsigned int Dimensions, unsigned int N = Dimensions>

void operator++ | ( |  | ) |

Advance to next starting location.

## ◆ operator++() [2/2]

template<unsigned int Dimensions, unsigned int N = Dimensions>

void operator++ | ( | int |  | ) |

Advance to next starting location.

## ◆ hasMore()

template<unsigned int Dimensions, unsigned int N = Dimensions>

bool hasMore | ( |  | ) | const

true if there are more elements.

## ◆ atEnd()

template<unsigned int Dimensions, unsigned int N = Dimensions>

bool atEnd | ( |  | ) | const

true if iterator is exhausted.

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

- vigra/navigator.hxx

© 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.12.1