[Insight-developers] ImageRandomIterator ready

Lorensen, William E (Research) lorensen@crd.ge.com
Wed, 17 Apr 2002 09:00:16 -0400


Perhaps this iterator would be a good experiment to reduce code duplication in the const/nonconst
versions.

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Sent: Wednesday, April 17, 2002 1:37 AM
To: Lydia Ng
Cc: insight-developers@public.kitware.com; Miller, James V (Research)
Subject: [Insight-developers] ImageRandomIterator ready



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




_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers