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

Karthik Krishnan karthik.krishnan at kitware.com
Thu Aug 13 01:14:56 EDT 2009


A less obtrusive and more trivial change might be to add an overloaded
constructor to the flood fill iterator that reads :

 Iterator( imagePtr, fnPtr, seedList, exclusionImagePtr)

This constructor would simply look exactly like the other constructor,
except that it instead of calling InitializeIteration(), (which creates a
new m_TemporaryPtr), it would set m_TemporaryPtr to exclustionImagePtr
itself.

What do you think ?

Thanks


On Wed, Aug 12, 2009 at 4:48 PM, David Doria
<daviddoria+itk at gmail.com<daviddoria%2Bitk at gmail.com>
> wrote:

> 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<http://www.rpi.edu/%7Edoriad/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
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


-- 
Karthik Krishnan
R&D Engineer,
Kitware Inc.
Ph: 518 881 4919
Fax: 518 371 4573
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090813/841844b8/attachment.htm>


More information about the Insight-users mailing list