Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

gdcmDicomDirElement Class Reference

#include <gdcmDicomDirElement.h>

List of all members.

Public Member Functions

 gdcmDicomDirElement (void)
 constructor

 ~gdcmDicomDirElement (void)
 destructor

void Print (std::ostream &os)
 Print all.

ListMetaElemGetMetaElements (void)
ListPatientElemGetPatientElements (void)
ListStudyElemGetStudyElements (void)
ListSerieElemGetSerieElements (void)
ListImageElemGetImageElements (void)

Private Attributes

ListMetaElem MetaList
ListPatientElem PatientList
ListStudyElem StudyList
ListSerieElem SerieList
ListImageElem ImageList


Constructor & Destructor Documentation

gdcmDicomDirElement::gdcmDicomDirElement void   ) 
 

constructor

Definition at line 29 of file gdcmDicomDirElement.cxx.

References gdcmDictSet::BuildDictPath(), dbg, DICT_ELEM, eatwhite(), gdcmElement::elem, gdcmDebug::Error(), gdcmElement::group, ImageList, MetaList, PatientList, SerieList, StudyList, and gdcmElement::value.

00030 {
00031    std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_ELEM);
00032    std::ifstream from(filename.c_str());
00033    dbg.Error(!from, "gdcmDicomDirElement::gdcmDicomDirElement: can't open dictionary",filename.c_str());
00034 
00035    char buff[1024];
00036    std::string type;
00037    gdcmElement elem;
00038 
00039    while (!from.eof()) {
00040       eatwhite(from);
00041       from.getline(buff, 1024, ' ');
00042       type = buff;
00043 
00044       if( (type=="metaElem") || (type=="patientElem") || 
00045           (type=="studyElem") || (type=="serieElem") || 
00046           (type=="imageElem") )
00047       {
00048          from >> std::hex >> elem.group >> elem.elem;
00049 
00050          eatwhite(from);
00051          from.getline(buff, 1024, '"');
00052          eatwhite(from);
00053          from.getline(buff, 1024, '"');
00054          elem.value = buff;
00055 
00056          if(type=="metaElem")
00057             MetaList.push_back(elem);
00058          else if(type=="patientElem")
00059             PatientList.push_back(elem);
00060          else if(type=="studyElem")
00061             StudyList.push_back(elem);
00062          else if(type=="serieElem")
00063             SerieList.push_back(elem);
00064          else if(type=="imageElem")
00065             ImageList.push_back(elem);
00066       }
00067 
00068       from.getline(buff, 1024, '\n');
00069    }
00070    from.close();
00071 }

gdcmDicomDirElement::~gdcmDicomDirElement void   ) 
 

destructor

Definition at line 77 of file gdcmDicomDirElement.cxx.

References ImageList, MetaList, PatientList, SerieList, and StudyList.

00078 {
00079    MetaList.clear();
00080    PatientList.clear();
00081    StudyList.clear();
00082    SerieList.clear();
00083    ImageList.clear();
00084 }


Member Function Documentation

ListImageElem& gdcmDicomDirElement::GetImageElements void   )  [inline]
 

Definition at line 42 of file gdcmDicomDirElement.h.

References ListImageElem.

Referenced by gdcmDicomDir::SetElement().

00042 {return(ImageList);};

ListMetaElem& gdcmDicomDirElement::GetMetaElements void   )  [inline]
 

Definition at line 38 of file gdcmDicomDirElement.h.

References ListMetaElem.

Referenced by gdcmDicomDir::SetElement().

00038 {return(MetaList);};

ListPatientElem& gdcmDicomDirElement::GetPatientElements void   )  [inline]
 

Definition at line 39 of file gdcmDicomDirElement.h.

References ListPatientElem.

Referenced by gdcmDicomDir::SetElement().

00039 {return(PatientList);};

ListSerieElem& gdcmDicomDirElement::GetSerieElements void   )  [inline]
 

