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

details MultiCoordinateNavigator< Dimensions, N > VIGRA

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++ (int)
void operator++ ()

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:

© 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.8.0 (20 Sep 2011)