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

gdcm::DicomDirElement Class Reference

Represents elements contained in a DicomDir class for the chained lists from the file 'Dicts/DicomDir.dic'. More...

#include <gdcmDicomDirElement.h>

List of all members.

Public Member Functions

 DicomDirElement ()
 constructor : populates the chained lists from the file 'Dicts/DicomDir.dic'

 ~DicomDirElement ()
 canonical destructor

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

ListDicomDirMetaElem const & GetDicomDirMetaElements () const
 returns a reference to the chained List related to the META Elements of a DICOMDIR.

ListDicomDirPatientElem const & GetDicomDirPatientElements () const
 returns a reference to the chained List related to the PATIENT Elements of a DICOMDIR.

ListDicomDirStudyElem const & GetDicomDirStudyElements () const
 returns a reference to the chained List related to the STUDY Elements of a DICOMDIR.

ListDicomDirSerieElem const & GetDicomDirSerieElements () const
 returns a reference to the chained List related to the SERIE Elements of a DICOMDIR.

ListDicomDirImageElem const & GetDicomDirImageElements () const
 returns a reference to the chained List related to the IMAGE Elements of a DICOMDIR.

bool AddEntry (DicomDirType type, Element const &elem)
 Add an entry to one of the DicomDir Elements (Patient, Study, Serie, Image).

void AddDicomDirElement (DicomDirType type, uint16_t group, uint16_t elem)
 Add an entry to one of the DicomDir Elements (Patient, Study, Serie, Image).


Private Attributes

ListDicomDirMetaElem DicomDirMetaList
 Elements chained list, related to the MetaElements of DICOMDIR.

ListDicomDirPatientElem DicomDirPatientList
 Elements chained list, related to the PatientElements of DICOMDIR.

ListDicomDirStudyElem DicomDirStudyList
 Elements chained list, related to the StudyElements of DICOMDIR.

ListDicomDirSerieElem DicomDirSerieList
 Elements chained list, related to the SerieElements of DICOMDIR.

ListDicomDirImageElem DicomDirImageList
 Elements chained list, related to the ImageElements of DICOMDIR.


Detailed Description

Represents elements contained in a DicomDir class for the chained lists from the file 'Dicts/DicomDir.dic'.

Definition at line 43 of file gdcmDicomDirElement.h.


Constructor & Destructor Documentation

gdcm::DicomDirElement::DicomDirElement  ) 
 

constructor : populates the chained lists from the file 'Dicts/DicomDir.dic'

Definition at line 38 of file gdcmDicomDirElement.cxx.

References AddEntry(), gdcm::DD_IMAGE, gdcm::DD_META, gdcm::DD_PATIENT, gdcm::DD_SERIE, gdcm::DD_STUDY, gdcm::DD_UNKNOWN, gdcm::DicomDirType, DICT_ELEM, gdcm::Element::Elem, gdcm::FillDefaultDIRDict(), gdcmWarningMacro, gdcm::Element::Group, and gdcm::Element::Value.

00039 {
00040    std::string filename = DictSet::BuildDictPath() + DICT_ELEM;
00041    std::ifstream from(filename.c_str());
00042    if(!from)
00043    {
00044       gdcmWarningMacro( "Can't open DicomDirElement dictionary" 
00045                         << filename.c_str());
00046       FillDefaultDIRDict( this );
00047    }
00048    else
00049    {
00050       char buff[1024];
00051       std::string strType;
00052       Element elem;
00053       DicomDirType type;
00054 
00055       while (!from.eof())
00056       {
00057          from >> std::ws;
00058          from.getline(buff, 1024, ' ');
00059          strType = buff;
00060 
00061          if( strType == "metaElem" )
00062             type = DD_META;
00063          else if( strType == "patientElem" )
00064             type = DD_PATIENT;
00065          else if( strType == "studyElem" )
00066             type = DD_STUDY;
00067          else if( strType == "serieElem" )
00068             type = DD_SERIE;
00069          else if( strType == "imageElem" )
00070             type = DD_IMAGE;
00071          else
00072          {
00073             gdcmWarningMacro("Unknown type found in the file : "
00074                              <<filename.c_str());
00075             type = DD_UNKNOWN;
00076          }
00077 
00078          if( type!=DD_UNKNOWN )
00079          {
00080             from >> std::hex >> elem.Group >> elem.Elem;
00081 
00082             from >> std::ws;
00083             from.getline(buff, 1024, '"');
00084             from >> std::ws;
00085             from.getline(buff, 1024, '"');
00086             elem.Value = buff;
00087 
00088             AddEntry(type, elem);
00089          }
00090          from.getline(buff, 1024, '\n');
00091       }
00092       from.close();
00093    }
00094 }

