RuntimeError

When I evaluate the model , I meet an error. But only one patient will create the problem.
RuntimeError: Exception thrown in SimpleITK ImageFileReader_Execute: /tmp/SimpleITK-build/ITK/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx:1980:
ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition found!
what will I do?

We will try and fix it asap.

Hi,

Try using SimpleITK==2.0.2.
Let me know if that works.

Best,
Valentin

Hi,
When I use SimpleITK==2.0.2, the error is gone.
Thank you!

@huangzy Thanks for the tip. Personally, I found it difficult if not impossible to downgrade SimpleITK to 2.0.2 due to dependencies with other packages in my working environment. What helped for me was to use SimpleITK==2.0.2 in a different environment and subsequently run the code below. The new image could be loaded in a newer version of SimpleITK.

import SimpleITK as sitk # version 2.0.2
p = ‘path_to_the_image’

img = sitk.ReadImage§
arr = sitk.GetArrayFromImage(img)
sitk.WriteImage(np2itk(arr,img),p)

def np2itk(arr,original_img):
img = sitk.GetImageFromArray(arr)
img.SetSpacing(original_img.GetSpacing())
img.SetOrigin(original_img.GetOrigin())
img.SetDirection(original_img.GetDirection())
return img