]> Creatis software - gdcm.git/blob - src/gdcmDefaultDicts.cxx.in
BUG: Remove Benoit bomb
[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/02/09 21:37:11 $
7   Version:   $Revision: 1.8 $
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->AddEntry( 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    std::string strType;
85
86    while( e.type != 0 )
87    {
88       // Force to use the string comparision operator ==
89       strType = e.type;
90       if( strType == "metaElem" )
91          type = DD_META;
92       else if( strType == "patientElem" )
93          type = DD_PATIENT;
94       else if( strType == "studyElem" )
95          type = DD_STUDY;
96       else if( strType == "serieElem" )
97          type = DD_SERIE;
98       else if( strType == "imageElem" )
99          type = DD_IMAGE;
100       else
101          type = DD_UNKNOWN;
102
103       elem.Group = e.group;
104       elem.Elem  = e.element;
105       elem.Value = e.value;
106       dde->AddEntry( type, elem);
107       e = dataElement[++i];
108    }
109 }
110
111 } //end gdcm namespace
112 #endif
113