gdcm::DicomDirElement::~DicomDirElement  ) 
 

canonical destructor

Definition at line 99 of file gdcmDicomDirElement.cxx.

References DicomDirImageList, DicomDirMetaList, DicomDirPatientList, DicomDirSerieList, and DicomDirStudyList.

00100 {
00101    DicomDirMetaList.clear();
00102    DicomDirPatientList.clear();
00103    DicomDirStudyList.clear();
00104    DicomDirSerieList.clear();
00105    DicomDirImageList.clear();
00106 }


Member Function Documentation

void gdcm::DicomDirElement::AddDicomDirElement DicomDirType  type,
uint16_t  group,
uint16_t  elem
 

Add an entry to one of the DicomDir Elements (Patient, Study, Serie, Image).

Parameters:
type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE)
group Group number of the entry to be added
elem Element number of the entry to be added

Definition at line 148 of file gdcmDicomDirElement.cxx.

References AddEntry(), gdcm::Element::Elem, gdcm::Element::Group, and gdcm::Element::Value.

00150 {
00151    Element el;
00152    el.Group = group;
00153    el.Elem  = elem;
00154    el.Value = "";
00155    AddEntry(type, el);
00156 }

bool gdcm::DicomDirElement::AddEntry DicomDirType  type,
Element const &  elem
 

Add an entry to one of the DicomDir Elements (Patient, Study, Serie, Image).

Parameters:
type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE)
elem elem

Definition at line 116 of file gdcmDicomDirElement.cxx.

References gdcm::DD_IMAGE, gdcm::DD_META, gdcm::DD_PATIENT, gdcm::DD_SERIE, gdcm::DD_STUDY, DicomDirImageList, DicomDirMetaList, DicomDirPatientList, DicomDirSerieList, and DicomDirStudyList.

Referenced by AddDicomDirElement(), and DicomDirElement().

00117 {
00118    switch( type )
00119    {
00120       case DD_META :
00121          DicomDirMetaList.push_back(elem);
00122          break;
00123       case DD_PATIENT :
00124          DicomDirPatientList.push_back(elem);
00125          break;
00126       case DD_STUDY :
00127          DicomDirStudyList.push_back(elem);
00128          break;
00129       case DD_SERIE :
00130          DicomDirSerieList.push_back(elem);
00131          break;
00132       case DD_IMAGE :
00133          DicomDirImageList.push_back(elem);
00134          break;
00135       default :
00136          return false;
00137    }
00138    return true;
00139 }

ListDicomDirImageElem const& gdcm::DicomDirElement::GetDicomDirImageElements  )  const [inline]
 

returns a reference to the chained List related to the IMAGE Elements of a DICOMDIR.

Definition at line 86 of file gdcmDicomDirElement.h.

References gdcm::ListDicomDirImageElem.

00087       { return DicomDirImageList; };

ListDicomDirMetaElem const& gdcm::DicomDirElement::GetDicomDirMetaElements  )  const [inline]
 

returns a reference to the chained List related to the META Elements of a DICOMDIR.

Definition at line 58 of file gdcmDicomDirElement.h.

References gdcm::ListDicomDirMetaElem.

00059       { return DicomDirMetaList; };

ListDicomDirPatientElem const& gdcm::DicomDirElement::GetDicomDirPatientElements  )  const [inline]
 

returns a reference to the chained List related to the PATIENT Elements of a DICOMDIR.

Definition at line 65 of file gdcmDicomDirElement.h.

References gdcm::ListDicomDirPatientElem.

00066       { return DicomDirPatientList; };

ListDicomDirSerieElem const& gdcm::DicomDirElement::GetDicomDirSerieElements  )  const [inline]
 

returns a reference to the chained List related to the SERIE Elements of a DICOMDIR.

