Trolley.download() uncaught value error
sjoerdk opened this issue · comments
Sjoerd Kerkstra commented
- dicomtrolley version: 3.0.1
- Python version: 3.8
Description
Ran into this when downloading a specific corrupt DICOM dataset. The dataset has inproperly configured encapsulation of compressed pixeldata. pydicom dataset.save_as()
on this dataset will raise the following:
ValueError: (7FE0,0010) Pixel Data has an undefined length indicating that it's compressed, but the data isn't encapsulated as required. See pydicom.encaps.encapsulate() for more information
Pydicom raising the exception is understandable; it cannot properly write this data. The problem is that ValueError
is not typically caught at higher levels, and thus typically crashes the whole program.
Sjoerd Kerkstra commented
Solution would be to catch this and transform it to a TrolleyError so that the error is easier to catch