[Insight-users] Modified FloodFill iterator (remember regions)

David Doria daviddoria+itk at gmail.com
Wed Aug 12 16:48:03 EDT 2009


My goal was to add the functionality of "remembering" which regions have
been marked as "filled" so the regions grown after multiple region growing
iterations will be mutually exclusive.

Ie.
Set seed1
Grow region A
Set seed 2
Grow region B

A and B should not contain any of the same pixels.

I spoke with Luis and he thought I should just be able to modify
itkFloodFilledFunctionConditionalConstIterator to prevent it from clearing
m_TemporaryPointer. The problem with that was that the region growing
filters (I was using itkConnectedThresholdImageFilter as an example)
construct a new floodfill iterator
IteratorType it ( outputImage, function, m_SeedList );

each time GenerateData() is called. Therefore there is no way to keep track
of the m_TemporaryPointer in the FF class (i.e. prevent it from being
deleted) because a different FF instance is generated each time a region is
created.

The way I fixed it is by changing itkConnectedThresholdImageFilter to have a
member pointer to a FF iterator
IteratorType* floodfill_iterator;

and an instance counter:
unsigned int m_InstanceCounter;

so that in GenerateData() I could do:

         if(m_InstanceCounter == 0)
         {
            //IteratorType it ( outputImage, function, m_SeedList );
             floodfill_iterator = new IteratorType( outputImage, function,
m_SeedList );
         }
         else
         {
             floodfill_iterator->FakeConstructor( outputImage, function,
m_SeedList );
         }
         m_InstanceCounter++;

It is working exactly how I want (see
http://www.rpi.edu/~doriad/ITK_List/itkFloodFilledFunctionConditionalConstIterator2.zip),
but I'm concerned that it is not an *elegant* enough solution - as it would
require a change in every region growing class. I didn't want to write up an
IJ paper about what I did because maybe someone will say "bah that was
silly, just do this...".

Thoughts?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090812/b3f74555/attachment.htm>


More information about the Insight-users mailing list