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

流过昼夜 提交于 2019-12-02 08:48:02

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.

Following is copied from 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.

Following is copied from 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: [


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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!