From b256504aefc30a415a2d256af2bb7c5f5ca154ea Mon Sep 17 00:00:00 2001 From: Jaemin Shin Date: Wed, 27 Mar 2024 23:11:19 -0500 Subject: [PATCH 1/2] GE AcquisitionDuration (#808) --- console/nii_dicom.cpp | 7 +++++++ console/nii_dicom.h | 2 +- console/nii_dicom_batch.cpp | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/console/nii_dicom.cpp b/console/nii_dicom.cpp index c236576c..5aa8db7e 100644 --- a/console/nii_dicom.cpp +++ b/console/nii_dicom.cpp @@ -4477,6 +4477,7 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD #define kLastScanLoc 0x0019 + (0x101B << 16) #define kBandwidthPerPixelPhaseEncode 0x0019 + (0x1028 << 16) //FD #define kSliceTimeSiemens 0x0019 + (0x1029 << 16) ///FD +#define kAcquisitionDurationGE 0x0019 + (0x105a << 16) //FL Acquisition Duration in microsecond, Duration of Scan (series) #define kPulseSequenceNameGE 0x0019 + (0x109C << 16) //LO 'epiRT' or 'epi' #define kInternalPulseSequenceNameGE 0x0019 + (0x109E << 16) //LO 'EPI' or 'EPI2' #define kRawDataRunNumberGE 0x0019 + (0x10A2 << 16)//SL @@ -5838,6 +5839,12 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD printf("%s\t FrameAcquisitionDateTime %0.4f \n", dateTime, dTime); //d.triggerDelayTime = dTime; }*/ + case kAcquisitionDurationGE: // issue 808 + if (d.manufacturer != kMANUFACTURER_GE) + break; + d.acquisitionDuration = dcmFloat(lLength, &buffer[lPos], d.isLittleEndian); + d.acquisitionDuration /= 1000000.0; //convert microsec to sec + break; case kDiffusionDirectionality: { // 0018, 9075 set_directionality0018_9075(&volDiffusion, (&buffer[lPos])); if ((d.manufacturer != kMANUFACTURER_PHILIPS) || (lLength < 10)) diff --git a/console/nii_dicom.h b/console/nii_dicom.h index 830c7576..6d3546df 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.20240325" +#define kDCMdate "v1.0.20240327" #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 a07fe3df..7eb6d206 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -2256,6 +2256,11 @@ tse3d: T2*/ // FSL definition is start of first line until start of last line. // Other than the use of (n-1), the value is basically just 1.0/bandwidthPerPixelPhaseEncode. // https://github.com/rordenlab/dcm2niix/issues/130 + if (d.manufacturer == kMANUFACTURER_GE){ //issue808 + char acquisitionDurationbuffer[50]; + sprintf(acquisitionDurationbuffer, "%02d:%02d",(int)round(d.acquisitionDuration)/60,(int)round(d.acquisitionDuration)%60); + json_Str(fp, "\t\"AcquisitionDurationGE\": \"%s\",\n", acquisitionDurationbuffer); + } if (d.manufacturer != kMANUFACTURER_UIH) //issue606 json_Float(fp, "\t\"AcquisitionDuration\": %g,\n", d.acquisitionDuration); if ((d.manufacturer == kMANUFACTURER_UIH) && (effectiveEchoSpacing <= 0.0)) //issue225, issue531 From 608f636d097d8c4a2fb059e6ba885a4743088556 Mon Sep 17 00:00:00 2001 From: Jaemin Shin Date: Fri, 29 Mar 2024 08:51:12 -0500 Subject: [PATCH 2/2] GE AcquisitionDuration minor (#808) --- console/nii_dicom.cpp | 2 ++ console/nii_dicom_batch.cpp | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/console/nii_dicom.cpp b/console/nii_dicom.cpp index 5aa8db7e..f42f5fd1 100644 --- a/console/nii_dicom.cpp +++ b/console/nii_dicom.cpp @@ -5826,6 +5826,8 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD d.accelFactPE = accelFactPE; break; case kAcquisitionDuration: + if (!isSameFloatGE(d.acquisitionDuration, 0.0)) + break; //issue 808: give precedence to more precise measures, e.g kAcquisitionDurationGE (0019,105a) //n.b. used differently by different vendors https://github.com/rordenlab/dcm2niix/issues/225 d.acquisitionDuration = dcmFloatDouble(lLength, &buffer[lPos], d.isLittleEndian); break; diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp index 7eb6d206..a07fe3df 100644 --- a/console/nii_dicom_batch.cpp +++ b/console/nii_dicom_batch.cpp @@ -2256,11 +2256,6 @@ tse3d: T2*/ // FSL definition is start of first line until start of last line. // Other than the use of (n-1), the value is basically just 1.0/bandwidthPerPixelPhaseEncode. // https://github.com/rordenlab/dcm2niix/issues/130 - if (d.manufacturer == kMANUFACTURER_GE){ //issue808 - char acquisitionDurationbuffer[50]; - sprintf(acquisitionDurationbuffer, "%02d:%02d",(int)round(d.acquisitionDuration)/60,(int)round(d.acquisitionDuration)%60); - json_Str(fp, "\t\"AcquisitionDurationGE\": \"%s\",\n", acquisitionDurationbuffer); - } if (d.manufacturer != kMANUFACTURER_UIH) //issue606 json_Float(fp, "\t\"AcquisitionDuration\": %g,\n", d.acquisitionDuration); if ((d.manufacturer == kMANUFACTURER_UIH) && (effectiveEchoSpacing <= 0.0)) //issue225, issue531