]> Creatis software - gdcm.git/commitdiff
gdcmObject:SetEntryByNumber now creates a VirtualDictEntry if the (group,elem)
authorjpr <jpr>
Fri, 12 Mar 2004 15:04:32 +0000 (15:04 +0000)
committerjpr <jpr>
Fri, 12 Mar 2004 15:04:32 +0000 (15:04 +0000)
supplied doesn't correspond to an already existing DictEntry

src/gdcmObject.cxx
src/gdcmParser.cxx

index 3f4b5101f4dc8c0e1bfda7f83661756bfe8713ad..a91aec1f9c1c635f43bdd5998731b86eab087bf5 100644 (file)
@@ -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
index cea36d4ec8f30adadf59d4497a59077c06882e85..e2df1e28fcef9dcf9f211ee3a54a95473c121090 100644 (file)
@@ -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;