Orthanc crashes when calling WADO with transcoding

Hi Authors,

I am running Orthanc 1.8.0, DicomWeb plugin version 3, when I call this url in Postman
localhost:8042/dicom-web/studies/1.2.826.0.1.3680043.10.96507826537626540129244984210872342496/series/1.3.12.2.1107.5.1.7.120165.30000020120208035181900001199/instances/1.3.12.2.1107.5.1.7.120165.30000020120208035181900001207/frames/1

with header
Accept: multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.51

Orthanc service crashed. Below is the log file when running in verbose mode

I1203 17:03:53.161651 OrthancPlugins.cpp:1815] Delegating HTTP request to plugin for URI: /dicom-web/studies/1.2.826.0.1.3680043.10.96507826537626540129244984210872342496/series/1.3.12.2.1107.5.1.7.120165.30000020120208035181900001199/instances/1.3.12.2.1107.5.1.7.120165.30000020120208035181900001207/frames/1
I1203 17:03:53.162399 OrthancPlugins.cpp:2388] Plugin making REST GET call on URI /instances/a2e860a5-782cb8d4-258d9080-b6d02066-3f940755/series (built-in API)
I1203 17:03:53.163233 OrthancPlugins.cpp:2388] Plugin making REST GET call on URI /instances/a2e860a5-782cb8d4-258d9080-b6d02066-3f940755/study (built-in API)
I1203 17:03:53.163429 OrthancPlugins.cpp:2388] Plugin making REST GET call on URI /instances/a2e860a5-782cb8d4-258d9080-b6d02066-3f940755/file (built-in API)
I1203 17:03:53.163516 FilesystemStorage.cpp:144] Reading attachment “70557791-1bb8-4a87-9777-ce10deb45b9a” of “DICOM” content type
I1203 17:03:53.164013 PluginsManager.cpp:172] DICOMweb RetrieveFrames on a2e860a5-782cb8d4-258d9080-b6d02066-3f940755, frames: 1
I1203 17:03:53.164046 PluginsManager.cpp:172] DICOMweb RetrieveFrames: Transcoding instance a2e860a5-782cb8d4-258d9080-b6d02066-3f940755 to transfer syntax 1.2.840.10008.1.2.4.51
DCT coefficient out of range

I think Orthanc should catch this exception instead of letting itself die. The attachment is the dicom file I used. Can you identify if this is intentional ?

70557791-1bb8-4a87-9777-ce10deb45b9a.dcm (516 KB)

Hello,

Thanks for your analysis. The problem is related to the GDCM transcoder plugin, not to DICOMweb or to the Orthanc core.

For future reference, here is a more direct way to reproduce your issue, without relying on DICOMweb:

$ curl http://localhost:8042/instances/a2e860a5-782cb8d4-258d9080-b6d02066-3f940755/modify -d ‘{“Transcode”:“1.2.840.10008.1.2.4.51”}’

The problem comes from the GDCM toolkit, to which I have just send a bug report:
https://sourceforge.net/p/gdcm/bugs/513/

As a temporary workaround to prevent this crash in Orthanc, I have committed a changeset in the Orthanc GDCM plugin to explicitly prevent any conversion of 16bit images to the 1.2.840.10008.1.2.4.51 transfer syntax:
https://hg.orthanc-server.com/orthanc-gdcm/rev/962307b99548

This protection is pending in the mainline of the Orthanc GDCM plugin, and will be part of forthcoming 1.2 release of this plugin.

Regards,
Sébastien-