首页 > 其他分享 >Nifty file process

Nifty file process

时间:2022-10-24 12:45:26浏览次数:52  
标签:plt nifti process object nib nii file Nifty data

20221024

使用nibabel库

import nibabel as nib

nifti_data_object = nib.load(‘example.nii.gz’)
nifti_image_data = nifti_data_object.get_fdata()
print(nifti_data_object)

plt.figure(figsize=(8, 8))
plt.imshow(a_nifti[:,:,80], 'gray', interpolation='none')
plt.imshow(b_nifti[:,:,80], 'jet', alpha=0.5, interpolation='none')
plt.show()

nifti_data_header = nifti_data_object.header

# Write nii data
nifti_data_object = nib.Nifti1Image(nifti_image_data, np.eye(4))
nib.save(nifti_data_object, ‘example.nii.gz’)

标签:plt,nifti,process,object,nib,nii,file,Nifty,data
From: https://www.cnblogs.com/xiaoxu-xli/p/16821100.html

相关文章