From 92bdc838ab03d387da993fcb3e1cd28f4a9cdac8 Mon Sep 17 00:00:00 2001 From: wtclarke Date: Tue, 5 May 2026 21:43:08 +0100 Subject: [PATCH] VE vienna CRT --- CHANGELOG.md | 1 + spec2nii/Siemens/dicomfunctions.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d531d1..a8962f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ This document contains the Spec2nii release history in reverse chronological ord 0.8.12 (WIP) ------------ - Handle DICOMs missing series and instance numbers (generated through Siemens retrorecon). +- Special case handling of ViennaCrt sequence for VE DICOM. 0.8.11 (Monday 20th April 2026) ---------------------------------- diff --git a/spec2nii/Siemens/dicomfunctions.py b/spec2nii/Siemens/dicomfunctions.py index 32bc586..989749b 100644 --- a/spec2nii/Siemens/dicomfunctions.py +++ b/spec2nii/Siemens/dicomfunctions.py @@ -78,6 +78,13 @@ def svs_or_CSI(img): return 'SVS' +def _is_vienna_crt(img): + """Returns True if sequence is identified as Vienna's CRT sequence + """ + ptrn = re.compile(r'_ViennaCrt_') + return True if ptrn.search(img.dcm_data.ProtocolName) else False + + def multi_file_dicom(files_in, fname_out, tag, verbose): """Parse a list of Siemens DICOM files""" @@ -214,6 +221,13 @@ def not_equal(lst): data_in_gr = data_list[gr] if len(data_in_gr) > 1: combined_data = np.stack(data_in_gr, axis=-1) + + if _is_vienna_crt(img): + print('Vienna CRT') + combined_data = np.moveaxis( + combined_data, + (0, 1, 2, 3, 4), + (0, 1, 4, 3, 2)) else: combined_data = data_in_gr[0] @@ -406,7 +420,10 @@ def process_siemens_csi_vx(img, verbose): # slices = int(xprot[('sSpecPara', 'lFinalMatrixSizeSlice')]) # spectral_points = int(xprot[('sSpecPara', 'lVectorSize')]) - specDataCmplx = specDataCmplx.reshape((slices, rows, cols, spectral_points)) + if _is_vienna_crt(img): + specDataCmplx = specDataCmplx.reshape((1, rows, cols, spectral_points)) + else: + specDataCmplx = specDataCmplx.reshape((slices, rows, cols, spectral_points)) specDataCmplx = np.moveaxis(specDataCmplx, (0, 1, 2), (2, 1, 0)) # 1) Extract dicom parameters