]> Creatis software - gdcm.git/blob - src/gdcmDicomDirObject.cxx
According to Benoit's suggestion, and without any objection from anybody
[gdcm.git] / src / gdcmDicomDirObject.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomDirObject.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/01/08 15:03:59 $
7   Version:   $Revision: 1.15 $
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.
12                                                                                 
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.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmDicomDirObject.h"
20 #include "gdcmGlobal.h"
21 #include "gdcmDebug.h"
22 #include "gdcmValEntry.h"
23 #include "gdcmDictSet.h"
24
25 namespace gdcm 
26 {
27
28 //-----------------------------------------------------------------------------
29 /**
30  * \brief  Constructor 
31  *          
32  * @param depth Sequence depth level
33  */
34   
35 DicomDirObject::DicomDirObject(int depth) 
36           : SQItem (depth)
37 {
38 }
39
40
41 /**
42  * \brief   Canonical destructor.
43  */
44 DicomDirObject::~DicomDirObject()
45 {
46 }
47
48
49 //-----------------------------------------------------------------------------
50 // Public
51
52
53 /**
54  * \brief   Builds a hash table (multimap) containing 
55  *          pointers to all Header Entries (i.e Dicom Element)
56  *          related to this 'object'
57  * @return
58  */ 
59 TagDocEntryHT DicomDirObject::GetEntryHT()
60 {
61    TagDocEntryHT HT;
62    DocEntries = GetDocEntries();   
63    for(ListDocEntry::iterator i = DocEntries.begin(); 
64                               i != DocEntries.end(); ++i)
65    {
66       HT[(*i)->GetKey()] = *i;
67    }
68    return HT;
69 }
70
71 //-----------------------------------------------------------------------------
72 // Protected
73 /**
74  * \brief   add the 'Object' related Dicom Elements to the listEntries
75  *          of a partially created DICOMDIR
76  * @param elemList Element List to add at the right place
77  */
78 void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList)
79 {
80   // FillObject fills up the SQItem that will be conneected to the right place
81
82    ListDicomDirMetaElem::const_iterator it;
83    uint16_t tmpGr,tmpEl;
84    DictEntry *dictEntry;
85    ValEntry *entry;
86       
87    // for all the Elements found in they own part of the DicomDir dict.     
88    for(it = elemList.begin(); it != elemList.end(); ++it)
89    {
90       tmpGr = it->Group;
91       tmpEl = it->Elem;
92       dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetDictEntry(tmpGr,tmpEl);
93       entry = new ValEntry(dictEntry);
94       entry->SetOffset(0); // just to avoid further missprinting
95       entry->SetValue(it->Value);
96
97       AddEntry(entry);
98    }   
99 }   
100 } // end namespace gdcm
101