sjoerdk/dicomtrolley

Uncaught ValueError for data with invalid compression

sjoerdk opened this issue · 1 comments

  • dicomtrolley version: 3.0.4
  • Python version: 3.8
  • Operating System: ubuntu 22.04

Description

Related to https://github.com/ResearchBureau/tickets/issues/206
For certain data the following Exception is raised by pydicom:

  File "...\lib\site-packages\pydicom\filewriter.py", line 577, in write_data_element
    raise ValueError(
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

This value error is not caught by dicomtrolley, which causes issue further up the stack.

Catch this and raise TrolleyError

What I Did

An example of the offending data can be found in https://github.com/ResearchBureau/tickets/issues/206

This error is actually caught by Trolley and raised as a pydicom.storage.StorageError which derives from DICOMTrolleyError.

anonserver should catching the StorageError. This is not a dicomtrolley issue