<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">Hi Ali,</span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">Try to change the following line: </span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span class="Apple-style-span" style="font-family: 'Times
New Roman'; font-size: medium; "><pre>reader->SetFileName( "IM35" );</pre><pre><br></pre><pre>to: reader->SetFileName( "IM35.dcm" );</pre><pre><br></pre><pre>This way you would explicitly indicate the file format of your</pre><pre><br></pre><pre>image.</pre><pre><br></pre><pre>Also, in my experience using the ImageFileReader without GDCMImageIO</pre><pre><br></pre><pre>works just fine with DICOM images. A simple example is included in </pre><pre><br></pre><pre>the example directory of the ITK ( <span class="Apple-style-span" style="font-family: arial; white-space: normal; font-size: 13px; ">Examples/IO/ImageReadWrite.cxx </span>).</pre><pre><br></pre><pre>Regards,</pre><pre><br></pre><pre>Dawood.</pre></span></span></font></div><br></span></font><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial"
size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size:
13px;">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "><pre>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;
}</pre></span></span></font></div></td></tr></table><br>