what is the meaning for each coordinate in ( mri_image.shape ) using nibabel library?

44 Views Asked by At

I am checking the shape of the MRI data that I downloaded from the ADNI website. it supposes to be a 3D image but this code produces 4 coordinates! I need to know what each coordinate here means. print(img.shape) the output that I got is (170, 256, 256, 1). should it be 3 coordinates since this 3D image?

1

There are 1 best solutions below

0
jkr On

The 1 is the grayscale channel. You can “squeeze” that dimension away and you will have a 3D array.

You can use img.squeeze()

And as for which direction each axis corresponds to, I highly recommend plotting different slices of the volume. That way you will know which axes correspond to sagittal, coronal, and axial. You can plot the slices towards the middle of each dimension, so you can see the tissue.

import matplotlib.pyplot as plt
plt.imshow(img[85])
plt.imshow(img[:, 128])
plt.imshow(img[:, :, 128])