Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

/home/glehmann/rpm/BUILD/InsightToolkit-2.8.1/Code/Common/itkImageRegionConstIteratorWithIndex.h Class Reference

#include <itkImageRegionConstIteratorWithIndex.h>


Detailed Description

A multi-dimensional iterator templated over image type that walks an image region and is specialized to keep track of its index location.

The "WithIndex" family of iteators was designed for algorithms that use both the values and locations of image pixels in calculations. Unlike ImageRegionIterator, which calculates an index only when requested, ImageRegionIteratorWithIndex maintains its index location as a member variable that is updated during increment and decrement operations. Iteration speed is penalized, but index queries become more efficient.

ImageRegionConstIteratorWithIndex is a multi-dimensional iterator, requiring more information be specified before the iterator can be used than conventional iterators. Whereas the std::vector::iterator from the STL only needs to be passed a pointer to establish the iterator, the multi-dimensional image iterator needs a pointer, the size of the buffer, the size of the region, the start index of the buffer, and the start index of the region. To gain access to this information, ImageRegionConstIteratorWithIndex holds a reference to the image over which it is traversing.

ImageRegionConstIteratorWithIndex assumes a particular layout of the image data. The is arranged in a 1D array as if it were [][][][slice][row][col] with Index[0] = col, Index[1] = row, Index[2] = slice, etc.

operator++ provides a simple syntax for walking around a region of a multidimensional image. operator++ iterates across a row, constraining the movement to within a region of image. When the iterator reaches the boundary of the region along a row, the iterator automatically wraps to the next row, starting at the first pixel in the row that is part of the region. This allows for simple processing loops of the form:

  IteratorType it( image, image->GetRequestedRegion() );

  it.Begin();

  while( ! it.IsAtEnd() ) 
  {  
    it.Set( 100.0 + it.Get() );
    ++it;
  }

It also can be used for walking in the reverse direction like

  IteratorType it( image, image->GetRequestedRegion() );

  it.End();

  while( !it.IsAtBegin() ) 
  {  
    it.Set( 100.0 );
    --it;
  }

MORE INFORMATION


The documentation for this class was generated from the following file:
Generated at Sat Sep 2 21:22:49 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000