如何使用fo-dicom从序列中读取嵌套/子DICOM标签? [英] How to read nested/child DICOM tags from sequences using fo-dicom?

查看:712
本文介绍了如何使用fo-dicom从序列中读取嵌套/子DICOM标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的项目,我试图从VS2015(.Net 4.5.2)中使用fo-dicom 3.0.2和C#的DICOM文件中读取放射治疗计划(RT Plan).

For my project, I'm trying to read a radiation therapy plan (RT Plan) out of a DICOM file with fo-dicom 3.0.2 and C# in VS2015 (.Net 4.5.2).

由于使用DICOM编辑器,我知道存储在不同DicomTags中的值,但是我无法访问所有Tag.例如,我正在尝试读取DicomTag.BeamDose,但我知道该值不为空.

Thanks to a DICOM Editor, I know the values stored in the different DicomTags, but I cant get access to all Tags. e.g I'm trying to read the DicomTag.BeamDose and I know the value isn't empty.

string storedfile = file_path + file_name;
Dicom.DicomFile file = Dicom.DicomFile.Open(@storedfile);

MessageBox.Show(file.Dataset.Get<string>(Dicom.DicomTag.BeamDose));

运行代码会引发异常消息:

Running the code throws an exception with message:

在数据集中找不到

(300a,0084).

(300a,0084) not found in dataset.

如前所述,我知道它在那里,但是嵌套在序列中. 我接下来尝试做的是分析BeamDose的存储顺序.

As mentioned I know it is there, but nested in items of sequences in sequences. Next thing I tried is to analyse the sequence, where BeamDose is stored.

var NewDataSet = file.Dataset.Get<Dicom.DicomItem>(Dicom.DicomTag.FractionGroupSequence);

但是每次处理此变量的机会都不会使我进入顺序的下一个层次.

But every next opportunity to handle this variable doesn't bring me to the next level of the sequence.

我应该如何使用fo-dicom从序列中读取嵌套/子DICOM标签?

How should I read nested/child DICOM tags from sequences using fo-dicom?

推荐答案

查找标签的方式仅在DICOM标签树的最外层层次中查找.要正确搜索标签,您需要先访问正确的序列,然后访问适当的项目,然后再在该项目中搜索标签. DICOM数据集可能包含甚至可以进一步嵌套的序列(由VR SQ标识).

The way you are looking for tag only look for it in outermost hierarchy of DICOM tag tree. To search the tag correctly, you need to access the correct sequence first, then the appropriate item and then you should search the tag in that item. DICOM Dataset may contain sequences (identified by VR SQ) those could be even further nested.

以下内容是从此处复制的:

VR标识的"SQ"应用于值由零个或多个项目序列组成的数据元素,其中每个项目都包含一组数据元素. SQ提供了一种灵活的编码方案,可用于重复数据元素集的简单结构,或通常称为文件夹的更复杂的信息对象定义的编码. SQ数据元素还可用于递归包含多层嵌套结构.

The VR identified "SQ" shall be used for Data Elements with a Value consisting of a Sequence of zero or more Items, where each Item contains a set of Data Elements. SQ provides a flexible encoding scheme that may be used for simple structures of repeating sets of Data Elements, or the encoding of more complex Information Object Definitions often called folders. SQ Data Elements can also be used recursively to contain multi-level nested structures.

项目应为有序集合,其中每个项目都可以按其序号位置进行引用.每个项目都应隐式分配一个序号位置,该序号位置应是序列中第一个项目的值1,之后每个后续项目的值应增加1.序列中的最后一个项目的序号位置应等于序列中的项目数.

Items present in an SQ Data Element shall be an ordered set where each Item may be referenced by its ordinal position. Each Item shall be implicitly assigned an ordinal position starting with the value 1 for the first Item in the Sequence, and incremented by 1 with each subsequent Item. The last Item in the Sequence shall have an ordinal position equal to the number of Items in the Sequence.

以下内容是从此处复制的副本:

Following is copied from here:

DICOM允许数据集包含其他嵌套的数据集,这些数据集被编码为序列".此结构的重点是允许重复数据组,因此尽管此类序列通常仅包含一个数据集,但定义格式时应使每个序列都由一组数据集组成.当然,此结构非常适合递归,某些DICOM IOD(例如Structured_Reporting和Radiotherapy_Extensions)可以使用嵌套5或6个深度的序列!

DICOM allows a dataset to contain other nested datasets, which are encoded as "sequences". The point of this structure is to allow repeating groups of data, so whilst such sequences often only contain a single dataset, the format is defined such that each sequence consists of a set of datasets. Of course, this structure lends itself perfectly to recursion, and some DICOM IODs such a Structured_Reporting and the Radiotherapy_Extensions can use sequences nested 5 or 6 deep !

序列的格式如下所示: [

The format of a sequence is as shown here: [


足够的理论.以下是如何读取序列中的嵌套标签:


Enough theory. Following is how you can read nested tags within the sequences:

var value = file.Dataset.Get<DicomSequence>(DicomTag.FractionGroupSequence).Items[0].Get<string>(DicomTag.BeamDose);

有关更多详细信息,请参考线程.

Refer this thread for more details.

这篇关于如何使用fo-dicom从序列中读取嵌套/子DICOM标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