]> Creatis software - gdcm.git/blob - src/gdcmDefaultDicts.cxx.in
* gdcmDicomDirElement.[h|cxx] : change the AddEntry method. Now, it gets a
[gdcm.git] / src / gdcmDefaultDicts.cxx.in
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDefaultDicts.cxx.in,v $
5   Language:  C++
6   Date:      $Date: 2005/01/20 17:15:54 $
7   Version:   $Revision: 1.6 $
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 #ifndef GDCMDEFAULTDICTS_H
20 #define GDCMDEFAULTDICTS_H
21
22 #include "gdcmDict.h"
23 #include "gdcmDictEntry.h"
24 #include "gdcmTS.h"
25 #include "gdcmVR.h"
26 #include "gdcmDicomDirElement.h"
27
28 namespace gdcm
29 {
30
31 typedef struct
32 {
33    uint16_t group;
34    uint16_t element;
35    const char *vr;
36    const char *vm;
37    const char *name;
38 } DICT_ENTRY;
39
40 static DICT_ENTRY datadir[] = {
41 @DICOM_DATA_DICTIONARY@
42 };
43
44 void FillDefaultDataDict(Dict *d)
45 {
46    unsigned int i = 0;
47    DICT_ENTRY n = datadir[i];
48    while( n.name != 0 )
49    {
50       const DictEntry e( n.group, n.element, n.vr, n.vm, n.name);
51       d->AddNewEntry( e );
52       n = datadir[++i];
53    }
54 }
55
56 void FillDefaultTSDict(TSHT & ts)
57 {
58 @DICOM_TS_DICTIONARY@
59 }
60
61 void FillDefaultVRDict(VRHT & vr)
62 {
63 @DICOM_VR_DICTIONARY@
64 }
65
66 typedef struct
67 {
68    const char *type;
69    unsigned short group;
70    unsigned short element;
71    const char *value;
72 } ELEMENT;
73
74 static ELEMENT dataElement[] = {
75 @DICOM_DIR_DICTIONARY@
76 };
77
78 void FillDefaultDIRDict(DicomDirElement *dde)
79 {
80    unsigned int i = 0;
81    ELEMENT e = dataElement[i];
82    Element elem;
83    DicomDirType type;
84
85    while( e.type != 0 )
86    {
87       if( e.type == "metaElem" )
88          type = DD_META;
89       else if( e.type == "patientElem" )
90          type = DD_PATIENT;
91       else if( e.type == "studyElem" )
92          type = DD_STUDY;
93       else if( e.type == "serieElem" )
94          type = DD_SERIE;
95       else if( e.type == "imageElem" )
96          type = DD_IMAGE;
97       else
98          type = DD_UNKNOWN;
99
100       elem.Group = e.group;
101       elem.Elem  = e.element;
102       elem.Value = e.value;
103       dde->AddNewEntry( type, elem);
104       e = dataElement[++i];
105    }
106 }
107
108 } //end gdcm namespace
109 #endif
110