X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeaderEntry.cxx;h=e53120744a3385ac0f75921753cd04a5ca6439f3;hb=8d4184fc7129f85d9ec384a3c7b9c5928a1f5b5e;hp=c74b8afb8415d246645e534f72dc4806af4d4a9d;hpb=d3e997d981d84fece924c52c8b513bccc6cd371a;p=gdcm.git diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index c74b8afb..e5312074 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -32,16 +32,16 @@ void gdcmHeaderEntry::Print(std::ostream & os) { unsigned short int g, e; char st[20]; TSKey v; - std::string d2; + std::string d2, vr; gdcmTS * ts = gdcmGlobal::GetTS(); std::ostringstream s; guint32 lgth; char greltag[10]; //group element tag - - g = GetGroup(); - e = GetElement(); - v = GetValue(); - o = GetOffset(); + g = GetGroup(); + e = GetElement(); + v = GetValue(); + o = GetOffset(); + vr = GetVR(); sprintf(greltag,"%04x|%04x ",g,e); s << greltag ; @@ -71,7 +71,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { s << std::setw(8) << o; } - s << "[" << GetVR() << "] "; + s << "[" << vr << "] "; if (printLevel>=1) { s.setf(std::ios::left); @@ -79,7 +79,10 @@ void gdcmHeaderEntry::Print(std::ostream & os) { } s << "[" << GetName()<< "]"; - s << " [" << d2 << "]"; + if( (GetLength()<64) || (printLevel>=3) ) + 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 ? @@ -89,13 +92,19 @@ 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 + //if (e == 0x0000) { // elem 0x0000 --> group length + if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) { if (v == "4294967295") // to avoid troubles in convertion sprintf (st," x(ffffffff)"); else - sprintf(st," x(%08x)",atoi(v.c_str())); + sprintf(st," x(%x)",(unsigned long)atof(v.c_str())); s << st; } s << std::endl;