image_output_1.png
import os

flairs = t1ws = t2ws = t1gds = 0
study = {}
for p in os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train'):
    for i in os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p):
        study[p] = {}
        if i == 'FLAIR':
            flairs = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T1w':
            t1ws = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T2w':
            t2ws = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        elif i == 'T1wCE':
            t1gds = len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train/' + p + '/' + i))
        study[p]['FLAIR'] = flairs
        study[p]['T1w'] = t1ws
        study[p]['T2w'] = t2ws
        study[p]['T1wCE'] = t1gds
print(f"Total of {len(os.listdir('../input/rsna-miccai-brain-tumor-radiogenomic-classification/train'))} patients")
print('Study Directory Created')