Skip to content

Commit

Permalink
ImageType reporting (#881)
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Oct 24, 2024
1 parent fd81790 commit 2ffaba7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
10 changes: 9 additions & 1 deletion console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4348,7 +4348,7 @@ struct TDICOMdata readDICOMx(char *fname, struct TDCMprefs *prefs, struct TDTI4D
#define kImplementationVersionName 0x0002 + (0x0013 << 16)
#define kSourceApplicationEntityTitle 0x0002 + (0x0016 << 16)
#define kDirectoryRecordSequence 0x0004 + (0x1220 << 16)
// #define kSpecificCharacterSet 0x0008+(0x0005 << 16 ) //someday we should handle foreign characters...
//#define kSpecificCharacterSet 0x0008+(0x0005 << 16 ) //someday we should handle foreign characters...
#define kImageTypeTag 0x0008 + (0x0008 << 16)
#define kSOPInstanceUID 0x0008 + (0x0018 << 16) // Philips inserts time as last item, e.g. ?.?.?.YYYYMMDDHHmmSS.SSSS
// not reliable https://neurostars.org/t/heudiconv-no-extraction-of-slice-timing-data-based-on-philips-dicoms/2201/21
Expand Down Expand Up @@ -5436,6 +5436,14 @@ struct TDICOMdata readDICOMx(char *fname, struct TDCMprefs *prefs, struct TDTI4D
d.isSegamiOasis = true;
break;
}
/* case kSpecificCharacterSet : {
char charTxt[kDICOMStr];
dcmStr(lLength, &buffer[lPos], charTxt);
//issue878 dcm_qa_uih is ISO_IR 192 aka UTF-8 !
if (strcmp(charTxt, "ISO_IR 100") != 0) {
printWarning("Issue878: Specific Character Set (0008,0005) is not ISO-IR 100. Non-latin characters may be mangled.\n");
}
} */
case kDirectoryRecordSequence: {
d.isRawDataStorage = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion console/nii_dicom.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
#define kCPUsuf " " // unknown CPU
#endif

#define kDCMdate "v1.0.20241022"
#define kDCMdate "v1.0.20241024"
#define kDCMvers kDCMdate " " kJP2suf kLSsuf kCCsuf kCPUsuf

static const int kMaxEPI3D = 1024; // maximum number of EPI images in Siemens Mosaic
Expand Down
13 changes: 8 additions & 5 deletions console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,15 +1452,18 @@ tse3d: T2*/
} else
isSep = true;
}
if ((d.isHasMagnitude) && ((strstr(d.imageType, "_M_") == NULL) && (strstr(d.imageType, "_MAGNITUDE_") == NULL)))
//issue881 Philips enhanced includes magnitude and Hz images into one file
bool isHz = d.isHasReal && d.isRealIsPhaseMapHz;
//n.b. issue881 alias `M` does not prevent appending `MAGNITUDE`
if ((!isHz) && (d.isHasMagnitude) && (strstr(d.imageType, "_MAGNITUDE_") == NULL))
fprintf(fp, "\", \"MAGNITUDE");
if ((d.isHasPhase) && ((strstr(d.imageType, "_P_") == NULL) && (strstr(d.imageType, "_PHASE_") == NULL)))
if ((!isHz) && (d.isHasPhase) && (strstr(d.imageType, "_PHASE_") == NULL))
fprintf(fp, "\", \"PHASE");
if ((d.isHasReal) && ((strstr(d.imageType, "_R_") == NULL) && (strstr(d.imageType, "_REAL_") == NULL)))
if ((!isHz) && (d.isHasReal) && (strstr(d.imageType, "_REAL_") == NULL))
fprintf(fp, "\", \"REAL");
if ((d.isHasImaginary) && ((strstr(d.imageType, "_I_") == NULL) && (strstr(d.imageType, "_IMAGINARY_") == NULL)))
if ((!isHz) && (d.isHasImaginary) && (strstr(d.imageType, "_IMAGINARY_") == NULL))
fprintf(fp, "\", \"IMAGINARY");
if ((d.isRealIsPhaseMapHz) && ((strstr(d.imageType, "_FIELDMAPHZ_") == NULL)))
if ((isHz) && ((strstr(d.imageType, "_FIELDMAPHZ_") == NULL)))
fprintf(fp, "\", \"FIELDMAPHZ");
fprintf(fp, "\"],\n");
}
Expand Down

0 comments on commit 2ffaba7

Please sign in to comment.