From fed761ac76956deb03898be4e905f7cbf3b7331c Mon Sep 17 00:00:00 2001 From: dbouget Date: Fri, 16 Feb 2024 14:10:51 +0100 Subject: [PATCH] Hack for loading radiological volumes with uint8 data range --- utils/utilities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/utilities.py b/utils/utilities.py index 199958b..8b76523 100644 --- a/utils/utilities.py +++ b/utils/utilities.py @@ -47,10 +47,12 @@ def input_file_category_disambiguation(input_filename: str) -> str: image_type = image.GetPixelIDTypeAsString() array = sitk.GetArrayFromImage(image) - # @TODO. Have encountered FLAIR images with integer values in [0, 255], from DICOM conversion, which will be - # failed associated as annotations... if len(np.unique(array)) > 255 or np.max(array) > 255 or np.min(array) < -1: category = "MRI" + # If the input radiological volume has values within [0, 255] only. Empirical solution for now, since less than + # 10 classes are usually handle at any given time. + elif len(np.unique(array)) >= 25: + category = "MRI" else: category = "Annotation" return category