Skip to content

Commit

Permalink
Handle Siemens data where protocolName (0018,1030) is empty https://w…
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Dec 4, 2017
1 parent 02fc4b2 commit 94f3129
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3767,8 +3767,8 @@ uint32_t kUnnest2 = 0xFFFE +(0xE0DD << 16 ); //#define kUnnest2 0xFFFE +(0xE0DD
strcpy(d.protocolName, d.seriesDescription);
if ((strlen(d.protocolName) < 1) && (strlen(d.seriesDescription) > 1))
strcpy(d.protocolName, d.seriesDescription);
if ((strlen(d.protocolName) < 1) && (strlen(d.sequenceName) > 1))
strcpy(d.protocolName, d.sequenceName);
if ((strlen(d.protocolName) < 1) && (strlen(d.sequenceName) > 1) && (d.manufacturer != kMANUFACTURER_SIEMENS))
strcpy(d.protocolName, d.sequenceName); //protocolName (0018,1030) optional, sequence name (0018,0024) is not a good substitute for Siemens as it can vary per volume: *ep_b0 *ep_b1000#1, *ep_b1000#2, etc https://www.nitrc.org/forum/forum.php?thread_id=8771&forum_id=4703
// if (!isOrient) {
// if (d.isNonImage)
// printWarning("Spatial orientation ambiguous (tag 0020,0037 not found) [probably not important: derived image]: %s\n", fname);
Expand Down
2 changes: 1 addition & 1 deletion console/nii_dicom.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
#define kCCsuf " CompilerNA" //unknown compiler!
#endif

#define kDCMvers "v1.0.20171122" kDCMsuf kCCsuf
#define kDCMvers "v1.0.20171204" kDCMsuf kCCsuf

static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic
static const int kMaxDTI4D = 4096; //maximum number of DTI directions for 4D (Philips) images, also maximum number of 3D slices for Philips 3D and 4D images
Expand Down
13 changes: 9 additions & 4 deletions console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ int isSameFloatDouble (double a, double b) {
}

struct TWarnings { //generate a warning only once per set
bool acqNumVaries, bitDepthVaries, dateTimeVaries, echoVaries, coilVaries, nameVaries, orientVaries;
bool acqNumVaries, bitDepthVaries, dateTimeVaries, echoVaries, coilVaries, nameVaries, nameEmpty, orientVaries;
};

TWarnings setWarnings() {
Expand All @@ -2595,6 +2595,7 @@ TWarnings setWarnings() {
r.echoVaries = false;
r.coilVaries = false;
r.nameVaries = false;
r.nameEmpty = false;
r.orientVaries = false;
return r;
}
Expand Down Expand Up @@ -2649,9 +2650,13 @@ bool isSameSet (struct TDICOMdata d1, struct TDICOMdata d2, struct TDCMopts* opt
warnings->coilVaries = true;
return false;
}
if ((strcmp(d1.protocolName, d2.protocolName) != 0)) {
if ((!warnings->nameVaries))
printMessage("slices not stacked: protocol name varies\n");
if ((strlen(d1.protocolName) < 1) && (strlen(d2.protocolName) < 1)) {
if (!warnings->nameEmpty)
printWarning("Empty protocol name(s) (0018,1030)\n");
warnings->nameEmpty = true;
} else if ((strcmp(d1.protocolName, d2.protocolName) != 0)) {
if (!warnings->nameVaries)
printMessage("slices not stacked: protocol name varies '%s' != '%s'\n", d1.protocolName, d2.protocolName);
warnings->nameVaries = true;
return false;
}
Expand Down

0 comments on commit 94f3129

Please sign in to comment.