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.<br><br>Ie. <br>
Set seed1<br>Grow region A<br>Set seed 2<br>Grow region B<br><br>A and B should not contain any of the same pixels.<br><br>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 <br>
IteratorType it ( outputImage, function, m_SeedList );<br><br>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.<br>
<br>The way I fixed it is by changing itkConnectedThresholdImageFilter to have a member pointer to a FF iterator<br>IteratorType* floodfill_iterator;<br><br>and an instance counter:<br>unsigned int m_InstanceCounter;<br><br>
so that in GenerateData() I could do:<br><br> if(m_InstanceCounter == 0)<br> {<br> //IteratorType it ( outputImage, function, m_SeedList );<br> floodfill_iterator = new IteratorType( outputImage, function, m_SeedList );<br>
}<br> else<br> {<br> floodfill_iterator->FakeConstructor( outputImage, function, m_SeedList );<br> }<br> m_InstanceCounter++;<br><br>It is working exactly how I want (see <a href="http://www.rpi.edu/~doriad/ITK_List/itkFloodFilledFunctionConditionalConstIterator2.zip">http://www.rpi.edu/~doriad/ITK_List/itkFloodFilledFunctionConditionalConstIterator2.zip</a>), 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...".<br>
<br>Thoughts?<br><br clear="all">Thanks,<br><br>David<br>