📅  最后修改于: 2022-03-11 14:45:24.550000             🧑  作者: Mango
import nibabel as nib
import numpy as np
im = nib.load(im_path)
new_im = np.expand_dims(im.get_fdata().astype(np.float32),-1)
nib.save(nib.Nifti1Image(new_im, affine=im.affine), im_path)