OHIF with a local server (not dicomweb)

Describe Your Question

  • I want to use OHIF for it’s dicom viewing capabilities in my app. The dicom files reside on my local server with it’s own GUI. I want the user to click on a ‘Viewer’ icon in the GUI and use the Ohif viewer to display the dicom files on the server. My server does not adhere to a dicom web standard. I am wondering what are some ways I could achieve this ? I have looked through the documentation so a gentle nudge in the right direction would suffice. I see that I have to edit the config file to fetch files from external data sources as show in the example, but those sources appear to be PACS servers (adhering to Dicom Web Standards).

  • Which OHIF version you are using?
    I am using the latest version

Looks like I would have to setup a server which would support DicomWeb rest api services. Does anyone have a resource that points to a Javascript implementation of a DicomWeb server.

Relevant Links: https://www.dicomstandard.org/docs/librariesprovider2/dicomdocuments/dicom/wp-content/uploads/2018/04/dicomweb-cheatsheet.pdf

Another solution would be to have my server push data to orthanc and have ohif viewer interface the orthanc. This could work. Then I would have to look into a way to post data to the orthanc server (a client perhaps). Has anyone done that before or has a resource they could point me to ?

Still thinking about this. Working on having my nodejs server return a json file to ohif. Still
have to figure out configuration details in OHIF to have it speak to my server. Again, if someone has pointers than help would be much appreciated.

URL: OHIF Viewer

{
  "studies": [
    // first study metadata
    {
      "StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
      "StudyDate": "20000101",
      "StudyTime": "",
      "PatientName": "",
      "PatientID": "LIDC-IDRI-0001",
      "AccessionNumber": "",
      "PatientAge": "",
      "PatientSex": "",
      "series": [
        // first series metadata
        {
          "SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
          "SeriesNumber": 3000566,
          "Modality": "CT",
          "SliceThickness": 2.5,
          "instances": [
            // first instance metadata
            {
              "metadata": {
                "Columns": 512,
                "Rows": 512,
                "InstanceNumber": 1,
                "SOPClassUID": "1.2.840.10008.5.1.4.1.1.2",
                "PhotometricInterpretation": "MONOCHROME2",
                "BitsAllocated": 16,
                "BitsStored": 16,
                "PixelRepresentation": 1,
                "SamplesPerPixel": 1,
                "PixelSpacing": [0.703125, 0.703125],
                "HighBit": 15,
                "ImageOrientationPatient": [1, 0, 0, 0, 1, 0],
                "ImagePositionPatient": [-166, -171.699997, -10],
                "FrameOfReferenceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.229925374658226729607867499499",
                "ImageType": ["ORIGINAL", "PRIMARY", "AXIAL"],
                "Modality": "CT",
                "SOPInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.262721256650280657946440242654",
                "SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
                "StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
                "WindowCenter": -600,
                "WindowWidth": 1600,
                "SeriesDate": "20000101"
              },
              "url": "dicomweb:https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-001.dcm"
            },
            // second instance metadata
            {
              "metadata": {
                "Columns": 512,
                "Rows": 512,
                "InstanceNumber": 2,
                "SOPClassUID": "1.2.840.10008.5.1.4.1.1.2",
                "PhotometricInterpretation": "MONOCHROME2",
                "BitsAllocated": 16,
                "BitsStored": 16,
                "PixelRepresentation": 1,
                "SamplesPerPixel": 1,
                "PixelSpacing": [0.703125, 0.703125],
                "HighBit": 15,
                "ImageOrientationPatient": [1, 0, 0, 0, 1, 0],
                "ImagePositionPatient": [-166, -171.699997, -12.5],
                "FrameOfReferenceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.229925374658226729607867499499",
                "ImageType": ["ORIGINAL", "PRIMARY", "AXIAL"],
                "Modality": "CT",
                "SOPInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.512235483218154065970649917292",
                "SeriesInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192",
                "StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
                "WindowCenter": -600,
                "WindowWidth": 1600,
                "SeriesDate": "20000101"
              },
              "url": "dicomweb:https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001/01-01-2000-30178/3000566.000000-03192/1-002.dcm"
            }
            // ..... other instances metadata
          ]
        }
        // ... other series metadata
      ],
      "NumInstances": 133,
      "Modalities": "CT"
    }
    // second study metadata
  ]

In this example pasted above, I am curious as to what the url would be. Also, I did not understand the url scheme as it seemed to be looking at a folder structure in the server it’s making a request to.

Hello @PintoGideon and welcome to the forum. Have you had a look at the DICOM JSON OHIF docs? Does that help?

Hello @jbocce

This is what I have so far.

I have a server which parses a dicom file and creates a json. An example of that json is this.

This is on my server and I provide the link to ohif as an url parameter.

http://localhost:3000/viewer/dicomjson?url=http://localhost:5173/api/posts/test-upload-57.json

The Ohif viewer is able to request my server for the json which resolves correctly. No luck after that however. I am guessing ohif tries to request the url for the instance but fails. It’s been difficult to track the issue down in the react codebase.

I am currently facing a cors error. My server is configured with these headers.

headers: {
					'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
					'Access-Control-Allow-Headers': '*',
					'Access-Control-Allow-Origin': '*',
					'Access-Control-Max-Age': '1728000',
					'Access-Control-Allow-Credentials':'true'
				}

If the info can be provided publicly (i.e. both the json and DICOM url), then maybe we can have a look it. Otherwise, we are not really sure what is going on.

I was able to make this work. Thanks for your replies @jbocce

please can you provide more detail on how you achieved this? i am trying to use laravel as the api server, but can switch to javascript if theres any need