#include <gdcmBinEntry.h>
Inheritance diagram for gdcm::BinEntry:
Public Member Functions | |
BinEntry (DictEntry *e) | |
Constructor from a given BinEntry. | |
BinEntry (DocEntry *d) | |
Constructor from a given BinEntry. | |
~BinEntry () | |
Canonical destructor. | |
void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Prints a BinEntry (Dicom entry). | |
void | WriteContent (std::ofstream *fp, FileType ft) |
canonical Writer | |
uint8_t * | GetBinArea () |
Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon). | |
void | SetBinArea (uint8_t *area, bool self=true) |
Sets the value (non string) of the current Dicom Header Entry. | |
void | SetSelfArea (bool area) |
Sets SelfArea. | |
bool | IsSelfArea () |
Returns SelfArea. | |
virtual void | SetValue (std::string const &val) |
Sets the value (string) of the current Dicom entry. | |
std::string const & | GetValue () const |
Returns the 'Value' (e.g. "Dupond Marcel") converted into a 'string', event if it's physically stored on disk as an integer. | |
void | Copy (DocEntry *doc) |
Copies all the attributes from an other DocEntry. | |
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) | |
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. | |
Private Attributes | |
uint8_t * | BinArea |
memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons) | |
bool | SelfArea |
Whether BinEntry has its own BinArea or not. |
Definition at line 38 of file gdcmBinEntry.h.
|
Constructor from a given BinEntry.
Definition at line 35 of file gdcmBinEntry.cxx. References BinArea, and SelfArea.
00036 :ContentEntry(e) 00037 { 00038 BinArea = 0; 00039 SelfArea = true; 00040 } |
|
Constructor from a given BinEntry.
Definition at line 46 of file gdcmBinEntry.cxx. References BinArea, gdcm::ContentEntry::Copy(), and SelfArea.
00047 : ContentEntry(e->GetDictEntry()) 00048 { 00049 Copy(e); 00050 00051 BinArea = 0; 00052 SelfArea = true; 00053 } |
|
Canonical destructor.
Definition at line 58 of file gdcmBinEntry.cxx. References BinArea, and SelfArea.
|
|
Copies all the attributes from an other DocEntry.
Reimplemented from gdcm::DocEntry. Definition at line 65 of file gdcmContentEntry.cxx. References gdcm::ContentEntry::Value. Referenced by BinEntry(), gdcm::ContentEntry::ContentEntry(), gdcm::FileHelper::CopyBinEntry(), gdcm::FileHelper::CopyValEntry(), gdcm::File::File(), gdcm::FileHelper::SetWriteToLibido(), and gdcm::ValEntry::ValEntry().
00066 { 00067 DocEntry::Copy(doc); 00068 00069 ContentEntry *entry = dynamic_cast<ContentEntry *>(doc); 00070 if(entry) 00071 Value = entry->Value; 00072 } |
|
Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon).
Definition at line 52 of file gdcmBinEntry.h. Referenced by gdcm::File::File(), gdcm::DocEntrySet::GetEntryBinArea(), gdcm::Document::LoadEntryBinArea(), Print(), and WriteContent().
00052 { return BinArea; } |
|
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(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::Document::ReadNextDocEntry(), and gdcm::DocEntry::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 gdcm::DocEntry::GetReadLength(), gdcm::DocEntry::GetVR(), and gdcm::DocEntry::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(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::Document::ReadNextDocEntry(), gdcm::Document::SkipToNextDocEntry(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and 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(), Print(), gdcm::Document::SkipDocEntry(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and 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 gdcm::DocEntry::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(), gdcm::DocEntry::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 gdcm::DocEntry::GetFullLength(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SeqEntry::Print(), gdcm::DocEntry::Print(), and gdcm::Document::SkipToNextDocEntry().
00094 { return ReadLength; }; |
|
Returns the 'Value' (e.g. "Dupond Marcel") converted into a 'string', event if it's physically stored on disk as an integer.
Definition at line 46 of file gdcmContentEntry.h. Referenced by gdcm::DicomDir::CreateDicomDir(), gdcm::DocEntrySet::GetEntryValue(), gdcm::Document::GetTransferSyntax(), gdcm::ValEntry::Print(), Print(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), and gdcm::ValEntry::WriteContent().
00046 { return Value; };
|
|
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(), gdcm::DocEntry::GetFullLength(), gdcm::DocEntrySet::InsertBinEntry(), gdcm::DocEntrySet::InsertValEntry(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::ParseDES(), gdcm::ValEntry::Print(), gdcm::DocEntry::Print(), gdcm::ValEntry::SetValue(), gdcm::ValEntry::WriteContent(), gdcm::DocEntry::WriteContent(), and 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(), gdcm::DocEntry::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 gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup(). Referenced by gdcm::Document::ParseDES().
00176 { 00177 return (GetGroup() == 0xfffe && GetElement() == 0xe00d); 00178 } |
|
Returns SelfArea.
Definition at line 58 of file gdcmBinEntry.h. Referenced by gdcm::File::File().
00058 { return SelfArea; }; |
|
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
Definition at line 184 of file gdcmDocEntry.cxx. References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::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 a BinEntry (Dicom entry).
Reimplemented from gdcm::DocEntry. Definition at line 167 of file gdcmBinEntry.cxx. References GetBinArea(), gdcm::DocEntry::GetLength(), and gdcm::ContentEntry::GetValue().
00168 { 00169 os << "B "; 00170 DocEntry::Print(os); 00171 std::ostringstream s; 00172 void* binArea = GetBinArea(); 00173 if (binArea) 00174 { 00175 s << " [" << GetValue() 00176 << "; length = " << GetLength() << "]"; 00177 } 00178 else 00179 { 00180 if ( GetLength() == 0 ) 00181 { 00182 s << " []"; 00183 } 00184 else 00185 { 00186 s << " [" <<GetValue() << "]"; 00187 } 00188 } 00189 os << s.str(); 00190 } |
|
Sets the value (non string) of the current Dicom Header Entry.
Definition at line 145 of file gdcmBinEntry.cxx. References BinArea, and SelfArea. Referenced by gdcm::File::File(), gdcm::Document::LoadEntryBinArea(), gdcm::DocEntrySet::SetBinEntry(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().
|
|
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 gdcm::DocEntry::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 SelfArea.
Definition at line 56 of file gdcmBinEntry.h. Referenced by gdcm::File::File().
00056 { SelfArea = area; }; |
|
Sets the value (string) of the current Dicom entry.
Reimplemented in gdcm::ValEntry. Definition at line 43 of file gdcmContentEntry.h. Referenced by gdcm::Document::LoadDocEntry(), gdcm::DocEntrySet::SetBinEntry(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB().
00043 { Value = val; }; |
|
Sets the 'Value Multiplicity' of the current Dicom entry.
Definition at line 80 of file gdcmDocEntry.h. References gdcm::TagName.
00080 { DicomDict->SetVM(v); }; |
|
canonical Writer
Implements gdcm::ContentEntry. Definition at line 74 of file gdcmBinEntry.cxx. References GetBinArea(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetLength(), and gdcm::DocEntry::GetVR().
00075 { 00076 DocEntry::WriteContent(fp, filetype); 00077 void* binArea = GetBinArea(); 00078 int lgr = GetLength(); 00079 if (binArea) // the binArea was *actually* loaded 00080 { 00081 00082 // TODO FIME 00083 // Probabely, the same operation will have to be done when we want 00084 // to write image with Big Endian Transfert Syntax, 00085 // and we are working on Little Endian Processor 00086 00087 #ifdef GDCM_WORDS_BIGENDIAN 00088 const int BUFFER_SIZE = 4096; 00089 // TODO FIXME Right now, we only care of Pixels element 00090 00091 // 8 Bits Pixels *are* OB, 16 Bits Pixels *are* OW 00092 // -value forced while Reading process- 00093 if (GetGroup() == 0x7fe0 && GetVR() == "OW") 00094 { 00095 uint16_t *buffer = new uint16_t[BUFFER_SIZE/2]; 00096 00097 // how many BUFFER_SIZE long pieces in binArea ? 00098 int nbPieces = lgr/BUFFER_SIZE; //(16 bits = 2 Bytes) 00099 int remainingSize = lgr%BUFFER_SIZE; 00100 00101 uint16_t *binArea16 = (uint16_t*)binArea; 00102 for (int j=0;j<nbPieces;j++) 00103 { 00104 for (int i = 0; i < BUFFER_SIZE/2; i++) 00105 { 00106 //buffer[i] = (binArea16[i] >> 8) | (binArea16[i] << 8); 00107 uint16_t val = binArea16[i]; 00108 buffer[i] = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) ); 00109 } 00110 fp->write ( (char*)buffer, BUFFER_SIZE ); 00111 binArea16 += BUFFER_SIZE/2; 00112 } 00113 if ( remainingSize > 0) 00114 { 00115 for (int i = 0; i < remainingSize/2; i++) 00116 { 00117 //buffer[i] = (binArea16[i] >> 8) | (binArea16[i] << 8); 00118 uint16_t val = binArea16[i]; 00119 buffer[i] = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) ); 00120 } 00121 fp->write ( (char*)buffer, remainingSize ); 00122 } 00123 delete[] buffer; 00124 } 00125 else 00126 { 00127 // For any other VR, BinEntry is re-written as-is 00128 fp->write ( (char*)binArea, lgr ); 00129 } 00130 #else 00131 fp->write ( (char*)binArea, lgr ); // Elem value 00132 #endif //GDCM_WORDS_BIGENDIAN 00133 00134 } 00135 else 00136 { 00137 // nothing was loaded, but we need to skip space on disc 00138 fp->seekp(lgr, std::ios::cur); 00139 } 00140 } |
|
memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons)
Definition at line 63 of file gdcmBinEntry.h. Referenced by BinEntry(), SetBinArea(), and ~BinEntry(). |
|
pointer to the underlying Dicom dictionary element
Definition at line 134 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::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 gdcm::DocEntry::Copy(), gdcm::DocEntry::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 gdcm::DocEntry::Copy(), and gdcm::DocEntry::DocEntry(). |
|
Offset from the beginning of file for direct user access.
Definition at line 149 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Copy(), and gdcm::DocEntry::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 gdcm::DocEntry::Copy(), and gdcm::DocEntry::DocEntry(). |
|
Whether BinEntry has its own BinArea or not.
Definition at line 65 of file gdcmBinEntry.h. Referenced by BinEntry(), SetBinArea(), and ~BinEntry(). |