1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDirObject.cxx,v $
6 Date: $Date: 2004/10/25 04:08:20 $
7 Version: $Revision: 1.7 $
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(TagDocEntryHT *ptagHT, int depth)
44 * \ingroup DicomDirObject
45 * \brief Canonical destructor.
47 DicomDirObject::~DicomDirObject()
53 //-----------------------------------------------------------------------------
58 * \ingroup DicomDirObject
59 * \brief Builds a hash table (multimap) containing
60 * pointers to all Header Entries (i.e Dicom Element)
61 * related to this 'object'
64 TagDocEntryHT DicomDirObject::GetEntry()
67 DocEntries = GetDocEntries();
68 for(ListDocEntry::iterator i = DocEntries.begin();
69 i != DocEntries.end(); ++i)
71 HT[(*i)->GetKey()] = *i;
76 //-----------------------------------------------------------------------------
79 * \brief add the 'Object' related Dicom Elements to the listEntries
80 * of a partially created DICOMDIR
82 void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList)
84 // FillObject rempli le SQItem qui sera accroche au bon endroit
86 ListDicomDirMetaElem::const_iterator it;
91 // for all the Elements found in they own part of the DicomDir dict.
92 for(it = elemList.begin(); it != elemList.end(); ++it)
96 dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
97 entry = new ValEntry(dictEntry);
98 entry->SetOffset(0); // just to avoid further missprinting
99 entry->SetValue(it->Value);
101 // dealing with value length ...
103 if(dictEntry->GetGroup()==0xfffe)
105 entry->SetLength(entry->GetValue().length());
107 else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" )
111 else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" )
115 else if( dictEntry->GetVR() == "SQ" )
117 entry->SetLength(0xffffffff);
121 entry->SetLength(entry->GetValue().length());
126 } // end namespace gdcm