1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirObject.cxx,v $
6 Date: $Date: 2004/09/23 10:47:10 $
7 Version: $Revision: 1.1 $
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 "gdcmDicomDirObject.h"
20 #include "gdcmGlobal.h"
21 #include "gdcmDebug.h"
22 #include "gdcmValEntry.h"
24 //-----------------------------------------------------------------------------
26 * \ingroup gdcmDicomDirObject
29 * @param ptagHT pointer to the HTable (gdcmDicomDirObject needs it
30 * to build the gdcmDocEntries)
31 * @param depth Sequence depth level
34 gdcmDicomDirObject::gdcmDicomDirObject(TagDocEntryHT *ptagHT, int depth)
42 * \ingroup gdcmDicomDirObject
43 * \brief Canonical destructor.
45 gdcmDicomDirObject::~gdcmDicomDirObject()
51 //-----------------------------------------------------------------------------
56 * \ingroup gdcmDicomDirObject
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 gdcmDicomDirObject::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 gdcmDicomDirObject::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());