#include <gdcmDocEntry.h>
Inheritance diagram for gdcm::DocEntry:
Public Member Functions | |
DocEntry (DictEntry *) | |
Constructor from a given DictEntry. | |
virtual | ~DocEntry () |
Canonical Destructor. | |
virtual void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Prints the common part of ValEntry, BinEntry, SeqEntry. | |
virtual void | WriteContent (std::ofstream *fp, FileType filetype) |
Writes the common part of any ValEntry, BinEntry, SeqEntry. | |
DictEntry * | GetDictEntry () |
Gets the DicEntry of the current Dicom entry. | |
uint16_t | GetGroup () |
Returns the Dicom Group number of the current Dicom entry. | |
uint16_t | GetElement () |
Returns the Dicom Element number of the current Dicom entry. | |
void | SetKey (TagKey const &key) |
Set the 'key' of the current Dicom entry. | |
std::string const & | 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. | |
std::string 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", "1-n", "6"), 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. | |
size_t | GetOffset () |
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. | |
uint32_t | GetReadLength () |
Returns the 'read length' of the current Dicom entry. | |
void | SetLength (uint32_t l) |
Sets both 'Read Length' and 'Usable Length' of the current Dicom entry. | |
uint32_t | GetLength () |
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. | |
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 () |
Tells us if the current Dicom entry was checked as ImplicitVr. | |
bool | IsVRUnknown () |
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 | 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 | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Protected Attributes | |
DictEntry * | DicomDict |
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. | |
TagKey | Key |
Generalized key of this DocEntry (for details on the generalized key refer to TagKey documentation). | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. |
Definition at line 40 of file gdcmDocEntry.h.
|
Constructor from a given DictEntry.
Definition at line 40 of file gdcmDocEntry.cxx. References DicomDict, ImplicitVR, Length, Offset, ReadLength, and SetKey().
00041 { 00042 ImplicitVR = false; 00043 DicomDict = in; 00044 SetKey( in->GetKey( ) ); 00045 Offset = 0 ; // To avoid further missprinting 00046 00047 // init some variables 00048 ReadLength = 0; 00049 Length = 0; 00050 } |
|
Canonical Destructor.
Definition at line 45 of file gdcmDocEntry.h.
00045 {}; |
|
Copies all the attributes from an other DocEntry.
Reimplemented in gdcm::ContentEntry. Definition at line 193 of file gdcmDocEntry.cxx. References ImplicitVR, Length, Offset, and ReadLength.
00194 { 00195 Length = doc->Length; 00196 ReadLength = doc->ReadLength; 00197 ImplicitVR = doc->ImplicitVR; 00198 Offset = doc->Offset; 00199 } |
|
Gets the DicEntry of the current Dicom entry.
Definition at line 52 of file gdcmDocEntry.h. Referenced by gdcm::FileHelper::CopyBinEntry(), gdcm::FileHelper::CopyValEntry(), gdcm::DocEntryArchive::Push(), and gdcm::FileHelper::SetWriteToLibido().
00052 { return DicomDict; }; |
|
Returns the Dicom Element number of the current Dicom entry.
Definition at line 58 of file gdcmDocEntry.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), IsItemDelimitor(), IsSequenceDelimitor(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), Print(), gdcm::Document::ReadNextDocEntry(), and WriteContent().
00058 { return DicomDict->GetElement();}; |
|
Gets the full length of the elementary DocEntry (not only value length) depending on the VR.
Definition at line 150 of file gdcmDocEntry.cxx. References GetReadLength(), GetVR(), and IsImplicitVR().
00151 { 00152 uint32_t l = GetReadLength(); 00153 if ( IsImplicitVR() ) 00154 { 00155 l = l + 8; // 2 (gr) + 2 (el) + 4 (lgth) 00156 } 00157 else 00158 { 00159 if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" ) 00160 { 00161 l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth) 00162 } 00163 else 00164 { 00165 l = l + 8; // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth) 00166 } 00167 } 00168 return l; 00169 } |
|
Returns the Dicom Group number of the current Dicom entry.
Definition at line 55 of file gdcmDocEntry.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), IsItemDelimitor(), IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), Print(), gdcm::Document::ReadNextDocEntry(), gdcm::Document::SkipToNextDocEntry(), gdcm::ValEntry::WriteContent(), WriteContent(), and gdcm::BinEntry::WriteContent().
00055 { return DicomDict->GetGroup(); }; |
|
Returns the 'key' of the current Dicom entry.
Definition at line 63 of file gdcmDocEntry.h. Referenced by gdcm::ElementSet::AddEntry(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SQItem::RemoveEntryNoDestroy(), and gdcm::ElementSet::RemoveEntryNoDestroy().
00063 { return Key; } |
|
Returns the actual value length of the current Dicom entry.
Definition at line 102 of file gdcmDocEntry.h. Referenced by gdcm::File::AnonymizeNoLoad(), gdcm::Document::ComputeGroup0002Length(), gdcm::Document::GetDocEntryValue(), gdcm::DocEntrySet::GetEntryLength(), gdcm::File::GetPixelAreaLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::ValEntry::Print(), gdcm::BinEntry::Print(), gdcm::Document::SkipDocEntry(), gdcm::ValEntry::WriteContent(), WriteContent(), and gdcm::BinEntry::WriteContent().
00102 { return Length; }; |
|
Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.
Definition at line 67 of file gdcmDocEntry.h. Referenced by Print().
00067 { return DicomDict->GetName(); }; |
|
Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.
Definition at line 85 of file gdcmDocEntry.h. Referenced by gdcm::File::AnonymizeNoLoad(), gdcm::File::File(), gdcm::File::GetPixelOffset(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), Print(), gdcm::SeqEntry::SeqEntry(), and gdcm::Document::SkipToNextDocEntry().
00085 { return Offset; }; |
|
Gets the print level for the Dicom Entries.
Definition at line 48 of file gdcmBase.h.
00048 { return PrintLevel; }; |
|
Returns the 'read length' of the current Dicom entry.
Definition at line 94 of file gdcmDocEntry.h. Referenced by GetFullLength(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SeqEntry::Print(), Print(), and gdcm::Document::SkipToNextDocEntry().
00094 { return ReadLength; }; |
|
Returns the 'Value Multiplicity' (e.g. "1", "1-n", "6"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.
Definition at line 77 of file gdcmDocEntry.h.
00077 { return DicomDict->GetVM(); }; |
|
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 72 of file gdcmDocEntry.h. Referenced by gdcm::Document::ComputeGroup0002Length(), gdcm::FileHelper::CopyBinEntry(), gdcm::File::File(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::GetDocEntryUnvalue(), gdcm::Document::GetDocEntryValue(), gdcm::DocEntrySet::GetEntryVR(), GetFullLength(), gdcm::DocEntrySet::InsertBinEntry(), gdcm::DocEntrySet::InsertValEntry(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), Print(), gdcm::ValEntry::SetValue(), gdcm::ValEntry::WriteContent(), WriteContent(), and gdcm::BinEntry::WriteContent().
00072 { return DicomDict->GetVR(); }; |
|
Tells us if the current Dicom entry was checked as ImplicitVr.
Definition at line 117 of file gdcmDocEntry.h. References gdcm::ImplicitVR. Referenced by gdcm::Document::GetDocEntryUnvalue(), gdcm::Document::GetDocEntryValue(), GetFullLength(), and gdcm::SeqEntry::SeqEntry().
00117 { return ImplicitVR; }; |
|
tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)
Definition at line 175 of file gdcmDocEntry.cxx. References GetElement(), and GetGroup(). Referenced by gdcm::Document::ParseDES().
00176 { 00177 return (GetGroup() == 0xfffe && GetElement() == 0xe00d); 00178 } |
|
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
Definition at line 184 of file gdcmDocEntry.cxx. References GetElement(), and GetGroup(). Referenced by gdcm::Document::ParseSQ().
00185 { 00186 return (GetGroup() == 0xfffe && GetElement() == 0xe0dd); 00187 } |
|
Tells us if the VM of the current Dicom entry is Unknown.
Definition at line 125 of file gdcmDocEntry.h.
00125 { return DicomDict->IsVMUnknown(); }; |
|
Tells us if the VR of the current Dicom entry is Unknown.
Definition at line 121 of file gdcmDocEntry.h.
00121 { return DicomDict->IsVRUnknown(); }; |
|
Prints the common part of ValEntry, BinEntry, SeqEntry.
Reimplemented from gdcm::Base. Reimplemented in gdcm::BinEntry, gdcm::SeqEntry, and gdcm::ValEntry. Definition at line 214 of file gdcmDocEntry.cxx. References gdcm::GDCM_UNKNOWN, GetElement(), GetGroup(), GetName(), GetOffset(), GetReadLength(), GetVR(), and gdcm::TSKey. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), and gdcm::ElementSet::Print().
00215 { 00216 size_t o; 00217 std::string st; 00218 TSKey v; 00219 std::string d2, vr; 00220 std::ostringstream s; 00221 uint32_t lgth; 00222 00223 o = GetOffset(); 00224 vr = GetVR(); 00225 if(vr==GDCM_UNKNOWN) 00226 vr=" "; 00227 00228 s << DictEntry::TranslateToKey(GetGroup(),GetElement()); 00229 00230 if (PrintLevel >= 2) 00231 { 00232 s << " lg : "; 00233 lgth = GetReadLength(); // ReadLength, as opposed to Length 00234 if (lgth == 0xffffffff) 00235 { 00236 st = Util::Format("x(ffff)"); // I said : "x(ffff)" ! 00237 s.setf(std::ios::left); 00238 s << std::setw(10-st.size()) << " "; 00239 s << st << " "; 00240 s.setf(std::ios::left); 00241 s << std::setw(8) << "-1"; 00242 } 00243 else 00244 { 00245 st = Util::Format("x(%x)",lgth); 00246 s.setf(std::ios::left); 00247 s << std::setw(10-st.size()) << " "; 00248 s << st << " "; 00249 s.setf(std::ios::left); 00250 s << std::setw(8) << lgth; 00251 } 00252 s << " Off.: "; 00253 st = Util::Format("x(%x)",o); 00254 s << std::setw(10-st.size()) << " "; 00255 s << st << " "; 00256 s << std::setw(8) << o; 00257 } 00258 00259 s << "[" << vr << "] "; 00260 00261 if (PrintLevel >= 1) 00262 { 00263 s.setf(std::ios::left); 00264 s << std::setw(66-GetName().length()) << " "; 00265 } 00266 00267 s << "[" << GetName()<< "]"; 00268 os << s.str(); 00269 } |
|
Sets to TRUE the ImplicitVr flag of the current Dicom entry.
Definition at line 113 of file gdcmDocEntry.h. References gdcm::ImplicitVR. Referenced by gdcm::Document::ReadNextDocEntry().
00113 { ImplicitVR = true; }; |
|
Set the 'key' of the current Dicom entry.
Definition at line 61 of file gdcmDocEntry.h. References gdcm::TagKey. Referenced by DocEntry(), and gdcm::Document::ParseDES().
00061 { Key = key; } |
|
Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.
Definition at line 98 of file gdcmDocEntry.h. Referenced by gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntrySet::SetBinEntry(), gdcm::ValEntry::SetValue(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().
00098 { Length = l; }; |
|
Sets the offset of the Dicom entry.
Definition at line 110 of file gdcmDocEntry.h. Referenced by gdcm::DicomDirObject::FillObject(), gdcm::Document::ReadNextDocEntry(), and gdcm::DicomDir::SetElement().
00110 { Offset = of; }; |
|
Sets the print level for the Dicom Header Elements.
Definition at line 45 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().
00045 { PrintLevel = level; }; |
|
Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.
Definition at line 89 of file gdcmDocEntry.h. Referenced by gdcm::Document::FixDocEntryFoundLength().
00089 { ReadLength = l; }; |
|
Sets the 'Value Multiplicity' of the current Dicom entry.
Definition at line 80 of file gdcmDocEntry.h. References gdcm::TagName.
00080 { DicomDict->SetVM(v); }; |
|
Writes the common part of any ValEntry, BinEntry, SeqEntry.
Reimplemented in gdcm::BinEntry, gdcm::ContentEntry, gdcm::SeqEntry, and gdcm::ValEntry. Definition at line 59 of file gdcmDocEntry.cxx. References gdcm::binary_write(), gdcm::ExplicitVR, gdcm::GDCM_UNKNOWN, gdcmAssertMacro, GetElement(), GetGroup(), GetLength(), GetVR(), and gdcm::VRKey.
00060 { 00061 uint32_t ffff = 0xffffffff; 00062 uint16_t group = GetGroup(); 00063 VRKey vr = GetVR(); 00064 uint16_t el = GetElement(); 00065 uint32_t lgth = GetLength(); 00066 00067 if ( group == 0xfffe && el == 0x0000 ) 00068 { 00069 // Fix in order to make some MR PHILIPS images e-film readable 00070 // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm: 00071 // we just *always* ignore spurious fffe|0000 tag ! 00072 return; 00073 } 00074 // 00075 // ----------- Writes the common part 00076 // 00077 binary_write( *fp, group); //group number 00078 binary_write( *fp, el); //element number 00079 00080 if ( filetype == ExplicitVR ) 00081 { 00082 // Special case of delimiters: 00083 if (group == 0xfffe) 00084 { 00085 // Delimiters have NO Value Representation 00086 // Hence we skip writing the VR. 00087 // In order to avoid further troubles, we choose to write them 00088 // as 'no-length' Item Delimitors (we pad by writing 0xffffffff) 00089 // We shall force the end of a given Item by writting 00090 // a Item Delimitation Item (fffe, e00d) 00091 00092 uint32_t ff = 0xffffffff; 00093 binary_write(*fp, ff); 00094 return; 00095 } 00096 00097 uint16_t z = 0; 00098 uint16_t shortLgr = lgth; 00099 00100 if (vr == GDCM_UNKNOWN) 00101 { 00102 // Unknown was 'written' 00103 // deal with Little Endian 00104 binary_write(*fp, shortLgr); 00105 binary_write(*fp, z); 00106 } 00107 else 00108 { 00109 binary_write(*fp, vr); 00110 gdcmAssertMacro( vr.size() == 2 ); 00111 00112 if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || (vr == "UN") ) 00113 { 00114 binary_write(*fp, z); 00115 if (vr == "SQ") 00116 { 00117 // we set SQ length to ffffffff 00118 // and we shall write a Sequence Delimitor Item 00119 // at the end of the Sequence! 00120 binary_write(*fp, ffff); 00121 } 00122 else 00123 { 00124 binary_write(*fp, lgth); 00125 } 00126 } 00127 else 00128 { 00129 binary_write(*fp, shortLgr); 00130 } 00131 } 00132 } 00133 else // IMPLICIT VR 00134 { 00135 if (vr == "SQ") 00136 { 00137 binary_write(*fp, ffff); 00138 } 00139 else 00140 { 00141 binary_write(*fp, lgth); 00142 } 00143 } 00144 } |
|
pointer to the underlying Dicom dictionary element
Definition at line 134 of file gdcmDocEntry.h. Referenced by DocEntry(). |
|
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 146 of file gdcmDocEntry.h. Referenced by Copy(), DocEntry(), and gdcm::SeqEntry::SeqEntry(). |
|
Generalized key of this DocEntry (for details on the generalized key refer to TagKey documentation).
Definition at line 153 of file gdcmDocEntry.h. |
|
Correspond to the real length of the data This length might always be even.
Definition at line 138 of file gdcmDocEntry.h. Referenced by Copy(), and DocEntry(). |
|
Offset from the beginning of file for direct user access.
Definition at line 149 of file gdcmDocEntry.h. Referenced by Copy(), and DocEntry(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 53 of file gdcmBase.h. Referenced by gdcm::Base::Base(). |
|
Length to read in the file to obtain data.
Definition at line 141 of file gdcmDocEntry.h. Referenced by Copy(), and DocEntry(). |