OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.37k stars 3.39k forks source link

[Bug] Blank Page in PDF Viewer for DICOM JSON DataSource with ServiceWorker Error #4444

Open thereddycr opened 3 weeks ago

thereddycr commented 3 weeks ago

Describe the Bug

I’m experiencing an issue where the OHIF PDF viewer displays a blank page when using a dicomjson data source. Other viewers work correctly with the same setup. The PDF viewer functions as expected when uploading documents directly via the local upload URL. However, when attempting to load a PDF encapsulated in DICOM format via a dicomjson data source, it results in a blank page and a console error.

Steps to Reproduce

  1. Create a studywithpdf.json file inside the public folder (platform/app/public/studywithpdf.json) with the following JSON data:
{
  "studies": [
    {
      "StudyInstanceUID": "1.2.276.0.7230010.3.1.2.2344313775.14992.1458058363.6979",
      "StudyDate": "20130812",
      "StudyTime": "164709.000",
      "PatientName": "CARDIO",
      "PatientID": "7B23891B-E78E-43DC-AE6C-55AFC72FC51C",
      "AccessionNumber": "",
      "PatientAge": "",
      "PatientSex": "",
      "Modalities": "OT",
      "NumInstances": 0,
      "series": [
        {
          "SeriesInstanceUID": "1.2.276.0.7230010.3.1.3.1901948703.36080.1484835349.617",
          "SeriesNumber": 0,
          "Modality": "OT",
          "SliceThickness": 0,
          "instances": [
            {
              "metadata": {
                "Columns": 0,
                "Rows": 0,
                "InstanceNumber": 0,
                "SOPClassUID": "1.2.840.10008.5.1.4.1.1.104.1",
                "PhotometricInterpretation": "",
                "BitsAllocated": 0,
                "BitsStored": 0,
                "PixelRepresentation": 0,
                "SamplesPerPixel": 0,
                "PixelSpacing": [],
                "HighBit": 0,
                "ImageOrientationPatient": [
                  1,
                  0,
                  0,
                  0,
                  1,
                  0
                ],
                "ImagePositionPatient": [
                  0,
                  0,
                  0
                ],
                "FrameOfReferenceUID": "",
                "ImageType": [],
                "Modality": "OT",
                "SOPInstanceUID": "1.2.276.0.7230010.3.1.4.1901948703.36080.1484835349.618",
                "SeriesInstanceUID": "1.2.276.0.7230010.3.1.3.1901948703.36080.1484835349.617",
                "StudyInstanceUID": "1.2.276.0.7230010.3.1.2.2344313775.14992.1458058363.6979",
                "WindowCenter": 0,
                "WindowWidth": 0,
                "SeriesDate": "20130814"
              },
              "url": "dicomweb:[secure_url]"
            }
          ]
        }
      ]
    }
  ]
}

Study.With.PDF.zip Note: Replace [secure_url] with the URL of the DICOM PDF file provided for reference.

  1. Configure the OHIF viewer as follows:
/** @type {AppTypes.Config} */
window.config = {
  routerBasename: '/',
  extensions: [],
  modes: [],
  dataSources: [
    {
      namespace: '@ohif/extension-default.dataSourcesModule.dicomjson',
      sourceName: 'dicomjson',
      configuration: {
        friendlyName: 'dicom json',
        name: 'json',
        singlepart: 'bulkdata,video,pdf',
        bulkDataURI: {
          enabled: true,
          relativeResolution: 'series',
        },
      },
    },
  ],
  defaultDataSourceName: 'dicomjson',
};
  1. Load the viewer with the URL: http://localhost:3000/viewer/dicomjson?url=http://localhost:3000/studywithpdf.json

The current behavior

A blank page is displayed, and the following error appears in the console:

rendered:1  Uncaught (in promise) InvalidStateError: Failed to get ServiceWorkerRegistration objects: The document is in an invalid state.

image

The expected behavior

The PDF should display correctly in the viewer something like this, image

Additional Information

OS

window 11

Node version

v20.9.0

Browser

Version 130.0.6723.70 (Official Build) (64-bit)