[Insight-users] SignedDanielssonDistanceMapImageFilter
Andreas Wimmer
Andreas.Wimmer at gmx.ch
Wed Dec 10 17:14:28 EST 2008
Hi Siqi,
you could also use radial basis function interpolation to
create a signed distance function give a point cloud:
Reconstruction and Representation of 3D Objects With Radial Basis
Functions (2001) by T. R. Evans
In its simplest form, it is easy to implement but might
take a long time, depending on the number of points and
the size of the grid.
Regards,
Andreas
chensiqi wrote:
>
> I want the distance to the boundary. The points are located on the
> boundary and dense enough. I mean that when I connect those points with
> simple splines it will return well defined closed contour.
>
> I got those data from dcm files, the hospital physicians manually put
> those point to outline some organs, such as prostate. I want to build an
> implicit shape model. So the first problem is to convert these point
> based shape or "explicit" into a signed distance function or "implicit"
>
> What about the second question I have there about smart pointer.
> Is it OK to return a smart pointer from a function?
> E.g. I have this code:
> //////////////////////////////////////////////////////////////////////
> main.cpp
> typedef itk::Image< unsigned char, 2 > BinaryImageType;
> typedef itk::Image< float , 2> LSVImageType;
> LSVImageFilter::Pointer LSVImage = SDF(contour) // where the contour is
> binary image
>
> SDF.cpp
> L SVImageType::Pointer SDF(BinaryImageType::Pointer contour)
> {
> typedef itk::SignedDanielssonDistanceMapImageFilter <
> BinaryImageFilter, LSVImageFilter > FilterType;
> FilterType::Pointer filter = FilterType::New();
> filter ->SetInput ( contour ); // contour is the binary image
> return filter->GetOutput();
> }
> ////////////////////////////////////////////////////////////////////
>
> Thanks
> Siqi
>
> > Date: Wed, 10 Dec 2008 15:49:39 -0500
> > From: luis.ibanez at kitware.com
> > To: pidanchen at hotmail.com
> > CC: insight-users at itk.org
> > Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter
> >
> >
> > Hi chensiqi
> >
> >
> > Here is the philosophical question that you must
> > answer before your proceed further.
> >
> >
> > You want to get the distance to "what" ?
> >
> >
> > Do you want the distance to the points ?
> > Do you want the distance to the boundary ?
> >
> >
> > From a set of points located in a boundary is
> > *very difficult* to find the inside of an object.
> >
> > Do you have a topology connecting these points ?
> > e.g. a triangulated surface ?
> >
> > How did you get these points ?
> > It may be easier to work with the data preceeding
> > your point extraction.
> >
> >
> >
> > Regards,
> >
> >
> >
> > Luis
> >
> >
> >
> > ==================
> > chensiqi wrote:
> > >
> > > Hi, Luis.
> > >
> > > Thanks for the clarification.
> > > My purpose is to build a signed distance function given a point clouds
> > > of a shape boundary. I know there are several options to do this.
> If the
> > > only input are those points, which is the best, fast and easiest
> way to
> > > do this? I know there are several options in ITK.
> > > 1 . FastMarching.
> > > 2. Reinitiaze
> > > 3. DistanceMap (Danielsson).
> > >
> > > Another question would be regarding smart pointer and raw pointer. Is
> > > it OK to return a smart pointer from a function?
> > > E.g. I have this code:
> > > //////////////////////////////////////////////////////////////////////
> > > main.cpp
> > > typedef itk::Image< unsigned char, 2 > BinaryImageType;
> > > typedef itk::Image< float , 2> LSVImageType;
> > > LSVImageFilter::Pointer LSVImage = SDF(contour) // where the
> contour is
> > > binary image
> > > SDF.cpp
> > > LSVImageType::Pointer SDF(BinaryImageType::Pointer contour)
> > > {
> > > typedef itk::SignedDanielssonDistanceMapImageFilter <
> > > BinaryImageFilter, LSVImageFilter > FilterType;
> > > FilterType::Pointer filter = FilterType::New();
> > > filter ->SetInput ( contour ); // contour is the binary image
> > > return filter->GetOutput();
> > > }
> > >
> > >
> > > //////////////////////////////////////////////////////////////////////
> > >
> > >
> > > Thanks for any input
> > > Siqi
> > >
> > >
> > > > Date: Wed, 10 Dec 2008 15:16:08 -0500
> > > > From: luis.ibanez at kitware.com
> > > > To: pidanchen at hotmail.com
> > > > CC: insight-users at itk.org
> > > > Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter
> > > >
> > > >
> > > > 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
> > & gt; > 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.
> > > > >
> > >
> ////////////////////////////////////////////////////////////////////////////////////////////////////
> > & gt; > > 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.
> > > > >
> > >
> //////////////////////////////////////////////////////////////////////////////////////////////////////
> > > > >
> > > > &g t; 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
> > & gt; > > > 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
> > &g t; > > > > 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
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > 使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载!
> > > <http://im.live.cn/>
>
>
> ------------------------------------------------------------------------
> 使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载!
> <http://im.live.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