AttributeError: 'Dataset' object has no attribute 'ContourImageSequence'
JunMa11 opened this issue · 0 comments
JunMa11 commented
Hi,
Thanks for sharing the great package.
I'm using the following code to load RT annotations.
rtstruct = RTStructBuilder.create_from(
dicom_series_path=r"path to \Export_Case\CT",
rt_struct_path=r"path to\lung.dcm"
)
print(rtstruct.get_roi_names())
for name in rtstruct.get_roi_names():
mask_3d = rtstruct.get_roi_mask_by_name(name).astype(np.uint8)
It can output the roi_names
, but encounter the following error
['Lungs 1000 intensity threshold', 'Heart']
Traceback (most recent call last):
File ".\utils.py", line 40, in <module>
mask_3d = rtstruct.get_roi_mask_by_name(name).astype(np.uint8)
File "D:\ProgramData\Anaconda3\lib\site-packages\rt_utils\rtstruct.py", line 113, in get_roi_mask_by_name
return image_helper.create_series_mask_from_contour_sequence(
File "D:\ProgramData\Anaconda3\lib\site-packages\rt_utils\image_helper.py", line 246, in create_series_mask_from_contour_sequence
slice_contour_data = get_slice_contour_data(series_slice, contour_sequence)
File "D:\ProgramData\Anaconda3\lib\site-packages\rt_utils\image_helper.py", line 259, in get_slice_contour_data
for contour_image in contour.ContourImageSequence:
File "D:\ProgramData\Anaconda3\lib\site-packages\pydicom\dataset.py", line 835, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Dataset' object has no attribute 'ContourImageSequence'
How can I fix this problem?
Any comments would be highly appreciated:)
Best regards,
Jun