image = nib.load('some_image')
header_info = image.header
print(header_info)
# change the voxel dimensions to [2,2,2]
header_info['pixdim'][1:4] = [2,2,2]
c = np.array(image.get_fdata())
# Use the new `header_info` before writing
x = nib.Nifti1Image(c, image.affine, header_info)
nib.save(x, 'something.nii.gz')
在保存之前,您需要更改
header information
:相关问题 更多 >
编程相关推荐