From b9159306a9063caeea36cda480cd7ebc71884b9e Mon Sep 17 00:00:00 2001 From: William T Clarke Date: Thu, 7 Dec 2023 10:48:42 +0000 Subject: [PATCH] Fix dicom naming bug with mixed types (#122) --- CHANGELOG.md | 1 + spec2nii/Siemens/dicomfunctions.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8904a7..b269505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This document contains the Spec2nii release history in reverse chronological ord - SpectralWidth now added to header extension automatically to match bids specification. - NIfTI-MRS V0.8 now generated. - Better handling of philips spar/sdat tags and singleton dimensions. +- Fixed bug where no name was set when a mixed folder of imaging and spectroscopy dicom was provided. 0.7.1 (Tuesday 7th November 2023) --------------------------------- diff --git a/spec2nii/Siemens/dicomfunctions.py b/spec2nii/Siemens/dicomfunctions.py index 8781d33..89d2817 100644 --- a/spec2nii/Siemens/dicomfunctions.py +++ b/spec2nii/Siemens/dicomfunctions.py @@ -91,6 +91,7 @@ def multi_file_dicom(files_in, fname_out, tag, verbose): reference = [] str_suffix = [] mainStr = '' + first_mrs_dcm_found = False for idx, fn in enumerate(files_in): if verbose: print(f'Converting dicom file {fn}') @@ -129,7 +130,8 @@ def multi_file_dicom(files_in, fname_out, tag, verbose): reference.append(ref_ind) str_suffix.append(str_suf) - if idx == 0: + if not first_mrs_dcm_found: + first_mrs_dcm_found = True if fname_out: mainStr = fname_out elif 'SeriesDescription' in img.dcm_data: