From 86b5f665dbcb2868e70f4e8c526146030f13e08b Mon Sep 17 00:00:00 2001 From: wtclarke Date: Tue, 28 Apr 2026 09:54:14 +0100 Subject: [PATCH 1/4] Handle missing headers from offline recon --- spec2nii/Siemens/dicomfunctions.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spec2nii/Siemens/dicomfunctions.py b/spec2nii/Siemens/dicomfunctions.py index 9d822d4..69fa853 100644 --- a/spec2nii/Siemens/dicomfunctions.py +++ b/spec2nii/Siemens/dicomfunctions.py @@ -123,8 +123,21 @@ def multi_file_dicom(files_in, fname_out, tag, verbose): dwelltime_list.append(dwelltime) meta_list.append(meta_obj) - series_num.append(int(img.dcm_data.SeriesNumber)) - inst_num.append(int(img.dcm_data.InstanceNumber)) + try: + series_num.append(int(img.dcm_data.SeriesNumber)) + except TypeError: + # If offline reconstruction has been used, it is possible that + # SeriesNumber (and InstanceNumber) are None. + # Set series_num to the SeriesInstanceUID with dots removed + pass + series_num.append( + int(img.dcm_data.SeriesInstanceUID.replace('.', ''))) + + try: + inst_num.append(int(img.dcm_data.InstanceNumber)) + except TypeError: + # Set inst_num number to idx + inst_num.append(idx) ref_ind, str_suf = identify_integrated_references(img, img.dcm_data.InstanceNumber) reference.append(ref_ind) @@ -341,6 +354,8 @@ def process_siemens_csi_xa(img, verbose): specDataCmplx = specDataCmplx.reshape((slices, rows, cols, spectral_points)) specDataCmplx = np.moveaxis(specDataCmplx, (0, 1, 2), (2, 1, 0)) + import matplotlib.pyplot as plt + breakpoint() dcm_hdrs = img.dcm_data.PerFrameFunctionalGroupsSequence[0] dcm_hdrs1 = img.dcm_data.SharedFunctionalGroupsSequence[0] From 734b73ea4cd235c0f6278e4adc7bb781d8241924 Mon Sep 17 00:00:00 2001 From: wtclarke Date: Tue, 28 Apr 2026 09:54:50 +0100 Subject: [PATCH 2/4] remove breakpoint --- spec2nii/Siemens/dicomfunctions.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec2nii/Siemens/dicomfunctions.py b/spec2nii/Siemens/dicomfunctions.py index 69fa853..32bc586 100644 --- a/spec2nii/Siemens/dicomfunctions.py +++ b/spec2nii/Siemens/dicomfunctions.py @@ -354,8 +354,6 @@ def process_siemens_csi_xa(img, verbose): specDataCmplx = specDataCmplx.reshape((slices, rows, cols, spectral_points)) specDataCmplx = np.moveaxis(specDataCmplx, (0, 1, 2), (2, 1, 0)) - import matplotlib.pyplot as plt - breakpoint() dcm_hdrs = img.dcm_data.PerFrameFunctionalGroupsSequence[0] dcm_hdrs1 = img.dcm_data.SharedFunctionalGroupsSequence[0] From 01b0f5cd8081f1f3409e87a883efb297f58b615a Mon Sep 17 00:00:00 2001 From: wtclarke Date: Tue, 28 Apr 2026 14:01:58 +0100 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a2ffc..7357629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ This document contains the Spec2nii release history in reverse chronological order. +0.8.12 (WIP) +------------ +- Handle DICOMs missing series and intance numbers (generated through Siemens retrorecon). + 0.8.11 (Monday 20th April 2026) ---------------------------------- - Fix issues arising in coil names and 31P Siemens CSI with missing DICOM VOI fields. From bd78b8d226c3769e012e1a7e175908e4da27faf6 Mon Sep 17 00:00:00 2001 From: wtclarke Date: Tue, 28 Apr 2026 15:38:29 +0100 Subject: [PATCH 4/4] spelling --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7357629..6d531d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This document contains the Spec2nii release history in reverse chronological ord 0.8.12 (WIP) ------------ -- Handle DICOMs missing series and intance numbers (generated through Siemens retrorecon). +- Handle DICOMs missing series and instance numbers (generated through Siemens retrorecon). 0.8.11 (Monday 20th April 2026) ----------------------------------