[Insight-users] itkImageFileReader: could not create IO object

Marcos fotosentido at gmail.com
Wed Dec 12 07:54:34 EST 2012


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.

Edit: other tip, with gdcminfo I get UINT16 as ScalarType.

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;
}

Any ideas? Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121212/5fba5084/attachment.htm>


More information about the Insight-users mailing list