From cb60b430e590e22d6da65898871ae97e5727bef5 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Fri, 1 Mar 2024 15:30:26 -0500 Subject: [PATCH] Philips renaming (https://github.com/rordenlab/dcm2niix/issues/795) --- console/nii_dicom.cpp | 44 +++++++++++++++++++++++++------------ console/nii_dicom.h | 2 +- console/nii_dicom_batch.cpp | 2 +- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/console/nii_dicom.cpp b/console/nii_dicom.cpp index 741af678..361b3a26 100644 --- a/console/nii_dicom.cpp +++ b/console/nii_dicom.cpp @@ -5166,6 +5166,10 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD privateCreatorRemap = 0; char privateCreator[kDICOMStr]; dcmStr(lLength, &buffer[lPos], privateCreator); + // + int s_len = strlen(privateCreator); + for (int i = 0; i < s_len; i++) + privateCreator[i] = toupper(privateCreator[i]); //next lines determine remapping, append as needed //Siemens https://github.com/dcm4che/dcm4che/blob/master/dcm4che-dict/src/main/dicom3tools/libsrc/standard/elmdict/siemens.tpl if (strstr(privateCreator, "SIEMENS MR HEADER") != NULL) @@ -5194,18 +5198,30 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD if ((grp == 0x07a3) && (strstr(privateCreator, "ELSCINT1") != NULL)) privateCreatorRemap = 0x07a3 + (0x1000 << 16); //Philips https://github.com/dcm4che/dcm4che/blob/master/dcm4che-dict/src/main/dicom3tools/libsrc/standard/elmdict/philips.tpl - if (strstr(privateCreator, "PHILIPS IMAGING DD 001") != NULL) - privateCreatorRemap = 0x2001 + (0x1000 << 16); - if (strstr(privateCreator, "Philips Imaging DD 001") != NULL) - privateCreatorRemap = 0x2001 + (0x1000 << 16); - if (strstr(privateCreator, "PHILIPS MR IMAGING DD 001") != NULL) - privateCreatorRemap = 0x2005 + (0x1000 << 16); - if (strstr(privateCreator, "Philips MR Imaging DD 001") != NULL) - privateCreatorRemap = 0x2005 + (0x1000 << 16); - if (strstr(privateCreator, "PHILIPS MR IMAGING DD 005") != NULL) - privateCreatorRemap = 0x2005 + (0x1400 << 16); - if (strstr(privateCreator, "Philips MR Imaging DD 005") != NULL) - privateCreatorRemap = 0x2005 + (0x1400 << 16); + if (strstr(privateCreator, "PHILIPS IMAGING") != NULL) { + if (strstr(privateCreator, "DD 001") != NULL) + privateCreatorRemap = 0x2001 + (0x1000 << 16); + if (strstr(privateCreator, "DD 002") != NULL) + privateCreatorRemap = 0x2001 + (0x1100 << 16); + if (strstr(privateCreator, "DD 003") != NULL) + privateCreatorRemap = 0x2001 + (0x1200 << 16); + if (strstr(privateCreator, "DD 004") != NULL) + privateCreatorRemap = 0x2001 + (0x1300 << 16); + if (strstr(privateCreator, "DD 005") != NULL) + privateCreatorRemap = 0x2001 + (0x1400 << 16); + } + if (strstr(privateCreator, "PHILIPS MR IMAGING") != NULL) { + if (strstr(privateCreator, "DD 001") != NULL) + privateCreatorRemap = 0x2005 + (0x1000 << 16); + if (strstr(privateCreator, "DD 002") != NULL) + privateCreatorRemap = 0x2005 + (0x1100 << 16); + if (strstr(privateCreator, "DD 003") != NULL) + privateCreatorRemap = 0x2005 + (0x1200 << 16); + if (strstr(privateCreator, "DD 004") != NULL) + privateCreatorRemap = 0x2005 + (0x1300 << 16); + if (strstr(privateCreator, "DD 005") != NULL) + privateCreatorRemap = 0x2005 + (0x1400 << 16); + } //UIH https://github.com/neurolabusc/dcm_qa_uih if (strstr(privateCreator, "Image Private Header") != NULL) privateCreatorRemap = 0x0065 + (0x1000 << 16); @@ -6392,8 +6408,8 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD break; case kTE: TE = dcmStrFloat(lLength, &buffer[lPos]); - if (d.TE <= 0.0) - d.TE = TE; + //20240229 if (d.TE <= 0.0) + d.TE = TE; break; case kNumberOfAverages: d.numberOfAverages = dcmStrFloat(lLength, &buffer[lPos]); diff --git a/console/nii_dicom.h b/console/nii_dicom.h index d173cd8d..8008468a 100644 --- a/console/nii_dicom.h +++ b/console/nii_dicom.h @@ -50,7 +50,7 @@ extern "C" { #define kCPUsuf " " //unknown CPU #endif -#define kDCMdate "v1.0.20240222" +#define kDCMdate "v1.0.20240229" #define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf kCPUsuf static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index 839921d5..11cba2d4 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -6859,7 +6859,7 @@ void setBidsPhilips(struct TDICOMdata *d, int nConvert, int isVerbose) { strcat(suffixBIDS,modalityBIDS); } //if ((isVerbose > 0) || (strlen(dataTypeBIDS) < 1)) - //if (isVerbose > 0) + if (isVerbose > 0) printf("::autoBids:Philips pulseSeq:'%s' scanSeq:'%s' seqVariant:'%s'\n", d->pulseSequenceName, d->scanningSequence, d->sequenceVariant); if (isDerived)