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/itkImageRandomConstIteratorWithIndex.h Class Reference

#include <itkImageRandomConstIteratorWithIndex.h>


Detailed Description

A multi-dimensional image iterator that visits a random set of pixels within an image region.

ImageRandomConstIteratorWithIndex is a multi-dimensional iterator class that is templated over image type. ImageRandomConstIteratorWithIndex is constrained to walk only within the specified region. It samples random pixel positions at each increment or decrement.

ImageRandomConstIteratorWithIndex 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.

The operator++ method provides a simple syntax for walking around a region of a multidimensional image. operator++ performs a jump to a random position within the specified image region. This is designed to facilitate the extraction of random samples from the image.

This is the typical use of this iterator in a loop:

 ImageRandomConstIteratorWithIndex<ImageType> it( image, image->GetRequestedRegion() );
 
 it.SetNumberOfSamples(200);
 it.GoToBegin();
 while( !it.IsAtEnd() )
 {
   it.Get();
   ++it;  // here it jumps to another random position inside the region
  } 

or

 ImageRandomConstIteratorWithIndex<ImageType> it( image, image->GetRequestedRegion() );
 
 it.SetNumberOfSamples(200);
 it.GoToEnd();
 while( !it.IsAtBegin() )
 {
   it.Get();
   --it;  // here it jumps to another random position inside the region
  } 

Warning:
Incrementing the iterator (++it) followed by a decrement (--it) or vice versa does not in general return the iterator to the same position.


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