<div class="">
<p>I'm using ITK 4.2 with Qt Creator.</p>
<p>Trying to read several images, I always get the same:</p>
<blockquote>
<p>itk::ImageFileReaderException (0x1efccb0)
Location: "void itk::ImageFileReader::GenerateOutputInformation()
[with TOutputImage = itk::Image; ConvertPixelTraits =
itk::DefaultConvertPixelTraits]" </p>
<p>File: /usr/local/include/ITK-4.2/itkImageFileReader.hxx
Line: 143</p>
<p>Description: <strong>Could not create IO object</strong> for file /home/marcos/d2.dcm</p>
<p>Tried to create one of the following:
You probably failed to set a file suffix, or
set the suffix to an unsupported type.</p>
</blockquote>
<p>I've successfully readed it with </p>
<pre><code>vtkGDCMImageReader* reader = vtkGDCMImageReader::New();
reader->SetFileName(fileName);
reader->Update();
vtkImageData* imageData = reader->GetOutput();
cout << "imageData->GetScalarTypeAsString(): " << imageData->GetScalarTypeAsString() << endl;
</code></pre>
<p>And <em>GetScalarTypeAsString()</em> returns <strong>unsigned short</strong>.
Anyway, I tried with unsigned long, unsigned int, double, int, short, short unsigned int, unsigned char... I got the same.</p><p>Edit: other tip, with gdcminfo I get UINT16 as ScalarType.<br></p>
<p>This is the code:</p>
<pre><code>typedef itk::Image <unsigned short> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
try
{
reader->SetFileName(nombreFichero);
}
catch (itk::ExceptionObject& excep)
{
cerr << excep << endl;
return;
}
<br><br>Any ideas? Thanks in advance.<br></code></pre>
</div>