#include "gdcmUtil.h"
#include "gdcmElValSet.h"
+gdcmElValSet::~gdcmElValSet() {
+ for (TagElValueHT::iterator tag = tagHt.begin(); tag != tagHt.end(); ++tag) {
+ gdcmElValue* EntryToDelete = tag->second;
+ if ( EntryToDelete )
+ delete EntryToDelete;
+ }
+ tagHt.clear();
+ // Since Add() adds symetrical in both tagHt and NameHt we can
+ // assume all the pointed gdcmElValues are allready cleaned-up when
+ // we cleaned tagHt.
+ NameHt.clear();
+}
TagElValueHT & gdcmElValSet::GetTagHt(void) {
return tagHt;
TagKey key = gdcmDictEntry::TranslateToKey(group, element);
if ( ! tagHt.count(key))
return 0;
- tagHt[key]->SetValue(content);
- tagHt[key]->SetLength(content.length());
+ tagHt[key]->SetValue(content);
+ string vr = tagHt[key]->GetVR();
+ guint32 lgr;
+
+ if( (vr == "US") || (vr == "SS") )
+ lgr = 2;
+ else if( (vr == "UL") || (vr == "SL") )
+ lgr = 4;
+ else
+ lgr = content.length();
+
+ tagHt[key]->SetLength(lgr);
return 1;
}
if ( ! NameHt.count(TagName))
return 0;
NameHt[TagName]->SetValue(content);
- NameHt[TagName]->SetLength(content.length());
+ string vr = NameHt[TagName]->GetVR();
+ guint32 lgr;
+
+ if( (vr == "US") || (vr == "SS") )
+ lgr = 2;
+ else if( (vr == "UL") || (vr == "SL") )
+ lgr = 4;
+ else
+ lgr = content.length();
+
+ NameHt[TagName]->SetLength(lgr);
return 1;
}
str_trash=trash;
elemZ->SetValue(str_trash);
}
-
- // Liberer groupHt !
-
}
void gdcmElValSet::WriteElements(FileType type, FILE * _fp) {
}
continue;
}
+ tokens.clear();
// Les pixels ne sont pas chargés dans l'element !
if ((gr == 0x7fe0) && (el == 0x0010) ) break;