23 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
49 friend std::ostream&
operator<< (std::ostream &os,
const Item &val);
53 NestedDataSet.Clear();
56 template <
typename TDE>
60 NestedDataSet.Insert(de);
62 if( !IsUndefinedLength() )
64 assert( 0 &&
"InsertDataElement" );
70 return NestedDataSet.GetDataElement(t);
77 NestedDataSet = nested;
93 NestedDataSet = val.NestedDataSet;
96 template <
typename TDE,
typename TSwap>
97 std::istream &
Read(std::istream &is) {
100 DataSet &nested = NestedDataSet;
104 if( !TagField.Read<TSwap>(is) )
106 throw Exception(
"Should not happen (item)");
109 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
111 if( TagField ==
Tag(0xfeff, 0x00e0)
112 || TagField ==
Tag(0xfeff, 0xdde0) )
117 assert ( TagField ==
Tag(0xfffe, 0xe000)
118 || TagField ==
Tag(0xfffe, 0xe0dd) );
122 assert(0 &&
"Should not happen");
127 if( TagField ==
Tag(0xfffe,0xe0dd) )
129 if( ValueLengthField )
142 else if( ValueLengthField.IsUndefined() )
144 DataSet &nested = NestedDataSet;
147 std::streampos start = is.tellg();
150 nested.template ReadNested<TDE,SwapperDoOp>(is);
159 gdcmWarningMacro(
"Attempt to read nested Item without byteswapping the Value Length." );
162 is.seekg( start, std::ios::cur );
164 nested.template ReadNested<TDE,SwapperNoOp>(is);
167 bsf.SetByteSwapTag(
true);
182 DataSet &nested = NestedDataSet;
185 nested.template ReadWithLength<TDE,SwapperDoOp>(is, ValueLengthField);
193 if( TagField ==
Tag(0x3f3f, 0x3f00) )
198 if( TagField !=
Tag(0xfffe, 0xe000) && TagField !=
Tag(0xfffe, 0xe0dd) )
203 assert( TagField ==
Tag(0xfffe, 0xe000) || TagField ==
Tag(0xfffe, 0xe0dd) );
205 if( !ValueLengthField.Read<TSwap>(is) )
207 assert(0 &&
"Should not happen");
211 if( TagField ==
Tag(0xfffe,0xe0dd) )
214 if( ValueLengthField )
216 gdcmDebugMacro(
"ValueLengthField is not 0 but " << ValueLengthField );
219 else if( ValueLengthField.IsUndefined() )
221 DataSet &nested = NestedDataSet;
224 nested.template ReadNested<TDE,TSwap>(is);
228 assert( !ValueLengthField.IsUndefined() );
229 DataSet &nested = NestedDataSet;
231 assert( nested.IsEmpty() );
232 nested.template ReadWithLength<TDE,TSwap>(is, ValueLengthField);
238 template <
typename TDE,
typename TSwap>
239 const std::ostream &
Write(std::ostream &os)
const {
240 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
241 if( TagField ==
Tag(0x3f3f,0x3f00) &&
false )
243 Tag t(0xfffe, 0xe000);
249 assert ( TagField ==
Tag(0xfffe, 0xe000)
250 || TagField ==
Tag(0xfffe, 0xe0dd) );
252 if( TagField ==
Tag(0xfffe, 0xe0dd) )
255 assert( ValueLengthField == 0 );
256 assert( NestedDataSet.Size() == 0 );
258 if( !TagField.Write<TSwap>(os) )
260 assert(0 &&
"Should not happen");
264 if( ValueLengthField.IsUndefined() )
266 if( !ValueLengthField.Write<TSwap>(os) )
268 assert(0 &&
"Should not happen");
276 if( !dummy.
Write<TSwap>(os) )
278 assert(0 &&
"Should not happen");
283 NestedDataSet.Write<TDE,TSwap>(os);
284 if( ValueLengthField.IsUndefined() )
286 const Tag itemDelItem(0xfffe,0xe00d);
287 itemDelItem.
Write<TSwap>(os);
289 zero.
Write<TSwap>(os);
303 return NestedDataSet.FindDataElement( t );
318 val.NestedDataSet.
Print( os,
"\t" );
326 #include "gdcmItem.txx"
void Print(std::ostream &os, std::string const &indent="") const
Definition: gdcmDataSet.h:79
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
VL GetLength() const
Definition: gdcmVL.h:68
void InsertDataElement(const DataElement &de)
Definition: gdcmItem.h:59
std::istream & Read(std::istream &is)
Definition: gdcmItem.h:97
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
void SetNestedDataSet(const DataSet &nested)
Definition: gdcmItem.h:75
#define gdcmWarningMacro(msg)
Warning.
Definition: gdcmTrace.h:141
Value Length.
Definition: gdcmVL.h:29
#define gdcmDebugMacro(msg)
Debug.
Definition: gdcmTrace.h:119
ParseException Standard exception handling object.
Definition: gdcmParseException.h:26
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
VL ValueLengthField
Definition: gdcmDataElement.h:259
Item(Item const &val)
Definition: gdcmItem.h:91
const std::ostream & Write(std::ostream &os) const
Write a tag in binary rep.
Definition: gdcmTag.h:169
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
Class to represent an Item A component of the value of a Data Element that is of Value Representation...
Definition: gdcmItem.h:45
const DataElement & GetDataElement(const Tag &t) const
Definition: gdcmItem.h:68
bool FindDataElement(const Tag &t) const
Definition: gdcmItem.h:302
const std::ostream & Write(std::ostream &os) const
Definition: gdcmVL.h:99
void Clear()
Clear Data Element (make Value empty and invalidate Tag & VR)
Definition: gdcmDataElement.h:109
const std::ostream & Write(std::ostream &os) const
Definition: gdcmItem.h:239
ByteSwapFilter In place byte-swapping of a dataset FIXME: FL status ??
Definition: gdcmByteSwapFilter.h:27
void Clear()
Definition: gdcmDataSet.h:70
bool IsEmpty() const
Returns if the dataset is empty.
Definition: gdcmDataSet.h:218
Definition: gdcmSwapper.h:53
DataSet & GetNestedDataSet()
Definition: gdcmItem.h:84
Item()
Definition: gdcmItem.h:48
const DataSet & GetNestedDataSet() const
Definition: gdcmItem.h:80
#define gdcmErrorMacro(msg)
Error this is pretty bad, more than just warning It could mean lost of data, something not handle...
Definition: gdcmTrace.h:163
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38
Tag TagField
Definition: gdcmDataElement.h:257
void Clear()
Definition: gdcmItem.h:51
Exception.
Definition: gdcmException.h:33