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

details ImageIteratorBase Class Template Reference VIGRA

Base class for 2D random access iterators. More...

#include "vigra/imageiterator.hxx"


Public Types

typedef PIXELTYPE value_type
typedef PIXELTYPE PixelType
typedef REFERENCE reference
typedef REFERENCE index_reference
typedef POINTER pointer
typedef Diff2D difference_type
typedef image_traverser_tag iterator_category
typedef RowIteratorSelector::res row_iterator
typedef ColumnIteratorSelector::res column_iterator
typedef detail::DirectionSelector<
StridedOrUnstrided >::template
type< pointer
MoveX
typedef detail::DirectionSelector<
StridedArrayTag >::template
type< int > 
MoveY

Public Methods

Comparison of Iterators
bool operator== (ImageIteratorBase const &rhs) const
bool operator!= (ImageIteratorBase const &rhs) const
difference_type operator- (ImageIteratorBase const &rhs) const
Random navigation
IMAGEITERATOR & operator+= (difference_type const &s)
IMAGEITERATOR & operator-= (difference_type const &s)
IMAGEITERATOR operator+ (difference_type const &s) const
IMAGEITERATOR operator- (difference_type const &s) const
Access the Pixels
reference operator * () const
pointer operator-> () const
index_reference operator[] (Diff2D const &d) const
index_reference operator() (int dx, int dy) const
pointer operator[] (int dy) const

Public Attributes

Specify coordinate to operate on
MoveX x
MoveY y

Protected Methods

 ImageIteratorBase (pointer base, int ystride)
 ImageIteratorBase (pointer base, int xstride, int ystride)
 ImageIteratorBase (ImageIteratorBase const &rhs)
 ImageIteratorBase ()
ImageIteratorBase & operator= (ImageIteratorBase const &rhs)


Detailed Description


template<class IMAGEITERATOR, class PIXELTYPE, class REFERENCE, class POINTER, class StridedOrUnstrided = UnstridedArrayTag>
class vigra::ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided >

Base class for 2D random access iterators.

This class contains the navigational part of the iterator. Use derived classes to specifiy the access to the pixels.

#include "vigra/imageiterator.hxx"

Namespace: vigra

The usage examples assume that you constructed two iterators like this:

    vigra::ImageIteratorBase<SomePixelType> iterator(base, width);
    vigra::ImageIteratorBase<SomePixelType> iterator1(base, width);

See the paper: U. Koethe: Reusable Algorithms in Image Processing for a discussion of the concepts behind ImageIterators.


Member Typedef Documentation


typedef ColumnIteratorSelector::res column_iterator

 

The associated column iterator.


typedef Diff2D difference_type

 

the iterator's difference type (argument type of iter[diff])

Reimplemented in ImageIterator, ConstImageIterator, StridedImageIterator, and ConstStridedImageIterator.


typedef REFERENCE index_reference

 

the iterator's index reference type (return type of iter[diff])


typedef image_traverser_tag iterator_category

 

the iterator tag (image traverser)


typedef detail::DirectionSelector<StridedOrUnstrided>::template type<pointer> MoveX

 

Let operations act in X direction


typedef detail::DirectionSelector<StridedArrayTag>::template type<int> MoveY

 

Let operations act in Y direction


typedef PIXELTYPE PixelType

 

deprecated, use value_type instead.


typedef POINTER pointer

 

the iterator's pointer type (return type of iter.operator->())

Reimplemented in ImageIterator, ConstImageIterator, StridedImageIterator, and ConstStridedImageIterator.


typedef REFERENCE reference

 

the iterator's reference type (return type of *iter)


typedef RowIteratorSelector::res row_iterator

 

The associated row iterator.


typedef PIXELTYPE value_type

 

The underlying image's pixel type.


Constructor & Destructor Documentation


ImageIteratorBase pointer    base,
int    ystride
[inline, protected]

 

Construct from raw memory with a vertical stride of ystride. ystride must equal the physical image width (row length), even if the iterator will only be used for a sub image. This constructor must only be called for unstrided iterators (StridedOrUnstrided == UnstridedArrayTag)


ImageIteratorBase pointer    base,
int    xstride,
int    ystride
[inline, protected]

 

Construct from raw memory with a horizontal stride of xstride and a vertical stride of ystride. This constructor may be used for iterators that shall skip pixels. Thus, it must only be called for strided iterators (StridedOrUnstrided == StridedArrayTag)


ImageIteratorBase ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const &    rhs [inline, protected]

 

Copy constructor


ImageIteratorBase   [inline, protected]

 

Default constructor


Member Function Documentation


reference operator *   const [inline]

 

Access current pixel.
usage: SomePixelType value = *iterator


bool operator!= ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const &    rhs const [inline]

 

usage: iterator != iterator1


index_reference operator() int    dx,
int    dy
const [inline]

 

Access pixel at offset (dx, dy) from current location.
usage: SomePixelType value = iterator(dx, dy)


IMAGEITERATOR operator+ difference_type const &    s const [inline]

 

Add a distance


IMAGEITERATOR& operator+= difference_type const &    s [inline]

 

Add offset via Diff2D


IMAGEITERATOR operator- difference_type const &    s const [inline]

 

Subtract a distance


difference_type operator- ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const &    rhs const [inline]

 

usage: Diff2D dist = iterator - iterator1


IMAGEITERATOR& operator-= difference_type const &    s [inline]

 

Subtract offset via Diff2D


pointer operator->   const [inline]

 

Call member of current pixel.
usage: iterator->pixelMemberFunction()


ImageIteratorBase& operator= ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const &    rhs [inline, protected]

 

Copy assignment


bool operator== ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const &    rhs const [inline]

 

usage: iterator == iterator1


pointer operator[] int    dy const [inline]

 

Read pixel with offset [dy][dx] from current pixel. Note that the 'x' index is the trailing index.
usage: SomePixelType value = iterator[dy][dx]


index_reference operator[] Diff2D const &    d const [inline]

 

Access pixel at offset from current location.
usage: SomePixelType value = iterator[Diff2D(1,1)]


Member Data Documentation


MoveX x

 

Refer to iterator's x coordinate. Usage examples:

            ++iterator.x;        // move one step to the right
            --iterator.x;        // move one step to the left
            iterator.x += dx;    // move dx steps to the right
            iterator.x -= dx;    // move dx steps to the left
            bool notAtEndOfRow = iterator.x < lowerRight.x;   // compare x coordinates of two iterators
            int width = lowerRight.x - upperLeft.x;           // calculate difference of x coordinates
                                                              // between two iterators


MoveY y

 

Refer to iterator's y coordinate. Usage examples:

            ++iterator.y;        // move one step down
            --iterator.y;        // move one step up
            iterator.y += dy;    // move dy steps down
            iterator.y -= dy;    // move dy steps up
            bool notAtEndOfColumn = iterator.y < lowerRight.y; // compare y coordinates of two iterators
            int height = lowerRight.y - upperLeft.y;           // calculate difference of y coordinates
                                                               // between two iterators


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

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.2.0 (7 Aug 2003)