Here is an interactive session illustrating the location of the data using the rtstruct.dcm file included in 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'
Data is saved (in this case, as usual) as a set of coordinates for each plane. To get data for one contour, for one plane you can use
>>> 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']
These are the triplets of coordinates (x, y, z) one after another.
You can find additional information about each circuit (name, etc.) in the sequence StructureSetROISequence , for the index indicated by the ROI reference number.
You can get a complete array for all of them by going through each dataset in ContourSequence for that particular contour and adding them together into one array.