Trying to design a FCNN for kidney segmentation for MR images. Have 40 images (DICOM) and their associated ground truth labels (PNG) mounted to the Google Drive for the Colab notebook that I am building the architecture upon.
For these 40 images and their labels, trying to resize all of them to 256 x 256 using the code below (and it is practically a carbon copy for the label resizing). Receiving a "list index out of range" for both blocks of code but I am aware of the "n-1" rule for the range() call, so it has to be the glob block of code that is listed just below.
from glob import glob
img_path = glob.glob("/content/drive/My Drive/CHOAS_Kidney_Labels/Training_Images/IMG*.dcm")
mask_path = glob.glob("/content/drive/My Drive/CHOAS_Kidney_Labels/Ground_Truth_Training/IMG*.png")
AttributeError: 'function' object has no attribute 'glob'
images=[]
a=[]
for i in range(0,39):
a=nib.load(img_path[i])
a=a.get_data()
print("image (%d) loaded"%(i))
a=resize(a,(a.shape[0],256,256))
a=a[:,:,:]
for j in range(a.shape[0]):
images.append((a[j,:,:]))
IndexError: list index out of range
Because you used from glob import glob
, you don't need the glob.glob
. You should just call glob
without the namespace glob.
Your second error is because img_path
is empty. And you're better off doing something like:
for name in img_path:
a=nib.load(name)