GDCM_NAME_SPACE::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_NAME_SPACE::DocEntry:

Inheritance graph
[legend]
Collaboration diagram for GDCM_NAME_SPACE::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, bool insideMetaElements)
 Writes the common part of any DataEntry, SeqEntry.
DictEntryGetDictEntry ()
 Gets the DicEntry of the current Dicom entry.
uint16_t const & GetGroup () const
 Returns the Dicom Group number of the current Dicom entry.
uint16_t const & GetElement () const
 Returns the Dicom Element number of the current Dicom entry.
TagKey const & GetKey () const
 Returns the 'key' of the current Dicom entry.
std::string const & GetName ()
 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 ()
 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 &)
 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.
void SetVR (VRKey const &vr)
void SetTag (TagKey const &key)
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 ()
 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 last one of a 'no length' Sequence (fffe,e0dd)
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 (uint16_t group, uint16_t elem, VRKey const &vr)
 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
 Corresponds 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.
VRKey VR
 Value Representation (to avoid accessing Dicom Dict every time!).
TagKey Key
 Dicom TagKey. Contains Dicom Group number and Dicom Element number (to avoid accessing Dicom Dict every time !) // JPRx.
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_NAME_SPACE::DocEntry::DocEntry uint16_t  group,
uint16_t  elem,
VRKey const &  vr
[protected]
 

Constructor from a given DictEntry.

Parameters:
group Group number
elem Element number
vr VR

Definition at line 41 of file gdcmDocEntry.cxx.

References DicomDict, ImplicitVR, Key, Length, Offset, ReadLength, and GDCM_NAME_SPACE::TagKey::SetGroupElem().

00042 {
00043    ImplicitVR = false;
00044    DicomDict  = 0;   
00045    Offset     = 0 ; // To avoid further missprinting
00046 
00047    // init some variables
00048    ReadLength = 0;
00049    Length = 0;
00050 
00051    VR = vr;
00052    Key.SetGroupElem(group,elem);
00053 }

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

Destructor from a given DictEntry.

Definition at line 58 of file gdcmDocEntry.cxx.

References DicomDict, and gdcmAssertMacro.

00059 {
00060    if (DicomDict)
00061    {
00062       gdcmAssertMacro(DicomDict);
00063       DicomDict->Unregister();
00064    }
00065 }


Member Function Documentation

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

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

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

Copies all the attributes from an other DocEntry.

Parameters:
doc entry to copy from

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

Definition at line 252 of file gdcmDocEntry.cxx.

References ImplicitVR, Length, Offset, and ReadLength.

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

00253 {
00254    Length     = doc->Length;
00255    ReadLength = doc->ReadLength;
00256    ImplicitVR = doc->ImplicitVR;
00257    Offset     = doc->Offset;
00258 }

void GDCM_NAME_SPACE::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 41 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyMandatoryEntry(), GDCM_NAME_SPACE::Dict::DoTheLoadingJob(), GDCM_NAME_SPACE::FillDefaultDataDict(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), GDCM_NAME_SPACE::DicomDir::NewMeta(), GDCM_NAME_SPACE::DicomDirStudy::NewVisit(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::DicomDir::SetElement(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToExplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToImplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG2000(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), GDCM_NAME_SPACE::DicomDir::~DicomDir(), GDCM_NAME_SPACE::DictSet::~DictSet(), and GDCM_NAME_SPACE::Global::~Global().

00041 { Unregister(); }

GDCM_NAME_SPACE::DocEntry::gdcmTypeMacro DocEntry   )  [private]
 

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

Gets the DicEntry of the current Dicom entry.

Returns:
The DicEntry of the current Dicom entry

Definition at line 49 of file gdcmDocEntry.h.

00049 { return DicomDict; } 

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

Returns the Dicom Element number of the current Dicom entry.

Definition at line 56 of file gdcmDocEntry.h.

Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GDCM_NAME_SPACE::DataEntry::GetValue(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), Print(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and WriteContent().

00056 { return Key[1];}   

uint32_t GDCM_NAME_SPACE::DocEntry::GetFullLength  ) 
 

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

Definition at line 227 of file gdcmDocEntry.cxx.

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

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

00228 {
00229    uint32_t l = GetReadLength();
00230    if ( IsImplicitVR() )
00231    {
00232       l = l + 8;  // 2 (gr) + 2 (el) + 4 (lgth) 
00233    }
00234    else
00235    {
00236       if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
00237       {
00238          l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
00239       }
00240       else
00241       {
00242          l = l + 8;  // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
00243       }
00244    }
00245    return l;
00246 }

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

Returns the Dicom Group number of the current Dicom entry.

Definition at line 52 of file gdcmDocEntry.h.

Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GDCM_NAME_SPACE::DataEntry::GetValue(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), Print(), GDCM_NAME_SPACE::DataEntry::Print(), GDCM_NAME_SPACE::DocEntryArchive::Push(), GDCM_NAME_SPACE::Document::SkipToNextDocEntry(), WriteContent(), and GDCM_NAME_SPACE::DataEntry::WriteContent().

00052 { return Key[0];  }

TagKey const& GDCM_NAME_SPACE::DocEntry::GetKey  )  const [inline]
 

