Sunday, April 21, 2024

OHIF Dicom Viewer & Orthanc Server

 Running Orthanc Server & OHIF DICOM Viewer

OHIF DICOM Viewer

A viewer is available here https://github.com/OHIF/Viewers and is fairly easy to build and configure. Requires node & yarn and little configuration (to be seen later)

Orthanc Server [on a different machine]

Orthanc Server can be found here https://orthanc.uclouvain.be/book/ and it has a number of plugins that you can configure. One of which is the DICOMWeb which is the plugin that implements the DICOM-Web standard. This is the one you need to enable in order for The OHIF Viewer to work with Orthanc. Orthanc has its own RESTful API but it's the same API that OHIF Viewer uses.

CORS

Orthanc Server and it's DICOMWeb Plugin should ideally behind a reverse-proxy/load-balancer. This allows to set the necessary headers to allow scripts in one domain to call the DICOM API.

Here is an example NGINX Configuration

server {
    listen 8042;
    server_name localhost;

    location / {
        proxy_pass http://your_orthanc_server_ip_address_or_hostname:8042;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Test-Id 'some_value';
        add_header Access-Control-Allow-Origin 'http://localhost:3000';

    }
}

 Assuming your OHIF Viewer is running on http://localhost:3000

Don't forget to configure your plugin DICOMWeb Plugin of the Orthanc Server so that the Host value is the proper one it should be whatever your reverse proxy is otherwise; you'll run into weird CORS and/or connection errors.

Just some configs that helped me. Hopefully this helps.