Skip to content

Commit

Permalink
Discrepant uses for TriggerTime (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Apr 27, 2020
1 parent fb25fc2 commit ad0e1c8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Philips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ MyCustomDirections
```

## Missing Information.
## Missing Information

Philips DICOMs do not contain all the information desired by many neuroscientists. Due to this, the [BIDS](http://bids.neuroimaging.io/) files created by dcm2niix are impoverished relative to data from other vendors. This reflects a limitation in the Philips DICOMs, not dcm2niix.

Expand Down
16 changes: 12 additions & 4 deletions console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4354,6 +4354,8 @@ uint32_t kItemTag = 0xFFFE +(0xE000 << 16 );
uint32_t kItemDelimitationTag = 0xFFFE +(0xE00D << 16 );
uint32_t kSequenceDelimitationItemTag = 0xFFFE +(0xE0DD << 16 );
double TE = 0.0; //most recent echo time recorded
float MRImageDynamicScanBeginTime = 0.0;

bool is2005140FSQ = false;
bool isDICOMANON = false; //issue383
bool isMATLAB = false; //issue383
Expand Down Expand Up @@ -4580,7 +4582,10 @@ double TE = 0.0; //most recent echo time recorded
dcmDim[numDimensionIndexValues].intenScalePhilips = d.intenScalePhilips;
dcmDim[numDimensionIndexValues].RWVScale = d.RWVScale;
dcmDim[numDimensionIndexValues].RWVIntercept = d.RWVIntercept;
dcmDim[numDimensionIndexValues].triggerDelayTime = d.triggerDelayTime;
if (isSameFloat(MRImageDynamicScanBeginTime * 1000.0, d.triggerDelayTime))
dcmDim[numDimensionIndexValues].triggerDelayTime = 0.0; //issue395
else
dcmDim[numDimensionIndexValues].triggerDelayTime = d.triggerDelayTime;
dcmDim[numDimensionIndexValues].V[0] = -1.0;
#ifdef MY_DEBUG
if (numDimensionIndexValues < 19) {
Expand Down Expand Up @@ -5657,9 +5662,9 @@ double TE = 0.0; //most recent echo time recorded

case kMRImageDynamicScanBeginTime: { //FL
if (lLength != 4) break;
float dyn = dcmFloat(lLength, &buffer[lPos],d.isLittleEndian);
if (dyn < minDynamicScanBeginTime) minDynamicScanBeginTime = dyn;
if (dyn > maxDynamicScanBeginTime) maxDynamicScanBeginTime = dyn;
MRImageDynamicScanBeginTime = dcmFloat(lLength, &buffer[lPos],d.isLittleEndian);
if (MRImageDynamicScanBeginTime < minDynamicScanBeginTime) minDynamicScanBeginTime = MRImageDynamicScanBeginTime;
if (MRImageDynamicScanBeginTime > maxDynamicScanBeginTime) maxDynamicScanBeginTime = MRImageDynamicScanBeginTime;
break;
}
case kIntercept :
Expand Down Expand Up @@ -6739,6 +6744,9 @@ if (d.isHasPhase)
strcpy(d.seriesInstanceUID, d.studyInstanceUID);
d.seriesUidCrc = mz_crc32X((unsigned char*) &d.protocolName, strlen(d.protocolName));
}
if (isSameFloat(MRImageDynamicScanBeginTime * 1000.0, d.triggerDelayTime)) //issue395
d.triggerDelayTime = 0.0;
//printf("%d\t%g\t%g\t%g\n", d.imageNum, d.acquisitionTime, d.triggerDelayTime, MRImageDynamicScanBeginTime);
if ((d.manufacturer == kMANUFACTURER_SIEMENS) && (strlen(seriesTimeTxt) > 1) && (d.isXA10A) && (d.xyzDim[3] == 1) && (d.xyzDim[4] < 2)) {
//printWarning("Ignoring series number of XA data saved as classic DICOM (issue 394)\n");
d.isStackableSeries = true;
Expand Down
2 changes: 1 addition & 1 deletion console/nii_dicom.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern "C" {
#define kCCsuf " CompilerNA" //unknown compiler!
#endif

#define kDCMdate "v1.0.20200420"
#define kDCMdate "v1.0.20200427"
#define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf

static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic
Expand Down
5 changes: 4 additions & 1 deletion console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4851,7 +4851,10 @@ int saveDcm2NiiCore(int nConvert, struct TDCMsort dcmSort[],struct TDICOMdata dc
#endif
int imageNumRange = 1 + abs( dcmList[dcmSort[nConvert-1].indx].imageNum - dcmList[dcmSort[0].indx].imageNum);
if ((imageNumRange > 1) && (imageNumRange != nConvert)) {
printWarning("Missing images? Expected %d images, but instance number (0020,0013) ranges from %d to %d\n", nConvert, dcmList[dcmSort[0].indx].imageNum, dcmList[dcmSort[nConvert-1].indx].imageNum);
if ((dcmList[dcmSort[0].indx].locationsInAcquisition > 0) && ((nConvert % dcmList[dcmSort[0].indx].locationsInAcquisition) != 0) )
printError("Missing images. Found %d images, expected %d slices per volume and instance number (0020,0013) ranges from %d to %d\n", nConvert, dcmList[dcmSort[0].indx].locationsInAcquisition, dcmList[dcmSort[0].indx].imageNum, dcmList[dcmSort[nConvert-1].indx].imageNum);
else
printWarning("Missing images? Expected %d images, but instance number (0020,0013) ranges from %d to %d\n", nConvert, dcmList[dcmSort[0].indx].imageNum, dcmList[dcmSort[nConvert-1].indx].imageNum);
if (opts.isVerbose) {
printMessage("instance=[");
for (int i = 0; i < nConvert; i++) {
Expand Down

0 comments on commit ad0e1c8

Please sign in to comment.