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

gdcm::DocEntry Class Reference

The dicom header of a Dicom file contains a set of such entries (when successfuly parsed against a given Dicom dictionary). More...

#include <gdcmDocEntry.h>

Inheritance diagram for gdcm::DocEntry:

Inheritance graph
[legend]
Collaboration diagram for gdcm::DocEntry:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void Print (std::ostream &os=std::cout, std::string const &indent="")
 Prints the common part of DataEntry, SeqEntry.
virtual void WriteContent (std::ofstream *fp, FileType filetype)
 Writes the common part of any DataEntry, SeqEntry.
DictEntryGetDictEntry ()
 Gets the DicEntry of the current Dicom entry.
const uint16_t & GetGroup () const
 Returns the Dicom Group number of the current Dicom entry.
const uint16_t & GetElement () const
 Returns the Dicom Element number of the current Dicom entry.
TagKey GetKey () const
 Returns the 'key' of the current Dicom entry.
std::string const & GetName () const
 Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.
VRKey const & GetVR () const
 Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry.
std::string const & GetVM () const
 Returns the 'Value Multiplicity' (e.g. "1", 6", "1-n", "3-n"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.
void SetVM (TagName const &v)
 Sets the 'Value Multiplicity' of the current Dicom entry.
const size_t & GetOffset () const
 Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.
void SetReadLength (uint32_t l)
 Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.
const uint32_t & GetReadLength () const
 Returns the 'read length' of the current Dicom entry.
virtual void SetLength (uint32_t l)
 Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.
const uint32_t & GetLength () const
 Returns the actual value length of the current Dicom entry.
uint32_t GetFullLength ()
 Gets the full length of the elementary DocEntry (not only value length) depending on the VR.
virtual uint32_t ComputeFullLength ()=0
void SetOffset (size_t of)
 Sets the offset of the Dicom entry.
void SetImplicitVR ()
 Sets to TRUE the ImplicitVr flag of the current Dicom entry.
bool IsImplicitVR () const
 Tells us if the current Dicom entry was checked as ImplicitVr.
bool IsVRUnknown () const
 Tells us if the VR of the current Dicom entry is Unknown.
bool IsVMUnknown () const
 Tells us if the VM of the current Dicom entry is Unknown.
bool IsItemDelimitor ()
 tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)
bool IsItemStarter ()
 tells us if entry is the first one of an Item (fffe,e000)
bool IsSequenceDelimitor ()
 tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
virtual void Copy (DocEntry *doc)
 Copies all the attributes from an other DocEntry.
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.

Protected Member Functions

 DocEntry (DictEntry *)
 Constructor from a given DictEntry.
virtual ~DocEntry ()
 Destructor from a given DictEntry.

Protected Attributes

DictEntryDicomDict
 pointer to the underlying Dicom dictionary element
uint32_t Length
 Correspond to the real length of the data This length might always be even.
uint32_t ReadLength
 Length to read in the file to obtain data.
bool ImplicitVR
 Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary.
size_t Offset
 Offset from the beginning of file for direct user access.
int PrintLevel
 Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.

Private Member Functions

 gdcmTypeMacro (DocEntry)

Detailed Description

The dicom header of a Dicom file contains a set of such entries (when successfuly parsed against a given Dicom dictionary).

Definition at line 38 of file gdcmDocEntry.h.


Constructor & Destructor Documentation

gdcm::DocEntry::DocEntry DictEntry in  )  [protected]
 

Constructor from a given DictEntry.

Parameters:
in Pointer to existing dictionary entry

Definition at line 39 of file gdcmDocEntry.cxx.

References DicomDict, gdcmAssertMacro, ImplicitVR, Length, Offset, ReadLength, and gdcm::RefCounter::Register().

00040 {
00041    ImplicitVR = false;
00042    DicomDict  = in;
00043    Offset     = 0 ; // To avoid further missprinting
00044 
00045    // init some variables
00046    ReadLength = 0;
00047    Length = 0;
00048 
00049    gdcmAssertMacro(DicomDict);
00050    DicomDict->Register();
00051 }

gdcm::DocEntry::~DocEntry  )  [protected, virtual]
 

Destructor from a given DictEntry.

Definition at line 56 of file gdcmDocEntry.cxx.

References DicomDict, gdcmAssertMacro, and gdcm::RefCounter::Unregister().

00057 {
00058    gdcmAssertMacro(DicomDict);
00059 
00060    DicomDict->Unregister();
00061 }


