X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeaderEntry.cxx;h=a55933c0502308db78c8532a92faf5ab626e7d67;hb=fae5f95ae8cf044c024b1793b94032c9368f0f4b;hp=d56d92117ab2cd3513a14547fbefde32aa1c30ab;hpb=b1cbd2d3c12ccac8b257901236fe8eb27a20b117;p=gdcm.git diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index d56d9211..a55933c0 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -13,6 +13,9 @@ #endif #include // for std::ios::left, ... + +#define MAX_SIZE_PRINT_ELEMENT_VALUE 64 + //----------------------------------------------------------------------------- // Constructor / Destructor /** @@ -22,6 +25,7 @@ */ gdcmHeaderEntry::gdcmHeaderEntry(gdcmDictEntry* in) { ImplicitVR = false; + voidArea = NULL; // unsecure memory area to hold 'non string' values entry = in; } @@ -37,6 +41,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { std::ostringstream s; guint32 lgth; char greltag[10]; //group element tag + g = GetGroup(); e = GetElement(); v = GetValue(); @@ -48,7 +53,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { d2 = _CreateCleanString(v); // replace non printable characters by '.' if (printLevel>=2) { s << "lg : "; - lgth = GetReadLength(); + lgth = GetReadLength(); // ReadLength, as opposed to UsableLength if (lgth == 0xffffffff) { sprintf(st,"x(ffff)"); // I said : "x(ffff)" ! s.setf(std::ios::left); @@ -76,11 +81,24 @@ void gdcmHeaderEntry::Print(std::ostream & os) { if (printLevel>=1) { s.setf(std::ios::left); s << std::setw(66-GetName().length()) << " "; - } - - s << "[" << GetName()<< "]"; - s << " [" << d2 << "]"; + } + + s << "[" << GetName()<< "]"; + if (voidArea != NULL) { + s << " [gdcm::Non String Data Loaded in Unsecure Area (" + << GetLength() << ") ]"; + } + + else { + if( (GetLength()=3) || + (d2.find("gdcm::NotLoaded.") < d2.length()) ) + s << " [" << d2 << "]"; + else + s << " [gdcm::too long for print (" << GetLength() << ") ]"; + } + // Display the UID value (instead of displaying the rough code) if (g == 0x0002) { // Any more to be displayed ? if ( (e == 0x0010) || (e == 0x0002) ) @@ -89,6 +107,11 @@ void gdcmHeaderEntry::Print(std::ostream & os) { if (g == 0x0008) { if ( (e == 0x0016) || (e == 0x1150) ) s << " ==>\t[" << ts->GetValue(v) << "]"; + } else { + if (g == 0x0004) { + if ( (e == 0x1510) || (e == 0x1512) ) + s << " ==>\t[" << ts->GetValue(v) << "]"; + } } } //if (e == 0x0000) { // elem 0x0000 --> group length @@ -96,7 +119,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { if (v == "4294967295") // to avoid troubles in convertion sprintf (st," x(ffffffff)"); else - sprintf(st," x(%x)",atoi(v.c_str())); + sprintf(st," x(%x)",(unsigned long)atof(v.c_str())); s << st; } s << std::endl;