[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
|
ImageIteratorBase [Image Iterators] |
![]() |
Base class for 2D random access iterators. More...
#include <vigra/imageiterator.hxx>

Public Types | |
| typedef ColumnIteratorSelector::res | column_iterator |
| typedef Diff2D | difference_type |
| typedef REFERENCE | index_reference |
| typedef image_traverser_tag | iterator_category |
| typedef detail::DirectionSelector < StridedOrUnstrided > ::template type< pointer > | MoveX |
| typedef 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 |
| difference_type | operator- (ImageIteratorBase const &rhs) const |
| bool | operator== (ImageIteratorBase const &rhs) const |
Access the Pixels | |
| index_reference | operator() (int dx, int dy) const |
| reference | operator* () const |
| pointer | operator-> () const |
| pointer | operator[] (int dy) const |
| index_reference | operator[] (Diff2D const &d) const |
Random navigation | |
| IMAGEITERATOR | operator+ (difference_type const &s) const |
| IMAGEITERATOR & | operator+= (difference_type const &s) |
| IMAGEITERATOR | operator- (difference_type const &s) const |
| IMAGEITERATOR & | operator-= (difference_type const &s) |
Public Attributes | |
Specify coordinate to operate on | |
| MoveX | x |
| MoveY | y |
Protected Member Functions | |
| ImageIteratorBase () | |
| ImageIteratorBase (ImageIteratorBase const &rhs) | |
| ImageIteratorBase (pointer base, int xstride, int ystride) | |
| ImageIteratorBase (pointer base, int ystride) | |
| ImageIteratorBase & | operator= (ImageIteratorBase const &rhs) |
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.
| 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)
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.
| 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
| bool operator!= | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const |
usage: iterator != iterator1
| index_reference operator() | ( | int | dx, | |
| int | dy | |||
| ) | const |
Access pixel at offset (dx, dy) from current location.
usage: SomePixelType value = iterator(dx, dy)
| reference operator* | ( | ) | const |
Access current pixel.
usage: SomePixelType value = *iterator
| IMAGEITERATOR operator+ | ( | difference_type const & | s | ) | const |
Add a distance
| IMAGEITERATOR& operator+= | ( | difference_type const & | s | ) |
Add offset via Diff2D
| IMAGEITERATOR operator- | ( | difference_type const & | s | ) | const |
Subtract a distance
| difference_type operator- | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const |
usage: Diff2D dist = iterator - iterator1
| IMAGEITERATOR& operator-= | ( | difference_type const & | s | ) |
Subtract offset via Diff2D
| pointer operator-> | ( | ) | const |
Call member of current pixel.
usage: iterator->pixelMemberFunction()
| ImageIteratorBase& operator= | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | [protected] |
Copy assignment
| bool operator== | ( | ImageIteratorBase< IMAGEITERATOR, PIXELTYPE, REFERENCE, POINTER, StridedOrUnstrided > const & | rhs | ) | const |
usage: iterator == iterator1
| 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]
| index_reference operator[] | ( | Diff2D const & | d | ) | const |
Access pixel at offset from current location.
usage: SomePixelType value = iterator[Diff2D(1,1)]
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
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
|
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|