-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconstants.py
More file actions
332 lines (295 loc) · 12.5 KB
/
Copy pathconstants.py
File metadata and controls
332 lines (295 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
import os
from pathlib import Path
# DATA_BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../data")
# DATA_BASE_DIR = '/mnt/c/chong/data/'
# DATA_BASE_DIR = Path(DATA_BASE_DIR)
# #############################################
# CheXpert constants
# #############################################
CHEXPERT_DATA_DIR = Path('/mnt/c/chong/data/CheXpert-v1.0')
CHEXPERT_ORIGINAL_TRAIN_CSV = CHEXPERT_DATA_DIR / "train.csv"
CHEXPERT_TRAIN_CSV = CHEXPERT_DATA_DIR / "df_chexpert_plus_240401_chong.csv" # train split from train.csv
CHEXPERT_VALID_CSV = CHEXPERT_DATA_DIR / "valid_split.csv" # valid split from train.csv
CHEXPERT_TEST_CSV = (CHEXPERT_DATA_DIR / "valid.csv") # using validation set as test set (test set label hidden)
CHEXPERT_MASTER_CSV = (CHEXPERT_DATA_DIR / "master_updated.csv") # contains patient information, not PHI conplient
CHEXPERT_TRAIN_DIR = CHEXPERT_DATA_DIR / "train"
CHEXPERT_TEST_DIR = CHEXPERT_DATA_DIR / "valid"
CHEXPERT_5x200 = CHEXPERT_DATA_DIR / "chexpert_5x200.csv"
CHEXPERT_8x200_QUERY = CHEXPERT_DATA_DIR / "chexpert_8x200_query.csv"
CHEXPERT_8x200_CANDIDATES = CHEXPERT_DATA_DIR / "chexpert_8x200_candidates.csv"
CHEXPERT_VALID_NUM = 5000
CHEXPERT_VIEW_COL = "Frontal/Lateral"
CHEXPERT_PATH_COL = "Path"
CHEXPERT_SPLIT_COL = "Split"
CHEXPERT_REPORT_COL = "Report Impression"
CHEXPERT_TASKS = [
"No Finding",
"Enlarged Cardiomediastinum",
"Cardiomegaly",
"Lung Lesion",
"Lung Opacity",
"Edema",
"Consolidation",
"Pneumonia",
"Atelectasis",
"Pneumothorax",
"Pleural Effusion",
"Pleural Other",
"Fracture",
"Support Devices",
]
CHEXPERT_COMPETITION_TASKS = [
"Atelectasis",
"Cardiomegaly",
"Consolidation",
"Edema",
"Pleural Effusion",
]
# baseed on original chexpert paper
CHEXPERT_UNCERTAIN_MAPPINGS = {
"Atelectasis": 1,
"Cardiomegaly": 0,
"Consolidation": 0,
"Edema": 1,
"Pleural Effusion": 1,
}
# CHEXPERT_CLASS_PROMPTS = {
# "Atelectasis": "Platelike opacity likely represents atelectasis.",
# "Cardiomegaly": "The cardiac silhouette is enlarged.",
# "Edema": "The presence of hazy opacity suggests interstitial pulmonary edema.",
# "Fracture": "A cortical step off indicates the presence of a fracture.",
# "Pleural Effusion": "The pleural space is partially filled with fluid",
# "Pneumonia": "A pulmonary opacity with ill defined borders likely represents pneumonia.",
# "Pneumothorax": "A medial pneumothorax is present adjacent to the heart.",
# "No Finding": "No clinically significant radiographic abnormalities."
# }
CHEXPERT_CLASS_PROMPTS = {
"Atelectasis": {
"severity": ["", "mild", "minimal"],
"subtype": [
"subsegmental atelectasis",
"linear atelectasis",
"trace atelectasis",
"bibasilar atelectasis",
"retrocardiac atelectasis",
"bandlike atelectasis",
"residual atelectasis",
],
"location": [
"at the mid lung zone",
"at the upper lung zone",
"at the right lung zone",
"at the left lung zone",
"at the lung bases",
"at the right lung base",
"at the left lung base",
"at the bilateral lung bases",
"at the left lower lobe",
"at the right lower lobe",
],
},
"Cardiomegaly": {
"severity": [""],
"subtype": [
"cardiac silhouette size is upper limits of normal",
"cardiomegaly which is unchanged",
"mildly prominent cardiac silhouette",
"portable view of the chest demonstrates stable cardiomegaly",
"portable view of the chest demonstrates mild cardiomegaly",
"persistent severe cardiomegaly",
"heart size is borderline enlarged",
"cardiomegaly unchanged",
"heart size is at the upper limits of normal",
"redemonstration of cardiomegaly",
"ap erect chest radiograph demonstrates the heart size is the upper limits of normal",
"cardiac silhouette size is mildly enlarged",
"mildly enlarged cardiac silhouette, likely left ventricular enlargement. other chambers are less prominent",
"heart size remains at mildly enlarged",
"persistent cardiomegaly with prominent upper lobe vessels",
],
"location": [""],
},
"Consolidation": {
"severity": ["", "increased", "improved", "apperance of"],
"subtype": [
"bilateral consolidation",
"reticular consolidation",
"retrocardiac consolidation",
"patchy consolidation",
"airspace consolidation",
"partial consolidation",
],
"location": [
"at the lower lung zone",
"at the upper lung zone",
"at the left lower lobe",
"at the right lower lobe",
"at the left upper lobe",
"at the right uppper lobe",
"at the right lung base",
"at the left lung base",
],
},
"Edema": {
"severity": [
"",
"mild",
"improvement in",
"presistent",
"moderate",
"decreased",
],
"subtype": [
"pulmonary edema",
"trace interstitial edema",
"pulmonary interstitial edema",
],
"location": [""],
},
"Pleural Effusion": {
"severity": ["", "small", "stable", "large", "decreased", "increased"],
"location": ["left", "right", "tiny"],
"subtype": [
"bilateral pleural effusion",
"subpulmonic pleural effusion",
"bilateral pleural effusion",
],
},
}
# #############################################
# MIMIC-CXR-JPG constants
# #############################################
MIMIC_CXR_DATA_DIR = Path("/mnt/c/chong/data/mimic-cxr-jpg/2.0.0")
# MIMIC_CXR_TRAIN_TXT = MIMIC_CXR_DATA_DIR / "train.txt"
# MIMIC_CXR_VALID_TXT = MIMIC_CXR_DATA_DIR / "test.txt"
MIMIC_CXR_CHEXPERT_CSV = MIMIC_CXR_DATA_DIR / "mimic-cxr-2.0.0-chexpert.csv"
MIMIC_CXR_META_CSV = MIMIC_CXR_DATA_DIR / "mimic-cxr-2.0.0-metadata.csv"
MIMIC_CXR_TEXT_CSV = MIMIC_CXR_DATA_DIR / "yulequan/mimic_cxr_sectioned.csv"
MIMIC_CXR_SPLIT_CSV = MIMIC_CXR_DATA_DIR / "mimic-cxr-2.0.0-split.csv"
# Created csv
MIMIC_CXR_TRAIN_CSV = MIMIC_CXR_DATA_DIR / "train.csv"
MIMIC_CXR_VALID_CSV = MIMIC_CXR_DATA_DIR / "test.csv"
MIMIC_CXR_TEST_CSV = MIMIC_CXR_DATA_DIR / "test.csv"
MIMIC_CXR_MASTER_CSV = MIMIC_CXR_DATA_DIR / "yulequan/master.csv"
MIMIC_CXR_VIEW_COL = "ViewPosition"
MIMIC_CXR_PATH_COL = "Path"
MIMIC_CXR_SPLIT_COL = "split"
# #############################################
# PadChest constants
# #############################################
PadChest_CXR_DATA_DIR = Path("/mnt/c/chong/data/padchest/")
PadChest_CXR_TRAIN_CSV = PadChest_CXR_DATA_DIR / "PADCHEST_chest_x_ray_images_labels_160K_01.02.19_chong.csv"
# #############################################
# Open-I constants
# #############################################
Open_I_CXR_DATA_DIR = Path("/mnt/c/chong/data/open-i/")
Open_I_CXR_TRAIN_CSV = Open_I_CXR_DATA_DIR / "indiana_reports_chong.csv"
# #############################################
# BIMCV constants
# #############################################
BIMCV_CXR_DATA_DIR = Path("/mnt/c/chong/data/bimcv-covid19/")
BIMCV_CXR_TRAIN_CSV = BIMCV_CXR_DATA_DIR / "final_annotations_chong.csv"
# #############################################
# CANDID constants
# #############################################
CANDID_CXR_DATA_DIR = Path("/mnt/c/chong/data/candid/")
CANDID_CXR_TRAIN_CSV = CANDID_CXR_DATA_DIR / "Pneumothorax_reports_chong.csv"
# #############################################
# ReXGradient constants
# #############################################
ReXGradient_CXR_DATA_DIR = Path("/mnt/c/chong/data/ReXGradient-160K/")
ReXGradient_CXR_TRAIN_CSV = ReXGradient_CXR_DATA_DIR / "train_metadata_chong.csv"
# #############################################
# CASIA-CXR constants
# #############################################
CASIA_CXR_DATA_DIR = Path("/mnt/c/chong/data/CASIA-CXR/")
CASIA_CXR_TRAIN_CSV = CASIA_CXR_DATA_DIR / "CASIA-CXR_Combined_Reports_chong.csv"
# #############################################
# Brax constants
# #############################################
Brax_CXR_DATA_DIR = Path("/mnt/c/chong/data/brax/")
Brax_CXR_TRAIN_CSV = Brax_CXR_DATA_DIR / "master_spreadsheet_update_chong.csv"
# #############################################
# ChestDR constants
# #############################################
ChestDR_CXR_DATA_DIR = Path("/mnt/c/chong/data/ChestDR/")
ChestDR_CXR_TRAIN_CSV = ChestDR_CXR_DATA_DIR / "chestdr_published_19d_chong.csv"
# #############################################
# NIHChestXray14 constants
# #############################################
NIHChestXray14_CXR_DATA_DIR = Path("/mnt/c/chong/data/chestxray14/")
NIHChestXray14_CXR_TRAIN_CSV = NIHChestXray14_CXR_DATA_DIR / "Data_Entry_2017_chong.csv"
# #############################################
# Vindr-CXR constants
# #############################################
Vindr_CXR_DATA_DIR = Path("/mnt/c/chong/data/vindr-cxr/")
Vindr_CXR_TRAIN_CSV = Vindr_CXR_DATA_DIR / "image_labels_train_chong.csv"
# #############################################
# Vindr-PCXR constants
# #############################################
Vindr_PCXR_DATA_DIR = Path("/mnt/c/chong/data/vindr-pcxr/")
Vindr_PCXR_TRAIN_CSV = Vindr_PCXR_DATA_DIR / "image_labels_train_chong.csv"
# #############################################
# RSNA constants
# #############################################
RSNA_DATA_DIR = Path("/mnt/c/chong/data/RSNA_Pneumonia")
RSNA_ORIGINAL_TRAIN_CSV = RSNA_DATA_DIR / "stage_2_train_labels.csv"
RSNA_CLASSINFO_CSV = RSNA_DATA_DIR / "stage_2_detailed_class_info.csv"
RSNA_TRAIN_CSV = RSNA_DATA_DIR / "train.csv"
RSNA_VALID_CSV = RSNA_DATA_DIR / "val.csv"
RSNA_TEST_CSV = RSNA_DATA_DIR / "test.csv"
RSNA_DETECTION_TRAIN_PKL = RSNA_DATA_DIR / "train.pkl"
RSNA_DETECTION_VALID_PKL = RSNA_DATA_DIR / "val.pkl"
RSNA_DETECTION_TEST_PKL = RSNA_DATA_DIR / "test.pkl"
RSNA_IMG_DIR = RSNA_DATA_DIR / "stage_2_train_images"
RSNA_TRAIN_PCT = 0.7
# #############################################
# SIIM constants
# #############################################
PNEUMOTHORAX_DATA_DIR = Path("/mnt/c/chong/data/SIIM_Pneumothorax")
PNEUMOTHORAX_ORIGINAL_TRAIN_CSV = PNEUMOTHORAX_DATA_DIR / "train-rle.csv"
PNEUMOTHORAX_TRAIN_CSV = PNEUMOTHORAX_DATA_DIR / "train.csv"
PNEUMOTHORAX_VALID_CSV = PNEUMOTHORAX_DATA_DIR / "valid.csv"
PNEUMOTHORAX_TEST_CSV = PNEUMOTHORAX_DATA_DIR / "test.csv"
PNEUMOTHORAX_IMG_DIR = PNEUMOTHORAX_DATA_DIR / "dicom-images-train"
PNEUMOTHORAX_IMG_SIZE = 1024
PNEUMOTHORAX_TRAIN_PCT = 0.7
# #############################################
# tuberculosis constants
# #############################################
COVIDX_DATA_DIR = Path("/mnt/c/chong/data/COVIDx")
# COVIDX_ORIGINAL_TRAIN_TXT = COVIDX_DATA_DIR / "train.txt"
COVIDX_ORIGINAL_TRAIN_TXT = COVIDX_DATA_DIR / "train_COVIDx9A.txt"
# COVIDX_ORIGINAL_TEST_TXT = COVIDX_DATA_DIR / "test.txt"
COVIDX_ORIGINAL_TEST_TXT = COVIDX_DATA_DIR / "test_COVIDx9A.txt"
COVIDX_TRAIN_CSV = COVIDX_DATA_DIR / "train.csv"
COVIDX_VALID_CSV = COVIDX_DATA_DIR / "valid.csv"
COVIDX_TEST_CSV = COVIDX_DATA_DIR / "test.csv"
# #############################################
# COVIDx constants
# #############################################
TUBERCULOSIS_DATA_DIR = Path("/mnt/c/chong/data/tuberculosis")
TUBERCULOSIS_ORIGINAL_TRAIN_CSV = TUBERCULOSIS_DATA_DIR / "shenzhen_metadata.csv"
TUBERCULOSIS_TRAIN_CSV = TUBERCULOSIS_DATA_DIR / "train.csv"
TUBERCULOSIS_VALID_CSV = TUBERCULOSIS_DATA_DIR / "valid.csv"
TUBERCULOSIS_TEST_CSV = TUBERCULOSIS_DATA_DIR / "test.csv"
# #############################################
# Vinbigdata constants
# #############################################
VIN_DATA_DIR = Path("/mnt/c/chong/data/vinbigdata")
VIN_ORIGINAL_TRAIN_TXT = VIN_DATA_DIR / "train.csv"
VIN_TRAIN_CSV = VIN_DATA_DIR / "train_df.csv"
VIN_VALID_CSV = VIN_DATA_DIR / "valid_df.csv"
VIN_TEST_CSV = VIN_DATA_DIR / "test_df.csv"
# #############################################
# Object CXR constants
# #############################################
OBJ_DATA_DIR = Path("/mnt/c/chong/data/object-CXR")
OBJ_ORIGINAL_TRAIN_CSV = OBJ_DATA_DIR / "train.csv"
OBJ_ORIGINAL_DEV_CSV = OBJ_DATA_DIR / "dev.csv"
OBJ_TRAIN_PKL = OBJ_DATA_DIR / "train.pkl"
OBJ_VALID_PKL = OBJ_DATA_DIR / "valid.pkl"
OBJ_TEST_PKL = OBJ_DATA_DIR / "test.pkl"
OBJ_TRAIN_IMG_PATH = OBJ_DATA_DIR / "train"
OBJ_VALID_IMG_PATH = OBJ_DATA_DIR / "train"
OBJ_TEST_IMG_PATH = OBJ_DATA_DIR / "dev"