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 &indent="")
 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 is 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 40 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(), 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(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00040 { 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 147 of file gdcmVR.cxx.

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

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

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 57 of file gdcmRefCounter.h.

00058    {
00059       return RefCount;
00060    }

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

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

00110 {
00111    //FIXME : either you consider than US, UL, SS, SL *are* string representable
00112    //                            and you have to add FD and FL
00113    //        or  you consider they are not, and you have to remove them
00114    // (I cannot guess your point, reading gdcmDataEntry code :-( )  JPR
00115  
00116    return tested == "AE" ||
00117           tested == "AS" ||
00118           tested == "CS" ||
00119           tested == "DA" ||
00120           tested == "DS" ||
00121           tested == "IS" || 
00122           tested == "LO" ||
00123           tested == "LT" ||
00124           tested == "PN" ||
00125           tested == "SH" ||
00126           tested == "SL" ||
00127           tested == "SS" ||
00128           tested == "ST" ||
00129           tested == "TM" ||
00130           tested == "UI" ||
00131           tested == "UL" ||
00132           tested == "US" ||
00133           tested == "UT";
00134 
00135    // Should be quicker --> But it doesn't work : revert to old code
00136 /*
00137    return tested != "FL" &&
00138           tested != "FD" &&
00139           tested != "OB" &&
00140           tested != "OW" &&
00141           tested != "AT" && // Attribute Tag ?!?
00142           tested != "UN" && // UN is an actual VR !
00143           tested != "SQ" ;
00144 */
00145 }

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 &  indent = ""
[virtual]
 

Print all.

Parameters:
os The output stream to be written to.

Reimplemented from gdcm::Base.

Definition at line 188 of file gdcmVR.cxx.

References vr.

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

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

Register the object.

Remarks:
It increments the reference counting

Definition at line 45 of file gdcmRefCounter.h.

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

00045 { 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 49 of file gdcmRefCounter.h.

Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DocEntrySet::GetDictEntry(), 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().

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


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 Nov 18 15:58:51 2005 for gdcm by  doxygen 1.4.4