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

Examples/itkImageRandomConstIteratorWithIndex.cxx Class Reference
[Image Iterators]

#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.
MORE INFORMATION
For a complete description of the ITK Image Iterators and their API, please see the Iterators chapter in the ITK Software Guide. The ITK Software Guide is available in print and as a free .pdf download from http://www.itk.org.
See also:
ImageConstIterator

ConditionalConstIterator

ConstNeighborhoodIterator

ConstShapedNeighborhoodIterator

ConstSliceIterator

CorrespondenceDataStructureIterator

FloodFilledFunctionConditionalConstIterator

FloodFilledImageFunctionConditionalConstIterator

FloodFilledImageFunctionConditionalIterator

FloodFilledSpatialFunctionConditionalConstIterator

FloodFilledSpatialFunctionConditionalIterator

ImageConstIterator

ImageConstIteratorWithIndex

ImageIterator

ImageIteratorWithIndex

ImageLinearConstIteratorWithIndex

ImageLinearIteratorWithIndex

ImageRandomConstIteratorWithIndex

ImageRandomIteratorWithIndex

ImageRegionConstIterator

ImageRegionConstIteratorWithIndex

ImageRegionExclusionConstIteratorWithIndex

ImageRegionExclusionIteratorWithIndex

ImageRegionIterator

ImageRegionIteratorWithIndex

ImageRegionReverseConstIterator

ImageRegionReverseIterator

ImageReverseConstIterator

ImageReverseIterator

ImageSliceConstIteratorWithIndex

ImageSliceIteratorWithIndex

NeighborhoodIterator

PathConstIterator

PathIterator

ShapedNeighborhoodIterator

SliceIterator

ImageConstIteratorWithIndex


The documentation for this class was generated from the following file:
Generated at Sun Jul 9 18:46:22 2006 for ITK by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2000