sjoerdk / dicomtrolley

Retrieve medical images via WADO, MINT, RAD69 and DICOM-QR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trolley.download() uncaught value error

sjoerdk opened this issue · comments

  • 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.

Solution would be to catch this and transform it to a TrolleyError so that the error is easier to catch