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

Image Iterators

General image iterator definition and implementations.

General image iterator definition and implementations.

The following tables describe the general requirements for image iterators and their iterator traits. The iterator implementations provided here may be used for any image data type that stores its data as a linear array of pixels. The array will be interpreted as a row-major matrix with a particular width.

Requirements for Image Iterators

Local Types Meaning
ImageIterator::value_typethe underlying image's pixel type
ImageIterator::PixelTypethe underlying image's pixel type
ImageIterator::referencethe iterator's reference type (return type of *iter). Will be value_type & for a mutable iterator, and convertible to value_type const & for a const iterator.
ImageIterator::index_referencethe iterator's index reference type (return type of iter[diff]). Will be value_type & for a mutable iterator, and convertible to value_type const & for a const iterator.
ImageIterator::pointerthe iterator's pointer type (return type of iter.operator->()). Will be value_type * for a mutable iterator, and convertible to value_type const * for a const iterator.
ImageIterator::difference_typethe iterator's difference type (vigra::Diff2D)
ImageIterator::iterator_categorythe iterator tag (vigra::image_traverser_tag)
ImageIterator::row_iteratorthe associated row iterator
ImageIterator::column_iteratorthe associated column iterator
ImageIterator::MoveXtype of the horizontal navigator
ImageIterator::MoveYtype of the vertical navigator
Operation Result Semantics
++i.x
i.x–
voidincrement x-coordinate
–i.x
i.x–
voiddecrement x-coordinate
i.x += dxImageIterator::MoveX &add dx to x-coordinate
i.x -= dxImageIterator::MoveX &subtract dx from x-coordinate
i.x - j.xintdifference of the x-coordinates of i and j
i.x = j.xImageIterator::MoveX &i.x += j.x - i.x
i.x == i.yboolj.x - i.x == 0
i.x < j.xboolj.x - i.x > 0
++i.y
i.y++
voidincrement y-coordinate
–i.y
i.y–
voiddecrement y-coordinate
i.y += dyImageIterator::MoveY &add dy to y-coordinate
i.y -= dyImageIterator::MoveY &subtract dy from y-coordinate
i.y - j.yintdifference of the y-coordinates of i and j
i.y = j.yImageIterator::MoveY &i.y += j.y - i.y
i.y == j.yboolj.y - i.y == 0
i.y < j.yboolj.y - i.y > 0
ImageIterator k(i)copy constructor
k = iImageIterator &assignment
ImageIterator kdefault constructor
ImageIterator::row_iterator r(i)construction of row iterator
ImageIterator::column_iterator c(i)construction of column iterator
i += diffImageIterator &{ i.x += diff.x
i.y += diff.y; }
i -= diffImageIterator &{ i.x -= diff.x
i.y -= diff.y; }
i + diffImageIterator{ ImageIterator tmp(i);
tmp += diff;
return tmp; }
i - diffImageIterator{ ImageIterator tmp(i);
tmp -= diff;
return tmp; }
i - jImageIterator::difference_type{ ImageIterator::difference_type tmp(i.x - j.x, i.y - j.y);
return tmp; }
i == jbooli.x == j.x && i.y == j.y
*iImageIterator::referenceaccess the current pixel
i[diff]ImageIterator::index_referenceaccess pixel at offset diff
i(dx, dy)ImageIterator::index_referenceaccess pixel at offset (dx, dy)
i->member()depends on operationcall member function of underlying pixel type via operator-> of iterator
i, j, k are of type ImageIterator
diff is of type ImageIterator::difference_type
dx, dy are of type int

Requirements for Image Iterator Traits

The following iterator traits must be defined for an image iterator:

Types Meaning
IteratorTraits<ImageIterator>::Iteratorthe iterator type the traits are referring to
IteratorTraits<ImageIterator>::iteratorthe iterator type the traits are referring to
IteratorTraits<ImageIterator>::value_typethe underlying image's pixel type
IteratorTraits<ImageIterator>::referencethe iterator's reference type (return type of *iter)
IteratorTraits<ImageIterator>::index_referencethe iterator's index reference type (return type of iter[diff])
IteratorTraits<ImageIterator>::pointerthe iterator's pointer type (return type of iter.operator->())
IteratorTraits<ImageIterator>::difference_typethe iterator's difference type
IteratorTraits<ImageIterator>::iterator_categorythe iterator tag (vigra::image_traverser_tag)
IteratorTraits<ImageIterator>::row_iteratorthe associated row iterator
IteratorTraits<ImageIterator>::column_iteratorthe associated column iterator
IteratorTraits<ImageIterator>::DefaultAccessorthe default accessor to be used with the iterator
IteratorTraits<ImageIterator>::default_accessorthe default accessor to be used with the iterator
IteratorTraits<ImageIterator>::hasConstantStrideswhether the iterator uses constant strides on the underlying memory (always VigraTrueType for ImageIterators).

© 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.12.3