1 /*=========================================================================
4 Module: $RCSfile: gdcmObject.cxx,v $
6 Date: $Date: 2004/07/21 14:02:10 $
7 Version: $Revision: 1.23 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmObject.h"
20 #include "gdcmGlobal.h"
21 #include "gdcmDebug.h"
22 #include "gdcmValEntry.h"
24 //-----------------------------------------------------------------------------
29 * @param ptagHT pointer to the HTable (gdcmObject needs it
30 * to build the gdcmDocEntries)
31 * @param depth Sequence depth level
34 gdcmObject::gdcmObject(TagDocEntryHT *ptagHT, int depth)
35 : gdcmSQItem (depth) {
36 this->ptagHT = ptagHT;
42 * \brief Canonical destructor.
44 gdcmObject::~gdcmObject(void) {
49 //-----------------------------------------------------------------------------
55 * \brief Builds a hash table (multimap) containing
56 * pointers to all Header Entries (i.e Dicom Element)
57 * related to this 'object'
60 TagDocEntryHT gdcmObject::GetEntry(void) {
62 docEntries=GetDocEntries();
63 for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
64 HT[(*i)->GetKey()]=*i;
69 //-----------------------------------------------------------------------------
72 * \brief add the 'Object' related Dicom Elements to the listEntries
73 * of a partially created DICOMDIR
75 void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
77 // FillObject rempli le SQItem qui sera accroche au bon endroit
79 std::list<gdcmElement>::iterator it;
81 gdcmDictEntry *dictEntry;
84 // for all the Elements found in they own part of the DicomDir dict.
85 for(it=elemList.begin();it!=elemList.end();++it)
89 dictEntry=gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
90 entry=new gdcmValEntry(dictEntry);
91 entry->SetOffset(0); // just to avoid further missprinting
92 entry->SetValue(it->value);
94 // dealing with value length ...
96 if(dictEntry->GetGroup()==0xfffe)
98 entry->SetLength(entry->GetValue().length());
100 else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
104 else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
108 else if(dictEntry->GetVR()=="SQ")
110 entry->SetLength(0xffffffff);
114 entry->SetLength(entry->GetValue().length());