Member Function Documentation

virtual uint32_t gdcm::DocEntry::ComputeFullLength  )  [pure virtual]
 

Implemented in gdcm::DataEntry, and gdcm::SeqEntry.

void gdcm::DocEntry::Copy DocEntry doc  )  [virtual]
 

Copies all the attributes from an other DocEntry.

Parameters:
doc entry to copy from

Reimplemented in gdcm::DataEntry, and gdcm::SeqEntry.

Definition at line 230 of file gdcmDocEntry.cxx.

References ImplicitVR, Length, Offset, and ReadLength.

Referenced by gdcm::SeqEntry::Copy(), and gdcm::DataEntry::Copy().

00231 {
00232    Length     = doc->Length;
00233    ReadLength = doc->ReadLength;
00234    ImplicitVR = doc->ImplicitVR;
00235    Offset     = doc->Offset;
00236 }

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

DictEntry* gdcm::DocEntry::GetDictEntry  )  [inline]
 

Gets the DicEntry of the current Dicom entry.

Returns:
The DicEntry of the current Dicom entry

Definition at line 48 of file gdcmDocEntry.h.

Referenced by gdcm::FileHelper::CopyDataEntry(), gdcm::DocEntryArchive::Push(), and gdcm::FileHelper::SetWriteToLibido().

00048 { return DicomDict; } 

const uint16_t& gdcm::DocEntry::GetElement  )  const [inline]
 

Returns the Dicom Element number of the current Dicom entry.

Definition at line 54 of file gdcmDocEntry.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), IsItemDelimitor(), IsItemStarter(), IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), Print(), gdcm::DataEntry::Print(), gdcm::Document::ReadNextDocEntry(), and WriteContent().

00054 { return DicomDict->GetElement();}

uint32_t gdcm::DocEntry::GetFullLength  ) 
 

Gets the full length of the elementary DocEntry (not only value length) depending on the VR.

Definition at line 178 of file gdcmDocEntry.cxx.

References GetReadLength(), GetVR(), and IsImplicitVR().

Referenced by gdcm::DataEntry::ComputeFullLength().

00179 {
00180    uint32_t l = GetReadLength();
00181    if ( IsImplicitVR() )
00182    {
00183       l = l + 8;  // 2 (gr) + 2 (el) + 4 (lgth) 
00184    }
00185    else
00186    {
00187       if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
00188       {
00189          l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
00190       }
00191       else
00192       {
00193          l = l + 8;  // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
00194       }
00195    }
00196    return l;
00197 }

const uint16_t& gdcm::DocEntry::GetGroup  )  const [inline]
 

Returns the Dicom Group number of the current Dicom entry.

Definition at line 51 of file gdcmDocEntry.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), IsItemDelimitor(), IsItemStarter(), IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), Print(), gdcm::DataEntry::Print(), gdcm::Document::ReadNextDocEntry(), gdcm::Document::SkipToNextDocEntry(), WriteContent(), and gdcm::DataEntry::WriteContent().

00051 { return DicomDict->GetGroup();  }

TagKey gdcm::DocEntry::GetKey  )  const [inline]
 

Returns the 'key' of the current Dicom entry.

Definition at line 57 of file gdcmDocEntry.h.

Referenced by gdcm::ElementSet::AddEntry(), gdcm::Document::ParseDES(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::Validator::SetInput(), and gdcm::DataEntry::WriteContent().

00057 { return DicomDict->GetKey(); }

const uint32_t& gdcm::DocEntry::GetLength  )  const [inline]
 

Returns the actual value length of the current Dicom entry.

Warning:
this value is not *always* the one stored in the Dicom header in case of well known bugs

Definition at line 96 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::DataEntry::Copy(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DocEntrySet::GetEntryLength(), gdcm::File::GetPixelAreaLength(), gdcm::DataEntry::GetString(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::DataEntry::NewBinArea(), gdcm::DataEntry::Print(), gdcm::Document::SkipDocEntry(), WriteContent(), and gdcm::DataEntry::WriteContent().

00096 { return Length; }

std::string const& gdcm::DocEntry::GetName  )  const [inline]
 

Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.

Definition at line 61 of file gdcmDocEntry.h.

Referenced by Print().

00061 { return DicomDict->GetName(); }

const size_t& gdcm::DocEntry::GetOffset  )  const [inline]
 

Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.

Warning:
offset of the *value*, not of the Dicom entry

