上传者: 38678550
|
上传时间: 2021-09-13 10:47:42
|
文件大小: 41KB
|
文件类型: PDF
我就废话不多说了,大家还是直接看代码吧~
## using simpleITK to load and save data.
import SimpleITK as sitk
itk_img = sitk.ReadImage('./nifti.nii.gz')
img = sitk.GetArrayFromImage(itk_img)
print("img shape:",img.shape)
## save
out = sitk.GetImageFromArray(img)
# # out.SetSpacing(itk_img.GetSpacing())
# # out.SetOrigin