Here I have many patient fold, each fold has 10 images. And I have a list which stores some directories what I want.
How can I load/read the files only from the directory on the list(data_paths)?
# data_paths is the list
data_paths = ['./data/preprocessed_data/train/Patient009969', './data/preprocessed_data/train/Patient009928', './data/preprocessed_data/train/Patient009966']
data_and_seg_arr = [np.load(ii, mmap_mode='r') for ii in data_paths]
Eror:
IsADirectoryError: [Errno 21] Is a directory: './data/preprocessed_data/train/Patient009969'
I need to keep this data form. because I will have to do :
pids = [ii.split('/')[-1].split('.')[0] for ii in data_paths]
data = OrderedDict()
for ix, pid in enumerate(pids):
data[pid] = {'data': data_and_seg_arr[ix][..., 0], 'seg': data_and_seg_arr[ix][..., 1], 'pid': pid}
return data