Definition at line 79 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::File::DoTheLoadingJob(), gdcm::File::GetPixelOffset(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), Print(), gdcm::SeqEntry::SeqEntry(), and gdcm::Document::SkipToNextDocEntry().

00079 { return Offset; }

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 uint32_t& gdcm::DocEntry::GetReadLength  )  const [inline]
 

Returns the 'read length' of the current Dicom entry.

Warning:
this value is the one stored in the Dicom header but not mandatoryly the one thats's used (in case on SQ, or delimiters, the usable length is set to zero)

Definition at line 88 of file gdcmDocEntry.h.

Referenced by GetFullLength(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SeqEntry::Print(), Print(), gdcm::Document::SkipToNextDocEntry(), and gdcm::SeqEntry::WriteContent().

00088 { return ReadLength; }

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    }

std::string const& gdcm::DocEntry::GetVM  )  const [inline]
 

Returns the 'Value Multiplicity' (e.g. "1", 6", "1-n", "3-n"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.

Definition at line 71 of file gdcmDocEntry.h.

Referenced by gdcm::CheckVM(), and gdcm::DataEntry::IsValueCountValid().

00071 { return DicomDict->GetVM(); }

VRKey const& gdcm::DocEntry::GetVR  )  const [inline]
 

Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry.

Definition at line 66 of file gdcmDocEntry.h.

Referenced by gdcm::CheckVM(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::FileHelper::CopyDataEntry(), gdcm::File::DoTheLoadingJob(), gdcm::Document::FixDocEntryFoundLength(), GetFullLength(), gdcm::DataEntry::GetString(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), Print(), gdcm::DataEntry::Print(), gdcm::DataEntry::SetString(), gdcm::DataEntry::SetValue(), and WriteContent().

00066 { return DicomDict->GetVR(); }

bool gdcm::DocEntry::IsImplicitVR  )  const [inline]
 

Tells us if the current Dicom entry was checked as ImplicitVr.

Returns:
true if the current Dicom entry was checked as ImplicitVr

Definition at line 112 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

Referenced by GetFullLength(), and gdcm::SeqEntry::SeqEntry().

00112 { return ImplicitVR; }

bool gdcm::DocEntry::IsItemDelimitor  ) 
 

tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)

Definition at line 203 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

Referenced by gdcm::Document::ParseDES().

00204 {
00205    return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
00206 }

bool gdcm::DocEntry::IsItemStarter  ) 
 

tells us if entry is the first one of an Item (fffe,e000)

Definition at line 212 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

Referenced by gdcm::Document::ParseDES().

00213 {
00214    return (GetGroup() == 0xfffe && GetElement() == 0xe000);
00215 }

bool gdcm::DocEntry::IsSequenceDelimitor  ) 
 

tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)

Definition at line 221 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

Referenced by gdcm::Document::ParseSQ().

00222 {
00223    return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
00224 }

bool gdcm::DocEntry::IsVMUnknown  )  const [inline]
 

Tells us if the VM of the current Dicom entry is Unknown.

Returns:
true if the VM is unknown

Definition at line 120 of file gdcmDocEntry.h.

00120 { return DicomDict->IsVMUnknown(); }

bool gdcm::DocEntry::IsVRUnknown  )  const [inline]
 

Tells us if the VR of the current Dicom entry is Unknown.

Returns:
true if the VR is unknown

Definition at line 116 of file gdcmDocEntry.h.

Referenced by WriteContent().

00116 { return DicomDict->IsVRUnknown(); }

void gdcm::DocEntry::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual]
 

Prints the common part of DataEntry, SeqEntry.

Parameters:
os ostream we want to print in
indent Indentation string to be prepended during printing

Reimplemented from gdcm::Base.

Reimplemented in gdcm::DataEntry, and gdcm::SeqEntry.

Definition at line 251 of file gdcmDocEntry.cxx.

References gdcm::Util::Format(), gdcm::GDCM_VRUNKNOWN, GetElement(), GetGroup(), GetName(), GetOffset(), GetReadLength(), GetVR(), gdcm::Base::PrintLevel, and gdcm::DictEntry::TranslateToKey().

Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::ElementSet::Print(), and gdcm::DataEntry::Print().

