I'm using the following code to slice a 3D image:
import nibabel as nib
import numpy as np
from nibabel.testing import data_path
import os
vol1= np.load("teste01.npy")
zSlice= (vol1[200, :, :]).squeeze()
print (zSlice.shape)
np.save("D:/Volumes convertidos LIDC/slice200.npy", zSlice)
The problem is that I need to do it manually, I need to obtain all slices and there are just to many for it to be possible to keep doing it like that. Is there any alternative?