当前位置: 首页>>代码示例>>C#>>正文


C# Reading.DICOMBinaryReader类代码示例

本文整理汇总了C#中EvilDICOM.Core.IO.Reading.DICOMBinaryReader的典型用法代码示例。如果您正苦于以下问题:C# DICOMBinaryReader类的具体用法?C# DICOMBinaryReader怎么用?C# DICOMBinaryReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DICOMBinaryReader类属于EvilDICOM.Core.IO.Reading命名空间,在下文中一共展示了DICOMBinaryReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadFileMetadata

        /// <summary>
        /// Read explicit VR little endian up to transfer syntax element and determines transfer syntax for rest of elements
        /// </summary>
        /// <param name="dr">the binary reader which is reading the DICOM object</param>
        /// <param name="syntax">the transfer syntax of the DICOM file</param>
        /// <returns>elements preceeding and including transfer syntax element</returns>
        private static List<IDICOMElement> ReadFileMetadata(DICOMBinaryReader dr, out TransferSyntax syntax)
        {
            List<IDICOMElement> elements = new List<IDICOMElement>();
            syntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN;

            while (dr.StreamPosition < dr.StreamLength)
            {
                long position = dr.StreamPosition;
                if (TagReader.ReadLittleEndian(dr).Group == _MetaGroup)
                {
                    dr.StreamPosition = position;
                    IDICOMElement el = DICOMElementReader.ReadElementExplicitLittleEndian(dr);
                    if (el.Tag.CompleteID == TagHelper.TRANSFER_SYNTAX_UID.CompleteID)
                    {
                        syntax = TransferSyntaxHelper.GetSyntax(el);
                    }
                    elements.Add(el);
                }
                else
                {
                    dr.StreamPosition = position;
                    break;
                }
            }

            return elements;
        }
开发者ID:baheywadea,项目名称:Evil-DICOM,代码行数:33,代码来源:DICOMFileReader.cs

示例2: PeekVR

 public static VR PeekVR(DICOMBinaryReader dr)
 {
     byte[] vrBytes = dr.Peek(2);
     char[] vr = Encoding.UTF8.GetChars(vrBytes);
     VR foundVR = VRDictionary.GetVRFromAbbreviation(new string(vr));
     return foundVR;
 }
开发者ID:rexcardan,项目名称:Evil-DICOM,代码行数:7,代码来源:VRReader.cs

示例3: ReadFileMetadata

        /// <summary>
        ///     Read explicit VR little endian up to transfer syntax element and determines transfer syntax for rest of elements
        /// </summary>
        /// <param name="dr">the binary reader which is reading the DICOM object</param>
        /// <param name="syntax">the transfer syntax of the DICOM file</param>
        /// <returns>elements preceeding and including transfer syntax element</returns>
        public static List<IDICOMElement> ReadFileMetadata(DICOMBinaryReader dr, ref TransferSyntax syntax)
        {
            var elements = new List<IDICOMElement>();
            syntax = syntax != TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN
                ? syntax
                : TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN;

            while (dr.StreamPosition < dr.StreamLength)
            {
                long position = dr.StreamPosition;
                if (TagReader.ReadLittleEndian(dr).Group == _metaGroup)
                {
                    dr.StreamPosition = position;
                    IDICOMElement el = DICOMElementReader.ReadElementExplicitLittleEndian(dr);
                    Tag uid = TagHelper.TRANSFER_SYNTAX_UID;
                    if (el.Tag == uid)
                    {
                        syntax = TransferSyntaxHelper.GetSyntax(el);
                    }
                    elements.Add(el);
                }
                else
                {
                    dr.StreamPosition = position;
                    break;
                }
            }

            return elements;
        }
开发者ID:waynemunro,项目名称:Evil-DICOM,代码行数:36,代码来源:DICOMFileReader.cs

