<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<BR>
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. <BR> <BR>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"<BR> <BR>What about the second question I have there about smart pointer.<BR>Is it OK to return a smart pointer from a function?<BR>E.g. I have this code:<BR>//////////////////////////////////////////////////////////////////////<BR> main.cpp<BR>typedef itk::Image< unsigned char, 2 > BinaryImageType;<BR>typedef itk::Image< float , 2> LSVImageType;<BR>LSVImageFilter::Pointer LSVImage = SDF(contour) // where the contour is binary image <BR><BR>SDF.cpp<BR>LSVImageType::Pointer SDF(BinaryImageType::Pointer contour)<BR>{<BR>typedef itk::SignedDanielssonDistanceMapImageFilter < BinaryImageFilter, LSVImageFilter > FilterType;<BR>FilterType::Pointer filter = FilterType::New(); <BR>filter ->SetInput ( contour ); // contour is the binary image <BR>return filter->GetOutput();<BR>} <BR>////////////////////////////////////////////////////////////////////<BR> <BR>Thanks<BR>Siqi<BR><BR>> Date: Wed, 10 Dec 2008 15:49:39 -0500<BR>> From: luis.ibanez@kitware.com<BR>> To: pidanchen@hotmail.com<BR>> CC: insight-users@itk.org<BR>> Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter<BR>> <BR>> <BR>> Hi chensiqi<BR>> <BR>> <BR>> Here is the philosophical question that you must<BR>> answer before your proceed further.<BR>> <BR>> <BR>> You want to get the distance to "what" ?<BR>> <BR>> <BR>> Do you want the distance to the points ?<BR>> Do you want the distance to the boundary ?<BR>> <BR>> <BR>> From a set of points located in a boundary is<BR>> *very difficult* to find the inside of an object.<BR>> <BR>> Do you have a topology connecting these points ?<BR>> e.g. a triangulated surface ?<BR>> <BR>> How did you get these points ?<BR>> It may be easier to work with the data preceeding<BR>> your point extraction.<BR>> <BR>> <BR>> <BR>> Regards,<BR>> <BR>> <BR>> <BR>> Luis<BR>> <BR>> <BR>> <BR>> ==================<BR>> chensiqi wrote:<BR>> > <BR>> > Hi, Luis.<BR>> > <BR>> > Thanks for the clarification.<BR>> > My purpose is to build a signed distance function given a point clouds <BR>> > of a shape boundary. I know there are several options to do this. If the <BR>> > only input are those points, which is the best, fast and easiest way to <BR>> > do this? I know there are several options in ITK.<BR>> > 1. FastMarching. <BR>> > 2. Reinitiaze<BR>> > 3. DistanceMap (Danielsson).<BR>> > <BR>> > Another question would be regarding smart pointer and raw pointer. Is <BR>> > it OK to return a smart pointer from a function?<BR>> > E.g. I have this code:<BR>> > //////////////////////////////////////////////////////////////////////<BR>> > main.cpp<BR>> > typedef itk::Image< unsigned char, 2 > BinaryImageType;<BR>> > typedef itk::Image< float , 2> LSVImageType;<BR>> > LSVImageFilter::Pointer LSVImage = SDF(contour) // where the contour is <BR>> > binary image <BR>> > SDF.cpp<BR>> > LSVImageType::Pointer SDF(BinaryImageType::Pointer contour)<BR>> > {<BR>> > typedef itk::SignedDanielssonDistanceMapImageFilter < <BR>> > BinaryImageFilter, LSVImageFilter > FilterType;<BR>> > FilterType::Pointer filter = FilterType::New(); <BR>> > filter ->SetInput ( contour ); // contour is the binary image <BR>> > return filter->GetOutput();<BR>> > } <BR>> > <BR>> > <BR>> > //////////////////////////////////////////////////////////////////////<BR>> > <BR>> > <BR>> > Thanks for any input<BR>> > Siqi<BR>> > <BR>> > <BR>> > > Date: Wed, 10 Dec 2008 15:16:08 -0500<BR>> > > From: luis.ibanez@kitware.com<BR>> > > To: pidanchen@hotmail.com<BR>> > > CC: insight-users@itk.org<BR>> > > Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter<BR>> > ><BR>> > ><BR>> > > Hi Chensiqi,<BR>> > ><BR>> > > You are misinterpreting the behavior of this filter.<BR>> > ><BR>> > > If you have a binary image, where<BR>> > ><BR>> > > * The foreground object is set to 1 and<BR>> > > * The background object is set to 0<BR>> > ><BR>> > ><BR>> > > Then the SignedDanielssonDistanceMapImageFilter will compute<BR>> > > the distances to the *transition* region between the 0s and<BR>> > > the 1s.<BR>> > ><BR>> > > All pixesl in the 0s region will have positive distances to<BR>> > > that boundary, while all pixels in the 1s region will have<BR>> > > negative distances to that boundary.<BR>> > ><BR>> > > In your case you are feeding an input image where the *boundary*<BR>> > > points are set to 1. Therefore, there is no "inside" to the<BR>> > > object.<BR>> > ><BR>> > > E.g. if you are feeding into this distance filter an image with<BR>> > > a thin ring, you are not going to find the "inside" of the ring.<BR>> > ><BR>> > > You should feed this filter with an image containing a filled<BR>> > > circle of radius R. Where all the points at locations r < R will<BR>> > > be set to 1s. Only in that case will the distance map be able to<BR>> > > find the "inside" of the object.<BR>> > ><BR>> > ><BR>> > > Regards,<BR>> > ><BR>> > ><BR>> > > Luis<BR>> > ><BR>> > ><BR>> > > ---------------<BR>> > > chensiqi wrote:<BR>> > > > Hi, Ghassan<BR>> > > ><BR>> > > > Thanks for the advice. I flip the input.<BR>> > > > The result now is both inside and outside are positive :(<BR>> > > ><BR>> > > > I use float type as the filteroutput instead of "unsigned short" in <BR>> > the<BR>> > > > example. I also tried unsigned short, the result is the same.<BR>> > > ><BR>> > > > Here is part of my code.<BR>> > > > <BR>> > ////////////////////////////////////////////////////////////////////////////////////////////////////<BR>> > > > typedef itk::Image< unsigned char, 2 > BinaryImageType;<BR>> > > > typedef itk::Image< float , 2> LSVImageType;<BR>> > > > typedef itk::SignedDanielssonDistanceMapImageFilter < <BR>> > BinaryImageFilter,<BR>> > > > LSVImageFilter > FilterType;<BR>> > > > FilterType::Pointer filter = FilterType::New();<BR>> > > ><BR>> > > > filter ->SetInput ( contour ); // contour is the binary image with<BR>> > > > BinaryImageType, 1 at boundary points, and 0 elsewhere.<BR>> > > ><BR>> > > > LSVImageFilter::Pointer LSVImage = filter->GetDistanceMap();<BR>> > > ><BR>> > > > Display (LSVImage) // this is a function that displays the image.<BR>> > > > <BR>> > //////////////////////////////////////////////////////////////////////////////////////////////////////<BR>> > > ><BR>> > > > I notice when I cout<<LSV_image->GetBufferedRegion().GetSize() , the<BR>> > > > output is [0,0]. I guess there is something wrong in my code that<BR>> > > > causes this weird output size. I can display LSVImage, although both<BR>> > > > inside and outside region are postive.<BR>> > > ><BR>> > > ><BR>> > > > Thanks for any input<BR>> > > > Siqi<BR>> > > ><BR>> > > > > CC: insight-users@itk.org<BR>> > > > > From: hamarneh@gmail.com<BR>> > > > > To: pidanchen@hotmail.com<BR>> > > > > Subject: Re: [Insight-users] SignedDanielssonDistanceMapImageFilter<BR>> > > > > Date: Tue, 9 Dec 2008 20:45:19 -0800<BR>> > > > ><BR>> > > > > Hello Siqi,<BR>> > > > ><BR>> > > > > You write: "The input is only a binary image with boundary points at<BR>> > > > > 0, and all other points at 1."<BR>> > > > > However, according to he documentation: "As a convention, the <BR>> > distance<BR>> > > > > is evaluated from the boundary of the ON pixels."<BR>> > > > > (from<BR>> > > > <BR>> > http://www.itk.org/Doxygen/html/classitk_1_1SignedDanielssonDistanceMapImageFilter.html <BR>> > <BR>> > > ><BR>> > > > > )<BR>> > > > > So, your input image should have boundary pixels set to 1 and all<BR>> > > > > other points to 0 (and not the other way around).<BR>> > > > > HTH,<BR>> > > > > /Ghassan<BR>> > > > ><BR>> > > > ><BR>> > > > ><BR>> > > > > On 9-Dec-08, at 7:24 PM, chensiqi wrote:<BR>> > > > ><BR>> > > > > ><BR>> > > > > > Hi, ITKers<BR>> > > > > ><BR>> > > > > > I got two ques tions regarding <BR>> > SignedDanielssonDistanceMapImageFilter.<BR>> > > > > ><BR>> > > > > > 1. The result I have is not "signed", both the inside and outside<BR>> > > > > > distance values are negative. The input is only a binary image with<BR>> > > > > > boundary points at 0, and all other points at 1. I was wondering<BR>> > > > > > how I was wondering how SignedDanielssonDistanceMapImageFilter<BR>> > > > > > determine the region of inside and outside.<BR>> > > > > ><BR>> > > > > > 2. In Examples of SignedDanielssonDistanceMapImageFilter. cxx, I<BR>> > > > > > notice that the OutputImageType of filter is unsigned short, <BR>> > which I<BR>> > > > > > don't quite understand. The output should contains both negative<BR>> > > > > > and positive distance, why use "unsigned" here?<BR>> > > > > ><BR>> > > > > > Thanks<BR>> > > > > > Siqi<BR>> > > > > ><BR>> > > > > > MSN保护盾,十八般武艺保障MSN安全! 现<BR>> > > > > > 在就下载! _______________________________________________<BR>> > > > > > Insight-users mailing list<BR>> > > > > > Insight-users@itk.org<BR>> > > > > > http://www.itk.org/mailman/listinfo/insight-users<BR>> > > > ><BR>> > > ><BR>> > > ><BR>> > > > <BR>> > ------------------------------------------------------------------------<BR>> > > > MSN热搜榜全新升级,更多排行榜等着你! 立即查看! < <BR>> > http://top.msn.com.cn><BR>> > > ><BR>> > > ><BR>> > > > <BR>> > ------------------------------------------------------------------------<BR>> > > ><BR>> > > > _______________________________________________<BR>> > > > Insight-users mailing list<BR>> > > > Insight-users@itk.org<BR>> > > > http://www.itk.org/mailman/listinfo/insight-users<BR>> > <BR>> > <BR>> > ------------------------------------------------------------------------<BR>> > 使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载! <BR>> > <http://im.live.cn/><BR><BR><br /><hr />使用新一代 Windows Live Messenger 轻松交流和共享! <a href='http://im.live.cn/' target='_new'>立刻下载!</a></body>
</html>