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 *e)
 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 38 of file gdcmDocEntry.cxx.

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

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

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

Destructor from a given DictEntry.

Definition at line 55 of file gdcmDocEntry.cxx.

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

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


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.

Definition at line 225 of file gdcmDocEntry.cxx.

References ImplicitVR, Length, Offset, and ReadLength.

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

00226 {
00227    Length     = doc->Length;
00228    ReadLength = doc->ReadLength;
00229    ImplicitVR = doc->ImplicitVR;
00230    Offset     = doc->Offset;
00231 }

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::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 173 of file gdcmDocEntry.cxx.

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

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

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

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::GetEntryForcedAsciiValue(), 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 57 of file gdcmRefCounter.h.

00058    {
00059       return RefCount;
00060    }

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(), gdcm::DocEntrySet::GetEntryForcedAsciiValue(), 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 198 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

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

00199 {
00200    return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
00201 }

bool gdcm::DocEntry::IsItemStarter  ) 
 

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

Definition at line 207 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

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

00208 {
00209    return (GetGroup() == 0xfffe && GetElement() == 0xe000);
00210 }

bool gdcm::DocEntry::IsSequenceDelimitor  ) 
 

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

Definition at line 216 of file gdcmDocEntry.cxx.

References GetElement(), and GetGroup().

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

00217 {
00218    return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
00219 }

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 246 of file gdcmDocEntry.cxx.

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

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

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

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

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

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

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

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

Definition at line 69 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().

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


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