I am trying to view MRI scan images from kits23 dataset on Google Colab, but instead I get blank images. The path is valid and I am using nibable library to view .nii images. I don't know what the issue is, so help me solve this problem.
I was expecting the original image, but instead I get a blank image.
This is the code:
import nibabel as nib
import matplotlib.pyplot as plt
path = '/content/kits23/dataset/case_00008/segmentation.nii.gz'
image_data = nib.load(path).get_fdata()
normalized_image = (image_data - image_data.min()) / (image_data.max() - image_data.min())
plt.style.use('default')
fig, axes = plt.subplots(4,4, figsize=(12,12))
for i, ax in enumerate(axes.reshape(-1)):
ax.imshow(normalized_image[:,:,1 + i], cmap="gray", vmin=0, vmax=1)
plt.show()normalized_image.shape
This is the output I get: