pydicom / deid

best effort anonymization for medical images using python
https://pydicom.github.io/deid/
MIT License
142 stars 44 forks source link

Error on get_files import #231

Closed DarylWM closed 2 years ago

DarylWM commented 2 years ago

Thanks for this handy library. I'm keen to use it but I'm a bit stuck on the import statement that's failing.

Traceback (most recent call last):
  File "main.py", line 5, in <module>
    from deid.dicom import get_files
  File "/Users/darylwilding-mcbride/anaconda3/envs/dicom-anon/lib/python3.8/site-packages/deid-0.2.36-py3.8.egg/deid/dicom/__init__.py", line 3, in <module>
    from .pixels import DicomCleaner, has_burned_pixels, clean_pixel_data
  File "/Users/darylwilding-mcbride/anaconda3/envs/dicom-anon/lib/python3.8/site-packages/deid-0.2.36-py3.8.egg/deid/dicom/pixels/__init__.py", line 2, in <module>
    from .detect import has_burned_pixels
  File "/Users/darylwilding-mcbride/anaconda3/envs/dicom-anon/lib/python3.8/site-packages/deid-0.2.36-py3.8.egg/deid/dicom/pixels/detect.py", line 22, in <module>
    dicom_files: Union[list[DcmOrStr], DcmOrStr],
TypeError: 'type' object is not subscriptable

What have I missed?

vsoch commented 2 years ago

This looks like a bug that was added with a new release - can you try the last two versions and see if it happens? I’ll get started on a fix here.

vsoch commented 2 years ago

okay here is a branch with a fix to test (when tests pass!) https://github.com/pydicom/deid/pull/232 I had mixed feelings about adding custom typing - largely it is useful in some cases, but also can lead to bugs (as we see here). I think for the time being I'm happier not having it.

Give that branch a test - let me know if it works and I'll get a release in asap!

DarylWM commented 2 years ago

Thanks @vsoch, that branch has resolved the issue. I appreciate your prompt response.

vsoch commented 2 years ago

Thank you for reporting the bug! The fix is now in https://pypi.org/project/deid/0.2.37/. Closing, and please open other issues that might arise - we did a bit of a refactor for the data and dicom clean functionality recently.

And just a note I'm off to bed, so any other issues I'll be back tomorrow!