Skip to content

Commit

Permalink
Bruker enhanced 4D data (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Nov 5, 2018
1 parent 5b696cc commit da64ebc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4160,11 +4160,11 @@ double TE = 0.0; //most recent echo time recorded
//if we leave the folder MREchoSequence 0018,9114
if (( nDimIndxVal > 0) && ((d.manufacturer == kMANUFACTURER_BRUKER) || (d.manufacturer == kMANUFACTURER_PHILIPS)) && (sqDepth00189114 >= sqDepth)) {
sqDepth00189114 = -1; //triggered
//printf("%d--->\n", inStackPositionNumber);
//printf("slice %d---> 0020,9157 = %d %d %d\n", inStackPositionNumber, d.dimensionIndexValues[0], d.dimensionIndexValues[1], d.dimensionIndexValues[2]);
if (inStackPositionNumber > 0) {
//for images without SliceNumberMrPhilips (2001,100A)
int sliceNumber = inStackPositionNumber;
//printf("%d>>>>>>\n", sliceNumber);
//printf("slice %d \n", sliceNumber);
if ((sliceNumber == 1) && (!isnan(patientPosition[1])) ) {
for (int k = 0; k < 4; k++)
patientPositionStartPhilips[k] = patientPosition[k];
Expand Down Expand Up @@ -4617,7 +4617,7 @@ double TE = 0.0; //most recent echo time recorded
dcmStr (lLength, &buffer[lPos], aotTxt);
int slen = (int) strlen(aotTxt);
if((slen < 9) || (strstr(aotTxt, "QUADRUPED") == NULL) ) break;
printError("Anatomical Orientation Type (0010,2210) is QUADRUPED: rotate coordinates accordingly");
printError("Anatomical Orientation Type (0010,2210) is QUADRUPED: rotate coordinates accordingly\n");
break; }
case kPatientID :
dcmStr (lLength, &buffer[lPos], d.patientID);
Expand Down Expand Up @@ -5148,6 +5148,7 @@ double TE = 0.0; //most recent echo time recorded
break;
}
case kSequenceVariant21 :
if (d.manufacturer != kMANUFACTURER_SIEMENS) break; //see GE dataset in dcm_qa_nih
//fall through...
case kSequenceVariant : {
dcmStr (lLength, &buffer[lPos], d.sequenceVariant);
Expand Down Expand Up @@ -5806,12 +5807,14 @@ if (d.isHasPhase)
if (mn[i] != mx[i])
printMessage(" Dimension %d Range: %d..%d\n", i, mn[i], mx[i]);
} //verbose > 1
if (d.manufacturer != kMANUFACTURER_BRUKER) { //only single sample Bruker - perhaps use 0020,9057 to identify if space or time is 3rd dimension
//sort dimensions
#ifdef USING_R
std::sort(dcmDim.begin(), dcmDim.begin() + numberOfFrames, compareTDCMdim);
#else
qsort(dcmDim, numberOfFrames, sizeof(struct TDCMdim), compareTDCMdim);
#endif
}
//for (int i = 0; i < numberOfFrames; i++)
// printf("%d -> %d %d %d %d\n", i, dcmDim[i].diskPos, dcmDim[i].dimIdx[1], dcmDim[i].dimIdx[2], dcmDim[i].dimIdx[3]);
for (int i = 0; i < numberOfFrames; i++)
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 kDCMvers "v1.0.20181030 " kJP2suf kLSsuf kCCsuf
#define kDCMvers "v1.0.20181105 " kJP2suf kLSsuf kCCsuf

static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic
static const int kMaxDTI4D = 18000; //maximum number of DTI directions for 4D (Philips) images, also maximum number of 3D slices for Philips 3D and 4D images
Expand Down
8 changes: 6 additions & 2 deletions console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2888,12 +2888,16 @@ void checkSliceTiming(struct TDICOMdata * d, struct TDICOMdata * d1) {
float minT1 = d1->CSA.sliceTiming[0];
float maxT1 = minT1;
for (int i = 0; i < kMaxEPI3D; i++) {
if (d1->CSA.sliceTiming[i] < 0.0) break;
//if (d1->CSA.sliceTiming[i] < 0.0) break;
if (d1->CSA.sliceTiming[i] < minT1) minT1 = d1->CSA.sliceTiming[i];
if (d1->CSA.sliceTiming[i] > maxT1) maxT1 = d1->CSA.sliceTiming[i];
}
if (minT1 < 0.0) { //https://github.com/neurolabusc/MRIcroGL/issues/31
printWarning("Siemens MoCo? Bogus slice timing (range %g..%g, TR=%gms)\n", minT1, maxT1, d->TR);
return;
}
if ((minT1 == maxT1) || (maxT1 >= d->TR)) { //both first and second image corrupted
printWarning("CSA slice timing appears corrupted (range %g..%g, TR=%gms)\n", minT, maxT, d->TR);
printWarning("CSA slice timing appears corrupted (range %g..%g, TR=%gms)\n", minT1, maxT1, d->TR);
return;
}
//1st image corrupted, but 2nd looks ok - substitute values from 2nd image
Expand Down

0 comments on commit da64ebc

Please sign in to comment.