I have some process for a image, and I want to save the result.
The complete code to save image is:
writer = sitk.ImageFileWriter()
writer.KeepOriginalImageUIDOn()
writer.SetFileName(name)
print(img.GetMetaData('0028|0030'))
writer.Execute(img)
tImg = sitk.ReadImage(name)
print(tImg.GetMetaData('0028|0030'))
The tag of 0028|0030
is pixel spacing.
In the above code, I want to save img
, and the printed information is:
0.34090909361839\0.34090909361839
1\1
The spacing of img
is 0.34\0.34. But, when I write it and read it, the spacing is changed to be 1\1.
My enviornment is:
win 10
python 3.7
SimpleITK 2.0.2
Is there anything wrong with sitk.ImageFileWrite()
?