I’m trying to debug a test executable of a Slicer Extension (PkModeling). The problem is that running the test, which processes an image, fails in itkImageFileReader.hxx with this error:
File: d:\sd\itkv4\modules\io\imagebase\include\itkImageFileReader.hxx
Line: 143
Description: Could not create IO object for reading file
D:/Dev/Repos/PkModeling/CLI/Testing/Cxx/../../../Data/SampledPhantoms/QINProstate001/Input/QINProstate001-phantom.nrrd
Tried to create one of the following:
MRMLIDImageIO
You probably failed to set a file suffix, or
set the suffix to an unsupported type.
The project is set up as superbuild and can be build Standalone and as Slicer Extension. The test works fine in standalone but fails when build as extension (build against the ITK in Slicer). I have no idea what’s going on, and why ITK thinks it cannot load a nrrd file.
Debugging into it confirmed that in ImageIOFactory::CreateImageIO the call to ObjectFactoryBase::CreateAllInstance(“itkImageIOBase”) doesn’t return any ImageIOBase object that could handle an “nrrd” file.
I’m suspecting I am missing smth in my cmake configuration, since other extensions (e.g. DCMQI) built as Slicer Extension against the same ITK doesn’t have this problem
MRMLIDImageIO is a special IO class that allows passing images between Slicer and CLI modules without writing them to file. One way of disabling it is to only create executable CLI by adding EXECUTABLE_ONLY in your CMakeLists.txt file:
If you don’t use MRMLIDImageIO then it means that standard ITK image IO factory classes are not registered. Compare CMakeLists.txt and source code of your CLI to other CLIs that can read images, there are probably 1-2 lines missing from your code.