push before migration
This commit is contained in:
1
uncertainty/scripts/Names.csv
Normal file
1
uncertainty/scripts/Names.csv
Normal file
@@ -0,0 +1 @@
|
||||
patient;year;t2;adc;high_b
|
|
5
uncertainty/scripts/dict.csv
Normal file
5
uncertainty/scripts/dict.csv
Normal file
File diff suppressed because one or more lines are too long
55
uncertainty/scripts/select_data.py
Normal file
55
uncertainty/scripts/select_data.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import glob
|
||||
import csv
|
||||
|
||||
directories = {}
|
||||
directories['patient'] = []
|
||||
directories['year'] = []
|
||||
directories['t2'] = []
|
||||
directories['adc'] = []
|
||||
directories['high_b'] = []
|
||||
|
||||
# for patient in patients:
|
||||
# for year in mri_d:
|
||||
# x = glob.glob('/data/pca-rad/dataset/datasets/anonymized_mri/only_nii_directory/{patient}/{year}/')
|
||||
|
||||
path = '../../../datasets/anonymized_mri/only_nii_directory/*/*'
|
||||
x = glob.glob('../../../datasets/anonymized_mri/only_nii_directory/*/*')
|
||||
|
||||
for patient_year in sorted(x):
|
||||
directories['patient'].append(patient_year.split('/')[-2])
|
||||
directories['year'].append(patient_year.split('/')[-1])
|
||||
for string in sorted(glob.glob(f'../../../datasets/anonymized_mri/only_nii_directory/{patient_year.split("/")[-2]}/{patient_year.split("/")[-1]}/*/*')):
|
||||
if 'T2' in string or 't2' in string:
|
||||
if ('tra' in string):
|
||||
if not ('seg' in string):
|
||||
directories['t2'].append(string)
|
||||
# input(string)
|
||||
# input(patient_year)
|
||||
|
||||
for string in sorted(glob.glob(f'../../../datasets/anonymized_mri/only_nii_directory/{patient_year.split("/")[-2]}/{patient_year.split("/")[-1]}/*')):
|
||||
if 'manual_adc' in string:
|
||||
directories['adc'].append(string)
|
||||
if 'manual_b-1400' in string:
|
||||
directories['high_b'].append(string)
|
||||
|
||||
|
||||
print(len(x))
|
||||
print(len(directories['t2']))
|
||||
print(len(directories['adc']))
|
||||
print(len(directories['high_b']))
|
||||
|
||||
print(directories)
|
||||
with open('test.csv', 'w') as f:
|
||||
for key in directories.keys():
|
||||
f.write("%s,%s\n"%(key,directories[key]))
|
||||
# with open('dict.csv', 'w') as csv_file:
|
||||
# writer = csv.writer(csv_file)
|
||||
# for key, value in directories.items():
|
||||
# writer.writerow([key, value])
|
||||
# break
|
||||
# with open('Names.csv', 'w', newline='') as csvfile:
|
||||
# writer = csv.DictWriter(csvfile, fieldnames=['patient','year','t2','adc','high_b'], delimiter=';')
|
||||
# writer.writeheader()
|
||||
# writer.writerows(directories)
|
||||
|
||||
# give patients with incomplete exam
|
5
uncertainty/scripts/test.csv
Normal file
5
uncertainty/scripts/test.csv
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user