pydicom / deid

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

Handling DICOM time-series data in DicomCleaner for displaying and saving images #135

Closed nquach closed 4 years ago

nquach commented 4 years ago

Currently DicomCleaner cannot handle pixel data that is time-series data in the save_png or get_figure() functions (either 3D or 4D depending on whether its greyscale or RGB), since it simply dumps the pixel array into imshow.

https://github.com/pydicom/deid/blob/618005f973ffb6e20f9c8173da92c40ab86e2650/deid/dicom/pixels/clean.py#L196

To ensure that all private health information is removed after running clean(), it would be nice to be able to save/show 1 frame of the cleaned movie for quality control.

This could be as simple as checking if the DICOM is Ultrasound data (or other types of time series or volumetric data like CT and MRI) and having get_figure() output the first frame of the series.

vsoch commented 4 years ago

hey @nquach ! I've just added support to save a 4d image as either a random selected middle slice (for png) and also for an mp4 movie (to scroll through slices). Would you like to take a look?

https://github.com/pydicom/deid/pull/136

I provided instructions in the README to reproduce with your echo image example that you gave me. Let me know if it works for you, and if any additional documentation is needed.

vsoch commented 4 years ago

hey @nquach you never took a look at #136 - is it good to merge?

vsoch commented 4 years ago

I've merged it, and you can report issues as needed. Thanks again.