Definition at line 79 of file gdcmDicomDirElement.h.

References gdcm::ListDicomDirSerieElem.

00080       { return DicomDirSerieList; };

ListDicomDirStudyElem const& gdcm::DicomDirElement::GetDicomDirStudyElements  )  const [inline]
 

returns a reference to the chained List related to the STUDY Elements of a DICOMDIR.

Definition at line 72 of file gdcmDicomDirElement.h.

References gdcm::ListDicomDirStudyElem.

00073       { return DicomDirStudyList; };

void gdcm::DicomDirElement::Print std::ostream &  os  ) 
 

Print all.

Parameters:
os The output stream to be written to.

Definition at line 169 of file gdcmDicomDirElement.cxx.

References DicomDirImageList, DicomDirMetaList, DicomDirPatientList, DicomDirSerieList, and DicomDirStudyList.

00170 {
00171    std::ostringstream s;
00172    std::list<Element>::iterator it;
00173    //char greltag[10];  //group element tag
00174    std::string greltag;
00175 
00176    s << "Meta Elements :"<<std::endl;
00177    for (it = DicomDirMetaList.begin(); it != DicomDirMetaList.end(); ++it)
00178    {
00179       greltag = Util::Format("%04x|%04x ",it->Group,it->Elem);
00180       s << "   (" << greltag << ") = " << it->Value << std::endl;
00181    }
00182 
00183    s << "Patient Elements :"<<std::endl;
00184    for (it = DicomDirPatientList.begin(); it != DicomDirPatientList.end(); ++it)
00185    {
00186       greltag = Util::Format("%04x|%04x ",it->Group,it->Elem);
00187       s << "   (" << greltag << ") = " << it->Value << std::endl;
00188    }
00189 
00190    s << "Study Elements :"<<std::endl;
00191    for (it = DicomDirStudyList.begin(); it != DicomDirStudyList.end(); ++it)
00192    {
00193       greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
00194       s << "   (" << greltag << ") = " << it->Value << std::endl;
00195    }
00196 
00197    s << "Serie Elements :"<<std::endl;
00198    for (it = DicomDirSerieList.begin(); it != DicomDirSerieList.end(); ++it)
00199    {
00200       greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
00201       s << "   (" << greltag << ") = " << it->Value << std::endl;
00202    }
00203 
00204    s << "Image Elements :"<<std::endl;
00205    for (it = DicomDirImageList.begin(); it != DicomDirImageList.end(); ++it)
00206    {
00207       greltag = Util::Format("%04x|%04x ", it->Group, it->Elem);
00208       s << "   (" << greltag << ") = " << it->Value << std::endl;
00209    }
00210 
00211    os << s.str();
00212 }


Member Data Documentation

ListDicomDirImageElem gdcm::DicomDirElement::DicomDirImageList [private]
 

Elements chained list, related to the ImageElements of DICOMDIR.

Definition at line 106 of file gdcmDicomDirElement.h.

Referenced by AddEntry(), Print(), and ~DicomDirElement().

ListDicomDirMetaElem gdcm::DicomDirElement::DicomDirMetaList [private]
 

Elements chained list, related to the MetaElements of DICOMDIR.

Definition at line 98 of file gdcmDicomDirElement.h.

Referenced by AddEntry(), Print(), and ~DicomDirElement().

ListDicomDirPatientElem gdcm::DicomDirElement::DicomDirPatientList [private]
 

Elements chained list, related to the PatientElements of DICOMDIR.

Definition at line 100 of file gdcmDicomDirElement.h.

Referenced by AddEntry(), Print(), and ~DicomDirElement().

ListDicomDirSerieElem gdcm::DicomDirElement::DicomDirSerieList [private]
 

Elements chained list, related to the SerieElements of DICOMDIR.

Definition at line 104 of file gdcmDicomDirElement.h.

Referenced by AddEntry(), Print(), and ~DicomDirElement().

ListDicomDirStudyElem gdcm::DicomDirElement::DicomDirStudyList [private]
 

Elements chained list, related to the StudyElements of DICOMDIR.

Definition at line 102 of file gdcmDicomDirElement.h.

Referenced by AddEntry(), Print(), and ~DicomDirElement().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 22:18:06 2005 for gdcm by doxygen 1.3.6