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

标签 c# dicom fo-dicom

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

感谢 DICOM 编辑器,我知道存储在不同 DicomTags 中的值,但我无法访问所有 Tag。例如,我正在尝试读取 DicomTag.BeamDose 并且我知道该值不为空。

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

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

运行代码会抛出异常消息:

(300a,0084) not found in dataset.

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

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

但每一次处理这个变量的机会都不会把我带到序列的下一个级别。

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

最佳答案

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

以下内容复制自here :

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.

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.

以下内容复制自here :

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: [Image][3]


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

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

引用this线程以获取更多详细信息。

关于c# - 如何使用 fo-dicom 从序列中读取嵌套/子 DICOM 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46690392/

相关文章:

c++ - 未使用 ITK 正确读取 DICOM 图像系列

c# - 具有多个值的 Dicom US

c# - 如何使用 fo-DICOM 删除或更新私有(private)标签?

c# - 如何为现有框架 (BCL) 代码指定代码约定?

c# - 使用 Angular 将 POST 2 引导参数传递给 API

python - 在Python中使用插值统一ct扫描体素大小

fo-dicom - 我可以通过 FO-DICOM 中的登录号查询 MWL(模态工作列表)吗?

dicom - 如何将患者插入/更新到 DICOM WorkList RIS?

c# - 解析 HTML 文档?

c# - 无法在 selenium webdriver c# 中双击