Returns the 'key' of the current Dicom entry.

Definition at line 60 of file gdcmDocEntry.h.

Referenced by GDCM_NAME_SPACE::ElementSet::AddEntry(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::Document::ParseDES(), GDCM_NAME_SPACE::DocEntryArchive::Push(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), GDCM_NAME_SPACE::Validator::SetInput(), and GDCM_NAME_SPACE::DataEntry::WriteContent().

00060 { return Key; }   

const uint32_t& GDCM_NAME_SPACE::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 102 of file gdcmDocEntry.h.

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

00102 { return Length; }

std::string const & GDCM_NAME_SPACE::DocEntry::GetName  ) 
 

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

Definition at line 192 of file gdcmDocEntry.cxx.

References DicomDict, GDCM_NAME_SPACE::GDCM_UNKNOWN, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::Dict::GetEntry(), GDCM_NAME_SPACE::DictEntry::GetName(), Key, and GDCM_NAME_SPACE::RefCounter::Register().

Referenced by Print().

00193 { 
00194    if (DicomDict == 0)
00195       DicomDict =
00196                  Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]);
00197    if (DicomDict == 0)
00198       return GDCM_UNKNOWN;
00199    else
00200    {
00201       DicomDict->Register();
00202       return DicomDict->GetName();
00203    }
00204 }

const size_t& GDCM_NAME_SPACE::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 85 of file gdcmDocEntry.h.

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

00085 { return Offset; }

int GDCM_NAME_SPACE::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_NAME_SPACE::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 of SQ, or delimiters, the usable length is set to zero)

Definition at line 94 of file gdcmDocEntry.h.

Referenced by GetFullLength(), GDCM_NAME_SPACE::SeqEntry::Print(), Print(), GDCM_NAME_SPACE::Document::SkipToNextDocEntry(), and GDCM_NAME_SPACE::SeqEntry::WriteContent().

00094 { return ReadLength; }

const unsigned long& GDCM_NAME_SPACE::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 59 of file gdcmRefCounter.h.

00060    {
00061       return RefCount;
00062    }

std::string const & GDCM_NAME_SPACE::DocEntry::GetVM  ) 
 

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

References DicomDict, GDCM_NAME_SPACE::GDCM_UNKNOWN, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::Dict::GetEntry(), GDCM_NAME_SPACE::DictEntry::GetVM(), Key, and GDCM_NAME_SPACE::RefCounter::Register().

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

00210 {
00211    if (DicomDict == 0)
00212       DicomDict =
00213                  Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]);
00214    if (DicomDict == 0)
00215       return GDCM_UNKNOWN;
00216    else
00217    {
00218       DicomDict->Register();
00219       return DicomDict->GetVM();
00220    }
00221 }

VRKey const& GDCM_NAME_SPACE::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 70 of file gdcmDocEntry.h.

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

00070 { return VR; }   

bool GDCM_NAME_SPACE::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 129 of file gdcmDocEntry.h.

References GDCM_NAME_SPACE::ImplicitVR.

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

