[Insight-users] Abnormal program termination error.....Help
Sentil Balaji
profbalse at yahoo.co.in
Sun, 15 Feb 2004 06:48:42 +0000 (GMT)
Hey All,
I am trying to read and write a .bmp image.I
used the itkImageFileReader but I got an 'abnormal
program termination error'.I read the mailing list
archives and I found that I should use 'try' and
'catch'.I got the program executing without an error
but no '.bmp 'file was written.The code is
below:Please comment whether am I doing the try and
catch properly , any corrections for a better
solution is welcome...Many Thanks
------------------------------------
CODE
----------------------------------
#include <ITK/itkImageFileReader.h>
#include <ITK/itkImageFileWriter.h>
#include <ITK/itkImage.h>
BOOL main()
{
typedef itk::Image<unsigned char,2> Imagetype;
typedef itk::ImageFileReader<Imagetype> Readertype;
typedef itk::ImageFileWriter<Imagetype> Writertype;
Readertype ::Pointer reader=Readertype::New();
reader->SetFileName("C:/SLICES/ADD10.bmp");
try
{
reader->Update();
}
catch(itk::ExceptionObject exp)
{
return FALSE;
}
Imagetype::Pointer ir=reader->GetOutput();
Writertype ::Pointer writer=Writertype::New();
writer->SetInput(ir);
writer->SetFileName("C:/SLICES/ITKWRITE.bmp");
writer->Write();
return TRUE;
}
----------------------------------------------
________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more.
Go to: http://in.insurance.yahoo.com/licspecial/index.html