I'm using SimpleITK for Python and have created an empty image using NumPy as follows:
import SimpleITK as sitk
import numpy as np
pixels = np.zeros((64, 64))
image = sitk.GetImageFromArray(pixels)
Then, when I try to write the image to file in NIFTI format it complains that it cannot find the method "SetImageIO" on the ImageFileWriter object.
write = sitk.ImageFileWriter()
write.SetFileName('hello.nii.gz')
write.SetImageIO('NiftiImageIO')
write.Execute(image)
Error:
AttributeError: 'ImageFileWriter' object has no attribute 'SetImageIO'
Does anybody know why this is? The C++ docs clearly mention a method "SetImageIO" for ImageFileWriter.
Thanks, Ralph