<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><BLOCKQUOTE>Hello,<BR> <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>please find my program, and if you have any suggestion, telle it to me</PRE><PRE>Thanks</PRE><PRE> </PRE><PRE><FONT face="" color=#0000ff size=2>#include<FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkActiveShapeModelCalculator.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImage.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageFileReader.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageFileWriter.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkImageSeriesReader.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkNumericSeriesFileNames.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkBMPImageIO.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkArray.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2>"itkActiveShapeModelGradientSearchMethod.h"<BR></FONT><FONT face="" color=#0000ff size=2>#include</FONT><FONT face="" color=#000000 size=2> </FONT><FONT face="" color=#800000 size=2><iostream><BR> <BR></FONT><FONT face="" 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> <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 < InputPixelType, 3 > InputVolumeType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::Image< </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 > Image2DType;<BR><BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ActiveShapeModelCalculator< InputVolumeType > ASMCalculatorType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ImageSeriesReader< InputVolumeType > SeriesReaderType;<BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::NumericSeriesFileNames NameGeneratorType;</FONT></PRE><PRE><FONT face="" color=#008000 size=2><BR></FONT><FONT face="" size=2>SeriesReaderType::Pointer seriesReader = SeriesReaderType::New();</FONT></PRE><PRE><FONT face="" color=#008000 size=2><BR></FONT><FONT face="" size=2>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</PRE><DIV align=left><PRE>nameGenerator->SetSeriesFormat( </FONT><FONT face="" color=#800000 size=2>"c:\\130.bmp"</FONT><FONT face="" size=2> );<BR>nameGenerator->SetStartIndex( 1 );<BR>nameGenerator->SetEndIndex( 2 );<BR>nameGenerator->SetIncrementIndex( 1 );<BR>seriesReader->SetFileNames( nameGenerator->GetFileNames()); <BR>seriesReader->SetImageIO( itk::BMPImageIO::New() );<BR>ASMCalculatorType::Pointer asm_calculator = ASMCalculatorType::New();<BR></FONT><FONT face="" color=#0000ff size=2>try<BR></FONT><FONT face="" size=2>{<BR>seriesReader->Update();<BR>}<BR></FONT><FONT color=#0000ff size=2>catch</FONT><FONT face="" size=2> ( itk::ExceptionObject & err )<BR>{<BR>std::cerr << </FONT><FONT face="" color=#800000 size=2>"Exception Object caught!"</FONT><FONT face="" size=2> << std::endl;<BR>std::cerr << err << std::endl;<BR></FONT><FONT color=#0000ff size=2>return</FONT><FONT face="" size=2> EXIT_FAILURE;<BR>}<BR>asm_calculator->SetImage( seriesReader->GetOutput() );<BR></FONT><FONT face="" color=#0000ff size=2>try<BR></FONT><FONT face="" size=2>{<BR><BR>asm_calculator->GenerateData();<BR>}<BR></FONT><FONT color=#0000ff size=2>catch</FONT><FONT face="" size=2> ( itk::ExceptionObject & err )<BR>{<BR>std::cerr << </FONT><FONT face="" color=#800000 size=2>"Exception Object caught!"</FONT><FONT face="" size=2> << std::endl;<BR>std::cerr << err << std::endl;<BR></FONT><FONT color=#0000ff size=2>return</FONT><FONT face="" size=2> EXIT_FAILURE;<BR>}<BR>itk::Array<</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>> meanShape;<BR>meanShape = asm_calculator->GetMeanShape();<BR>vnl_vector<</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>> eigenValues = asm_calculator->GetEigenvalues();<BR>vnl_matrix<</FONT><FONT face="" color=#0000ff size=2>double</FONT><FONT face="" size=2>> eigenVectors = asm_calculator->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<meanShape.GetNumberOfElements(); i++ )<BR>{<BR>std::cout << i << </FONT><FONT face="" color=#800000 size=2>": "</FONT><FONT face="" size=2> << meanShape.GetElement(i) << std::endl;<BR>}</FONT><FONT color=#008000 size=2><BR></FONT><FONT face="" size=2>std::cout << </FONT><FONT face="" color=#800000 size=2>"Vecteurs Propres:"</FONT><FONT face="" size=2> << 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 < eigenVectors.rows(); i++) <BR>{<BR>std::cout<< eigenVectors.get_row(i)<<</FONT><FONT face="" color=#800000 size=2>" "</FONT><FONT face="" size=2>;<BR>} std::cout <<</FONT><FONT face="" color=#800000 size=2>""</FONT><FONT face="" size=2><<std::endl;<BR>cout << </FONT><FONT color=#800000 size=2>"Valeurs Propres:"</FONT><FONT face="" size=2> << endl;<BR>cout << eigenValues << endl;<BR><BR></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> itk::ActiveShapeModelGradientSearchMethod< Image2DType> 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< Image2DType > 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->SetFileName( input2DFilename );<BR>reader1->Update( );<BR>ImageSearch->SetImage( reader1->GetOutput() );</FONT></PRE></DIV><FONT color=#008000 size=2><PRE><BR></FONT><FONT face="" size=2>ImageSearch->SetLenghtOfProfile( m_LenghtOfProfile );</PRE><PRE>ImageSearch->SetNumberOfIteration( m_NumberOfIteration );<BR>ImageSearch->SetMeanShape( asm_calculator->GetMeanShape() + 0.5);<BR>ImageSearch->SetEigenValues( asm_calculator->GetEigenvalues() );<BR>ImageSearch->SetEigenVectors( asm_calculator->GetEigenvector() );</FONT><FONT face="" size=2><BR><BR>ImageSearch->GenerateData();</FONT><FONT face="" color=#008000 size=2><BR></FONT><FONT face="" size=2>ImageSearch->Print(std::cout);</FONT><FONT color=#008000 size=2><BR></FONT><FONT size=2></FONT><FONT face="" color=#0000ff size=2>typedef</FONT><FONT face="" size=2> ImageSearchType::Superclass GenericEstimator2Type;<BR>std::cout << ImageSearch->GenericEstimator2Type::GetNameOfClass() << std::endl;<BR><BR>cout << </FONT><FONT color=#800000 size=2>"The new shape: "</FONT><FONT face="" size=2> <<<BR>ImageSearch->GetNewShape() <<endl;<BR><BR><BR></PRE></FONT><PRE><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;</PRE><PRE>}<BR></PRE></FONT><PRE> </FONT><HR>Téléchargez le nouveau Windows Live Messenger ! <A href="http://get.live.com/messenger/overview" target=_blank>Essayez-le !</A> </PRE></BLOCKQUOTE><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>