]> Creatis software - gdcm.git/blob - src/gdcmDefaultDicts.cxx.in
* Fix compilation errors for the Python part
[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/10/19 12:01:50 $
7   Version:   $Revision: 1.10 $
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
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    unsigned int i = 0;
48    DICT_ENTRY n = datadir[i];
49    while( n.name != 0 )
50    {
51       const DictEntry e( n.group, n.element, n.vr, n.vm, n.name);
52       d->AddEntry( e );
53       n = datadir[++i];
54    }
55 }
56
57 void FillDefaultTSDict(TSHT &ts)
58 {
59 @DICOM_TS_DICTIONARY@
60 }
61
62 void FillDefaultVRDict(VRHT &vr)
63 {
64 @DICOM_VR_DICTIONARY@
65 }
66
67 void FillDefaultDictGroupName(DictGroupNameHT &groupName)
68 {
69 @DICT_GROUP_NAME_DICTIONARY@
70 }
71
72 typedef struct
73 {
74    const char *type;
75    unsigned short group;
76    unsigned short element;
77    const char *value;
78 } ELEMENT;
79
80 static ELEMENT dataElement[] = {
81 @DICOM_DIR_DICTIONARY@
82 };
83
84 void FillDefaultDIRDict(DicomDirElement *dde)
85 {
86    unsigned int i = 0;
87    ELEMENT e = dataElement[i];
88    DicomElement elem;
89    DicomDirType type;
90    std::string strType;
91
92    while( e.type != 0 )
93    {
94       // Force to use the string comparision operator ==
95       strType = e.type;
96       if( strType == "metaElem" )
97          type = DD_META;
98       else if( strType == "patientElem" )
99          type = DD_PATIENT;
100       else if( strType == "studyElem" )
101          type = DD_STUDY;
102       else if( strType == "serieElem" )
103          type = DD_SERIE;
104       else if( strType == "imageElem" )
105          type = DD_IMAGE;
106       else
107          type = DD_UNKNOWN;
108
109       elem.Group = e.group;
110       elem.Elem  = e.element;
111       elem.Value = e.value;
112       dde->AddEntry( type, elem);
113       e = dataElement[++i];
114    }
115 }
116
117 } //end gdcm namespace
118 #endif
119