00252 {
00253    size_t o;
00254    std::string st;
00255    TSKey v;
00256    std::string d2;
00257    VRKey vr;
00258    std::ostringstream s;
00259    uint32_t lgth;
00260 
00261    o  = GetOffset();
00262    vr = GetVR();
00263    if ( vr == GDCM_VRUNKNOWN )
00264       vr = "  ";
00265 
00266    s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
00267 
00268    if (PrintLevel >= 2)
00269    {
00270       s << " lg : ";
00271       lgth = GetReadLength(); // ReadLength, as opposed to (usable) Length
00272       if (lgth == 0xffffffff)
00273       {
00274          st = " ffff ";
00275          s.setf(std::ios::left);
00276          s << std::setw(4);  
00277          s << "    x(ffff) ";
00278          s.setf(std::ios::left);
00279          s << std::setw(8) << "-1"; 
00280       }
00281       else
00282       {
00283          st = Util::Format("x(%x)",lgth); // we may keep it
00284          s.setf(std::ios::left);
00285          s << std::setw(11-st.size()) << " ";
00286          s << st << " ";
00287          s.setf(std::ios::left);
00288          s << std::setw(8) << lgth; 
00289       }
00290       s << " Off.: ";
00291       st = Util::Format("x(%x)",o);  // we may keep it
00292       s << std::setw(11-st.size()) << " ";
00293       s << st << " ";
00294       s << std::setw(8) << o; 
00295    }
00296    if (PrintLevel >= 1)
00297       s << " ";
00298 
00299    s << "[" << vr  << "] ";
00300 
00301    std::string name;
00302    if ( GetElement() == 0x0000 )
00303       name = "Group Length";
00304    else
00305       name = GetName();
00306 
00307    if (PrintLevel >= 1)
00308    {
00309       s.setf(std::ios::left);
00310       s << std::setw(66-name.length()) << " ";
00311    }
00312     
00313    s << "[" << name << "]";
00314    os << s.str();      
00315 }

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(), DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem().

00044 { RefCount++; }

void gdcm::DocEntry::SetImplicitVR  )  [inline]
 

Sets to TRUE the ImplicitVr flag of the current Dicom entry.

Definition at line 108 of file gdcmDocEntry.h.

References gdcm::ImplicitVR.

Referenced by gdcm::Document::ReadNextDocEntry().

00108 { ImplicitVR = true; }

virtual void gdcm::DocEntry::SetLength uint32_t  l  )  [inline, virtual]
 

Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.

Definition at line 92 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::DataEntry::CopyBinArea(), gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntrySet::SetEntryBinArea(), gdcm::DataEntry::SetString(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().

00092 { Length = l; }

void gdcm::DocEntry::SetOffset size_t  of  )  [inline]
 

Sets the offset of the Dicom entry.

Warning:
use with caution !
Parameters:
of offset to be set

Definition at line 105 of file gdcmDocEntry.h.

Referenced by gdcm::Document::Backtrack(), gdcm::DicomDirObject::FillObject(), gdcm::Document::ReadNextDocEntry(), and gdcm::DicomDir::SetElement().

00105 { Offset = of; }

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::DocEntry::SetReadLength uint32_t  l  )  [inline]
 

Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.

Definition at line 83 of file gdcmDocEntry.h.

Referenced by gdcm::Document::FixDocEntryFoundLength().

00083 { ReadLength = l; }

void gdcm::DocEntry::SetVM TagName const &  v  )  [inline]
 

Sets the 'Value Multiplicity' of the current Dicom entry.

Definition at line 74 of file gdcmDocEntry.h.

00074 { DicomDict->SetVM(v); } 

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(), ~DocEntry(), and gdcm::FileHelper::~FileHelper().

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

void gdcm::DocEntry::WriteContent std::ofstream *  fp,
FileType  filetype
[virtual]
 

Writes the common part of any DataEntry, SeqEntry.

Parameters:
fp already open ofstream pointer
filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...)
Todo:
allow skipping Shadow groups

Reimplemented in gdcm::DataEntry, and gdcm::SeqEntry.

Definition at line 70 of file gdcmDocEntry.cxx.

References gdcm::binary_write(), gdcm::ExplicitVR, GetElement(), GetGroup(), GetLength(), GetVR(), IsVRUnknown(), gdcm::JPEG, and gdcm::VRKey::str().

Referenced by gdcm::SeqEntry::WriteContent(), and gdcm::DataEntry::WriteContent().

