ImagingDataCommons / dicomweb-client

Python client for DICOMweb RESTful services
https://dicomweb-client.readthedocs.io
MIT License
110 stars 38 forks source link

Allow to set force option of dcmread #89

Open medihack opened 1 year ago

medihack commented 1 year ago

Currently dcmread is used without the force option in dicomweb-client. It would be nice to make this configurable to read also maybe not so valid DICOM files.

pieper commented 1 year ago

I don't see any downside to being more tolerant when reading. It might make sense to try reading first, and if an exception is raised issue a warning and try again with the force option.

Anyone else have suggestions? @hackermd

medihack commented 1 year ago

I am unsure if this would be a good solution as it would try to read each dataset twice when it is not valid, which could be quite a performance hit when reading many invalid datasets. But maybe it would be a good default (with some warning when the reading initially fails) but still have some option to do a forced reading initially.

pieper commented 1 year ago

From the documentation for force, it says it only checks for a metaheader, which I would think is very quick. But we could check if it's an issue.

medihack commented 1 year ago

You are right. It then sounds like a good solution. Maybe a little warning on the console could still be printed.