]> Creatis software - gdcm.git/blob - src/gdcmDefaultDicts.cxx.in
Fix mistypings
[gdcm.git] / src / gdcmDefaultDicts.cxx.in
1 /*=========================================================================
2
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDefaultDicts.cxx.in,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:08 $
7   Version:   $Revision: 1.13 $
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 "gdcmDictGroupName.h"
27 #include "gdcmDicomDirElement.h"
28
29 namespace GDCM_NAME_SPACE
30 {
31
32 typedef struct
33 {
34    uint16_t group;
35    uint16_t element;
36    const char *vr;
37    const char *vm;
38    const char *name;
39 } DICT_ENTRY;
40
41 static DICT_ENTRY datadir[] = {
42 @DICOM_DATA_DICTIONARY@
43 };
44
45 void FillDefaultDataDict(Dict *d)
46 {
47    DictEntry *e;
48    unsigned int i = 0;
49    DICT_ENTRY n = datadir[i];
50    while( n.name != 0 )
51    {
52       e = DictEntry::New( n.group, n.element, n.vr, n.vm, n.name);
53       d->AddEntry( e );
54       e->Delete();
55       n = datadir[++i];
56    }
57 }
58
59 void FillDefaultTSDict(TSHT &ts)
60 {
61 @DICOM_TS_DICTIONARY@
62 }
63
64 void FillDefaultVRDict(VRHT &vr)
65 {
66 @DICOM_VR_DICTIONARY@
67 }
68
69 void FillDefaultDictGroupName(DictGroupNameHT &groupName)
70 {
71 @DICT_GROUP_NAME_DICTIONARY@
72 }
73
74 typedef struct
75 {
76    const char *type;
77    unsigned short group;
78    unsigned short element;
79    //VRKey vr;
80    const char *vr;
81    const char *value;
82 } ELEMENT;
83
84 static ELEMENT dataElement[] = {
85 @DICOM_DIR_DICTIONARY@
86 };
87
88 void FillDefaultDIRDict(DicomDirElement *dde)
89 {
90    unsigned int i = 0;
91    ELEMENT e = dataElement[i];
92    DicomElement elem;
93    DicomDirType type;
94    std::string strType;
95
96    while( e.type != 0 )
97    {
98       // Force to use the string comparison operator ==
99       strType = e.type;
100       if( strType == "metaElem" )
101          type = DD_META;
102       else if( strType == "patientElem" )
103          type = DD_PATIENT;
104       else if( strType == "studyElem" )
105          type = DD_STUDY;
106       else if( strType == "serieElem" )
107          type = DD_SERIE;
108       else if( strType == "imageElem" )
109          type = DD_IMAGE;
110       else
111          type = DD_UNKNOWN;
112
113       elem.Group = e.group;
114       elem.Elem  = e.element;
115       elem.VR    = e.vr;
116       elem.Value = e.value;
117       dde->AddEntry( type, elem);
118       e = dataElement[++i];
119    }
120 }
121
122 } //end gdcm namespace
123 #endif
124