Using Webserver DicomWeb interface with OHIF (CORS enabled)

Hello!

I just found out the WebServer extension in Slicer and discovered that it provided a DicomWeb interface to the dicom database.

I would like to use it with OHIF (3.8.3, running locally for now), without the need to setup a reverse proxy. I enabled the CORS option, however I can’t seem to get it to work. The dicom-client of OHIF will send preflight requests which will just hang on the slicer webserver, since OPTIONS requests are dismissed. Browser will then just hang waiting for the preflight response.

Preflights are sent when trying to fetch the /studies/{...}/series and /studies/{...}/metadata routes.

relevant line : Slicer/Modules/Scripted/WebServer/WebServer.py at ba3a9fdc04c9f4fc47cad331f9160b6d7a0beded · Slicer/Slicer · GitHub

I was wondering if my setup was wrong, or this use case is not implemented.
I’m on Windows (WSL2) with Slicer 5.6.2. Here’s my datasource config in OHIF if it’s any help

    {
      friendlyName: 'Slicer 3D',
      namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
      sourceName: 'slicer',
      configuration: {
        name: 'Slicer',
        wadoUriRoot: 'http://localhost:2016/dicom',
        qidoRoot: 'http://localhost:2016/dicom',
        wadoRoot: 'http://localhost:2016/dicom',
        qidoSupportsIncludeField: true,
        imageRendering: 'wadouri',
        thumbnailRendering: 'wadouri',
        enableStudyLazyLoad: true,
        supportsFuzzyMatching: true,
      },
    },

I’m not sure if you are aware that Slicer already comes with a preconfigured OHIF viewer that you can launch by a few clicks. I’ve just tested it now and everything works well.

You can start the DICOMweb server in Slicer and launch OHIF viewer by starting the Slicer web server with DICOMweb API and static pages enabled, opening the static pages in a web browser, and clicking on the “DICOM database browser” link. No need to download or configure OHIF (unless you want a different version than what already comes with Slicer):

Just make sure to give enough time (several minutes) for OHIF to start if you have lots of data sets in your DICOM database.

You can find the server configuration that Slicer uses here:

Hi Andras,
Ah nice! I didn’t know that.

However in my case I wanted to use Slicer as a dicomweb server only, since we have our own custom OHIF extensions and modes that we are developing. (I’m looking for a dicomweb solution that’s easy to install locally, if any comes to mind)

In case of the built-in OHIF, the dicom-web client doesn’t send preflight requests since the viewer is served from the same host as the dicomweb server (http://localhost:2016).

Without an OPTIONS request handler, I’m not sure how the “Enable CORS” option would work… I’ll try to add that request handler, and if it solves the issue I can open a PR.

It should be easy enough to add OPTIONS support to the Slicer WebServer module. It would be great if you could add it.

Slicer’s dicom database and dicomweb server may handle some practical use cases, but it’s not really tested on huge data. I’ve used maybe a few thousand studies.

Some of us also worked on this approach with a more scalable database. I’ve been told by some users that it’s actually working well in a high-volume production environment.

Thanks for the link Steve, I’ll keep that project in mind for high volume of data!

In my immediate situation, I was rather looking for something like a small daemon to could expose through dicomweb the content of a dicom folder with perhaps at most a couple of hundred series. Something like GitHub - RadicalImaging/Static-DICOMWeb but with a tiny GUI and an installer. The goal here is to have end users test-run our OHIF extensions without the need to setup Orthanc or a server. In that sense, Slicer seems like a good solution.

Regarding CORS, after adding the OPTIONS handler, things seems to work out! I’ve open a PR here BUG: add missing OPTIONS request handler when CORS enabled by Gabsha · Pull Request #7998 · Slicer/Slicer · GitHub