00129 { return ImplicitVR; }

bool GDCM_NAME_SPACE::DocEntry::IsItemDelimitor  )  [inline]
 

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

Definition at line 143 of file gdcmDocEntry.h.

00144                       {return (GetGroup() == 0xfffe && GetElement() == 0xe00d);}

bool GDCM_NAME_SPACE::DocEntry::IsItemStarter  )  [inline]
 

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

Definition at line 147 of file gdcmDocEntry.h.

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

00147                        { if (GetGroup() != 0xfffe) return false;
00148                          return (GetElement() == 0xe000); }

bool GDCM_NAME_SPACE::DocEntry::IsSequenceDelimitor  )  [inline]
 

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

Definition at line 151 of file gdcmDocEntry.h.

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

00151 { return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);}  

bool GDCM_NAME_SPACE::DocEntry::IsVMUnknown  )  [inline]
 

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

Returns:
true if the VM is unknown

Definition at line 139 of file gdcmDocEntry.h.

References GDCM_NAME_SPACE::GDCM_UNKNOWN.

00139 { return GetVM() == GDCM_UNKNOWN; }

bool GDCM_NAME_SPACE::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 134 of file gdcmDocEntry.h.

References GDCM_NAME_SPACE::GDCM_VRUNKNOWN.

Referenced by WriteContent().

00134 { return VR == GDCM_VRUNKNOWN; }

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

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

Definition at line 273 of file gdcmDocEntry.cxx.

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

Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), and GDCM_NAME_SPACE::DataEntry::Print().

00274 {
00275    size_t o;
00276    std::string st;
00277    TSKey v;
00278    std::string d2;
00279    VRKey vr;
00280    std::ostringstream s;
00281    uint32_t lgth;
00282 
00283    o  = GetOffset();
00284    vr = GetVR();
00285    if ( vr == GDCM_VRUNKNOWN )
00286       vr = "  ";
00287 
00288    s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 
00289 
00290    if (PrintLevel >= 2)
00291    {
00292       s << " lg : ";
00293       lgth = GetReadLength(); // ReadLength, as opposed to (usable) Length
00294       if (lgth == 0xffffffff)
00295       {
00296          st = " ffff ";
00297          s.setf(std::ios::left);
00298          s << std::setw(4);  
00299          s << "    x(ffff) ";
00300          s.setf(std::ios::left);
00301          s << std::setw(8) << "-1"; 
00302       }
00303       else
00304       {
00305          st = Util::Format("x(%x)",lgth); // we may keep it
00306          s.setf(std::ios::left);
00307          s << std::setw(11-st.size()) << " ";
00308          s << st << " ";
00309          s.setf(std::ios::left);
00310          s << std::setw(8) << lgth; 
00311       }
00312       s << " Off.: ";
00313       st = Util::Format("x(%x)",o);  // we may keep it
00314       s << std::setw(11-st.size()) << " ";
00315       s << st << " ";
00316       s << std::setw(8) << o; 
00317    }
00318    if (PrintLevel >= 1)
00319       s << " ";
00320 
00321    s << "[" << vr  << "] ";
00322 
00323    std::string name;
00324    uint16_t e = GetElement();
00325    if ( e == 0x0000 )
00326       name = "Group Length";
00327    else if ( GetGroup()%2 == 1 )
00328    {
00329       if ( e >= 0x0010 && e <= 0x00ff )
00330          name = "Private Creator";
00331       else if (e == 0x0001)
00332          name = "Private Group Length To End";
00333    }
00334    else
00335    {
00336       name = GetName();
00337       // prevent Print from any CR at end of name (hope it's enought!)
00338       if (name[name.length()-1] == 0x0d || name[name.length()-1] == 0x0a)
00339       {  
00340          name.replace(name.length()-1, 1, 1, ' ');
00341       }
00342    }
00343    if (PrintLevel >= 1)
00344    {
00345       s.setf(std::ios::left);
00346       s << std::setw(66-name.length()) << " ";
00347    }
00348     
00349    s << "[" << name << "]";
00350    os << s.str();      
00351 }

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

Register the object.

Remarks:
It increments the reference counting

