X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeaderEntry.cxx;h=4ed417243198fd72831d9e68cbb0ade3f7e60271;hb=e25987c451d6f797a5e5288ac1a926cfd767fe57;hp=514a591eace2439f0b913a6b01cc2771bc08f765;hpb=a547ed6d41e444153f4bea38c47810fe7f50d88e;p=gdcm.git diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index 514a591e..4ed41724 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -3,6 +3,7 @@ // #include "gdcmHeaderEntry.h" #include "gdcmTS.h" +#include "gdcmGlobal.h" #include "gdcmUtil.h" #ifdef GDCM_NO_ANSI_STRING_STREAM @@ -14,7 +15,7 @@ #include // for std::ios::left, ... -#define MAX_SIZE_PRINT_ELEMENT_VALUE 10000 +#define MAX_SIZE_PRINT_ELEMENT_VALUE 64 //----------------------------------------------------------------------------- // Constructor / Destructor @@ -24,12 +25,17 @@ * @param in Pointer to existing dictionary entry */ gdcmHeaderEntry::gdcmHeaderEntry(gdcmDictEntry* in) { - ImplicitVR = false; - entry = in; + ImplicitVR = false; + voidArea = NULL; // unsecure memory area to hold 'non string' values + entry = in; } //----------------------------------------------------------------------------- // Print +/** + * \ingroup gdcmHeaderEntry + * \brief canonical Printer + */ void gdcmHeaderEntry::Print(std::ostream & os) { size_t o; unsigned short int g, e; @@ -40,6 +46,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 +55,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { sprintf(greltag,"%04x|%04x ",g,e); s << greltag ; - d2 = _CreateCleanString(v); // replace non printable characters by '.' + d2 = CreateCleanString(v); // replace non printable characters by '.' if (printLevel>=2) { s << "lg : "; lgth = GetReadLength(); // ReadLength, as opposed to UsableLength @@ -78,20 +85,25 @@ void gdcmHeaderEntry::Print(std::ostream & os) { if (printLevel>=1) { s.setf(std::ios::left); - s << std::setw(66-GetName().length()) << " "; + s << std::setw(66-GetName().length()) << " "; } s << "[" << GetName()<< "]"; - - - if( (GetLength()=3) || - (d2.find("gdcm::NotLoaded.") < d2.length()) ) - s << " [" << d2 << "]"; - else - s << " [ gdcm::too long for print (" << GetLength() << ") ]"; - + 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) ) @@ -111,7 +123,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) { if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) { if (v == "4294967295") // to avoid troubles in convertion sprintf (st," x(ffffffff)"); - else + else sprintf(st," x(%x)",(unsigned long)atof(v.c_str())); s << st; }