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

gdcm::VR Class Reference

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

#include <gdcmVR.h>

Inheritance diagram for gdcm::VR:

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

Constructor.

Definition at line 40 of file gdcmVR.cxx.

References gdcm::DictSet::BuildDictPath(), DICT_VR, gdcm::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::VR::~VR  )  [protected]
 

Destructor.

Definition at line 79 of file gdcmVR.cxx.

References vr.

00080 {
00081    vr.clear();
00082 }


Member Function Documentation

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

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

returns the length of a elementary elem whose VR is passed

Definition at line 145 of file gdcmVR.cxx.

Referenced by gdcm::Document::LoadEntryBinArea(), and gdcm::DataEntry::WriteContent().

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

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    }

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

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

bool gdcm::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::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::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 gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), IsVROfBinaryRepresentable(), gdcm::DataEntry::Print(), and gdcm::DataEntry::SetValue().

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

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

Definition at line 47 of file gdcmVR.h.

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

00047 {return new VR();}

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

Definition at line 189 of file gdcmVR.cxx.

References vr.

00190 {
00191    for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
00192    {
00193       os << "VR : " << it->first << " = " << it->second << std::endl;
00194    }
00195 }

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

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

VRHT gdcm::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 Jan 20 10:15:08 2006 for gdcm by  doxygen 1.4.4