<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hello,<BR>
&nbsp;<BR>
i want to use active shape model for segmentation of medical Image 2d. <BR><PRE>for constructing a volume itk::ImageSeriesReader. the programm compile fine, but it crash in run time, it tell me that   BMPImageIO could not open file c:\130.bmp for reading.</PRE><PRE>&nbsp;</PRE><PRE><FONT color=#0000ff size=2>#include<FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkActiveShapeModelCalculator.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImage.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageFileReader.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageFileWriter.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageSeriesReader.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkNumericSeriesFileNames.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkBMPImageIO.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkArray.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkActiveShapeModelGradientSearchMethod.h"<BR></FONT><FONT color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>&lt;iostream&gt;<BR>&nbsp;<BR></FONT><FONT color=#0000ff size=2>using</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#0000ff size=2>namespace</FONT><FONT face="" size=2><FONT face="" color=#000000> std;</FONT><BR>&nbsp;<BR></FONT><FONT color=#0000ff size=2>int</FONT><FONT color=#000000 size=2> main( </FONT><FONT color=#0000ff size=2>int</FONT><FONT face="" color=#000000 size=2> argc, </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2><FONT face="" color=#000000> * argv[] )</FONT><BR>{<BR><BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT size=2> </FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT face="" size=2> InputPixelType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::Image &lt; InputPixelType, 3 &gt; InputVolumeType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::Image&lt; </FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT face="" size=2>, 2 &gt; Image2DType;<BR><BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ActiveShapeModelCalculator&lt; InputVolumeType &gt; ASMCalculatorType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ImageSeriesReader&lt; InputVolumeType &gt; SeriesReaderType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::NumericSeriesFileNames NameGeneratorType;</FONT><P><FONT face="" color=#008000 size=2><BR></FONT><FONT size=2>SeriesReaderType::Pointer seriesReader = SeriesReaderType::New();</FONT></P><P><FONT face="" color=#008000 size=2><BR></FONT><FONT size=2>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</P>nameGenerator-&gt;SetSeriesFormat( </FONT><FONT face="" color=#800000 size=2>"c:\\130.bmp"</FONT><FONT face="" size=2> );<BR>nameGenerator-&gt;SetStartIndex( 1 );<BR>nameGenerator-&gt;SetEndIndex( 2 );<BR>nameGenerator-&gt;SetIncrementIndex( 1 );<BR>seriesReader-&gt;SetFileNames( nameGenerator-&gt;GetFileNames()); <BR>seriesReader-&gt;SetImageIO( itk::BMPImageIO::New() );<BR>ASMCalculatorType::Pointer asm_calculator = ASMCalculatorType::New();<BR></FONT><FONT face="" color=#0000ff size=2>try<BR></FONT><FONT size=2>{<BR>seriesReader-&gt;Update();<BR>}<BR></FONT><FONT color=#0000ff size=2>catch</FONT><FONT face="" size=2> ( itk::ExceptionObject &amp; err )<BR>{<BR>std::cerr &lt;&lt; </FONT><FONT face="" color=#800000 size=2>"Exception Object caught!"</FONT><FONT face="" size=2> &lt;&lt; std::endl;<BR>std::cerr &lt;&lt; err &lt;&lt; std::endl;<BR></FONT><FONT color=#0000ff size=2>return</FONT><FONT face="" size=2> EXIT_FAILURE;<BR>}<BR>asm_calculator-&gt;SetImage( seriesReader-&gt;GetOutput() );<BR></FONT><FONT face="" color=#0000ff size=2>try<BR></FONT><FONT size=2>{<BR><BR>asm_calculator-&gt;GenerateData();<BR>}<BR></FONT><FONT color=#0000ff size=2>catch</FONT><FONT face="" size=2> ( itk::ExceptionObject &amp; err )<BR>{<BR>std::cerr &lt;&lt; </FONT><FONT face="" color=#800000 size=2>"Exception Object caught!"</FONT><FONT face="" size=2> &lt;&lt; std::endl;<BR>std::cerr &lt;&lt; err &lt;&lt; std::endl;<BR></FONT><FONT color=#0000ff size=2>return</FONT><FONT face="" size=2> EXIT_FAILURE;<BR>}<BR>itk::Array&lt;</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>&gt; meanShape;<BR>meanShape = asm_calculator-&gt;GetMeanShape();<BR>vnl_vector&lt;</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>&gt; eigenValues = asm_calculator-&gt;GetEigenvalues();<BR>vnl_matrix&lt;</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>&gt; eigenVectors = asm_calculator-&gt;GetEigenvector();<BR></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> ( </FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT face="" size=2> i=0; i&lt;meanShape.GetNumberOfElements(); i++ )<BR>{<BR>std::cout &lt;&lt; i &lt;&lt; </FONT><FONT face="" color=#800000 size=2>": "</FONT><FONT face="" size=2> &lt;&lt; meanShape.GetElement(i) &lt;&lt; std::endl;<BR>}</FONT><FONT color=#008000 size=2><BR></FONT><FONT size=2>std::cout &lt;&lt; </FONT><FONT face="" color=#800000 size=2>"Vecteurs Propres:"</FONT><FONT face="" size=2> &lt;&lt; std::endl;<BR></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT face="" size=2> i = 0; i &lt; eigenVectors.rows(); i++) <BR>{<BR>std::cout&lt;&lt; eigenVectors.get_row(i)&lt;&lt;</FONT><FONT face="" color=#800000 size=2>" "</FONT><FONT face="" size=2>;<BR>} std::cout &lt;&lt;</FONT><FONT face="" color=#800000 size=2>""</FONT><FONT face="" size=2>&lt;&lt;std::endl;<BR>cout &lt;&lt; </FONT><FONT color=#800000 size=2>"Valeurs Propres:"</FONT><FONT face="" size=2> &lt;&lt; endl;<BR>cout &lt;&lt; eigenValues &lt;&lt; endl;<BR><BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ActiveShapeModelGradientSearchMethod&lt; Image2DType&gt; ImageSearchType;<BR>ImageSearchType::Pointer <BR>ImageSearch = ImageSearchType::New();<BR></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT face="" size=2> m_LenghtOfProfile = 3;<BR></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT face="" color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT face="" size=2> m_NumberOfIteration = 2;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ImageFileReader&lt; Image2DType &gt; Reader2DType;<BR>Reader2DType::Pointer reader1 = Reader2DType::New();<BR></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT face="" size=2> * input2DFilename = argv[2];<BR>reader1-&gt;SetFileName( input2DFilename );<BR>reader1-&gt;Update( );<BR>ImageSearch-&gt;SetImage( reader1-&gt;GetOutput() );</FONT><P><FONT color=#008000 size=2><BR></FONT><FONT size=2>ImageSearch-&gt;SetLenghtOfProfile( m_LenghtOfProfile );</P>ImageSearch-&gt;SetNumberOfIteration( m_NumberOfIteration );<BR>ImageSearch-&gt;SetMeanShape( asm_calculator-&gt;GetMeanShape() + 0.5);<BR>ImageSearch-&gt;SetEigenValues( asm_calculator-&gt;GetEigenvalues() );<BR>ImageSearch-&gt;SetEigenVectors( asm_calculator-&gt;GetEigenvector() );</FONT><FONT face="" size=2><BR><BR>ImageSearch-&gt;GenerateData();</FONT><FONT face="" color=#008000 size=2><BR></FONT><FONT size=2>ImageSearch-&gt;Print(std::cout);</FONT><FONT color=#008000 size=2><BR></FONT><FONT size=2></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT size=2> ImageSearchType::Superclass GenericEstimator2Type;<BR>std::cout &lt;&lt; ImageSearch-&gt;GenericEstimator2Type::GetNameOfClass() &lt;&lt; std::endl;<BR><BR>cout &lt;&lt; </FONT><FONT color=#800000 size=2>"The new shape: "</FONT><FONT size=2> &lt;&lt;<BR>ImageSearch-&gt;GetNewShape() &lt;&lt;endl;<BR><BR><BR></FONT><P><FONT color=#008000 size=2><BR></FONT><FONT size=2><BR><BR></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> EXIT_SUCCESS;</P>}<BR></FONT></PRE><PRE>&nbsp;</PRE></FONT><br /><hr />Téléchargez le nouveau Windows Live Messenger ! <a href='http://get.live.com/messenger/overview' target='_new'>Essayez-le !</a></body>
</html>