<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2876" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=217102014-13072006>Hello, 
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=217102014-13072006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=217102014-13072006>I want to use Active 
Shape models for segmentation tasks. Unfortunately, I didn't find too much 
information on the image type required by itk::ActiveShapeModelCalculator. I 
use&nbsp;itk::ImageSeriesReader for constructing a volume. The program compiles 
and runs fine. Only trouble is that the calculated mean shape vector contains 
really strange landmarks. I tried it out for very small png-images (2 colors) 
containing a simple rectangle each. Below, please find my code. Any help on 
understanding these weird effects&nbsp;would be&nbsp;highly 
appreciated.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=217102014-13072006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=217102014-13072006>Corinna</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=217102014-13072006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=217102014-13072006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=217102014-13072006>#if 
defined(_MSC_VER)<BR>#pragma warning ( disable : 4786 
)<BR>#endif</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=217102014-13072006>#ifdef 
__BORLANDC__<BR>#define ITK_LEAN_AND_MEAN<BR>#endif</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=Arial size=2><SPAN class=217102014-13072006>
<DIV><BR>#include "itkActiveShapeModelCalculator.h"</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include 
"itkImageFileWriter.h"<BR>#include "itkImageSeriesReader.h"<BR>#include 
"itkNumericSeriesFileNames.h"<BR>#include "itkPNGImageIO.h"<BR>#include 
"itkArray.h"</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include &lt;iostream&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>// ASM Calculator<BR>// input: binary volume containing the training 
shapes<BR>// output: mean shape, eigenvectors, eigenvalues</DIV>
<DIV>&nbsp;</DIV>
<DIV>int main( int argc, char * argv[] )<BR>{<BR>&nbsp; if( argc != 4 
)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: " 
&lt;&lt; argv[0] &lt;&lt; " first last imgnames" &lt;&lt; 
std::endl;<BR>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp; <BR>&nbsp; typedef unsigned 
char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InputPixelType;<BR>&nbsp; 
typedef itk::Image &lt; InputPixelType, &nbsp;3 
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InputVolumeType;<BR>&nbsp; typedef 
itk::ActiveShapeModelCalculator&lt; InputVolumeType &gt; 
&nbsp;ASMCalculatorType;<BR>&nbsp; typedef itk::ImageSeriesReader&lt; 
InputVolumeType &gt;&nbsp; &nbsp;&nbsp;&nbsp;SeriesReaderType;<BR>&nbsp; typedef 
itk::NumericSeriesFileNames&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NameGeneratorType;<BR>&nbsp; <BR>&nbsp; // 
read 2D images and construct a volume<BR>&nbsp; SeriesReaderType::Pointer 
seriesReader = SeriesReaderType::New();<BR>&nbsp; int first = atoi( argv[1] 
);<BR>&nbsp; int last = atoi( argv[2] );<BR>&nbsp; NameGeneratorType::Pointer 
nameGenerator = NameGeneratorType::New();<BR>&nbsp; 
nameGenerator-&gt;SetSeriesFormat( argv[3] );<BR>&nbsp; 
nameGenerator-&gt;SetStartIndex( first );<BR>&nbsp; 
nameGenerator-&gt;SetEndIndex( last );<BR>&nbsp; 
nameGenerator-&gt;SetIncrementIndex( 1 );<BR>&nbsp; seriesReader-&gt;SetImageIO( 
itk::PNGImageIO::New() );<BR>&nbsp; seriesReader-&gt;SetFileNames( 
nameGenerator-&gt;GetFileNames() );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; ASMCalculatorType::Pointer asm_calculator = 
ASMCalculatorType::New();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; try<BR>&nbsp; {<BR>&nbsp; &nbsp;seriesReader-&gt;Update();<BR>&nbsp; 
}<BR>&nbsp; catch ( itk::ExceptionObject &amp; err )<BR>&nbsp; {<BR>&nbsp; 
&nbsp;std::cerr &lt;&lt; "Exception Object caught!" &lt;&lt; 
std::endl;<BR>&nbsp; &nbsp;std::cerr &lt;&lt; err &lt;&lt; std::endl;<BR>&nbsp; 
&nbsp;return EXIT_FAILURE;<BR>&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; asm_calculator-&gt;SetImage( seriesReader-&gt;GetOutput() );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; try<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
asm_calculator-&gt;GenerateData();<BR>&nbsp; }<BR>&nbsp; catch ( 
itk::ExceptionObject &amp; err )<BR>&nbsp; {<BR>&nbsp; &nbsp;std::cerr &lt;&lt; 
"Exception Object caught!" &lt;&lt; std::endl;<BR>&nbsp; &nbsp;std::cerr 
&lt;&lt; err &lt;&lt; std::endl;<BR>&nbsp; &nbsp;return EXIT_FAILURE;<BR>&nbsp; 
}<BR>&nbsp; <BR>&nbsp; itk::Array&lt;double&gt; meanShape;<BR>&nbsp; meanShape = 
asm_calculator-&gt;GetMeanShape();<BR>&nbsp; for ( unsigned int i=0; 
i&lt;meanShape.GetNumberOfElements(); i++ )<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
std::cout &lt;&lt; i &lt;&lt; ": " &lt;&lt; meanShape.GetElement(i) &lt;&lt; 
std::endl;<BR>&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; return EXIT_SUCCESS;<BR>}<BR></SPAN></FONT></DIV></BODY></HTML>