Chris Oswald
commited on
Commit
•
b9661d6
1
Parent(s):
e2c0319
debugging
Browse files
SPIDER.py
CHANGED
@@ -37,6 +37,7 @@ def import_csv_data(filepath: str) -> List[Dict[str, str]]:
|
|
37 |
|
38 |
# Define constants
|
39 |
N_PATIENTS = 257
|
|
|
40 |
|
41 |
# TODO: Add BibTeX citation
|
42 |
# Find for instance the citation on arxiv or on the dataset repo/website
|
@@ -439,12 +440,12 @@ class SPIDER(datasets.GeneratorBasedBuilder):
|
|
439 |
if patient_grades:
|
440 |
grades_dict[str(patient_id)] = patient_grades
|
441 |
|
442 |
-
# Determine maximum number of radiological gradings per patient
|
443 |
-
max_ivd = 0
|
444 |
-
for temp_dict_1 in grades_dict.values():
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
|
449 |
# Import image and mask data
|
450 |
image_files = [
|
@@ -526,17 +527,19 @@ class SPIDER(datasets.GeneratorBasedBuilder):
|
|
526 |
|
527 |
# Pad patient radiological gradings so that data for all patients
|
528 |
# have the same dimensions
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
|
|
|
|
540 |
|
541 |
# Prepare example return dict
|
542 |
return_dict = {'patient_id':patient_id, 'scan_type':scan_type}
|
|
|
37 |
|
38 |
# Define constants
|
39 |
N_PATIENTS = 257
|
40 |
+
MAX_IVD = 9
|
41 |
|
42 |
# TODO: Add BibTeX citation
|
43 |
# Find for instance the citation on arxiv or on the dataset repo/website
|
|
|
440 |
if patient_grades:
|
441 |
grades_dict[str(patient_id)] = patient_grades
|
442 |
|
443 |
+
# # Determine maximum number of radiological gradings per patient
|
444 |
+
# max_ivd = 0
|
445 |
+
# for temp_dict_1 in grades_dict.values():
|
446 |
+
# for temp_dict_2 in temp_dict_1:
|
447 |
+
# if int(temp_dict_2['IVD label']) > max_ivd:
|
448 |
+
# max_ivd = int(temp_dict_2['IVD label'])
|
449 |
|
450 |
# Import image and mask data
|
451 |
image_files = [
|
|
|
527 |
|
528 |
# Pad patient radiological gradings so that data for all patients
|
529 |
# have the same dimensions
|
530 |
+
if len(patient_grades_dict) < MAX_IVD:
|
531 |
+
for i in range(len(patient_grades_dict) + 1, MAX_IVD + 1):
|
532 |
+
print(i)
|
533 |
+
patient_grades_dict[f'IVD{i}'] = {
|
534 |
+
"Modic": "",
|
535 |
+
"UP endplate": "",
|
536 |
+
"LOW endplate": "",
|
537 |
+
"Spondylolisthesis": "",
|
538 |
+
"Disc herniation": "",
|
539 |
+
"Disc narrowing": "",
|
540 |
+
"Disc bulging": "",
|
541 |
+
"Pfirrman grade": "",
|
542 |
+
}
|
543 |
|
544 |
# Prepare example return dict
|
545 |
return_dict = {'patient_id':patient_id, 'scan_type':scan_type}
|