• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Reading.DICOMBinaryReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ReadIndefiniteLengthLittleEndian

 public static int ReadIndefiniteLengthLittleEndian(DICOMBinaryReader dr, TransferSyntax syntax)
 {
     long startingPos = dr.StreamPosition;
     while (!IsEndOfSequenceLittleEndian(dr))
     {
         dr.StreamPosition -= 8;
         SequenceItemReader.SkipItemLittleEndian(dr, syntax);
     }
     return CalculateLength(dr, startingPos)-8;
 }
开发者ID:baheywadea,项目名称:Evil-DICOM,代码行数:10,代码来源:SequenceReader.cs


示例17: Read

 /// <summary>
 ///     Reads the length from a series of bytes in a stream. The number of bytes is automatically determined from
 ///     VR.
 /// </summary>
 /// <param name="vr">the value representation of the element</param>
 /// <param name="dr">the binary stream with a current position on the length parameter</param>
 /// <param name="syntax">the transfer syntax of this element</param>
 /// <returns></returns>
 public static int Read(VR vr, DICOMBinaryReader dr, TransferSyntax syntax)
 {
     switch (syntax)
     {
         case TransferSyntax.EXPLICIT_VR_BIG_ENDIAN:
             return ReadBigEndian(vr, dr);
         default:
             return ReadLittleEndian(vr, dr);
     }
 }
开发者ID:Baasanjav,项目名称:Evil-DICOM,代码行数:18,代码来源:LengthReader.cs


示例18: ReadObject

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


示例19: ReadIndefiniteLengthBigEndian

 public static int ReadIndefiniteLengthBigEndian(DICOMBinaryReader dr)
 {
     long startingPos = dr.StreamPosition;
     while (!IsEndOfSequenceBigEndian(dr))
     {
         dr.StreamPosition -= 8;
         SequenceItemReader.SkipItemBigEndian(dr);
     }
     return CalculateLength(dr, startingPos)-8;
 }
开发者ID:baheywadea,项目名称:Evil-DICOM,代码行数:10,代码来源:SequenceReader.cs


示例20: ReadVR

 public static VR ReadVR(DICOMBinaryReader dr)
 {
     char[] vr = dr.ReadChars(2);
     VR foundVR = VRDictionary.GetVRFromAbbreviation(new string(vr));
     if (foundVR == VR.Null)
     {
         throw new Exception(ExceptionHelper.VRReadException);
     }
     return foundVR;
 }
开发者ID:rexcardan,项目名称:Evil-DICOM,代码行数:10,代码来源:VRReader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextBlocks.Block类代码示例发布时间:2022-05-24
下一篇:
C# NoteStore.NoteFilter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap