Image quality when retrieve PNG/ JPEG image from WADO URI

Hi Authors,

In ORTHANC, I noticed that the quality of JPEG/PNG image retrieved by WADO-URI is somehow different from other methods like: ORTHANC RENDERED INSTANCE or DCM4CHEE WADO-URI or CornerStone WADO-RS. I dont know if the quality is better or worsen, but here is what I compared and observed:

1/ Retrieve JPEG/PNG image from Orthanc by calling: http://localhost:8042/wado?requestType=WADO&objectUID=1.2.840.113704.9.1000.16.2.20190613104005642000100010001&contentType=image/jpeg
2/ Retrieve JPEG/PNG image from Orthanc by calling: http://localhost:8042/instances/efe24a75-8feafc74-fc83584b-0f133128-60304d7c/rendered
3/ Retrieve JPEG/PNG image from DCM4CHEE by calling:

So, methods number 2 (Orthanc rendered instance) and number 3 (DCM4CHEE WADO-URI) return same image quality, but different from method number 1 (ORTHANC WADO-URI). I did dig more into the source code (OrthancDicomWeb: and notice that when client calling to WADO-URI, the plugin redirects it to the preview url

static bool RetrievePngPreview(OrthancPlugins::MemoryBuffer& png,
                               const std::string& instance)
  std::string uri = "/instances/" + instance + "/preview";

  if (png.RestApiGet(uri, true))
    return true;
    OrthancPlugins::LogError("WADO-URI: Unable to generate a preview image for " + uri);
    return false;

This is the log when calling ORTHANC WADO-URI:

I0812 10:34:42.419103 HttpServer.cpp:824] GET /wado

I0812 10:34:42.419144 OrthancPlugins.cpp:1811] Delegating HTTP request to plugin for URI: /wado

I0812 10:34:42.419933 OrthancPlugins.cpp:2384] Plugin making REST GET call on URI /instances/efe24a75-8feafc74-fc83584b-0f133128-60304d7c/preview (after plugins)

I0812 10:34:42.420170 FilesystemStorage.cpp:155] Reading attachment “f704e1a0-5c0a-44e6-af0e-dace2ebc662e” of “DICOM” content type

I0812 10:34:42.420248 PluginsManager.cpp:172] Decoding one DICOM instance of 0.1MB using GDCM

I tried to change “/preview” to “/rendered” and all three methods above result in the same image. I dont know if you guys can change the source code so the result of WADO-URI is consistent among vendors.
P/S I attached 4 files:
1- JPEG file from ORTHANC WADO-URI (1.jpeg)
3- JPEG file from DCM4CHEE (3.JPEG)
4- DICOM file (1.2.840.113704.9.1000.16.2.20190613104005642000100010001.dcm)


1.2.840.113704.9.1000.16.2.20190613104005642000100010001.dcm (68.3 KB)


I confirm there was an issue regarding the default windowing that was used in WADO-URI and “WADO-RS Retrieve Rendered Frames”. This issue is fixed by the following changeset:

An integrated test was also added to avoid future regression:

The fix will be part of forthcoming 1.3 release of the DICOMweb plugin.