[Insight-users] How to compute "PCA s
hape model"?
sun
kacking123 at 163.com
Tue May 30 07:49:14 EDT 2006
Hi Zach :
I have generated three Signed Distance Maps with SignedDanielssonDistanceMapImageFilter,and stored them in mha files,I want to use them as the TrainingImage. Now i have a question that how can i give these inputs to the itkImagePCAShapeModelEstimator? There are 3 TrainingImages and they are accessed using "this->getinput(0),this->getinput(1),this->getinput(2) in the itkImagePCAShapeModelEstimator class.</DIV>
<DIV> Here is my code, it can't work.</DIV>
<DIV> </DIV>
<DIV> const unsigned int Dimension = 2;</DIV>
<DIV> typedef float my_PixelType;<BR> typedef itk::Image< my_PixelType, Dimension > signdis_ImageType;<BR> std::vector<signdis_ImageType::Pointer> signdisImages( 3 );<BR> <BR> typedef itk::ImageFileReader< signdis_ImageType > ReaderType;<BR> typedef itk::ImageFileWriter< signdis_ImageType > WriterType;</DIV>
<DIV> ReaderType::Pointer reader = ReaderType::New();<BR> WriterType::Pointer writer = WriterType::New();</DIV>
<DIV> reader->SetFileName( argv[1] );<BR> reader->Update();<BR> signdisImages[0] = reader->GetOutput();<BR> reader->SetFileName( argv[2] );<BR> reader->Update();<BR> signdisImages[1] = reader->GetOutput();<BR> reader->SetFileName( argv[3] );<BR> reader->Update();<BR> signdisImages[2] = reader->GetOutput();</DIV>
<DIV><BR> typedef itk::ImagePCAShapeModelEstimator<<BR> signdis_ImageType, <BR> signdis_ImageType > my_Estimatortype;</DIV>
<DIV> my_Estimatortype::Pointer filter = my_Estimatortype::New(); <BR> filter->SetInput( signdisImages ); // error here!!!!!!!!!!!!!!!!!!!!!</DIV>
<DIV> writer->SetFileName( argv[4] );<BR> writer->SetInput( filter->GetOutput(0) );<BR> writer->Update(); <BR> writer->SetFileName( argv[5] );<BR> writer->SetInput( filter->GetOutput(1) );<BR> writer->Update(); </DIV>
<DIV> ........</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>sunli</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>----- Original Message ----- <BR>From: "Zachary Pincus" <<A href="mailto:zpincus at stanford.edu">zpincus at stanford.edu</A>><BR>To: "sun" <<A href="mailto:kacking123 at 163.com">kacking123 at 163.com</A>><BR>Cc: <<A href="mailto:insight-users at itk.org">insight-users at itk.org</A>><BR>Sent: Tuesday, May 30, 2006 2:55 AM<BR>Subject: Re: [Insight-users] How to compute "PCA shape model"?<BR><BR><BR><BR>> Hi Zach :<BR>> Thank you for your reply.<BR>> I have read the code in itkImagePCAShapeModelEstimator.txx . It <BR>> seems that the mean image and principal component outputs are<BR>> generated in this class,and the inputs of this class is <BR>> TrainingImages.<BR><BR>This is correct.<BR><BR>> So i wondered what the "signed distance maps a set of
> training shapes " mean in your reply, and how can i input these <BR>> images.<BR><BR>Use one of the Signed Distance Map filters available in ITK (there <BR>are several, check out the Doxygen class list) to convert binary <BR>training images (spanning the space of possible shapes you wish to <BR>segment) into signed distance maps, where each pixel's value is the <BR>distance from that pixel to the nearest edge of the binary object <BR>(and the pixel's value is negative if it is inside the object). This <BR>then represents each shape as the zero-level set of an image.<BR><BR>> In the quoted code, the shape model defined by <BR>> CorpusCallosumMeanShape.mha and the first three principal<BR>> components CorpusCallosumMode0.mha, CorpusCallosumMode1.mha and <BR>> CorpusCallosumMode12.mha. How can i generate<BR>> these mha files? Can i write the principal component outputs of <BR>> itkImagePCAShapeModelEstimator class in mha files<BR>> directly?<BR><BR>That is correct. Or you could use them directly without writing them <BR>to files.<BR><BR><BR><BR>><BR>> Thanks<BR>> Sunli<BR>><BR>> ----- Original Message -----<BR>> From: "Zachary Pincus" <<A href="mailto:zpincus at stanford.edu">zpincus at stanford.edu</A>><BR>> To: "sun" <<A href="mailto:kacking123 at 163.com">kacking123 at 163.com</A>><BR>> Cc: "itk" <<A href="mailto:insight-users at itk.org">insight-users at itk.org</A>><BR>> Sent: Sunday, May 28, 2006 3:41 AM<BR>> Subject: Re: [Insight-users] How to compute "PCA shape model"?<BR>><BR>><BR>><BR>> This is a longstanding gap in the documentation.<BR>><BR>> In brief, you will need to generate signed distance maps of a set of<BR>> training shapes, and pass them to the PCAShapeModelEstimator class.<BR>> You may then choose to divide the returned "shape mode" images (note<BR>> that output zero from the model estimator is the mean image) by the<BR>> reported standard deviations, as described in the example.<BR>><BR>> Let me know if more detail is required.<BR>><BR>> Zach Pincus<BR>><BR>> Program in Biomedical Informatics and Department of Biochemistry<BR>> Stanford University School of Medicine<BR>><BR>><BR>> On May 27, 2006, at 12:06 AM, sun wrote:<BR>><BR>>> Hi all:<BR>>> I am using the filter "Geodesic Active Contours Segmentation
>> with Shape Guidance" to<BR>>> segment my image now.But the quoted code just reads in a "PCA
>> shape model" that has been pre-computed<BR>>> earlier. I want to know how to compute such a shape model in ITK.<BR>>> Who can help me?<BR>>> sun li<BR>>><BR>>><BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV><SPAN></SPAN>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060530/32459af1/attachment.htm
More information about the Insight-users
mailing list