[ 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>`

List of all members.

## 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;
            }
        }

## Member Typedef Documentation

typedef MultiArrayShape<Dimensions>::type value_type

The shape type for the given iterator type.

## Constructor & Destructor Documentation

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

void operator++ | ( |  | ) |

Advance to next starting location.

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

Advance to next starting location.

bool hasMore | ( |  | ) | const

true if there are more elements.

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.9.0 (Tue Nov 6 2012)