[Insight-developers] Flood iterator ++ method

Miller, James V (CRD) millerjv@crd.ge.com
Wed, 6 Jun 2001 07:29:06 -0400


Damion, 

Instead of a stack of indices indicating where you have been, you could keep a mask (image). This
could be an image of a low bit count or a run length encoded image. You really only need one bit per
pixel to indicate that you have visited that pixel.

While this is analogous to your stack storage, it would require less memory.

Jim



-----Original Message-----
From: Damion Shelton [mailto:dmsst59+@pitt.edu]
Sent: Tuesday, June 05, 2001 6:08 PM
To: 'insight-Developers'
Subject: [Insight-developers] Flood iterator ++ method


Ok...

Jim's suggestion worked fine. The ++ method now executes one step of the
flood algorithm; more correctly, it executes the flood algorithm until a new
"interior" pixel is found or the algorithm terminates.

So, the usage syntax looks like:

  TImageType::IndexType seedPos;
  const unsigned long pos[] = {15,15,15};
  seedPos.SetIndex(pos);

  typedef itk::FloodFilledSpatialFunctionIterator<TImageType,
TSphereFunctionType> TSphereItType;
  TSphereItType sfi = TSphereItType(sourceImage, spatialFunc, seedPos);

  unsigned long int itCount = 0;

  // Iterate through the entire image and set interior pixels to 255
  for( ; !( sfi.IsAtEnd() ); ++sfi)
    {
    sfi.Get().SetScalar(255);
    itCount++;
    }

This code fragment iterates over a spherical region, with the sphere defined
earlier, and sets the pixels within the region to 255. The only remaining
memory issue is the stack that holds the list of indices generated during
the flood algorithm; I don't really see any way around this since it's
central to the algorithm.

Any other comments, pass them along. I appreciate the help...

-Damion-


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