forked from nknuecht/3D-ESPNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen.py
More file actions
21 lines (20 loc) · 669 Bytes
/
gen.py
File metadata and controls
21 lines (20 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#============================================
__author__ = "Sachin Mehta"
__license__ = "MIT"
__maintainer__ = "Sachin Mehta"
#============================================
'''
This file generates a mapping between FLAIR file and segmentation file
'''
import glob
import os
folders = ['HGG', 'LGG']
writeText = open('train.txt', 'w')
for folder in folders:
sub_folders = glob.glob(folder + os.sep + '*')
for sub_folder in sub_folders:
files = glob.glob(sub_folder + '/*_flair.nii.gz')
if len(files) <= 0:
continue
writeText.write(os.sep + files[0] + ', ' + os.sep + files[0].replace('flair', 'seg') + '\n')
writeText.close()