X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDefaultDicts.cxx.in;h=62fdb4e3514f406ca137a63e3c24104a2749bc77;hb=c1a305b54c1a9dd1bfe2173940ba84ccd1b4bb27;hp=6c3c53d571ca025a73f463d5630771decb7e5164;hpb=1fecdc6dcc36f951de19246bd14ef282b3dec13a;p=gdcm.git diff --git a/src/gdcmDefaultDicts.cxx.in b/src/gdcmDefaultDicts.cxx.in index 6c3c53d5..62fdb4e3 100644 --- a/src/gdcmDefaultDicts.cxx.in +++ b/src/gdcmDefaultDicts.cxx.in @@ -1,19 +1,19 @@ /*========================================================================= - + Program: gdcm Module: $RCSfile: gdcmDefaultDicts.cxx.in,v $ Language: C++ - Date: $Date: 2005/01/07 12:29:17 $ - Version: $Revision: 1.5 $ - + Date: $Date: 2007/05/23 14:18:08 $ + Version: $Revision: 1.13 $ + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. - + This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. - + =========================================================================*/ #ifndef GDCMDEFAULTDICTS_H @@ -23,18 +23,19 @@ #include "gdcmDictEntry.h" #include "gdcmTS.h" #include "gdcmVR.h" +#include "gdcmDictGroupName.h" #include "gdcmDicomDirElement.h" -namespace gdcm +namespace GDCM_NAME_SPACE { typedef struct { - uint16_t group; - uint16_t element; - const char *vr; - const char *vm; - const char *name; + uint16_t group; + uint16_t element; + const char *vr; + const char *vm; + const char *name; } DICT_ENTRY; static DICT_ENTRY datadir[] = { @@ -43,51 +44,79 @@ static DICT_ENTRY datadir[] = { void FillDefaultDataDict(Dict *d) { - unsigned int i = 0; - DICT_ENTRY n = datadir[i]; - while( n.name != 0 ) - { - const DictEntry e( n.group, n.element, n.vr, n.vm, n.name); - d->AddNewEntry( e ); - n = datadir[++i]; - } + DictEntry *e; + unsigned int i = 0; + DICT_ENTRY n = datadir[i]; + while( n.name != 0 ) + { + e = DictEntry::New( n.group, n.element, n.vr, n.vm, n.name); + d->AddEntry( e ); + e->Delete(); + n = datadir[++i]; + } } -void FillDefaultTSDict(TSHT & ts) +void FillDefaultTSDict(TSHT &ts) { @DICOM_TS_DICTIONARY@ } -void FillDefaultVRDict(VRHT & vr) +void FillDefaultVRDict(VRHT &vr) { @DICOM_VR_DICTIONARY@ } +void FillDefaultDictGroupName(DictGroupNameHT &groupName) +{ +@DICT_GROUP_NAME_DICTIONARY@ +} + typedef struct { - const char *type; - unsigned short group; - unsigned short element; - const char *value; + const char *type; + unsigned short group; + unsigned short element; + //VRKey vr; + const char *vr; + const char *value; } ELEMENT; -static ELEMENT dataelement[] = { +static ELEMENT dataElement[] = { @DICOM_DIR_DICTIONARY@ }; void FillDefaultDIRDict(DicomDirElement *dde) { - unsigned int i = 0; - ELEMENT e = dataelement[i]; - Element elem; - while( e.type != 0 ) - { - elem.Group = e.group; - elem.Elem = e.element; - elem.Value = e.value; - dde->AddNewEntry( e.type, elem); - e = dataelement[++i]; - } + unsigned int i = 0; + ELEMENT e = dataElement[i]; + DicomElement elem; + DicomDirType type; + std::string strType; + + while( e.type != 0 ) + { + // Force to use the string comparison operator == + strType = e.type; + if( strType == "metaElem" ) + type = DD_META; + else if( strType == "patientElem" ) + type = DD_PATIENT; + else if( strType == "studyElem" ) + type = DD_STUDY; + else if( strType == "serieElem" ) + type = DD_SERIE; + else if( strType == "imageElem" ) + type = DD_IMAGE; + else + type = DD_UNKNOWN; + + elem.Group = e.group; + elem.Elem = e.element; + elem.VR = e.vr; + elem.Value = e.value; + dde->AddEntry( type, elem); + e = dataElement[++i]; + } } } //end gdcm namespace