GDCM_NAME_SPACE::DicomDirElement Class Reference

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

#include <gdcmDicomDirElement.h>

Inheritance diagram for GDCM_NAME_SPACE::DicomDirElement:

Inheritance graph
[legend]
Collaboration diagram for GDCM_NAME_SPACE::DicomDirElement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void Print (std::ostream &os=std::cout, std::string const &indent="")
 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.
ListDicomDirVisitElem const & GetDicomDirVisitElements () const
 returns a reference to the chained List related to the VISIT 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.
ListDicomDirPrivateElem const & GetDicomDirPrivateElements () const
 returns a reference to the chained List related to the PRIVATE Elements of a DICOMDIR.
bool AddEntry (DicomDirType type, DicomElement 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, VRKey vr)
 Add an entry to one of the DicomDir Elements (Patient, Study, Serie, Image).
void Delete ()
 Delete the object.
void Register ()
 Register the object.
void Unregister ()
 Unregister the object.
const unsigned long & GetRefCount () const
 Get the reference counting.
void SetPrintLevel (int level)
 Sets the print level for the Dicom Header Elements.
int GetPrintLevel ()
 Gets the print level for the Dicom Entries.

Static Public Member Functions

static DicomDirElementNew ()
 Contructs a DicomDirElement with a RefCounter.

Protected Member Functions

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

Protected Attributes

int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Member Functions

 gdcmTypeMacro (DicomDirElement)

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.
ListDicomDirVisitElem DicomDirVisitList
 Elements chained list, related to the VisitElements of DICOMDIR.
ListDicomDirSerieElem DicomDirSerieList
 Elements chained list, related to the SerieElements of DICOMDIR.
ListDicomDirImageElem DicomDirImageList
 Elements chained list, related to the ImageElements of DICOMDIR.
ListDicomDirPrivateElem DicomDirPrivateList
 Elements chained list, related to the PrivateElements of DICOMDIR.

Detailed Description

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

Definition at line 70 of file gdcmDicomDirElement.h.


Constructor & Destructor Documentation

GDCM_NAME_SPACE::DicomDirElement::DicomDirElement  )  [protected]
 

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

Definition at line 40 of file gdcmDicomDirElement.cxx.

References AddEntry(), GDCM_NAME_SPACE::DictSet::BuildDictPath(), GDCM_NAME_SPACE::DD_IMAGE, GDCM_NAME_SPACE::DD_META, GDCM_NAME_SPACE::DD_PATIENT, GDCM_NAME_SPACE::DD_SERIE, GDCM_NAME_SPACE::DD_STUDY, GDCM_NAME_SPACE::DD_UNKNOWN, DICT_ELEM, GDCM_NAME_SPACE::DicomElement::Elem, GDCM_NAME_SPACE::FillDefaultDIRDict(), gdcmWarningMacro, GDCM_NAME_SPACE::DicomElement::Group, GDCM_NAME_SPACE::DicomElement::Value, and GDCM_NAME_SPACE::DicomElement::VR.

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

GDCM_NAME_SPACE::DicomDirElement::~DicomDirElement  )  [protected]
 

canonical destructor

Definition at line 108 of file gdcmDicomDirElement.cxx.

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

00109 {
00110    DicomDirMetaList.clear();
00111    DicomDirPatientList.clear();
00112    DicomDirStudyList.clear();
00113    DicomDirSerieList.clear();
00114    DicomDirImageList.clear();
00115 }


Member Function Documentation

void GDCM_NAME_SPACE::DicomDirElement::AddDicomDirElement DicomDirType  type,
uint16_t  group,
uint16_t  elem,
VRKey  vr
 

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
vr Value Representation of the entry to be added

Definition at line 158 of file gdcmDicomDirElement.cxx.

References AddEntry(), GDCM_NAME_SPACE::DicomElement::Elem, GDCM_NAME_SPACE::DicomElement::Group, GDCM_NAME_SPACE::DicomElement::Value, and GDCM_NAME_SPACE::DicomElement::VR.

00160 {
00161    DicomElement el;
00162    el.Group = group;
00163    el.Elem  = elem;
00164    el.VR    = vr;
00165    el.Value = "";
00166    AddEntry(type, el);
00167 }

bool GDCM_NAME_SPACE::DicomDirElement::AddEntry DicomDirType  type,
DicomElement 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 125 of file gdcmDicomDirElement.cxx.

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

Referenced by AddDicomDirElement(), DicomDirElement(), and GDCM_NAME_SPACE::FillDefaultDIRDict().

00126 {
00127    switch( type )
00128    {
00129       case DD_IMAGE :
00130          DicomDirImageList.push_back(elem);
00131          break;
00132       case DD_SERIE :
00133          DicomDirSerieList.push_back(elem);
00134          break;
00135       case DD_STUDY :
00136          DicomDirStudyList.push_back(elem);
00137          break;
00138       case DD_PATIENT :
00139          DicomDirPatientList.push_back(elem);
00140          break;
00141       case DD_META :
00142          DicomDirMetaList.push_back(elem);
00143          break;
00144       default :
00145          return false;
00146    }
00147    return true;
00148 }

void GDCM_NAME_SPACE::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 41 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyMandatoryEntry(), GDCM_NAME_SPACE::Dict::DoTheLoadingJob(), GDCM_NAME_SPACE::FillDefaultDataDict(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), GDCM_NAME_SPACE::DicomDir::NewMeta(), GDCM_NAME_SPACE::DicomDirStudy::NewVisit(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::DicomDir::SetElement(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToExplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToImplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG2000(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), GDCM_NAME_SPACE::DicomDir::~DicomDir(), GDCM_NAME_SPACE::DictSet::~DictSet(), and GDCM_NAME_SPACE::Global::~Global().

00041 { Unregister(); }

GDCM_NAME_SPACE::DicomDirElement::gdcmTypeMacro DicomDirElement   )  [private]
 

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

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

Definition at line 122 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirImage::DicomDirImage(), and GDCM_NAME_SPACE::DicomDir::SetElement().

00123       { return DicomDirImageList; }

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

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

Definition at line 88 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirMeta::DicomDirMeta(), and GDCM_NAME_SPACE::DicomDir::SetElement().

00089       { return DicomDirMetaList; }

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

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

Definition at line 95 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirPatient::DicomDirPatient(), and GDCM_NAME_SPACE::DicomDir::SetElement().

00096       { return DicomDirPatientList; }

ListDicomDirPrivateElem const& GDCM_NAME_SPACE::DicomDirElement::GetDicomDirPrivateElements  )  const [inline]
 

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

Definition at line 129 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirPrivate::DicomDirPrivate().

00130       { return DicomDirPrivateList; }

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

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

Definition at line 115 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirSerie::DicomDirSerie(), and GDCM_NAME_SPACE::DicomDir::SetElement().

00116       { return DicomDirSerieList; }

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

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

Definition at line 102 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirStudy::DicomDirStudy(), and GDCM_NAME_SPACE::DicomDir::SetElement().

00103       { return DicomDirStudyList; }

ListDicomDirVisitElem const& GDCM_NAME_SPACE::DicomDirElement::GetDicomDirVisitElements  )  const [inline]
 

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

Definition at line 109 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::DicomDirVisit::DicomDirVisit().

00110       { return DicomDirVisitList; }

int GDCM_NAME_SPACE::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

const unsigned long& GDCM_NAME_SPACE::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 59 of file gdcmRefCounter.h.

00060    {
00061       return RefCount;
00062    }

static DicomDirElement* GDCM_NAME_SPACE::DicomDirElement::New  )  [inline, static]
 

Contructs a DicomDirElement with a RefCounter.

Definition at line 76 of file gdcmDicomDirElement.h.

Referenced by GDCM_NAME_SPACE::Global::Global().

00076 {return new DicomDirElement();}

void GDCM_NAME_SPACE::DicomDirElement::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual]
 

Print all.

Parameters:
os The output stream to be written to.

Reimplemented from GDCM_NAME_SPACE::Base.

Definition at line 181 of file gdcmDicomDirElement.cxx.

References DicomDirMetaList, and GDCM_NAME_SPACE::DictEntry::TranslateToKey().

00182 {
00183    std::ostringstream s;
00184    std::list<DicomElement>::iterator it;
00185    TagKey greltag;
00186 
00187    s << "Meta Elements :"<<std::endl;
00188    for (it = DicomDirMetaList.begin(); it != DicomDirMetaList.end(); ++it)
00189    {
00190       greltag = DictEntry::TranslateToKey(it->Group,it->Elem);
00191       s << "   (" << greltag << ") = " << it->Value << std::endl;
00192    }
00193 
00194    s << "Patient Elements :"<<std::endl;
00195    for (it = DicomDirPatientList.begin(); it != DicomDirPatientList.end(); ++it)
00196    {
00197       greltag = DictEntry::TranslateToKey(it->Group,it->Elem);
00198       s << "   (" << greltag << ") = " << it->Value << std::endl;
00199    }
00200 
00201    s << "Study Elements :"<<std::endl;
00202    for (it = DicomDirStudyList.begin(); it != DicomDirStudyList.end(); ++it)
00203    {
00204       greltag = DictEntry::TranslateToKey(it->Group, it->Elem);
00205       s << "   (" << greltag << ") = " << it->Value << std::endl;
00206    }
00207 
00208    s << "Serie Elements :"<<std::endl;
00209    for (it = DicomDirSerieList.begin(); it != DicomDirSerieList.end(); ++it)
00210    {
00211       greltag = DictEntry::TranslateToKey( it->Group, it->Elem);
00212       s << "   (" << greltag << ") = " << it->Value << std::endl;
00213    }
00214 
00215    s << "Image Elements :"<<std::endl;
00216    for (it = DicomDirImageList.begin(); it != DicomDirImageList.end(); ++it)
00217    {
00218       greltag = DictEntry::TranslateToKey(it->Group, it->Elem);
00219       s << "   (" << greltag << ") = " << it->Value << std::endl;
00220    }
00221 
00222    os << s.str();
00223 }

void GDCM_NAME_SPACE::RefCounter::Register  )  [inline, inherited]
 

Register the object.

Remarks:
It increments the reference counting

Definition at line 46 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem().

00046 { RefCount++; }

void GDCM_NAME_SPACE::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

Definition at line 47 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print().

00047 { PrintLevel = level; }

void GDCM_NAME_SPACE::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 50 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper().

00051    {
00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl;
00053       RefCount--;
00054       if(RefCount<=0)
00055         delete this;
00056    }


Member Data Documentation

ListDicomDirImageElem GDCM_NAME_SPACE::DicomDirElement::DicomDirImageList [private]
 

Elements chained list, related to the ImageElements of DICOMDIR.

Definition at line 156 of file gdcmDicomDirElement.h.

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

ListDicomDirMetaElem GDCM_NAME_SPACE::DicomDirElement::DicomDirMetaList [private]
 

Elements chained list, related to the MetaElements of DICOMDIR.

Definition at line 146 of file gdcmDicomDirElement.h.

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

ListDicomDirPatientElem GDCM_NAME_SPACE::DicomDirElement::DicomDirPatientList [private]
 

Elements chained list, related to the PatientElements of DICOMDIR.

Definition at line 148 of file gdcmDicomDirElement.h.

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

ListDicomDirPrivateElem GDCM_NAME_SPACE::DicomDirElement::DicomDirPrivateList [private]
 

Elements chained list, related to the PrivateElements of DICOMDIR.

Definition at line 158 of file gdcmDicomDirElement.h.

ListDicomDirSerieElem GDCM_NAME_SPACE::DicomDirElement::DicomDirSerieList [private]
 

Elements chained list, related to the SerieElements of DICOMDIR.

Definition at line 154 of file gdcmDicomDirElement.h.

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

ListDicomDirStudyElem GDCM_NAME_SPACE::DicomDirElement::DicomDirStudyList [private]
 

Elements chained list, related to the StudyElements of DICOMDIR.

Definition at line 150 of file gdcmDicomDirElement.h.

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

ListDicomDirVisitElem GDCM_NAME_SPACE::DicomDirElement::DicomDirVisitList [private]
 

Elements chained list, related to the VisitElements of DICOMDIR.

Definition at line 152 of file gdcmDicomDirElement.h.

int GDCM_NAME_SPACE::Base::PrintLevel [protected, inherited]
 

Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Definition at line 55 of file gdcmBase.h.

Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 13:01:26 2007 for gdcm by  doxygen 1.4.6