Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Dataset' object has no attribute 'ContourImageSequence' #49

Closed
JunMa11 opened this issue Mar 1, 2022 · 0 comments
Closed

Comments

@JunMa11
Copy link

JunMa11 commented Mar 1, 2022

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

@JunMa11 JunMa11 closed this as completed Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant