Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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>

Inheritance diagram for gdcm::DicomDirElement:

Inheritance graph
[legend]
Collaboration diagram for gdcm::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.
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)
 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.

Detailed Description

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

Definition at line 68 of file gdcmDicomDirElement.h.


Constructor & Destructor Documentation

gdcm::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::DictSet::BuildDictPath(), gdcm::DD_IMAGE, gdcm::DD_META, gdcm::DD_PATIENT, gdcm::DD_SERIE, gdcm::DD_STUDY, gdcm::DD_UNKNOWN, DICT_ELEM, gdcm::DicomElement::Elem, gdcm::FillDefaultDIRDict(), gdcmWarningMacro, gdcm::DicomElement::Group, and gdcm::DicomElement::Value.

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       std::string strType;
00054       DicomElement elem;
00055       DicomDirType type;
00056 
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;
00084 
00085             from >> std::ws;
00086             from.getline(buff, 1024, '"');
00087             from >> std::ws;
00088             from.getline(buff, 1024, '"');
00089             elem.Value = buff;
00090 
00091             AddEntry(type, elem);
00092          }
00093          from.getline(buff, 1024, '\n');
00094       }
00095       from.close();
00096    }
00097 }

gdcm::DicomDirElement::~DicomDirElement  )  [protected]
 

canonical destructor

Definition at line 102 of file gdcmDicomDirElement.cxx.

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

00103 {
00104    DicomDirMetaList.clear();
00105    DicomDirPatientList.clear();
00106    DicomDirStudyList.clear();
00107    DicomDirSerieList.clear();
00108    DicomDirImageList.clear();
00109 }


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 151 of file gdcmDicomDirElement.cxx.

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

00153 {
00154    DicomElement el;
00155    el.Group = group;
00156    el.Elem  = elem;
00157    el.Value = "";
00158    AddEntry(type, el);
00159 }

bool gdcm::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 119 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().

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

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

Delete the object.

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

Definition at line 39 of file gdcmRefCounter.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::File::DoTheLoadingJob(), gdcm::Dict::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), vtkGdcmReader::LoadImageInMemory(), main(), gdcm::DicomDir::NewMeta(), gdcm::DicomDirStudy::NewVisit(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::Document::ReadNextDocEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), vtkGdcmWriter::WriteDcmFile(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00039 { Unregister(); }

gdcm::DicomDirElement::gdcmTypeMacro DicomDirElement   )  [private]
 

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 120 of file gdcmDicomDirElement.h.

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

00121       { 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 86 of file gdcmDicomDirElement.h.

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

00087       { 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 93 of file gdcmDicomDirElement.h.

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

00094       { 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 113 of file gdcmDicomDirElement.h.

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

00114       { 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 100 of file gdcmDicomDirElement.h.

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

00101       { return DicomDirStudyList; }

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

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

Definition at line 107 of file gdcmDicomDirElement.h.

Referenced by gdcm::DicomDirVisit::DicomDirVisit().

00108       { return DicomDirVisitList; }

int gdcm::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::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 56 of file gdcmRefCounter.h.

00057    {
00058       return RefCount;
00059    }

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

Contructs a DicomDirElement with a RefCounter.

Definition at line 74 of file gdcmDicomDirElement.h.

Referenced by gdcm::Global::Global().

00074 {return new DicomDirElement();}

void gdcm::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::Base.

Definition at line 173 of file gdcmDicomDirElement.cxx.

References DicomDirImageList, DicomDirMetaList, DicomDirPatientList, DicomDirSerieList, DicomDirStudyList, gdcm::TagKey::str(), and gdcm::DictEntry::TranslateToKey().

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

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

Register the object.

Remarks:
It increments the reference counting

Definition at line 44 of file gdcmRefCounter.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem().

00044 { RefCount++; }

void gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00047 { PrintLevel = level; }

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

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 48 of file gdcmRefCounter.h.

Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().

00049    {
00050       RefCount--;
00051       if(RefCount<=0)
00052          delete this;
00053    }


Member Data Documentation

ListDicomDirImageElem gdcm::DicomDirElement::DicomDirImageList [private]
 

Elements chained list, related to the ImageElements of DICOMDIR.

Definition at line 146 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 136 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 138 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 144 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 140 of file gdcmDicomDirElement.h.

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

ListDicomDirVisitElem gdcm::DicomDirElement::DicomDirVisitList [private]
 

Elements chained list, related to the VisitElements of DICOMDIR.

Definition at line 142 of file gdcmDicomDirElement.h.

int gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:14:32 2006 for gdcm by  doxygen 1.4.4