import numpy as np
import nibabel as nib
mask_path='./data/mask/mask.img'
img_path='../data/image/image.img'
img=nib.load(img_path)
mask_arr=np.memmap(mask_path,dtype=np.uint16,mode='r',order='F',shape=img.dataobj.shape)
mask=nib.Nifti1Image(mask_arr,affine=None)
nib.save(mask, 'mask.nii')
nib.save(img, 'image.nii')
.hdr/img转nii格式-python版本
于 2022-11-25 16:59:16 首次发布