Пример #1
0
        /// <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)
        {
            var tag    = TagReader.ReadBigEndian(dr);
            var vr     = VRReader.Read(dr);
            int length = LengthReader.ReadBigEndian(vr, dr);
            var data   = DataReader.ReadBigEndian(length, dr);

            return(ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.EXPLICIT_VR_BIG_ENDIAN));
        }
Пример #2
0
        /// <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 ReadElementExplicitLittleEndian(DICOMBinaryReader dr)
        {
            Tag tag    = TagReader.ReadLittleEndian(dr);
            VR  vr     = VRReader.Read(dr);
            int length = LengthReader.ReadLittleEndian(vr, dr);

            byte[] data = DataReader.ReadLittleEndian(length, dr, TransferSyntax.EXPLICIT_VR_LITTLE_ENDIAN);
            return(ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.EXPLICIT_VR_LITTLE_ENDIAN));
        }
Пример #3
0
        public static void SkipElementExplicitBigEndian(DICOMBinaryReader dr)
        {
            Tag tag    = TagReader.ReadBigEndian(dr);
            VR  vr     = VRReader.Read(dr);
            int length = LengthReader.ReadBigEndian(vr, dr);

            if (length != -1)
            {
                dr.Skip(length);
            }
            else
            {
                dr.Skip(SequenceReader.ReadIndefiniteLengthBigEndian(dr));
                dr.Skip(8);
            }
        }
Пример #4
0
        public static void SkipElementExplicitLittleEndian(DICOMBinaryReader dr)
        {
            Tag tag    = TagReader.ReadLittleEndian(dr);
            VR  vr     = VRReader.Read(dr);
            int length = LengthReader.ReadLittleEndian(vr, dr);

            if (length != -1)
            {
                dr.Skip(length);
            }
            else
            {
                dr.Skip(SequenceReader.ReadIndefiniteLengthLittleEndian(dr, TransferSyntax.EXPLICIT_VR_LITTLE_ENDIAN));
                dr.Skip(8);
            }
        }