[Insight-developers] DanielssonDistanceMapImage segfaults

Luis Ibanez luis.ibanez at kitware.com
Fri Mar 31 08:43:32 EST 2006


Hi Gaetan,

Feeding a 2D image into a pipeline that is defined for 3D images
is not a good practice. Specially if you are using filters that
require neighborhoods (as it is the case for the Danielsson distance
map).


Some questions:

   1) Why are you passing a 2D image to a 3D pipeline ?

   2) If you want to process a 2D image,
      why don't you define a 2D pipeline ?

   3) What could be the result of a distance in 3D to a 2D slice ?
      do you want to manage the singularity of the 2D slice in 3D ?


There are *many* ND operations that you cannot do in a N-1 dimensional
image. E.g. any derivative operation, morpho math, Markov random fields,
just to mention a few.


We could add a check to the Danielsson distance map in order to require
the input image to have at least three pixels along every dimension.
The check could throw an exception with the input image does not satisfy
this requirement. This will prevent the filter from crashing when it is
feed with degenerate images.



   Luis



-------------------
Gaetan Lehmann wrote:
> 
> Hi,
> 
> I'm trying to use the DanielssonDistanceMapImageFilter with some images  
> whith a size which is sometime 1 on one dimension, and the filter 
> segfault  in that case. It seem that the 
> ReflectiveImageRegionConstIterator try to  access pixels outside the 
> image (!) and that make
> 
>       components->GetPixel( here ) = offsetValueThere;
> 
> fail in UpdateLocalDistance() method.
> 
> I have no idea how to fix that, so I tried to pad the image by one on 
> all  faces, apply the distance map filter, and crop the pixel, but again 
> I get  a segfault. I have to use the pad and crop filters AND to call 
> Udapte() on  my DanielssonDistanceMapImage before calling Update() on 
> the last filter  filter of my pipeline to finally get the result without 
> segfault.
> 
> The problem is easy to reproduce: write a pipeline
> 
> reader 3D
> danielsson distance map 3D
> writer 3D
> 
> and read a 2D image (cthead1.png for example) is enough.
> 
> It seems that there is several bugs which should be fixed in  
> DanielssonDistanceMapImage class :-)
> 
> Gaetan
> 



More information about the Insight-developers mailing list