Open junxnone opened 3 years ago
MRI
import nibabel as nib from nilearn import image import matplotlib.pyplot as plt %matplotlib inline img_path = 'Task01_BrainTumour/imagesTr/BRATS_001.nii.gz' label_path = 'Task01_BrainTumour/labelsTr/BRATS_001.nii.gz' img = nib.load(img_path).get_fdata() label = nib.load(label_path).get_fdata() print(f'image shape {img.shape}') print(f'label shape {label.shape}') plt.figure(figsize=(10,10)) plt.subplot(121) plt.imshow(img[:,:,60,2],cmap='gray') plt.title('image') plt.subplot(122) plt.imshow(label[:,:,60], cmap='gray') plt.title('label')
import itk from itkwidgets import view import itkwidgets nii = nib.load(img_path).get_fdata()[:,:,:,0] viewer = view(nii,cmap=itkwidgets.cm.grayscale) viewer
Reference
Brief
MRI
, 逐渐被 NIFTI 替代Tasks
Read image