[Insight-users] reading dicom error
Dawood Masslawi
masslawi at gmail.com
Tue Dec 28 09:47:42 EST 2010
Hi Ali,
Try to change the following line:
reader->SetFileName( "IM35" );
to: reader->SetFileName( "IM35.dcm" );
This way you would explicitly indicate the file format of your
image.
Also, in my experience using the ImageFileReader without GDCMImageIO
works just fine with DICOM images. A simple example is included in
the example directory of the ITK ( Examples/IO/ImageReadWrite.cxx ).
Regards,
Dawood.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Dear All,
I used the following code to read DICOM file , but it always enter the catch
, am I forget something
typedef signed short InputPixelType;
const unsigned int InputDimension = 2;
typedef itk::Image< InputPixelType, InputDimension > InputImageType;
typedef itk::ImageFileReader< InputImageType > ReaderType;
typedef InputImageType::SizeType SizeType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( "IM35" );
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
reader->SetImageIO( gdcmImageIO );
try
{
reader->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "exception in file reader " << std::endl;
std::cerr << e << std::endl;
// return EXIT_FAILURE;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101228/ed64ec63/attachment.htm>
More information about the Insight-users
mailing list