/// <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 ReadElementImplicitLittleEndian(DICOMBinaryReader dr) { var tag = TagReader.ReadLittleEndian(dr); var vr = TagDictionary.GetVRFromTag(tag); int length = LengthReader.ReadLittleEndian(VR.Null, dr); var data = DataReader.ReadLittleEndian(length, dr, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN); var el = ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN); return(el); }
/// <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 ReadElementImplicitLittleEndian(DICOMBinaryReader dr) { Tag tag = TagReader.ReadLittleEndian(dr); VR vr = TagDictionary.GetVRFromTag(tag); if (CheckForExplicitness(tag, dr, ref vr)) { return(ReadElementExplicitLittleEndian(tag, vr, dr)); } else { int length = LengthReader.ReadLittleEndian(VR.Null, dr); byte[] data = DataReader.ReadLittleEndian(length, dr, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN); IDICOMElement el = ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN); return(el); } }