Specifying ImageIO when reading a file in Python

With SimpleITK, I can specify ImageIO when reading a file:

image = sitk.ReadImage(filename, sitk.sitkInt16, 'GiplImageIO')

Is there a similar, Pythonic interface for this in itk-5.0rc1? I tried:

img = itk.image_file_reader(FileName=filename, ImageIO=itk.GiplImageIO)

NotImplementedError: Wrong number or type of arguments for overloaded function 'itkImageIOBase_SetFileName'.
  Possible C/C++ prototypes are:
    itkImageIOBase::SetFileName(char const *)
    itkImageIOBase::SetFileName(std::string const &)

itk.imread can take PixelType as an argument, but it still guesses ImageIO from the file extension, which I want to avoid ā€” Iā€™d like to be able to read images always as a certain type, no matter what their file extension is.

1 Like

It should work if you write:

img = itk.image_file_reader(FileName=filename, ImageIO=itk.GiplImageIO.New())
2 Likes

Thank you!