[Insight-developers] Unsafe code in ObjectMorphologyImageFilter

Lorensen, William E (Research) lorensen at crd . ge . com
Sun, 17 Aug 2003 09:03:30 -0400


Steven
I noticed intermittent test failures for the subject filter. I tracked the
problem down to the ThreadedGenerateData method. There is a loop that copies
data from the input to the output region. Unfortunately, since the region
extends beyond the pixels that should be updated in a thread, some of this
pixels overlay pixels in other threads. As a temporary fix, I put a mutex
around the loop. The real fix would be to just copy the pixels that will be
affected in a given thread. Then the mutex can be removed.

Forget half of what I just said...
After putting in the mutex, I get different failures. I think the filter
needs to be reviewed further for thread safety. I suspect the
IsObjectPixelOnBoundary is messing up. For now, I've set the number of
threads to 1 for this filter.

Bill