Update rsna-2023-abdominal-trauma-detection.py
Browse files
rsna-2023-abdominal-trauma-detection.py
CHANGED
@@ -338,4 +338,59 @@ class RSNA2023AbdominalTraumaDetectionSegmentation(datasets.GeneratorBasedBuilde
|
|
338 |
},
|
339 |
}
|
340 |
else:
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
},
|
339 |
}
|
340 |
else:
|
341 |
+
for key, (series_id, img_path) in enumerate(zip(series_ids, img_files)):
|
342 |
+
series_meta = (
|
343 |
+
series_meta_df.loc[series_meta_df["series_id"] == series_id]
|
344 |
+
.iloc[0]
|
345 |
+
.to_dict()
|
346 |
+
)
|
347 |
+
patient_id = series_meta["patient_id"]
|
348 |
+
label_data = (
|
349 |
+
labels_df.loc[labels_df["patient_id"] == patient_id]
|
350 |
+
.iloc[0]
|
351 |
+
.to_dict()
|
352 |
+
)
|
353 |
+
|
354 |
+
yield key, {
|
355 |
+
"img_path": img_path,
|
356 |
+
"bowel": np.argmax(
|
357 |
+
[label_data["bowel_healthy"], label_data["bowel_injury"]]
|
358 |
+
),
|
359 |
+
"extravasation": np.argmax(
|
360 |
+
[
|
361 |
+
label_data["extravasation_healthy"],
|
362 |
+
label_data["extravasation_injury"],
|
363 |
+
]
|
364 |
+
),
|
365 |
+
"kidney": np.argmax(
|
366 |
+
[
|
367 |
+
label_data["kidney_healthy"],
|
368 |
+
label_data["kidney_low"],
|
369 |
+
label_data["kidney_high"],
|
370 |
+
]
|
371 |
+
),
|
372 |
+
"liver": np.argmax(
|
373 |
+
[
|
374 |
+
label_data["liver_healthy"],
|
375 |
+
label_data["liver_low"],
|
376 |
+
label_data["liver_high"],
|
377 |
+
]
|
378 |
+
),
|
379 |
+
"spleen": np.argmax(
|
380 |
+
[
|
381 |
+
label_data["spleen_healthy"],
|
382 |
+
label_data["spleen_low"],
|
383 |
+
label_data["spleen_high"],
|
384 |
+
]
|
385 |
+
),
|
386 |
+
"any_injury": label_data["any_injury"],
|
387 |
+
"metadata": {
|
388 |
+
"series_id": series_id,
|
389 |
+
"patient_id": series_meta["patient_id"],
|
390 |
+
"incomplete_organ": series_meta["incomplete_organ"],
|
391 |
+
"aortic_hu": series_meta["aortic_hu"],
|
392 |
+
"pixel_representation": series_meta["pixel_representation"],
|
393 |
+
"bits_allocated": series_meta["bits_allocated"],
|
394 |
+
"bits_stored": series_meta["bits_stored"],
|
395 |
+
},
|
396 |
+
}
|