00071 {
00072    uint32_t ffff  = 0xffffffff;
00073    uint16_t group = GetGroup();
00074    
00076    
00077    VRKey vr       = GetVR();
00078    uint16_t elem  = GetElement();
00079    uint32_t lgth  = GetLength();
00080 
00081    if ( group == 0xfffe && elem == 0x0000 )
00082    {
00083      // Fix in order to make some MR PHILIPS images e-film readable
00084      // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
00085      // we just *always* ignore spurious fffe|0000 tag !   
00086       return;
00087    }
00088  
00089    //
00090    // ----------- Writes the common part
00091    //
00092     // To avoid gdcm to propagate oddities.
00093     // --> Don't forget to *write* an even length value   
00094    if (lgth%2)
00095       lgth ++;
00096    
00097  // ----------- Writes the common part : the Tag   
00098    binary_write( *fp, group); //group number
00099    binary_write( *fp, elem);  //element number
00100 
00101    // Dicom V3 group 0x0002 is *always* Explicit VR !
00102    if ( filetype == ExplicitVR || filetype == JPEG || group == 0x0002 )
00103    {
00104 
00105 // ----------- Writes the common part : the VR + the length 
00106   
00107           // Special case of delimiters:
00108       if (group == 0xfffe)
00109       {
00110          // Delimiters have NO Value Representation
00111          // Hence we skip writing the VR.
00112          //
00113          // In order to avoid further troubles, we choose to write them
00114          // as 'no-length' Item Delimitors (we pad by writing 0xffffffff)
00115          // We shall force the end of a given SeqItem by writting 
00116          //  a Item Delimitation Item (fffe, e00d)
00117 
00118          uint32_t ff = 0xffffffff;
00119          binary_write(*fp, ff);
00120          return;
00121       }
00122 
00123       uint16_t zero = 0;
00124       uint16_t shortLgr = (uint16_t)lgth;
00125 
00126       if( IsVRUnknown() )
00127       {
00128          // GDCM_VRUNKNOWN was stored in the Entry VR;
00129          // deal with Entry as if TS were Implicit VR
00130  
00131          binary_write(*fp, lgth);
00132       }
00133       else
00134       {
00135          binary_write(*fp, vr.str());
00136 
00137          // See PS 3.5-2004 page 33, 36                  
00138          if ( (vr == "SQ") || (vr == "OB") || (vr == "OW") || (vr == "OF") 
00139           ||  (vr == "UN") || (vr == "UT") )
00140          {
00141             binary_write(*fp, zero);
00142             if (vr == "SQ")
00143             {
00144                // we set SQ length to ffffffff
00145                // and  we shall write a Sequence Delimitor Item 
00146                // at the end of the Sequence! 
00147                binary_write(*fp, ffff);
00148             }
00149             else
00150             {
00151                binary_write(*fp, lgth);
00152             }
00153          }
00154          else
00155          {
00156             binary_write(*fp, shortLgr);
00157          }
00158       }
00159    } 
00160    else // IMPLICIT VR 
00161    { 
00162 // ----------- Writes the common part : the VR  
00163       if (vr == "SQ")
00164       {
00165          binary_write(*fp, ffff);
00166       }
00167       else
00168       {
00169          binary_write(*fp, lgth);
00170       }
00171    }
00172 }


Member Data Documentation

DictEntry* gdcm::DocEntry::DicomDict [protected]
 

pointer to the underlying Dicom dictionary element

Definition at line 133 of file gdcmDocEntry.h.

Referenced by DocEntry(), and ~DocEntry().

bool gdcm::DocEntry::ImplicitVR [protected]
 

Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary.

Definition at line 145 of file gdcmDocEntry.h.

Referenced by Copy(), DocEntry(), and gdcm::SeqEntry::SeqEntry().

uint32_t gdcm::DocEntry::Length [protected]
 

Correspond to the real length of the data This length might always be even.

Definition at line 137 of file gdcmDocEntry.h.

Referenced by Copy(), DocEntry(), and gdcm::SeqEntry::SeqEntry().

size_t gdcm::DocEntry::Offset [protected]
 

Offset from the beginning of file for direct user access.

Definition at line 148 of file gdcmDocEntry.h.

Referenced by Copy(), DocEntry(), and gdcm::SeqEntry::SeqEntry().

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(), Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().

uint32_t gdcm::DocEntry::ReadLength [protected]
 

Length to read in the file to obtain data.

Definition at line 140 of file gdcmDocEntry.h.

Referenced by Copy(), DocEntry(), and gdcm::SeqEntry::SeqEntry().


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