GDCM_NAME_SPACE::VR Class Reference

Container for dicom Value Representation Hash Table. More...

#include <gdcmVR.h>

Inheritance diagram for GDCM_NAME_SPACE::VR:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void Print (std::ostream &os=std::cout, std::string const &="")
 Print all.
int Count (VRKey const &key)
 Get the count for an element.
bool IsVROfBinaryRepresentable (VRKey const &tested)
 Simple predicate that checks whether the given argument corresponds to the Value Representation of a DataEntry .
bool IsVROfStringRepresentable (VRKey const &tested)
 Simple predicate that checks whether the given argument corresponds to the Value Representation of a 'stdstring representable' value.
bool IsVROfSequence (VRKey const &tested)
 Simple predicate that checks whether the given argument corresponds to the Value Representation of a SeqEntry.
bool IsValidVR (VRKey const &key)
 checks if a supposed-to-be VR is a 'legal' one.
unsigned short GetAtomicElementLength (VRKey const &tested)
 returns the length of a elementary elem whose VR is passed
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 VRNew ()

Protected Member Functions

 VR ()
 Constructor.
 ~VR ()
 Destructor.

Protected Attributes

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

Private Member Functions

 gdcmTypeMacro (VR)

Private Attributes

VRHT vr

Detailed Description

Container for dicom Value Representation Hash Table.

Note:
This is a singleton

Definition at line 42 of file gdcmVR.h.


Constructor & Destructor Documentation

GDCM_NAME_SPACE::VR::VR  )  [protected]
 

Constructor.

Definition at line 40 of file gdcmVR.cxx.

References GDCM_NAME_SPACE::DictSet::BuildDictPath(), DICT_VR, GDCM_NAME_SPACE::FillDefaultVRDict(), gdcmWarningMacro, and vr.

00041 {
00042    std::string filename = DictSet::BuildDictPath() + DICT_VR;
00043    std::ifstream from(filename.c_str());
00044    if ( !from )
00045    {
00046       gdcmWarningMacro("Can't open dictionary " << filename.c_str());
00047       FillDefaultVRDict(vr);
00048    }
00049    else
00050    {
00051       char buff[1024];
00052       VRKey key;
00053       VRAtr name;
00054    
00055       while (!from.eof()) 
00056       {
00057          from >> std::ws;
00058          from.getline(buff, 1024, ' ');
00059          if( strcmp(buff,"") == 0)
00060             continue;
00061 
00062          key = buff;
00063          from >> std::ws;
00064          from.getline(buff, 1024, ';');
00065          name = buff;
00066    
00067          from >> std::ws;
00068          from.getline(buff, 1024, '\n');
00069    
00070          vr[key] = name;
00071       }
00072       from.close();
00073    }
00074 }

GDCM_NAME_SPACE::VR::~VR  )  [protected]
 

Destructor.

Definition at line 79 of file gdcmVR.cxx.

References vr.

00080 {
00081    vr.clear();
00082 }


Member Function Documentation

int GDCM_NAME_SPACE::VR::Count VRKey const &  key  )  [inline]
 

Get the count for an element.

Definition at line 53 of file gdcmVR.h.

00053 { return vr.count(key); };

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::VR::gdcmTypeMacro VR   )  [private]
 

unsigned short GDCM_NAME_SPACE::VR::GetAtomicElementLength VRKey const &  tested  ) 
 

returns the length of a elementary elem whose VR is passed

Definition at line 144 of file gdcmVR.cxx.

Referenced by GDCM_NAME_SPACE::DataEntry::WriteContent().

00145 {
00146    // Unsigned & signed short
00147    if( tested == "US" || tested == "SS" )
00148       return 2;
00149    // Unsigned & signed long
00150    if( tested == "UL" || tested == "SL" )
00151       return 4;
00152    // Float
00153    if( tested == "FL" )
00154       return 4;
00155    // Double
00156    if( tested == "FD" )
00157       return 8;
00158    // Word string
00159    if( tested == "OW" )
00160       return 2;
00161    // Float string
00162    if( tested == "OF" )
00163       return 4;   
00164    return 1;
00165 }

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    }

bool GDCM_NAME_SPACE::VR::IsValidVR VRKey const &  key  )  [inline]
 

checks if a supposed-to-be VR is a 'legal' one.

Definition at line 67 of file gdcmVR.h.

Referenced by GDCM_NAME_SPACE::Document::CheckDocEntryVR().

00067 { return vr.find(key) != vr.end(); }

bool GDCM_NAME_SPACE::VR::IsVROfBinaryRepresentable VRKey const &  tested  ) 
 

Simple predicate that checks whether the given argument corresponds to the Value Representation of a DataEntry .

Parameters:
tested value representation to check for.

Definition at line 92 of file gdcmVR.cxx.

References IsVROfSequence(), and IsVROfStringRepresentable().

00093 {
00094    if ( IsVROfStringRepresentable(tested) )
00095       return false;
00096 
00097    if ( IsVROfSequence(tested) )
00098       return false;
00099 
00100    return true;
00101 }

bool GDCM_NAME_SPACE::VR::IsVROfSequence VRKey const &  tested  )  [inline]
 

Simple predicate that checks whether the given argument corresponds to the Value Representation of a SeqEntry.

Definition at line 60 of file gdcmVR.h.

Referenced by IsVROfBinaryRepresentable().

00060 { return tested == "SQ"; }

bool GDCM_NAME_SPACE::VR::IsVROfStringRepresentable VRKey const &  tested  ) 
 

Simple predicate that checks whether the given argument corresponds to the Value Representation of a 'stdstring representable' value.

Parameters:
tested value representation to be checked.

Definition at line 109 of file gdcmVR.cxx.

Referenced by IsVROfBinaryRepresentable().

00110 {
00111    return tested == "AE" ||
00112           tested == "AS" ||
00113           tested == "CS" ||
00114           tested == "DA" ||
00115           tested == "DS" ||
00116           tested == "FL" ||
00117           tested == "FD" ||
00118           tested == "IS" || 
00119           tested == "LO" ||
00120           tested == "LT" ||
00121           tested == "PN" ||
00122           tested == "SH" ||
00123           tested == "SL" ||
00124           tested == "SS" ||
00125           tested == "ST" ||
00126           tested == "TM" ||
00127           tested == "UI" ||
00128           tested == "UL" ||
00129           tested == "US" ||
00130           tested == "UT";
00131 
00132    // Should be quicker
00133    // --> will *never* work : any rotten value would be considered as OK !
00134 /*
00135    return tested != "OB" &&
00136           tested != "OW" &&
00137           tested != "OF" &&
00138           tested != "AT" && // Attribute Tag ?!? contain no printable character
00139           tested != "UN" && // UN is an actual VR !
00140           tested != "SQ" ;
00141 */
00142 }

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

Definition at line 47 of file gdcmVR.h.

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

00047 {return new VR();}

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

Print all.

Parameters:
os The output stream to be written to.

Reimplemented from GDCM_NAME_SPACE::Base.

Definition at line 205 of file gdcmVR.cxx.

References vr.

00206 {
00207    for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
00208    {
00209       os << "VR : " << it->first << " = " << it->second << std::endl;
00210    }
00211 }

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

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().

VRHT GDCM_NAME_SPACE::VR::vr [private]
 

Definition at line 77 of file gdcmVR.h.

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


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 12:57:30 2007 for gdcm by  doxygen 1.4.6