[ITK-users] [ITK] Exception when running IO example ImageReadCastWrite in Xcode

padillr ramonpadilla1 at yahoo.co.uk
Wed Apr 2 02:44:36 EDT 2014


Hi Matt,

So your example registers one factory, right? The lines below are
responsible for that?

itk::ObjectFactoryBase::CreateAllInstance( "itkImageIOBase" );
...
itk::MetaImageIOFactory::RegisterOneFactory();

I took the file Code.cxx and built it in an Xcode project and linked to the
ITK libs. I ran it, passing it an Analyze hdr file and got the following
exception:

When CMake is not used to register the IO classes, there are
0 IO objects available to the ImageFileReader.

When we try to read a MetaImage, we will fail.

After registering the MetaImageIO object, there are
1 IO objects available to the ImageFileReader.

Now, when we try to read a MetaImage, we will Error: 
itk::ImageFileReaderException (0x100404798)
Location: "virtual void itk::ImageFileReader<itk::Image<unsigned char,
2>, itk::DefaultConvertPixelTraits<unsigned char>
>::GenerateOutputInformation() [TOutputImage = itk::Image<unsigned char, 2>,
ConvertPixelTraits = itk::DefaultConvertPixelTraits<unsigned char>]" 
File: /temp/itk/Modules/IO/ImageBase/include/itkImageFileReader.hxx
Line: 143
Description:  Could not create IO object for file
/temp/itk-sample/copied/T1_MAP.hdr
  Tried to create one of the following:
    MetaImageIO
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.



Program ended with exit code: 1




--
View this message in context: http://itk-users.7.n7.nabble.com/ITK-users-Exception-when-running-IO-example-ImageReadCastWrite-in-Xcode-tp33650p33695.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list