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

List of all members.

Public Member Functions

 VR (void)
 Constructor.

 ~VR ()
 Destructor.

void Print (std::ostream &os=std::cout)
 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 BinEntry .

bool IsVROfStringRepresentable (VRKey const &tested)
 Simple predicate that checks whether the given argument corresponds to the Value Representation of a ValEntry but NOT a BinEntry.

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)

Private Attributes

VRHT vr


Detailed Description

Container for dicom Value Representation Hash Table.

Note:
This is a singleton

Definition at line 41 of file gdcmVR.h.


Constructor & Destructor Documentation

gdcm::VR::VR void   ) 
 

Constructor.

Definition at line 37 of file gdcmVR.cxx.

References DICT_VR, gdcm::FillDefaultVRDict(), gdcmWarningMacro, vr, gdcm::VRAtr, and gdcm::VRKey.

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

gdcm::VR::~VR  ) 
 

Destructor.

Definition at line 76 of file gdcmVR.cxx.

References vr.

00077 {
00078    vr.clear();
00079 }


Member Function Documentation

int gdcm::VR::Count VRKey const &  key  ) 
 

Get the count for an element.

Parameters:
key key to count

Definition at line 87 of file gdcmVR.cxx.

References vr, and gdcm::VRKey.

00088 {
00089    return vr.count(key);
00090 }

bool gdcm::VR::IsValidVR VRKey const &  key  ) 
 

Definition at line 149 of file gdcmVR.cxx.

References vr, and gdcm::VRKey.

00150 {
00151    return vr.find(key) != vr.end();
00152 }

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

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

Parameters:
tested value representation to check for.

Definition at line 97 of file gdcmVR.cxx.

References gdcm::GDCM_UNKNOWN, IsVROfSequence(), IsVROfStringRepresentable(), and gdcm::VRKey.

00098 {
00099    if ( tested == GDCM_UNKNOWN)
00100       return true;
00101 
00102    if ( IsVROfStringRepresentable(tested) )
00103       return false;
00104 
00105    if ( IsVROfSequence(tested) )
00106       return false;
00107 
00108    return true;
00109 }

bool gdcm::VR::IsVROfSequence VRKey const &  tested  ) 
 

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

Parameters:
tested value representation to check for.

Definition at line 144 of file gdcmVR.cxx.

References gdcm::VRKey.

Referenced by IsVROfBinaryRepresentable().

00145 {
00146    return tested == "SQ";
00147 }

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

Simple predicate that checks whether the given argument corresponds to the Value Representation of a ValEntry but NOT a BinEntry.

Parameters:
tested value representation to be checked.

Definition at line 117 of file gdcmVR.cxx.

References gdcm::VRKey.

Referenced by IsVROfBinaryRepresentable().

00118 {
00119    return tested == "AE" ||
00120           tested == "AS" ||
00121           tested == "CS" ||
00122           tested == "DA" ||
00123           tested == "DS" ||
00124           tested == "IS" || 
00125           tested == "LO" ||
00126           tested == "LT" ||
00127           tested == "PN" ||
00128           tested == "SH" ||
00129           tested == "SL" ||
00130           tested == "SS" ||
00131           tested == "ST" ||
00132           tested == "TM" ||
00133           tested == "UI" ||
00134           tested == "UL" ||
00135           tested == "UN" ||
00136           tested == "US";
00137 }

void gdcm::VR::Print std::ostream &  os = std::cout  ) 
 

Print all.

Parameters:
os The output stream to be written to.

Definition at line 166 of file gdcmVR.cxx.

References vr.

00167 {
00168    std::ostringstream s;
00169 
00170    for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it)
00171    {
00172       s << "VR : " << it->first << " = " << it->second << std::endl;
00173    }
00174    os << s.str();
00175 }


Member Data Documentation

VRHT gdcm::VR::vr [private]
 

Definition at line 57 of file gdcmVR.h.

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


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