From dea3fb9ca7d2451a333ab9708ad0842d532eedd6 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Thu, 12 May 2022 07:30:36 -0400 Subject: [PATCH] Ignore non-spatial physio data (https://github.com/rordenlab/dcm2niix/issues/606) --- console/nii_dicom.cpp | 1 + console/nii_dicom_batch.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/console/nii_dicom.cpp b/console/nii_dicom.cpp index 00e46276..c74555d0 100644 --- a/console/nii_dicom.cpp +++ b/console/nii_dicom.cpp @@ -6607,6 +6607,7 @@ const uint32_t kEffectiveTE = 0x0018 + (0x9082 << 16); break; case kSpectroscopyData: //kSpectroscopyDataPointColumns printMessage("Skipping Spectroscopy DICOM '%s'\n", fname); + d.xyzDim[1] = 0; //issue606 d.imageStart = (int)lPos + (int)lFileOffset; break; case kCSAImageHeaderInfo: diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index f77dce2c..12dd7c4b 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -1229,7 +1229,6 @@ tse3d: T2*/ fprintf(fp, "\t\"Manufacturer\": \"UIH\",\n"); break; }; - json_Str(fp, "\t\"PulseSequenceName\": \"%s\",\n", d.pulseSequenceName); //if (d.epiVersionGE == 0) // fprintf(fp, "\t\"PulseSequenceName\": \"epi\",\n"); //if (d.epiVersionGE == 1) @@ -1284,6 +1283,7 @@ tse3d: T2*/ json_Str(fp, "\t\"SequenceVariant\": \"%s\",\n", d.sequenceVariant); json_Str(fp, "\t\"ScanOptions\": \"%s\",\n", d.scanOptions); json_Str(fp, "\t\"SequenceName\": \"%s\",\n", d.sequenceName); + json_Str(fp, "\t\"PulseSequenceName\": \"%s\",\n", d.pulseSequenceName); if (strlen(d.imageType) > 0) { fprintf(fp, "\t\"ImageType\": [\""); bool isSep = false; @@ -2125,6 +2125,8 @@ int *nii_saveDTI(char pathoutname[], int nConvert, struct TDCMsort dcmSort[], st if (opts.isOnlyBIDS) return NULL; uint64_t indx0 = dcmSort[0].indx; //first volume + if (isnan(dcmList[indx0].patientPosition[0])) + return NULL; //issue606 do not save bvec for non-spatial data (e.g. physio) int numDti = dcmList[indx0].CSA.numDti; #ifdef USING_R ImageList *images = (ImageList *)opts.imageList; @@ -6999,8 +7001,8 @@ int saveDcm2NiiCore(int nConvert, struct TDCMsort dcmSort[], struct TDICOMdata d //~ if (!dcmList[dcmSort[0].indx].isSlicesSpatiallySequentialPhilips) //~ nii_reorderSlices(imgM, &hdr0, dti4D); //hdr0.pixdim[3] = dxNoTilt; - if (hdr0.dim[3] < 2) - printWarning("Check that 2D images are not mirrored.\n"); + if ((hdr0.dim[3] < 2) && (!isnan(dcmList[dcmSort[0].indx].patientPosition[0]))) + printWarning("Check that 2D images are not mirrored.\n"); // isnan does not warn for non-spatial images (physio) #ifndef USING_R else fflush(stdout); //GUI buffers printf, display all results