[Insight-users] SignedDanielssonDistanceMapImageFilter

Luis Ibanez luis.ibanez at kitware.com
Wed Dec 10 15:16:08 EST 2008


Hi Chensiqi,

You are misinterpreting the behavior of this filter.

If you have a binary image, where

 *  The foreground object is set to 1 and
 *  The background object is set to 0


Then the SignedDanielssonDistanceMapImageFilter will compute
the distances to the *transition* region between the 0s and
the 1s.

All pixesl in the 0s region will have positive distances to
that boundary, while all pixels in the 1s region will have
negative distances to that boundary.

In your case you are feeding an input image where the *boundary*
points are set to 1. Therefore, there is no "inside" to the
object.

E.g. if you are feeding into this distance filter an image with
a thin ring, you are not going to find the "inside" of the ring.

You should feed this filter with an image containing a filled
circle of radius R. Where all the points at locations r < R will
be set to 1s. Only in that case will the distance map be able to
find the "inside" of the object.


   Regards,


       Luis


---------------
chensiqi wrote:
> Hi, Ghassan
> 
> Thanks for the advice.  I flip the input.
> The result now is both inside and outside are positive  :(
> 
> I use float type as the filteroutput instead of "unsigned short" in the 
> example. I also tried unsigned short, the result is the same.
>  
> Here is part of my code. 
> ////////////////////////////////////////////////////////////////////////////////////////////////////
> typedef itk::Image< unsigned char, 2 > BinaryImageType;
> typedef itk::Image< float , 2> LSVImageType;
> typedef itk::SignedDanielssonDistanceMapImageFilter < BinaryImageFilter, 
> LSVImageFilter >  FilterType;
> FilterType::Pointer filter = FilterType::New();
>  
> filter ->SetInput ( contour );  // contour is the binary image with 
> BinaryImageType,  1 at boundary points, and 0 elsewhere.
>  
> LSVImageFilter::Pointer LSVImage = filter->GetDistanceMap();
>  
> Display (LSVImage) // this is a function that displays the image.
> //////////////////////////////////////////////////////////////////////////////////////////////////////
>  
> I notice when I   cout<<LSV_image->GetBufferedRegion().GetSize() , the 
> output is [0,0].   I guess there is something wrong in my code that 
> causes this weird output size.  I can display LSVImage, although both 
> inside and outside region are postive.
>  
> 
> Thanks for any input
> Siqi
> 
>  > CC: insight-users at itk.org
>  > From: hamarneh at gmail.com
>  > To: pidanchen at hotmail.com
>  > Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter
>  > Date: Tue, 9 Dec 2008 20:45:19 -0800
>  >
>  > Hello Siqi,
>  >
>  > You write: "The input is only a binary image with boundary points at
>  > 0, and all other points at 1."
>  > However, according to he documentation: "As a convention, the distance
>  > is evaluated from the boundary of the ON pixels."
>  > (from 
> http://www.itk.org/Doxygen/html/classitk_1_1SignedDanielssonDistanceMapImageFilter.html 
> 
>  > )
>  > So, your input image should have boundary pixels set to 1 and all
>  > other points to 0 (and not the other way around).
>  > HTH,
>  > /Ghassan
>  >
>  >
>  >
>  > On 9-Dec-08, at 7:24 PM, chensiqi wrote:
>  >
>  > >
>  > > Hi, ITKers
>  > >
>  > > I got two ques tions regarding SignedDanielssonDistanceMapImageFilter.
>  > >
>  > > 1. The result I have is not "signed", both the inside and outside
>  > > distance values are negative. The input is only a binary image with
>  > > boundary points at 0, and all other points at 1. I was wondering
>  > > how I was wondering how SignedDanielssonDistanceMapImageFilter
>  > > determine the region of inside and outside.
>  > >
>  > > 2. In Examples of SignedDanielssonDistanceMapImageFilter. cxx, I
>  > > notice that the OutputImageType of filter is unsigned short, which I
>  > > don't quite understand. The output should contains both negative
>  > > and positive distance, why use "unsigned" here?
>  > >
>  > > Thanks
>  > > Siqi
>  > >
>  > > MSN保护盾,十八般武艺保障MSN安全! 现
>  > > 在就下载! _______________________________________________
>  > > Insight-users mailing list
>  > > Insight-users at itk.org
>  > > http://www.itk.org/mailman/listinfo/insight-users
>  >
> 
> 
> ------------------------------------------------------------------------
> MSN热搜榜全新升级,更多排行榜等着你! 立即查看! < http://top.msn.com.cn>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list