/// <summary> /// Reads and returns the next DICOM element starting at the current location in the DICOM binary reader /// </summary> /// <param name="dr">the binary reader which is reading the DICOM object</param> /// <returns>the next DICOM element</returns> public static IDICOMElement ReadElementExplicitBigEndian(DICOMBinaryReader dr, StringEncoding enc) { var tag = TagReader.ReadBigEndian(dr); var vr = VRReader.ReadVR(dr); var length = LengthReader.ReadBigEndian(vr, dr); var data = DataReader.ReadBigEndian(length, dr); return(ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.EXPLICIT_VR_BIG_ENDIAN, enc)); }
/// <summary> /// Reads and returns the next DICOM element starting at the current location in the DICOM binary reader /// </summary> /// <param name="dr">the binary reader which is reading the DICOM object</param> /// <returns>the next DICOM element</returns> public static IDICOMElement ReadElementExplicitBigEndian(DICOMBinaryReader dr) { Tag tag = TagReader.ReadBigEndian(dr); VR vr = VRReader.ReadVR(dr); int length = LengthReader.ReadBigEndian(vr, dr); byte[] data = DataReader.ReadBigEndian(length, dr); return(ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.EXPLICIT_VR_BIG_ENDIAN)); }
public static void SkipElementExplicitBigEndian(DICOMBinaryReader dr) { var tag = TagReader.ReadBigEndian(dr); var vr = VRReader.ReadVR(dr); var length = LengthReader.ReadBigEndian(vr, dr); if (length != -1) { dr.Skip(length); } else { dr.Skip(SequenceReader.ReadIndefiniteLengthBigEndian(dr)); dr.Skip(8); } }
public static void SkipItemBigEndian(DICOMBinaryReader dr) { var length = LengthReader.ReadBigEndian(VR.Null, dr.Skip(4)); if (length != -1) { dr.Skip(length); } else { while (!IsEndOfSequenceItemBigEndian(dr) && dr.StreamLength != dr.StreamPosition) { dr.StreamPosition -= 8; DICOMElementReader.SkipElementExplicitBigEndian(dr); } } }
public static DICOMObject ReadBigEndian(DICOMBinaryReader dr, TransferSyntax syntax, StringEncoding enc) { DICOMObject d; //Skip tag dr.Skip(4); var length = LengthReader.ReadBigEndian(VR.Null, dr); if (LengthReader.IsIndefinite(length)) { d = ReadIndefiniteBigEndian(dr, syntax, enc); } else { d = DICOMObjectReader.ReadObject(dr.ReadBytes(length), syntax); } return(d); }