Apr-28-2020, 09:01 PM
Trying to create an array of pixel data corresponding to a dataset of 40 PNG files contained within my Google Drive, using Google Colab.
Managed to accomplish the listed goal for 40 DICOM fils, using pydicom.dcmread() in place of imageio.imread() below in the code block. However, I keep receiving empty values for the print statements below. Tried using cv2.imread() as an alternative and the program provides an error message of "File Not Found" for the directory listed in the glob.glob() call.
Managed to accomplish the listed goal for 40 DICOM fils, using pydicom.dcmread() in place of imageio.imread() below in the code block. However, I keep receiving empty values for the print statements below. Tried using cv2.imread() as an alternative and the program provides an error message of "File Not Found" for the directory listed in the glob.glob() call.
pixel_data1 = [] masks = glob.glob("content/drive/My Drive/Masks/IMG*.png"); for mask in masks: dataset1 = imageio.imread(mask) pixel_data1.append(dataset1.pixel_array) print(len(masks)) print(pixel_data1)The above code outputs 0 and [], respectively, for the print statements. Is there a program that can read the elements in the masks statement and then append the pixel intensity values as a data array to create the pixel_data1 vector?