1 /*=========================================================================
4 Module: $RCSfile: gdcmObject.cxx,v $
6 Date: $Date: 2004/08/01 00:59:21 $
7 Version: $Revision: 1.24 $
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)
43 * \brief Canonical destructor.
45 gdcmObject::~gdcmObject()
51 //-----------------------------------------------------------------------------
57 * \brief Builds a hash table (multimap) containing
58 * pointers to all Header Entries (i.e Dicom Element)
59 * related to this 'object'
62 TagDocEntryHT gdcmObject::GetEntry()
65 docEntries=GetDocEntries();
66 for(ListDocEntry::iterator i = docEntries.begin();
67 i != docEntries.end(); ++i)
69 HT[(*i)->GetKey()]=*i;
74 //-----------------------------------------------------------------------------
77 * \brief add the 'Object' related Dicom Elements to the listEntries
78 * of a partially created DICOMDIR
80 void gdcmObject::FillObject(std::list<gdcmElement> elemList)
82 // FillObject rempli le SQItem qui sera accroche au bon endroit
84 std::list<gdcmElement>::iterator it;
86 gdcmDictEntry *dictEntry;
89 // for all the Elements found in they own part of the DicomDir dict.
90 for(it = elemList.begin(); it != elemList.end(); ++it)
94 dictEntry = gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
95 entry = new gdcmValEntry(dictEntry);
96 entry->SetOffset(0); // just to avoid further missprinting
97 entry->SetValue(it->value);
99 // dealing with value length ...
101 if(dictEntry->GetGroup()==0xfffe)
103 entry->SetLength(entry->GetValue().length());
105 else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" )
109 else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" )
113 else if( dictEntry->GetVR() == "SQ" )
115 entry->SetLength(0xffffffff);
119 entry->SetLength(entry->GetValue().length());