X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocEntry.cxx;h=4f3b2be0e8c3c7d1818e0c8e872e1f0483c3ab5d;hb=d65508e83c169bde30eecaed0ca1c5ce6d0eebcb;hp=e2a89b1def4d7184b45fda908a4f45795b6c1198;hpb=c92079b4881cba2560589210d4baeed9dd4d9cac;p=gdcm.git diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index e2a89b1d..4f3b2be0 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -3,12 +3,12 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.cxx,v $ Language: C++ - Date: $Date: 2004/08/31 14:24:47 $ - Version: $Revision: 1.16 $ + Date: $Date: 2004/10/06 13:12:42 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -36,7 +36,9 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) { ImplicitVR = false; - DictEntry = in; + DictEntry = in; + SetKey( in->GetKey( ) ); + Offset = 0 ; // To avoid further missprinting } //----------------------------------------------------------------------------- @@ -46,7 +48,7 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) * \brief Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry * @param os ostream we want to print in */ -void gdcmDocEntry::Print(std::ostream & os) +void gdcmDocEntry::Print(std::ostream& os) { PrintLevel = 2; // FIXME @@ -57,18 +59,17 @@ void gdcmDocEntry::Print(std::ostream & os) std::string d2, vr; std::ostringstream s; uint32_t lgth; - char greltag[10]; //group element tag g = GetGroup(); e = GetElement(); o = GetOffset(); vr = GetVR(); - sprintf(greltag,"%04x|%04x ",g,e); - s << greltag ; - + + s << gdcmDictEntry::TranslateToKey(GetGroup(),GetElement()); + if (PrintLevel >= 2) { - s << "lg : "; + s << " lg : "; lgth = GetReadLength(); // ReadLength, as opposed to UsableLength if (lgth == 0xffffffff) { @@ -77,13 +78,13 @@ void gdcmDocEntry::Print(std::ostream & os) s << std::setw(10-strlen(st)) << " "; s << st << " "; s.setf(std::ios::left); - s << std::setw(8) << "-1"; + s << std::setw(8) << "-1"; } else { sprintf(st,"x(%x)",lgth); s.setf(std::ios::left); - s << std::setw(10-strlen(st)) << " "; + s << std::setw(10-strlen(st)) << " "; s << st << " "; s.setf(std::ios::left); s << std::setw(8) << lgth; @@ -113,7 +114,7 @@ void gdcmDocEntry::Print(std::ostream & os) * @param fp already open file pointer * @param filetype type of the file to be written */ -void gdcmDocEntry::Write(FILE *fp, FileType filetype) +void gdcmDocEntry::Write(FILE* fp, FileType filetype) { uint32_t FFFF = 0xffffffff; uint16_t group = GetGroup(); @@ -163,7 +164,7 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) // Unknown was 'written' // deal with Little Endian fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp); - fwrite ( &z, (size_t)2 ,(size_t)1 ,fp); + fwrite ( &z, (size_t)2 ,(size_t)1 ,fp); } else { @@ -208,7 +209,8 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) /** * \ingroup gdcmDocEntry - * \brief Gets the full length of the elementary DocEntry (not only value length) + * \brief Gets the full length of the elementary DocEntry (not only value + * length) depending on the VR. */ uint32_t gdcmDocEntry::GetFullLength() {