Definition at line 41 of file gdcmDicomDirElement.h.

References ListSerieElem.

Referenced by gdcmDicomDir::SetElement().

00041 {return(SerieList);};

ListStudyElem& gdcmDicomDirElement::GetStudyElements void   )  [inline]
 

Definition at line 40 of file gdcmDicomDirElement.h.

References ListStudyElem.

Referenced by gdcmDicomDir::SetElement().

00040 {return(StudyList);};

void gdcmDicomDirElement::Print std::ostream &  os  ) 
 

Print all.

Todo:
add a 'Print Level' check
Parameters:
os The output stream to be written to.

Definition at line 94 of file gdcmDicomDirElement.cxx.

References ImageList, MetaList, PatientList, SerieList, and StudyList.

00095 {
00096    std::ostringstream s;
00097    std::list<gdcmElement>::iterator it;
00098    char greltag[10];  //group element tag
00099 
00100    s << "Meta Elements :"<<std::endl;
00101    for (it = MetaList.begin();it!=MetaList.end();++it)
00102    {
00103       sprintf(greltag,"%04x|%04x ",it->group,it->elem);
00104       s << "   ("<<greltag<<") = "<< it->value<<std::endl;
00105    }
00106 
00107    s << "Patient Elements :"<<std::endl;
00108    for (it = PatientList.begin();it!=PatientList.end();++it)
00109    {
00110       sprintf(greltag,"%04x|%04x ",it->group,it->elem);
00111       s << "   ("<<greltag<<") = "<< it->value<<std::endl;
00112    }
00113 
00114    s << "Study Elements :"<<std::endl;
00115    for (it = StudyList.begin();it!=StudyList.end();++it)
00116    {
00117       sprintf(greltag,"%04x|%04x ",it->group,it->elem);
00118       s << "   ("<<greltag<<") = "<< it->value<<std::endl;
00119    }
00120 
00121    s << "Serie Elements :"<<std::endl;
00122    for (it = SerieList.begin();it!=SerieList.end();++it)
00123    {
00124       sprintf(greltag,"%04x|%04x ",it->group,it->elem);
00125       s << "   ("<<greltag<<") = "<< it->value<<std::endl;
00126    }
00127 
00128    s << "Image Elements :"<<std::endl;
00129    for (it = ImageList.begin();it!=ImageList.end();++it)
00130    {
00131       sprintf(greltag,"%04x|%04x ",it->group,it->elem);
00132       s << "   ("<<greltag<<") = "<< it->value<<std::endl;
00133    }
00134 
00135    os << s.str();
00136 }


Member Data Documentation

ListImageElem gdcmDicomDirElement::ImageList [private]
 

Definition at line 49 of file gdcmDicomDirElement.h.

Referenced by gdcmDicomDirElement(), Print(), and ~gdcmDicomDirElement().

ListMetaElem gdcmDicomDirElement::MetaList [private]
 

Definition at line 45 of file gdcmDicomDirElement.h.

Referenced by gdcmDicomDirElement(), Print(), and ~gdcmDicomDirElement().

ListPatientElem gdcmDicomDirElement::PatientList [private]
 

Definition at line 46 of file gdcmDicomDirElement.h.

Referenced by gdcmDicomDirElement(), Print(), and ~gdcmDicomDirElement().

ListSerieElem gdcmDicomDirElement::SerieList [private]
 

Definition at line 48 of file gdcmDicomDirElement.h.

Referenced by gdcmDicomDirElement(), Print(), and ~gdcmDicomDirElement().

ListStudyElem gdcmDicomDirElement::StudyList [private]
 

Definition at line 47 of file gdcmDicomDirElement.h.

Referenced by gdcmDicomDirElement(), Print(), and ~gdcmDicomDirElement().


The documentation for this class was generated from the following files:
Generated on Mon Feb 14 16:13:37 2005 for gdcm by doxygen 1.3.6