这里是示出使用rtstruct.dcm文件中的数据布局的交互式会话附带pydicom:
>>> import dicom
>>> ds = dicom.read_file("rtstruct.dcm", force=True)
>>> ds.dir("contour")
['ROIContourSequence']
>>> ctrs = ds.ROIContourSequence
>>> ctrs[0]
(3006, 002a) ROI Display Color IS: ['220', '160', '120']
(3006, 0040) Contour Sequence 3 item(s) ----
(3006, 0042) Contour Geometric Type CS: 'CLOSED_PLANAR'
(3006, 0046) Number of Contour Points IS: '5'
(3006, 0048) Contour Number IS: '1'
(3006, 0050) Contour Data DS: ['-200.0', '150.0', '-20
0.0', '-200.0', '-150.0', '-200.0', '200.0', '-150.0', '-200.0', '200.0', '150.0
', '-200.0', '-200.0', '150.0', '-200.0']
---------
(3006, 0042) Contour Geometric Type CS: 'CLOSED_PLANAR'
(3006, 0046) Number of Contour Points IS: '6'
(3006, 0048) Contour Number IS: '2'
(3006, 0050) Contour Data DS: ['200.0', '-0.0', '-190.
0', '200.0', '-150.0', '-190.0', '-200.0', '-150.0', '-190.0', '-200.0', '150.0'
, '-190.0', '200.0', '150.0', '-190.0', '200.0', '-0.0', '-190.0']
---------
(3006, 0042) Contour Geometric Type CS: 'CLOSED_PLANAR'
(3006, 0046) Number of Contour Points IS: '6'
(3006, 0048) Contour Number IS: '3'
(3006, 0050) Contour Data DS: ['200.0', '-0.0', '-180.
0', '200.0', '-150.0', '-180.0', '-200.0', '-150.0', '-180.0', '-200.0', '150.0'
, '-180.0', '200.0', '150.0', '-180.0', '200.0', '-0.0', '-180.0']
---------
(3006, 0084) Referenced ROI Number IS: '1'
的数据被存储(在这种情况下,像通常那样)作为一组用于每个坐标平面。要获得数据一个轮廓,为一个平面,可以使用
>>> ctrs[0].ContourSequence[0].ContourData
['-200.0', '150.0', '-200.0', '-200.0', '-150.0', '-200.0', '200.0', '-150.0', '
-200.0', '200.0', '150.0', '-200.0', '-200.0', '150.0', '-200.0']
这些是(X,Y,Z)坐标一前一后三胞胎。
您可以在StructureSetROISequence
序列中找到有关每个轮廓(名称等)的更多信息,以了解引用ROI编号给出的索引。
通过在ContourSequence中为每个特定轮廓循环遍历每个数据集并将它们附加到一个数组中,可以获得所有这些数组的完整数组。
请提供相关DICOM文件的SOP类UID,以便我们知道信息是如何编码的。 –
@kritzel_sw哦,对不起,响应缓慢。如果我在结构文件上使用“SOP Class UID”标签,我会得到:RT Structure Set Storage。不知道这是你要求的吗? –