X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmValEntry.cxx;h=8f92ab338f7651bf8cef507ad764d97e9b1977a9;hb=a36f19bbc17a18bb85e99c11e6290642189ec6a2;hp=66198701929eef7193a2d14144fe2870988a0aac;hpb=e51bf0565bbe4c0e269dd941cb4071ebde6012e4;p=gdcm.git diff --git a/src/gdcmValEntry.cxx b/src/gdcmValEntry.cxx index 66198701..8f92ab33 100644 --- a/src/gdcmValEntry.cxx +++ b/src/gdcmValEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.cxx,v $ Language: C++ - Date: $Date: 2005/02/14 10:45:47 $ - Version: $Revision: 1.58 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.62 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,14 +22,15 @@ #include "gdcmGlobal.h" #include "gdcmUtil.h" #include "gdcmDebug.h" +#include "gdcmDocument.h" #include namespace gdcm { //----------------------------------------------------------------------------- -#define MAX_SIZE_PRINT_ELEMENT_VALUE 128 - +#define MAX_SIZE_PRINT_ELEMENT_VALUE 0x7fffffff +uint32_t ValEntry::MaxSizePrintEntry = MAX_SIZE_PRINT_ELEMENT_VALUE; //----------------------------------------------------------------------------- // Constructor / Destructor /** @@ -114,6 +115,26 @@ void ValEntry::WriteContent(std::ofstream *fp, FileType filetype) binary_write(*fp, GetValue()); } + +/** + * \brief Header Elements too long will not be printed + * @param newSize new size + */ +void ValEntry::SetMaxSizePrintEntry(long newSize) +{ + if ( newSize < 0 ) + { + return; + } + if ((uint32_t)newSize >= (uint32_t)0xffffffff ) + { + ValEntry::MaxSizePrintEntry = 0xffffffff; + return; + } + ValEntry::MaxSizePrintEntry = newSize; +} + + /** * \brief Sets the std::string representable' value of a ValEntry * @param val value to set @@ -125,13 +146,13 @@ void ValEntry::SetValue(std::string const &val) if ( l != 0) // To avoid to be cheated by 'zero length' integers { const VRKey &vr = GetVR(); - if( vr == "US" || vr == "SS" ) + if ( vr == "US" || vr == "SS" ) { // for multivaluated items l = (Util::CountSubstring(val, "\\") + 1) * 2; ContentEntry::SetValue(val); } - else if( vr == "UL" || vr == "SL" ) + else if ( vr == "UL" || vr == "SL" ) { // for multivaluated items l = (Util::CountSubstring(val, "\\") + 1) * 4;; @@ -193,7 +214,7 @@ void ValEntry::Print(std::ostream &os, std::string const &) TSAtr v = GetValue(); d2 = Util::CreateCleanString(v); // replace non printable characters by '.' - if( GetLength() <= MAX_SIZE_PRINT_ELEMENT_VALUE + if ( (long)GetLength() <= ValEntry::GetMaxSizePrintEntry() || PrintLevel >= 3 || d2.find(GDCM_NOTLOADED) < d2.length() ) { @@ -260,7 +281,7 @@ void ValEntry::Print(std::ostream &os, std::string const &) { if (v == "4294967295") // to avoid troubles in convertion { - st = Util::Format(" x(ffffffff)"); + st = "ffffffff"; } else { @@ -270,7 +291,7 @@ void ValEntry::Print(std::ostream &os, std::string const &) } else { - st = Util::Format(" "); + st = " "; } } s << st;