14#ifndef GDCMDATAELEMENT_H
15#define GDCMDATAELEMENT_H
37class SequenceOfFragments;
61 DataElement(
const Tag& t =
Tag(0),
const VL& vl = 0,
const VR &vr = VR::INVALID):TagField(t),ValueLengthField(vl),VRField(vr),ValueField(nullptr) {}
74 const VL&
GetVL()
const {
return ValueLengthField; }
79 void SetVL(
const VL &vl) { ValueLengthField = vl; }
84 VR const &
GetVR()
const {
return VRField; }
106 bool IsEmpty()
const {
return ValueField ==
nullptr || (GetByteValue() && GetByteValue()->IsEmpty()); }
109 void Empty() { ValueField =
nullptr; ValueLengthField = 0; }
115 VRField = VR::INVALID;
116 ValueField =
nullptr;
117 ValueLengthField = 0;
154 return ValueLengthField.IsUndefined();
167 return GetTag() < de.
GetTag();
200 template <
typename TDE>
202 return static_cast<const TDE*
>(
this)->GetLength();
205 template <
typename TDE,
typename TSwap>
206 std::istream &
Read(std::istream &is) {
207 return static_cast<TDE*
>(
this)->
template Read<TSwap>(is);
210 template <
typename TDE,
typename TSwap>
211 std::istream &
ReadOrSkip(std::istream &is, std::set<Tag>
const &skiptags) {
213 return static_cast<TDE*
>(
this)->
template Read<TSwap>(is);
216 template <
typename TDE,
typename TSwap>
217 std::istream &
ReadPreValue(std::istream &is, std::set<Tag>
const &skiptags) {
219 return static_cast<TDE*
>(
this)->
template ReadPreValue<TSwap>(is);
221 template <
typename TDE,
typename TSwap>
222 std::istream &
ReadValue(std::istream &is, std::set<Tag>
const &skiptags) {
224 return static_cast<TDE*
>(
this)->
template ReadValue<TSwap>(is);
226 template <
typename TDE,
typename TSwap>
229 return static_cast<TDE*
>(
this)->
template ReadValueWithLength<TSwap>(is, length);
232 template <
typename TDE,
typename TSwap>
234 return static_cast<TDE*
>(
this)->
template ReadWithLength<TSwap>(is,length);
237 template <
typename TDE,
typename TSwap>
238 const std::ostream &
Write(std::ostream &os)
const {
239 return static_cast<const TDE*
>(
this)->
template Write<TSwap>(os);
269 return ! ( lhs == rhs );
Class to represent binary value (array of bytes)
Definition gdcmByteValue.h:35
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
const VL & GetVL() const
Get VL.
Definition gdcmDataElement.h:74
VL GetLength() const
Definition gdcmDataElement.h:201
SmartPointer< Value > ValuePtr
Definition gdcmDataElement.h:249
const Tag & GetTag() const
Get Tag.
Definition gdcmDataElement.h:67
const std::ostream & Write(std::ostream &os) const
Definition gdcmDataElement.h:238
void Clear()
Clear Data Element (make Value empty and invalidate Tag & VR)
Definition gdcmDataElement.h:112
bool IsUndefinedLength() const
return if Value Length if of undefined length
Definition gdcmDataElement.h:153
void SetVL(const VL &vl)
Definition gdcmDataElement.h:79
void Empty()
Make Data Element empty (no Value)
Definition gdcmDataElement.h:109
VR const & GetVR() const
Definition gdcmDataElement.h:84
std::istream & ReadOrSkip(std::istream &is, std::set< Tag > const &skiptags)
Definition gdcmDataElement.h:211
ValuePtr ValueField
Definition gdcmDataElement.h:250
bool operator<(const DataElement &de) const
Definition gdcmDataElement.h:165
std::istream & ReadValueWithLength(std::istream &is, VL &length, std::set< Tag > const &skiptags)
Definition gdcmDataElement.h:227
const ByteValue * GetByteValue() const
Definition gdcmDataElement.h:133
void SetTag(const Tag &t)
Definition gdcmDataElement.h:71
Tag TagField
Definition gdcmDataElement.h:243
bool IsEmpty() const
Check if Data Element is empty.
Definition gdcmDataElement.h:106
VL & GetVL()
Definition gdcmDataElement.h:75
bool operator==(const DataElement &de) const
Definition gdcmDataElement.h:172
std::istream & ReadWithLength(std::istream &is, VL &length)
Definition gdcmDataElement.h:233
VL ValueLengthField
Definition gdcmDataElement.h:245
DataElement(const DataElement &_val)
Definition gdcmDataElement.h:157
const SequenceOfFragments * GetSequenceOfFragments() const
DataElement & operator=(const DataElement &)=default
DataElement(const Tag &t=Tag(0), const VL &vl=0, const VR &vr=VR::INVALID)
Definition gdcmDataElement.h:61
Value const & GetValue() const
Set/Get Value (bytes array, SQ of items, SQ of fragments):
Definition gdcmDataElement.h:94
void SetValue(Value const &vl)
Definition gdcmDataElement.h:100
SequenceOfFragments * GetSequenceOfFragments()
SmartPointer< SequenceOfItems > GetValueAsSQ() const
void SetByteValue(const char *array, VL length)
Definition gdcmDataElement.h:126
VR VRField
Definition gdcmDataElement.h:248
Tag & GetTag()
Definition gdcmDataElement.h:68
Value & GetValue()
Definition gdcmDataElement.h:95
std::istream & ReadPreValue(std::istream &is, std::set< Tag > const &skiptags)
Definition gdcmDataElement.h:217
std::istream & ReadValue(std::istream &is, std::set< Tag > const &skiptags)
Definition gdcmDataElement.h:222
std::istream & Read(std::istream &is)
Definition gdcmDataElement.h:206
void SetVR(VR const &vr)
Definition gdcmDataElement.h:88
void SetValueFieldLength(VL vl, bool readvalues)
virtual void Print(std::ostream &) const
Definition gdcmObject.h:87
Class to represent a Sequence Of Fragments.
Definition gdcmSequenceOfFragments.h:32
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
Value Length.
Definition gdcmVL.h:30
VR class.
Definition gdcmVR.h:55
Class to represent the value of a Data Element.
Definition gdcmValue.h:32
virtual VL GetLength() const =0
#define gdcmAssertAlwaysMacro(arg)
AssertAlways.
Definition gdcmTrace.h:228
#define GDCM_EXPORT
Definition gdcmWin32.h:34
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88
bool operator!=(const CodeString &ref, const CodeString &cs)
Definition gdcmCodeString.h:97