From cd7e4810363798c680ccd830f66c7a2999f14cb3 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Wed, 24 Jul 2024 16:34:57 -0700 Subject: [PATCH] GE slice timing (https://github.com/rordenlab/dcm2niix/issues/838) --- console/makefile | 7 ++++++- console/nii_dicom_batch.cpp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/console/makefile b/console/makefile index 33131075..077b9d91 100644 --- a/console/makefile +++ b/console/makefile @@ -1,6 +1,8 @@ # Regular use CFLAGS=-s -O3 +# Universal files used for everything +UFILES=main_console.cpp nii_foreign.cpp nii_dicom.cpp jpg_0XC3.cpp ujpeg.cpp nifti1_io_core.cpp nii_ortho.cpp nii_dicom_batch.cpp -o dcm2niix -DmyDisableOpenJPEG # Debugging #CFLAGS=-g @@ -44,4 +46,7 @@ ifneq ($(OS),Windows_NT) endif endif all: - g++ $(CFLAGS) -I. $(JSFLAGS) $(JFLAGS) $(LFLAGS) main_console.cpp nii_foreign.cpp nii_dicom.cpp jpg_0XC3.cpp ujpeg.cpp nifti1_io_core.cpp nii_ortho.cpp nii_dicom_batch.cpp -o dcm2niix -DmyDisableOpenJPEG + g++ $(CFLAGS) -I. $(JSFLAGS) $(JFLAGS) $(LFLAGS) $(UFILES) + +sanitize: + g++ -O1 -g -fsanitize=address -fno-omit-frame-pointer $(LFLAGS) $(UFILES) diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index 7e6fa9e0..fc9b9b41 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -7255,6 +7255,11 @@ void sliceTimingGE(struct TDICOMdata *d, const char *filename, struct TDCMopts o printWarning("Unable to determine GE Slice timing, no Protocol Data Block GE (0025,101B): %s\n", filename); return; } + if (strlen(d->softwareVersions) < 10) { //issue838 + d->CSA.sliceTiming[0] = -1; + printWarning("Unable to determine GE Slice timing, invalid SoftwareVersions (0018,1020): %s\n", filename); + return; + } //start version check: float geMajorVersion = 0; int geMajorVersionInt = 0, geMinorVersionInt = 0, geReleaseVersionInt = 0;