From: jpr Date: Fri, 12 Mar 2004 15:04:32 +0000 (+0000) Subject: gdcmObject:SetEntryByNumber now creates a VirtualDictEntry if the (group,elem) X-Git-Tag: Version0.5.bp~295 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8c5d11e469d0c09fa518a2b81ad0d13b279c33f2;p=gdcm.git gdcmObject:SetEntryByNumber now creates a VirtualDictEntry if the (group,elem) supplied doesn't correspond to an already existing DictEntry --- diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index 3f4b5101..a91aec1f 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -112,13 +112,16 @@ std::string gdcmObject::GetEntryByName(TagName name) { gdcmHeaderEntry *Entry; TagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! ptagHT->count(key)) { - // we assume the element is a belongs to a Public Group (not a shadow one) + // we assume the element belongs to a Public Group (not a shadow one) // we assume a Public Dictionnary *is* loaded gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict(); - // we assume the invoqued (group,elem) exists - // inside the Public Dictionary - gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group, element); - // we assume the constuctor didn't fail + // if the invoqued (group,elem) doesn't exist inside the Dictionary + // we create a VirtualDictEntry + gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group, element); + if (DictEntry == NULL) { + DictEntry=gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,"UN","??","??"); + } + // we assume the constructor didn't fail Entry = new gdcmHeaderEntry(DictEntry); // ---- // TODO diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index cea36d4e..e2df1e28 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -818,7 +818,7 @@ bool gdcmParser::SetEntryVoidAreaByNumber(void * area, /** * \ingroup gdcmParser * \brief Update the entries with the shadow dictionary. - * Only non even entries are analyzed + * Only non even entries are analyzed */ void gdcmParser::UpdateShaEntries(void) { gdcmDictEntry *entry;