From 1eab7243aabd8dcf873ef86d8547a481f39172f1 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Thu, 25 Jul 2024 10:47:05 -0700 Subject: [PATCH] Siemens instance number re-use (https://github.com/rordenlab/dcm2niix/issues/837) --- console/nii_dicom.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/console/nii_dicom.cpp b/console/nii_dicom.cpp index 149450ee..b6c6b83f 100644 --- a/console/nii_dicom.cpp +++ b/console/nii_dicom.cpp @@ -4517,6 +4517,7 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD #define kSequenceVariant21 0x0021 + (0x105B << 16) //CS Siemens ONLY: For GE this is TaggingFlipAngle #define kScanOptionsSiemens 0x0021 + (0x105C << 16) //CS Siemens ONLY #define kPATModeText 0x0021 + (0x1009 << 16) //LO, see kImaPATModeText +#define kFrameNumberInSeries 0x0021 + (0x118A << 16) //IS issue837 #define kCSASeriesHeaderInfoXA 0x0021 + (0x1019 << 16) #define kCSASeriesHeaderInfoXA2 0x0021 + (0x11FE << 16) #define kTimeAfterStart 0x0021 + (0x1104 << 16) //DS @@ -4727,6 +4728,7 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD int gradientOrientationNumberPhilips = -1; int numberOfFrames = 0; int numberOfFramesICEdims = 0; + int frameNumberInSeries = -1; //issue837 //int MRImageGradientOrientationNumber = 0; //int minGradNum = kMaxDTI4D + 1; //int maxGradNum = -1; @@ -6227,6 +6229,9 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD case kScanOptionsSiemens: dcmStr(lLength, &buffer[lPos], scanOptionsSiemens, true); break; + case kFrameNumberInSeries: //issue837 + frameNumberInSeries = dcmStrInt(lLength, &buffer[lPos]); + break; case kPATModeText: { //e.g. Siemens iPAT x2 listed as "p2" char accelStr[kDICOMStr]; dcmStr(lLength, &buffer[lPos], accelStr); @@ -8072,6 +8077,8 @@ const uint32_t kEffectiveTE = 0x0018 + uint32_t(0x9082 << 16); //FD d.seriesUidCrc = mz_crc32X((unsigned char *)&d.protocolName, strlen(d.protocolName)); } } + if (frameNumberInSeries >= 0) //issue837 + d.imageNum = frameNumberInSeries; //TODO533: alias Philips ASL PLD as frameDuration? isKludgeIssue533 //if ((d.manufacturer == kMANUFACTURER_PHILIPS) && ((!isTriggerSynced) || (!isProspectiveSynced)) ) //issue408 // d.triggerDelayTime = 0.0; //Philips ASL use "(0018,9037) CS [NONE]" but "(2001,1010) CS [TRIGGERED]", a situation not described in issue408