[Insight-developers] ImageRandomIterator ready
Luis Ibanez
luis.ibanez@kitware.com
Wed, 17 Apr 2002 01:36:50 -0400
Hi,
The ImageRandomIteratorWithIndex has been checked in.
Its "Const" version included: ImageRandomConstIteratorWithIndex.
This iterator will perform a random walk over a specific region of
an image. Here is the typical use:
itk::ImageRandomConstIteratorWithIndex it( image, region );
it.GoToBegin();
it.SetNumberOfSamples( 100 );
while( !it.IsAtEnd() )
{
myRandomPixelIndex = it.GetIndex();
myRandomPixelValue = it.Get();
++it;
}
The strategy used to randomize the position is to select a random
number in the range : [1: numberOfPixelsInRegion]. This number
is then unfolded as a position in the particular region.
Variants of the strategy could be implemented as sibling classes or
in derived classes
Luis