[Insight-developers] flood fill iterator changes

Damion Shelton dmshelto at andrew . cmu . edu
Wed, 04 Sep 2002 11:34:46 -0400


Hi,

I've made some changes to the flood fill iterator classes to permit 
creation of an iterator without knowledge of a valid seed point. As an 
example, the "old" constructors used the syntax:

FloodFilledFunctionConditionalConstIterator(const ImageType *imagePtr,
                                     FunctionType *fnPtr,
                                     IndexType startIndex);

There is now also a constructor:

FloodFilledFunctionConditionalConstIterator(const ImageType *imagePtr,
                                            FunctionType *fnPtr);

If the second form of the constructor is used, the function FindSeedPixel() 
should be called after constructing the iterator. FindSeedPixel() iterates 
through the input image until finding a pixel that passes the 
IsPixelIncluded() test and uses this as the seed/StartIndex for the flood 
fill. If this function is not called, or if it is called but fails to find 
a seed pixel, the seed is set to the origin (0,0...).

These changes should not affect existing code. The new constructor should 
be useful in cases - particularly with spatial functions - where it's not 
clear where (if anywhere) the function intersects the image.

I also modified the GoToBegin() function in 
FloodFilledFunctionConditionConstIterator to match the form of the 
non-const version. The previous const implementation did not check whether 
or not the seed pixel was actually included in the flood prior to adding it 
to the test stack.

Comments/suggestions welcome.

-Damion-