示例4: ReadUIDItem

 private static string ReadUIDItem(DICOMBinaryReader dr, string itemName, ItemType iType)
 {
     AssertItemType(dr, itemName, iType);
     dr.Skip(2); // PDU ID and Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     return dr.ReadString(length).Trim();
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:7,代码来源:ItemReader.cs

示例5: WriteDecimalString

        public void WriteDecimalString()
        {
            var ds = new DecimalString();
            ds.DData_ = Enumerable.Range(1, 15000).Select(i => ((double)i) + 0.005).ToList();
            ds.Tag = new Tag("00082130");
            byte[] written;
            var settings = DICOMWriteSettings.Default();

            using (var ms = new MemoryStream())
            {
                using (var dw = new DICOMBinaryWriter(ms))
                {

                    DICOMElementWriter.Write(dw, DICOMWriteSettings.Default(), ds);
                }
                written = ms.ToArray();
            }

            using (var dr = new DICOMBinaryReader(written))
            {
                var read = DICOMElementReader.ReadElementImplicitLittleEndian(dr) as DecimalString;
                CollectionAssert.AreEqual(ds.DData_, read.Data_);
            }


        }
开发者ID:Zaid-Safadi,项目名称:Evil-DICOM,代码行数:26,代码来源:ElementWriterTests.cs

示例6: SkipItemLittleEndian

 public static void SkipItemLittleEndian(DICOMBinaryReader dr, TransferSyntax syntax)
 {
     int length = LengthReader.ReadLittleEndian(VR.Null, dr.Skip(4));
     if (length != -1)
     {
         dr.Skip(length);
     }
     else
     {
         if (syntax == TransferSyntax.EXPLICIT_VR_LITTLE_ENDIAN)
         {
             while (!IsEndOfSequenceItemLittleEndian(dr))
             {
                 dr.StreamPosition -= 8;
                 DICOMElementReader.SkipElementExplicitLittleEndian(dr);
             }
         }
         else
         {
             while (!IsEndOfSequenceItemLittleEndian(dr))
             {
                 dr.StreamPosition -= 8;
                 DICOMElementReader.SkipElementImplicitLittleEndian(dr);
             }
         }
     }
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:27,代码来源:SequenceItemReader.cs

示例7: ReadPresentationCtxRequest

 public static PresentationContext ReadPresentationCtxRequest(DICOMBinaryReader dr)
 {
     AssertItemType(dr, "Presentation Context Request", ItemType.PRESENTATION_CONTEXT_REQUEST);
     dr.Skip(2); // PDU id Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     return ReadPresentationCtxContents(dr.Take(length), true);
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:7,代码来源:ItemReader.cs

示例8: ReadMaxLength

 public static int? ReadMaxLength(DICOMBinaryReader dr)
 {
     AssertItemType(dr, "Maximum Length", ItemType.MAXIMUM_LENGTH);
     dr.Skip(2); // PDU ID and Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     return LengthReader.ReadBigEndian(dr, 4);
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:7,代码来源:ItemReader.cs

示例9: ReadPDVItem

 public static PDVItem ReadPDVItem(DICOMBinaryReader dr)
 {
     var pi = new PDVItem();
     int length = LengthReader.ReadBigEndian(dr, 4);
     pi.PresentationContextID = dr.Take(1)[0];
     pi.Fragment = ReadPDVFragment(dr, length - 1);
     return pi;
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:8,代码来源:ItemReader.cs

示例10: ReadElementExplicitBigEndian

 /// <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.Read(dr);
     int length = LengthReader.ReadBigEndian(vr, dr);
     byte[] data = DataReader.ReadBigEndian(length, dr);
     return ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.EXPLICIT_VR_BIG_ENDIAN);
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:13,代码来源:DICOMElementReader.cs

示例11: ReadPDVFragment

 public static PDVItemFragment ReadPDVFragment(DICOMBinaryReader dr, int length)
 {
     var pif = new PDVItemFragment();
     byte messageHeader = dr.Take(1)[0];
     pif.IsCommandObject = messageHeader.GetBit(0);
     pif.IsLastItem = messageHeader.GetBit(1);
     pif.Data = dr.ReadBytes(length - 1);
     return pif;
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:9,代码来源:ItemReader.cs

示例12: ReadElementImplicitLittleEndian

 /// <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);
     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;
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:14,代码来源:DICOMElementReader.cs

示例13: ReadObject

 public static DICOMObject ReadObject(byte[] objectBytes, TransferSyntax syntax)
 {
     List<IDICOMElement> elements;
     using (DICOMBinaryReader dr = new DICOMBinaryReader(objectBytes))
     {
         elements = DICOMElementReader.ReadAllElements(dr, syntax);
     }
     return new DICOMObject(elements);
 }
开发者ID:baheywadea,项目名称:Evil-DICOM,代码行数:9,代码来源:DICOMObjectReader.cs

示例14: ReadAllElementsImplicitLittleEndian

 /// <summary>
 /// Reads and returns all elements in implicit little endian format
 /// </summary>
 /// <param name="dr">the binary reader which is reading the DICOM object</param>
 /// <returns>DICOM elements read</returns>
 public static List<IDICOMElement> ReadAllElementsImplicitLittleEndian(DICOMBinaryReader dr)
 {
     List<IDICOMElement> elements = new List<IDICOMElement>();
     while (dr.StreamPosition < dr.StreamLength)
     {
         elements.Add(ReadElementImplicitLittleEndian(dr));
     }
     return elements;
 }
开发者ID:baheywadea,项目名称:Evil-DICOM,代码行数:14,代码来源:DICOMElementReader.cs

示例15: ReadAsyncOperations

 public static AsyncOperations ReadAsyncOperations(DICOMBinaryReader dr)
 {
     AssertItemType(dr, "Async Operations", ItemType.ASYNCHRONOUS_OPERATIONS_WINDOW);
     var ao = new AsyncOperations();
     dr.Skip(2); // // PDU ID and Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     ao.MaxInvokeOperations = LengthReader.ReadBigEndian(dr, 2);
     ao.MaxPerformOperations = LengthReader.ReadBigEndian(dr, 2);
     return ao;
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:10,代码来源:ItemReader.cs


注:本文中的EvilDICOM.Core.IO.Reading.DICOMBinaryReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。