+2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * gdcmDicomDirElement.[h|cxx] : change the AddEntry method. Now, it gets a
+ type and not a string. So, there remove problems on the format of the
+ string.
+
2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* src/gdcmDicomDirObject.h : set the FillObject method in protected.
- Thus, DicomDirXXX are created with a flad that indicates if the created
+ Thus, DicomDirXXX are created with a flad that indicates if the created
object is empty or not (when not empty, the DicomDirElement is used to
fill the object)
Program: gdcm
Module: $RCSfile: gdcmCommon.h,v $
Language: C++
- Date: $Date: 2005/01/20 11:39:49 $
- Version: $Revision: 1.51 $
+ Date: $Date: 2005/01/20 17:15:53 $
+ Version: $Revision: 1.52 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
ACR,
ACR_LIBIDO
};
+
+enum DicomDirType {
+ DD_UNKNOWN = 0,
+ DD_META,
+ DD_PATIENT,
+ DD_STUDY,
+ DD_SERIE,
+ DD_IMAGE
+};
} //namespace gdcm
//-----------------------------------------------------------------------------
#endif
Program: gdcm
Module: $RCSfile: gdcmDefaultDicts.cxx.in,v $
Language: C++
- Date: $Date: 2005/01/07 12:29:17 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/01/20 17:15:54 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
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[] = {
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];
- }
+ 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];
+ }
}
void FillDefaultTSDict(TSHT & ts)
typedef struct
{
- const char *type;
- unsigned short group;
- unsigned short element;
- const char *value;
+ const char *type;
+ unsigned short group;
+ unsigned short element;
+ 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];
+ Element elem;
+ DicomDirType type;
+
+ while( e.type != 0 )
+ {
+ if( e.type == "metaElem" )
+ type = DD_META;
+ else if( e.type == "patientElem" )
+ type = DD_PATIENT;
+ else if( e.type == "studyElem" )
+ type = DD_STUDY;
+ else if( e.type == "serieElem" )
+ type = DD_SERIE;
+ else if( e.type == "imageElem" )
+ type = DD_IMAGE;
+ else
+ type = DD_UNKNOWN;
+
+ elem.Group = e.group;
+ elem.Elem = e.element;
+ elem.Value = e.value;
+ dde->AddNewEntry( type, elem);
+ e = dataElement[++i];
+ }
}
} //end gdcm namespace
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2005/01/20 11:40:14 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2005/01/20 17:15:54 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
else
{
char buff[1024];
- std::string type;
+ std::string strType;
Element elem;
+ DicomDirType type;
while (!from.eof())
{
from >> std::ws;
from.getline(buff, 1024, ' ');
- type = buff;
+ strType = buff;
+
+ 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
+ {
+ gdcmVerboseMacro("Unknown type found in the file : "
+ <<filename.c_str());
+ type = DD_UNKNOWN;
+ }
- if( type == "metaElem" || type == "patientElem" ||
- type == "studyElem" || type == "serieElem" ||
- type == "imageElem" )
+ if( type!=DD_UNKNOWN )
{
from >> std::hex >> elem.Group >> elem.Elem;
* @param type type
* @param elem elem
*/
-bool DicomDirElement::AddNewEntry(std::string const &type,
+bool DicomDirElement::AddNewEntry(DicomDirType type,
Element const &elem)
{
- if( type == "metaElem" )
- {
- DicomDirMetaList.push_back(elem);
- }
- else if( type == "patientElem" )
- {
- DicomDirPatientList.push_back(elem);
- }
- else if( type == "studyElem" )
- {
- DicomDirStudyList.push_back(elem);
- }
- else if( type == "serieElem" )
- {
- DicomDirSerieList.push_back(elem);
- }
- else if( type == "imageElem" )
- {
- DicomDirImageList.push_back(elem);
- }
- else
+ switch( type )
{
- return false;
+ case DD_META :
+ DicomDirMetaList.push_back(elem);
+ break;
+ case DD_PATIENT :
+ DicomDirPatientList.push_back(elem);
+ break;
+ case DD_STUDY :
+ DicomDirStudyList.push_back(elem);
+ break;
+ case DD_SERIE :
+ DicomDirSerieList.push_back(elem);
+ break;
+ case DD_IMAGE :
+ DicomDirImageList.push_back(elem);
+ break;
+ default :
+ return false;
}
return true;
}
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.h,v $
Language: C++
- Date: $Date: 2005/01/20 11:40:14 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2005/01/20 17:15:54 $
+ Version: $Revision: 1.21 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
//-----------------------------------------------------------------------------
-typedef struct
+GDCM_EXPORT typedef struct
{
/// DicomGroup number
unsigned short int Group;
{ return DicomDirImageList; };
// Public method to add an element
- bool AddNewEntry(std::string const &type, Element const &elem);
+ bool AddNewEntry(DicomDirType type, Element const &elem);
private:
/// Elements chained list, related to the MetaElements of DICOMDIR