I'm using ITK 4.2 with Qt Creator.
Trying to read several images, I always get the same:
itk::ImageFileReaderException (0x1efccb0)
Location: "void itk::ImageFileReader::GenerateOutputInformation() [with TOutputImage = itk::Image; ConvertPixelTraits = itk::DefaultConvertPixelTraits]"
File: /usr/local/include/ITK-4.2/itkImageFileReader.hxx
Line: 143
Description: Could not create IO object for file /home/marcos/d2.dcm
Tried to create one of the following:
You probably failed to set a file suffix, or
set the suffix to an unsupported type.
I've successfully readed it with
vtkGDCMImageReader* reader = vtkGDCMImageReader::New();
reader->SetFileName(fileName);
reader->Update();
vtkImageData* imageData = reader->GetOutput();
cout << "imageData->GetScalarTypeAsString(): " << imageData->GetScalarTypeAsString() << endl;
And GetScalarTypeAsString() returns unsigned short.
Anyway, I tried with unsigned long, unsigned int, double, int, short, short unsigned int, unsigned char... I got the same.
This is the 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;
}