1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirObject.cxx,v $
6 Date: $Date: 2004/12/03 17:13:18 $
7 Version: $Revision: 1.8 $
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.html 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"
26 //-----------------------------------------------------------------------------
28 * \ingroup DicomDirObject
31 * @param ptagHT pointer to the HTable (DicomDirObject needs it
32 * to build the DocEntries)
33 * @param depth Sequence depth level
36 DicomDirObject::DicomDirObject(int depth)
43 * \ingroup DicomDirObject
44 * \brief Canonical destructor.
46 DicomDirObject::~DicomDirObject()
52 //-----------------------------------------------------------------------------
57 * \ingroup DicomDirObject
58 * \brief Builds a hash table (multimap) containing
59 * pointers to all Header Entries (i.e Dicom Element)
60 * related to this 'object'
63 TagDocEntryHT DicomDirObject::GetEntry()
66 DocEntries = GetDocEntries();
67 for(ListDocEntry::iterator i = DocEntries.begin();
68 i != DocEntries.end(); ++i)
70 HT[(*i)->GetKey()] = *i;
75 //-----------------------------------------------------------------------------
78 * \brief add the 'Object' related Dicom Elements to the listEntries
79 * of a partially created DICOMDIR
81 void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList)
83 // FillObject rempli le SQItem qui sera accroche au bon endroit
85 ListDicomDirMetaElem::const_iterator it;
90 // for all the Elements found in they own part of the DicomDir dict.
91 for(it = elemList.begin(); it != elemList.end(); ++it)
95 dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
96 entry = new ValEntry(dictEntry);
97 entry->SetOffset(0); // just to avoid further missprinting
98 entry->SetValue(it->Value);
100 // dealing with value length ...
102 if(dictEntry->GetGroup()==0xfffe)
104 entry->SetLength(entry->GetValue().length());
106 else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" )
110 else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" )
114 else if( dictEntry->GetVR() == "SQ" )
116 entry->SetLength(0xffffffff);
120 entry->SetLength(entry->GetValue().length());
125 } // end namespace gdcm