Fw: [Insight-users] How to compute "PCA s hape model"?

sun kacking123 at 163.com
Wed May 31 02:58:40 EDT 2006


Hi Zach:
    I have find some test code of itkImagePCAShapeModelEstimator class, and  generated mean image and 3 PCAShapeModel outputs successfully(all in mha files).
But when i gave them to the quoted code of Geodesic Active Contours Segmentation with Shape Guidance, an error occured and the program aborted.  I want to know whether there are something else i needed to do ?

Thanks 
sunli


----- Original Message ----- 
From: sun 
To: insight-users ; zpincus at stanford.edu 
Sent: Tuesday, May 30, 2006 7:49 PM
Subject: Re: [Insight-users] How to compute "PCA s hape model"?


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.
    Here is my code, it can't work.

  const   unsigned int        Dimension = 2;
  typedef float    my_PixelType;
  typedef itk::Image< my_PixelType, Dimension >    signdis_ImageType;
  std::vector<signdis_ImageType::Pointer> signdisImages( 3 );
  
  typedef  itk::ImageFileReader< signdis_ImageType > ReaderType;
  typedef  itk::ImageFileWriter<  signdis_ImageType  > WriterType;
  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writer = WriterType::New();
  reader->SetFileName( argv[1] );
  reader->Update();
  signdisImages[0] = reader->GetOutput();
  reader->SetFileName( argv[2] );
  reader->Update();
  signdisImages[1] = reader->GetOutput();
  reader->SetFileName( argv[3] );
  reader->Update();
  signdisImages[2] = reader->GetOutput();

  typedef itk::ImagePCAShapeModelEstimator<
  signdis_ImageType, 
  signdis_ImageType >  my_Estimatortype;
  my_Estimatortype::Pointer filter = my_Estimatortype::New(); 
  filter->SetInput( signdisImages );    //   error  here!!!!!!!!!!!!!!!!!!!!!
  writer->SetFileName( argv[4] );
  writer->SetInput( filter->GetOutput(0) );
  writer->Update(); 
  writer->SetFileName( argv[5] );
  writer->SetInput( filter->GetOutput(1) );
  writer->Update(); 
  ........

Thanks
sunli



----- Original Message ----- 
From: "Zachary Pincus" <zpincus at stanford.edu>
To: "sun" <kacking123 at 163.com>
Cc: <insight-users at itk.org>
Sent: Tuesday, May 30, 2006 2:55 AM
Subject: Re: [Insight-users] How to compute "PCA shape model"?



> Hi  Zach :
>     Thank you for your reply.
>     I have read the code in itkImagePCAShapeModelEstimator.txx . It  
> seems that the mean image and principal component outputs are
> generated in this class,and the inputs of this class is  
> TrainingImages.

This is correct.

> So i wondered what the  "signed distance maps a set of
> training shapes " mean in your reply, and how can i input these  
> images.

Use one of the Signed Distance Map filters available in ITK (there  
are several, check out the Doxygen class list) to convert binary  
training images (spanning the space of possible shapes you wish to  
segment) into signed distance maps, where each pixel's value is the  
distance from that pixel to the nearest edge of the binary object  
(and the pixel's value is negative if it is inside the object). This  
then represents each shape as the zero-level set of an image.

>     In the quoted code, the shape model defined by  
> CorpusCallosumMeanShape.mha and the first three principal
> components CorpusCallosumMode0.mha, CorpusCallosumMode1.mha and  
> CorpusCallosumMode12.mha. How can i generate
> these mha files? Can i write the principal component outputs of  
> itkImagePCAShapeModelEstimator class in  mha files
> directly?

That is correct. Or you could use them directly without writing them  
to files.



>
> Thanks
> Sunli
>
> ----- Original Message -----
> From: "Zachary Pincus" <zpincus at stanford.edu>
> To: "sun" <kacking123 at 163.com>
> Cc: "itk" <insight-users at itk.org>
> Sent: Sunday, May 28, 2006 3:41 AM
> Subject: Re: [Insight-users] How to compute "PCA shape model"?
>
>
>
> This is a longstanding gap in the documentation.
>
> In brief, you will need to generate signed distance maps of a set of
> training shapes, and pass them to the PCAShapeModelEstimator class.
> You may then choose to divide the returned "shape mode" images (note
> that output zero from the model estimator is the mean image) by the
> reported standard deviations, as described in the example.
>
> Let me know if more detail is required.
>
> Zach Pincus
>
> Program in Biomedical Informatics and Department of Biochemistry
> Stanford University School of Medicine
>
>
> On May 27, 2006, at 12:06 AM, sun wrote:
>
>> Hi all:
>>      I am using the filter "Geodesic Active Contours Segmentation
>> with Shape Guidance" to
>> segment my image now.But the quoted  code just reads in a "PCA
>> shape model" that has been pre-computed
>> earlier. I want to know how to compute such a shape model in  ITK.
>> Who can help me?
>>                                       sun li
>>
>>












你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ? 
蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,126 “D 计 划”火 热 体 验 中 ! 


--------------------------------------------------------------------------------


_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060531/96c7d81b/attachment-0001.html


More information about the Insight-users mailing list