X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocument.cxx;h=71312ce5ce2b6bab3c66efceca65e65559e5e349;hb=eebb428694422967cab7559646df139d790afded;hp=7acd21ae7b02260ec465f35d3e1dcc6f81b7928a;hpb=c92079b4881cba2560589210d4baeed9dd4d9cac;p=gdcm.git diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 7acd21ae..71312ce5 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/08/31 14:24:47 $ - Version: $Revision: 1.69 $ + Date: $Date: 2004/09/07 13:57:04 $ + Version: $Revision: 1.71 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -588,8 +588,8 @@ gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber( uint16_t elem ) { gdcmValEntry* valEntry = 0; - gdcmDocEntry* currentEntry = GetDocEntryByNumber( group, elem); + if (!currentEntry) { // The entry wasn't present and we simply create the required ValEntry: @@ -721,9 +721,9 @@ bool gdcmDocument::ReplaceIfExistByNumber(std::string const & value, * \brief Checks if a given Dicom Element exists within the H table * @param group Group number of the searched Dicom Element * @param element Element number of the searched Dicom Element - * @return number of occurences + * @return true is found */ -int gdcmDocument::CheckIfEntryExistByNumber(uint16_t group, uint16_t element ) +bool gdcmDocument::CheckIfEntryExistByNumber(uint16_t group, uint16_t element ) { const std::string &key = gdcmDictEntry::TranslateToKey(group, element ); return TagHT.count(key); @@ -887,11 +887,13 @@ bool gdcmDocument::SetEntryByNumber(std::string const & content, gdcmVRKey vr = valEntry->GetVR(); if( vr == "US" || vr == "SS" ) { - valEntry->SetLength(2); + int c = CountSubstring(content, "\\"); // for multivaluated items + valEntry->SetLength((c+1)*2); } else if( vr == "UL" || vr == "SL" ) { - valEntry->SetLength(4); + int c = CountSubstring(content, "\\"); // for multivaluated items + valEntry->SetLength((c+1)*4); } else {