The write image function in both SimpleITK and ITK python wrapping is broken.
I am having a very weird issue when writing images whose information has changed:
>>> import SimpleITK as sitk >>> base_image = sitk.ReadImage("C:/test/test_flair.nii.gz") >>> test_image = sitk.ReadImage("C:/test/test_001.nii.gz") >>> test_image.CopyInformation(base_image) >>> sitk.WriteImage(test_image, "C:/test/test_new.nii.gz") >>> test_image_new = sitk.ReadImage("C:/test/test_new.nii.gz") >>> test_image_new.GetOrigin() (0.0, 0.0, 0.0) >>> test_image.GetOrigin() (-0.0, -239.0, 0.0)
As you can see, the information is no longer preserved. I am running on Windows with SimpleITK version 1.2.4 and 2.0.2. Any help towards this would be very helpful, thank you. I am also able to replicate this in ITK version 5.0.2 using Python wrapping. This is replicable across Windows and Linux.
Cross-post from https://github.com/SimpleITK/SimpleITK/issues/1323