]> Creatis software - gdcm.git/blobdiff - src/gdcmHeaderEntry.cxx
2004-01-31 Jean-Pierre Roux
[gdcm.git] / src / gdcmHeaderEntry.cxx
index 5832ad315e8763c7b46c3c014a723fa40a099927..514a591eace2439f0b913a6b01cc2771bc08f765 100644 (file)
@@ -13,6 +13,9 @@
 #endif
 #include <iomanip> // for std::ios::left, ...
 
+
+#define MAX_SIZE_PRINT_ELEMENT_VALUE 10000
+
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
@@ -48,7 +51,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,12 +79,17 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    if (printLevel>=1) {      
       s.setf(std::ios::left);
       s << std::setw(66-GetName().length()) << " ";             
-   } 
+   }
+    
+   s << "[" << GetName()<< "]";
+
      
-   s << "[" << GetName()<< "]";       
-   if( (GetLength()<64) || (printLevel>=3) )
+           
+   if( (GetLength()<MAX_SIZE_PRINT_ELEMENT_VALUE) || 
+       (printLevel>=3)  || 
+       (d2.find("gdcm::NotLoaded.") < d2.length()) )
       s << " [" << d2 << "]";
-   else
+   else 
       s << " [ gdcm::too long for print (" << GetLength() << ") ]";
 
    // Display the UID value (instead of displaying the rough code)  
@@ -92,6 +100,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