From c8ccbce40b762ceb918db425061d83cf93f8524f Mon Sep 17 00:00:00 2001 From: Robert Graf Date: Tue, 22 Sep 2026 11:10:19 +0000 Subject: [PATCH 1/2] extended dixon mapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cherry-picked content from tanja@50c8b4d without the whitespace-only reformatting noise: - Add h2d/tse2d1-4/tser2d regex to series-description → format mapping; drop the broad ".*t2w?_tse.*" match. - Fall back to SequenceName when SeriesDescription is empty. Co-Authored-By: Tanja Lerchl Co-Authored-By: Claude Opus 4.7 --- TPTBox/core/dicom/dicom_header_to_keys.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TPTBox/core/dicom/dicom_header_to_keys.py b/TPTBox/core/dicom/dicom_header_to_keys.py index 54db4da..8f483e6 100644 --- a/TPTBox/core/dicom/dicom_header_to_keys.py +++ b/TPTBox/core/dicom/dicom_header_to_keys.py @@ -45,7 +45,11 @@ } dixon_mapping = {**dixon_mapping, **{v: v for v in dixon_mapping.values()}} map_series_description_to_file_format_default = { - ".*t2w?_tse.*": "T2w", + ".*h2d.*": "T2haste", + ".*tse2d1-4.*": "T1w", + ".*tser2d.*": "T2w", + # ".*tse2d1_4.*": "T1w", + # ".*_tse.*": "T2w", "t2w?_fse.*": "T2w", ".*t1w?_tse.*": "T1w", ".*t1w?_vibe_tra.*": "vibe", @@ -297,6 +301,11 @@ def _get(key, default=None): keys["ce"] = "ContrastAgent" # GET MRI FORMAT series_description = _get("SeriesDescription", "mr").lower() + if series_description == "mr": + series_description = _get("SequenceName", "mr").lower() + print( + f"SeriesDescription: '{series_description}', ImageType: {image_type}, ProtocolName: '{_get('ProtocolName', '')}'" + ) modality = _get("Modality", "mr").lower() mri_format = None From 2a51ed673778fdfd62af66b84cf69cc7295f2a25 Mon Sep 17 00:00:00 2001 From: robert-graf <31210726+robert-graf@users.noreply.github.com> Date: Tue, 22 Sep 2026 11:13:23 +0000 Subject: [PATCH 2/2] style fixes by ruff --- TPTBox/core/dicom/dicom_header_to_keys.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TPTBox/core/dicom/dicom_header_to_keys.py b/TPTBox/core/dicom/dicom_header_to_keys.py index 8f483e6..0aa37c3 100644 --- a/TPTBox/core/dicom/dicom_header_to_keys.py +++ b/TPTBox/core/dicom/dicom_header_to_keys.py @@ -303,9 +303,7 @@ def _get(key, default=None): series_description = _get("SeriesDescription", "mr").lower() if series_description == "mr": series_description = _get("SequenceName", "mr").lower() - print( - f"SeriesDescription: '{series_description}', ImageType: {image_type}, ProtocolName: '{_get('ProtocolName', '')}'" - ) + print(f"SeriesDescription: '{series_description}', ImageType: {image_type}, ProtocolName: '{_get('ProtocolName', '')}'") modality = _get("Modality", "mr").lower() mri_format = None