55 template <
typename TSwap>
56 std::istream &
Read(std::istream &is)
58 ReadPreValue<TSwap>(is);
59 return ReadValue<TSwap>(is);
62 template <
typename TSwap>
65 TagField.Read<TSwap>(is);
71 if( !ValueLengthField.Read<TSwap>(is) )
78#ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
79 const Tag itemStart(0xfffe, 0xe000);
80 const Tag seqDelItem(0xfffe,0xe0dd);
81 if( TagField != itemStart && TagField != seqDelItem )
89 template <
typename TSwap>
94 bv->SetLength(ValueLengthField);
95 if( !bv->Read<TSwap>(is) )
109 template <
typename TSwap>
112 const Tag itemStart(0xfffe, 0xe000);
113 const Tag seqDelItem(0xfffe,0xe0dd);
116 const std::streampos start = is.tellg();
121 TagField.Read<TSwap>(is);
123 if( TagField != itemStart && TagField != seqDelItem )
126 is.seekg( (std::streampos)((
size_t)start - offset) );
127 gdcmWarningMacro(
"Fuzzy Search, backtrack: " << (start - is.tellg()) <<
" Offset: " << is.tellg() );
131 throw "Impossible to backtrack";
139 assert( TagField == itemStart || TagField == seqDelItem );
140 if( !ValueLengthField.Read<TSwap>(is) )
147 bv->SetLength(ValueLengthField);
148 if( !bv->Read<TSwap>(is) )
163 template <
typename TSwap>
164 std::ostream &
Write(std::ostream &os)
const {
165 const Tag itemStart(0xfffe, 0xe000);
166 const Tag seqDelItem(0xfffe,0xe0dd);
167 if( !TagField.Write<TSwap>(os) )
169 assert(0 &&
"Should not happen");
172 assert( TagField == itemStart
173 || TagField == seqDelItem );
182 if( !zero.
Write<TSwap>(os) )
184 assert(0 &&
"Should not happen");
190 assert( ValueLengthField );
191 assert( !ValueLengthField.IsUndefined() );
193 assert( actuallen == ValueLengthField || actuallen == ValueLengthField + 1 );
194 if( !actuallen.
Write<TSwap>(os) )
196 assert(0 &&
"Should not happen");
201 if( ValueLengthField && bv )
205 assert( bv->
GetLength() == ValueLengthField );
206 if( !bv->
Write<TSwap>(os) )
208 assert(0 &&
"Should not happen");
Class to represent binary value (array of bytes)
Definition gdcmByteValue.h:35
std::ostream const & Write(std::ostream &os) const
Definition gdcmByteValue.h:167
VL ComputeLength() const
Definition gdcmByteValue.h:79
VL GetLength() const override
Definition gdcmByteValue.h:77
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
ValuePtr ValueField
Definition gdcmDataElement.h:250
Tag TagField
Definition gdcmDataElement.h:243
VL ValueLengthField
Definition gdcmDataElement.h:245
Exception.
Definition gdcmException.h:44
Class to represent a Fragment.
Definition gdcmFragment.h:44
std::istream & ReadPreValue(std::istream &is)
Definition gdcmFragment.h:63
Fragment()
Definition gdcmFragment.h:48
std::ostream & Write(std::ostream &os) const
Definition gdcmFragment.h:164
std::istream & ReadBacktrack(std::istream &is)
Definition gdcmFragment.h:110
std::istream & Read(std::istream &is)
Definition gdcmFragment.h:56
std::istream & ReadValue(std::istream &is)
Definition gdcmFragment.h:90
ParseException Standard exception handling object.
Definition gdcmParseException.h:37
void SetLastElement(DataElement &de)
Definition gdcmParseException.h:71
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
const std::ostream & Write(std::ostream &os) const
Definition gdcmVL.h:99
#define gdcmWarningMacro(msg)
Warning.
Definition gdcmTrace.h:142
#define gdcmErrorMacro(msg)
Error this is pretty bad, more than just warning It could mean lost of data, something not handle....
Definition gdcmTrace.h:165
#define GDCM_EXPORT
Definition gdcmWin32.h:34
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88