X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDirElement.cxx;h=1757284f4494594566d236ee07bb30fd6796f8ff;hb=b823b9aedd899f5bd07315943ea3cedc4637ee8a;hp=66665db6476f68e3f32eac05dbd24fd609bbf2b6;hpb=d1c68c2c2ae9fadf927053150f7fbc625a7c7366;p=gdcm.git diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx index 66665db6..1757284f 100644 --- a/src/gdcmDicomDirElement.cxx +++ b/src/gdcmDicomDirElement.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirElement.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:54 $ - Version: $Revision: 1.33 $ + Date: $Date: 2005/07/11 14:40:40 $ + Version: $Revision: 1.39 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,6 +27,8 @@ namespace gdcm { //----------------------------------------------------------------------------- +/// \brief auto generate function, to fill up the default elements for +/// a DICOMDIR, if relevant file is not found on user's disk void FillDefaultDIRDict(DicomDirElement *dde); //----------------------------------------------------------------------------- @@ -39,9 +41,9 @@ DicomDirElement::DicomDirElement() { std::string filename = DictSet::BuildDictPath() + DICT_ELEM; std::ifstream from(filename.c_str()); - if(!from) + if ( !from ) { - gdcmVerboseMacro( "Can't open DicomDirElement dictionary" + gdcmWarningMacro( "Can't open DicomDirElement dictionary" << filename.c_str()); FillDefaultDIRDict( this ); } @@ -58,24 +60,24 @@ DicomDirElement::DicomDirElement() from.getline(buff, 1024, ' '); strType = buff; - if( strType == "metaElem" ) + if ( strType == "metaElem" ) type = DD_META; - else if( strType == "patientElem" ) + else if ( strType == "patientElem" ) type = DD_PATIENT; - else if( strType == "studyElem" ) + else if ( strType == "studyElem" ) type = DD_STUDY; - else if( strType == "serieElem" ) + else if ( strType == "serieElem" ) type = DD_SERIE; - else if( strType == "imageElem" ) + else if ( strType == "imageElem" ) type = DD_IMAGE; else { - gdcmVerboseMacro("Unknown type found in the file : " + gdcmWarningMacro("Unknown type found in the file : " <> std::hex >> elem.Group >> elem.Elem; @@ -108,8 +110,9 @@ DicomDirElement::~DicomDirElement() //----------------------------------------------------------------------------- // Public /** - * \brief Add an entry - * @param type type + * \brief Add an entry to one of the DicomDir Elements + * (Patient, Study, Serie, Image) + * @param type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE) * @param elem elem */ bool DicomDirElement::AddEntry(DicomDirType type, Element const &elem) @@ -137,6 +140,22 @@ bool DicomDirElement::AddEntry(DicomDirType type, Element const &elem) return true; } +/** + * \brief Add an entry to one of the DicomDir Elements + * (Patient, Study, Serie, Image) + * @param type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE) + * @param group Group number of the entry to be added + * @param elem Element number of the entry to be added + */ +void DicomDirElement::AddDicomDirElement(DicomDirType type, + uint16_t group, uint16_t elem) +{ + Element el; + el.Group = group; + el.Elem = elem; + el.Value = ""; + AddEntry(type, el); +} //----------------------------------------------------------------------------- // Protected @@ -154,40 +173,40 @@ void DicomDirElement::Print(std::ostream &os) std::ostringstream s; std::list::iterator it; //char greltag[10]; //group element tag - std::string greltag; + TagKey greltag; s << "Meta Elements :"<Group,it->Elem); + greltag = DictEntry::TranslateToKey(it->Group,it->Elem); s << " (" << greltag << ") = " << it->Value << std::endl; } s << "Patient Elements :"<Group,it->Elem); + greltag = DictEntry::TranslateToKey(it->Group,it->Elem); s << " (" << greltag << ") = " << it->Value << std::endl; } s << "Study Elements :"<Group, it->Elem); + greltag = DictEntry::TranslateToKey(it->Group, it->Elem); s << " (" << greltag << ") = " << it->Value << std::endl; } s << "Serie Elements :"<Group, it->Elem); + greltag = DictEntry::TranslateToKey( it->Group, it->Elem); s << " (" << greltag << ") = " << it->Value << std::endl; } s << "Image Elements :"<Group, it->Elem); + greltag = DictEntry::TranslateToKey(it->Group, it->Elem); s << " (" << greltag << ") = " << it->Value << std::endl; }