Definition at line 46 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GetName(), GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem().

00046 { RefCount++; }

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

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

Definition at line 115 of file gdcmDocEntry.h.

References GDCM_NAME_SPACE::ImplicitVR.

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

00115 { ImplicitVR = true; }

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

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

Definition at line 98 of file gdcmDocEntry.h.

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

00098 { Length = l; }

void GDCM_NAME_SPACE::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 112 of file gdcmDocEntry.h.

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

00112 { Offset = of; }

void GDCM_NAME_SPACE::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_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print().

00047 { PrintLevel = level; }

void GDCM_NAME_SPACE::DocEntry::SetReadLength uint32_t  l  )  [inline]
 

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

Definition at line 89 of file gdcmDocEntry.h.

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

00089 { ReadLength = l; }

void GDCM_NAME_SPACE::DocEntry::SetTag TagKey const &  key  )  [inline]
 

Sets the 'Value Representation' of the current Dicom entry

Parameters:
key TagKey to be set

Definition at line 123 of file gdcmDocEntry.h.

00123 { Key = key; } 

void GDCM_NAME_SPACE::DocEntry::SetVM TagName  )  [inline]
 

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

Definition at line 80 of file gdcmDocEntry.h.

00080 { std::cout << "-----------------FIXME : SetVM "; }

void GDCM_NAME_SPACE::DocEntry::SetVR VRKey const &  vr  )  [inline]
 

Sets the 'Value Representation' of the current Dicom entry

Parameters:
vr VR to be set

Definition at line 119 of file gdcmDocEntry.h.

Referenced by GDCM_NAME_SPACE::File::DoTheLoadingJob(), and WriteContent().

00119 { VR = vr; } 

void GDCM_NAME_SPACE::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 50 of file gdcmRefCounter.h.

Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper().

00051    {
00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl;
00053       RefCount--;
00054       if(RefCount<=0)
00055         delete this;
00056    }

void GDCM_NAME_SPACE::DocEntry::WriteContent std::ofstream *  fp,
FileType  filetype,
bool  insideMetaElements
[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_NAME_SPACE::DataEntry, and GDCM_NAME_SPACE::SeqEntry.

Definition at line 74 of file gdcmDocEntry.cxx.

References GDCM_NAME_SPACE::binary_write(), GDCM_NAME_SPACE::ExplicitVR, gdcmAssertMacro, GetElement(), GetGroup(), GetLength(), GetVR(), IsVRUnknown(), GDCM_NAME_SPACE::JPEG, GDCM_NAME_SPACE::JPEG2000, SetVR(), and GDCM_NAME_SPACE::VRKey::str().

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

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


Member Data Documentation

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

pointer to the underlying Dicom dictionary element

Definition at line 161 of file gdcmDocEntry.h.

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

bool GDCM_NAME_SPACE::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 173 of file gdcmDocEntry.h.

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

TagKey GDCM_NAME_SPACE::DocEntry::Key [protected]
 

Dicom TagKey. Contains Dicom Group number and Dicom Element number (to avoid accessing Dicom Dict every time !) // JPRx.

Definition at line 183 of file gdcmDocEntry.h.

Referenced by DocEntry(), GetName(), and GetVM().

uint32_t GDCM_NAME_SPACE::DocEntry::Length [protected]
 

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

Definition at line 165 of file gdcmDocEntry.h.

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

size_t GDCM_NAME_SPACE::DocEntry::Offset [protected]
 

Offset from the beginning of file for direct user access.

Definition at line 176 of file gdcmDocEntry.h.

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

int GDCM_NAME_SPACE::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_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print().

uint32_t GDCM_NAME_SPACE::DocEntry::ReadLength [protected]
 

Length to read in the file to obtain data.

Definition at line 168 of file gdcmDocEntry.h.

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

VRKey GDCM_NAME_SPACE::DocEntry::VR [protected]
 

Value Representation (to avoid accessing Dicom Dict every time!).

Definition at line 179 of file gdcmDocEntry.h.


The documentation for this class was generated from the following files:
Generated on Fri Aug 24 12:57:00 2007 for gdcm by  doxygen 1.4.6