1 /*=========================================================================
4 Module: $RCSfile: gdcmObject.cxx,v $
6 Date: $Date: 2004/06/20 18:08:48 $
7 Version: $Revision: 1.20 $
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 Seaquence 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;
71 * \brief Builds a Chained List containing
72 * pointers to all Header Entries (i.e Dicom Element)
73 * related to this 'object'
77 // FIXME : what was it used for ?!?
79 ListTag gdcmObject::GetListEntry(void) {
80 return(GetDocEntries());
84 //-----------------------------------------------------------------------------
88 * \brief add the 'Object' related Dicom Elements to the listEntries
89 * of a partially created DICOMDIR
91 void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
93 // FillObject rempli le SQItem qui sera accroche au bon endroit
95 std::list<gdcmElement>::iterator it;
97 gdcmDictEntry *dictEntry;
100 //gdcmSQItem *s = new gdcmSQItem;
102 // for all the Elements found in they own part of the DicomDir dict.
103 for(it=elemList.begin();it!=elemList.end();++it)
107 dictEntry=gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
108 entry=new gdcmValEntry(dictEntry);
109 entry->SetOffset(0); // just to avoid further missprinting
110 entry->SetValue(it->value);
112 // dealing with value length ...
114 if(dictEntry->GetGroup()==0xfffe)
116 entry->SetLength(entry->GetValue().length());
118 else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
122 else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
126 else if(dictEntry->GetVR()=="SQ")
128 entry->SetLength(0xffffffff);
132 entry->SetLength(entry->GetValue().length());
134 //docEntries->insert(debInsertion ,entry); // ??? // add at the begining of the Patient list
138 //-----------------------------------------------------------------------------
141 //-----------------------------------------------------------------------------