[Insight-users] Bug in itkFloodFilledFunctionConditionalIterator

Alberto Bert abert@mauriziano.it
Fri, 6 Sep 2002 16:45:28 +0200


On Sep 06 at 03:42PM+0200, Alberto Bert wrote:
> > I think I found a little bug in the
> > itkFloodFilledFunctionConditionalIterator.txx file.
> > 
> > This bug prevent the floodfill iterator to work correctly when used on
> > boundaries,
> > if you use the iterator on the first slice it will only stay on this slice
> > because as soon as an index in one dimension is considered invalid the other
> > is also considered invalid.
> 
> I've found the same problem. I'm using that class, so please warn me when it
> will be fixed.

I've watched to the code, and I've seen the bug (thanks Yann.)
The problem was the initialization of the m_IsValidIndex variable, isn't it?
For other users, the following code seems to work:

...
for(int i=0; i<NDimensions; i++)
	  {
	    // IndexType tempIndex;
	    // m_IsValidIndex = true;
	  
	    // The j loop establishes either left or right neighbor (+-1)
	    for(int j=-1; j<=1; j+=2)
	      {
	        IndexType tempIndex;
		m_IsValidIndex = true;
		// build the index of a neighbor
		for(int k=0; k<NDimensions; k++)
                        ... 

Bye,
Alberto