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

| ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > Class Template Reference Image Iterators |

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

`#include <vigra/imageiterator.hxx>`

List of all members.

## Public Types

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

## Public Member Functions

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 Member Functions

| 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. It is usually not constructed directly, but via some derived class such as ImageIterator or StridedImageIterator.

#include <vigra/imageiterator.hxx>

Namespace: vigra

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

        vigra::ImageIterator<SomePixelType> iterator(base, width);
        vigra::ImageIterator<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 PIXELTYPE value_type

The underlying image's pixel type.

typedef PIXELTYPE PixelType

deprecated, use `value_type` instead.

typedef REFERENCE reference

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

typedef REFERENCE index_reference

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

typedef POINTER pointer

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

Reimplemented in ConstStridedImageIterator< PIXELTYPE >, StridedImageIterator< PIXELTYPE >, ConstImageIterator< PIXELTYPE >, and ImageIterator< PIXELTYPE >.

typedef Diff2D difference_type

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

Reimplemented in ConstStridedImageIterator< PIXELTYPE >, StridedImageIterator< PIXELTYPE >, ConstImageIterator< PIXELTYPE >, and ImageIterator< PIXELTYPE >.

typedef image_traverser_tag iterator_category

the iterator tag (image traverser)

typedef RowIteratorSelector::res row_iterator

The associated row iterator.

typedef ColumnIteratorSelector::res column_iterator

The associated column iterator.

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

Let operations act in X direction

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

Let operations act in Y direction

## Constructor & Destructor Documentation

ImageIteratorBase | ( | pointer | base,
|  | int | ystride
| ) |  | `[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
| ) |  | `[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 | ) | `[protected]`

Copy constructor

ImageIteratorBase | ( |  | ) | `[protected]`

Default constructor

## Member Function Documentation

bool operator== | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const

usage: `iterator == iterator1`

bool operator!= | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const

usage: `iterator != iterator1`

difference_type operator- | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const

usage: `Diff2D dist = iterator - iterator1`

ImageIteratorBase& operator= | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | `[protected]`

Copy assignment

IMAGEITERATOR& operator+= | ( | difference_type const & | s | ) |

Add offset via Diff2D

IMAGEITERATOR& operator-= | ( | difference_type const & | s | ) |

Subtract offset via Diff2D

IMAGEITERATOR operator+ | ( | difference_type const & | s | ) | const

Add a distance

IMAGEITERATOR operator- | ( | difference_type const & | s | ) | const

Subtract a distance

reference operator* | ( |  | ) | const

Access current pixel.
usage: `SomePixelType value = *iterator`

pointer operator-> | ( |  | ) | const

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

index_reference operator[] | ( | Diff2D const & | d | ) | const

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

index_reference operator() | ( | int | dx,
|  | int | dy
| ) |  | const

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

pointer operator[] | ( | int | dy | ) | const

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

## 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:

- vigra/imageiterator.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)