X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocEntrySet.cxx;h=b73bb8f1933dbd78aabec36fae992b0fa8540853;hb=251590eb8bbe0635858d05909052d11c6a7ba490;hp=abccfe1f39049b43f7281d03baa352e8b6628a8c;hpb=c42a0d560374ca98eb7f1531de835fd4cd1c59b0;p=gdcm.git diff --git a/src/gdcmDocEntrySet.cxx b/src/gdcmDocEntrySet.cxx index abccfe1f..b73bb8f1 100644 --- a/src/gdcmDocEntrySet.cxx +++ b/src/gdcmDocEntrySet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.cxx,v $ Language: C++ - Date: $Date: 2004/10/27 22:31:12 $ - Version: $Revision: 1.25 $ + Date: $Date: 2005/01/06 13:35:38 $ + Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,6 +19,7 @@ #include "gdcmDebug.h" #include "gdcmCommon.h" +#include "gdcmDictSet.h" #include "gdcmGlobal.h" #include "gdcmException.h" #include "gdcmDocEntry.h" @@ -118,11 +119,12 @@ SeqEntry* DocEntrySet::NewSeqEntryByNumber(uint16_t Group, // Protected /** - * \brief Gets a Dicom Element inside a SQ Item Entry, by name + * \brief Gets a Dicom Element inside a SQ Item Entry, by name + * @param name of the element to be found. * @return */ - DocEntry *DocEntrySet::GetDocEntryByName(std::string const & name) - { +DocEntry* DocEntrySet::GetDocEntryByName( TagName const & name ) +{ Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); DictEntry *dictEntry = pubDict->GetDictEntryByName(name); if( !dictEntry ) @@ -162,11 +164,11 @@ std::string DocEntrySet::GetEntryByName(TagName const & name) * @param fourth owner group * @param name english name */ -DictEntry* DocEntrySet::NewVirtualDictEntry(uint16_t group, - uint16_t element, - std::string const & vr, - std::string const & fourth, - std::string const & name) +DictEntry* DocEntrySet::NewVirtualDictEntry( uint16_t group, + uint16_t element, + TagName const & vr, + TagName const & fourth, + TagName const & name ) { return Global::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name); } @@ -202,8 +204,7 @@ DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group, * Creates a new DocEntry (without any 'value' ...) * @param group group number of the underlying DictEntry * @param elem elem number of the underlying DictEntry - * @param VR V(alue) R(epresentation) of the Entry -if private Entry- - + * @param vr V(alue) R(epresentation) of the Entry -if private Entry- */ DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group, uint16_t elem, TagName const & vr) @@ -211,12 +212,29 @@ DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group, uint16_t elem, // Find out if the tag we encountered is in the dictionaries: Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem); - if (!dictEntry) + std::string goodVR = vr; + DictEntry *goodDict = dictEntry; + + // Check if the would VR is good + if (elem==0x0000) + goodVR="UL"; + + // Check if the DictEntry VR corresponds with the would VR + if (goodDict) + if (goodDict->GetVR() != goodVR && goodVR!=GDCM_UNKNOWN) + goodDict=NULL; + + // Create a new virtual DictEntry if necessary + if (!goodDict) { - dictEntry = NewVirtualDictEntry(group, elem, vr); + if (dictEntry) + goodDict = NewVirtualDictEntry(group, elem, goodVR,"FIXME",dictEntry->GetName()); + else + goodDict = NewVirtualDictEntry(group, elem, goodVR); } - DocEntry *newEntry = new DocEntry(dictEntry); + // Create the DocEntry + DocEntry *newEntry = new DocEntry(goodDict); if (!newEntry) { dbg.Verbose(1, "SQItem::NewDocEntryByNumber", @@ -225,6 +243,7 @@ DocEntry* DocEntrySet::NewDocEntryByNumber(uint16_t group, uint16_t elem, } return newEntry; } + /* \brief * Probabely move, as is, to DocEntrySet, as a non virtual method * and remove Document::NewDocEntryByName @@ -235,7 +254,7 @@ DocEntry *DocEntrySet::NewDocEntryByName(TagName const & name) DictEntry *newTag = pubDict->GetDictEntryByName(name); if (!newTag) { - newTag = NewVirtualDictEntry(0xffff, 0xffff, "LO", "unkn", name); + newTag = NewVirtualDictEntry(0xffff, 0xffff, "LO", GDCM_UNKNOWN, name); } DocEntry* newEntry = new DocEntry(newTag);