Skip to content

Blank Image Issue with CT Image Storage (1.2.840.10008.5.1.4.1.1.2) #545

@DarineZeyad

Description

@DarineZeyad

When retrieving DICOM images with the following attributes:

  • SOP Class: 1.2.840.10008.5.1.4.1.1.2 (CT Image Storage)
  • Transfer Syntax: 1.2.840.10008.1.2.1 (Explicit VR Little Endian)

The image is retrieved without pixelData (resulting in black pixels) if the requested transfer syntax is set to JPEG (1.2.840.10008.1.2.4.50, Default Transfer Syntax for Lossy JPEG 8-bit Image Compression). When retrieving the same DICOM externally without the loader in JPEG format, the image renders fine.

Additional Observations:

  • Changing convertFloatPixelDataToInt from false to true renders the image but with high contrast and brightness. The reason for this effect is unclear to me.

CornerstoneWADOImageLoader Initialisation:

private static initCornerstoneWADOImageLoader() {
    cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
    cornerstoneWADOImageLoader.external.dicomParser = dicomParser;
    cornerstoneWADOImageLoader.configure({
      useWebWorkers: true,
      decodeConfig: {
        convertFloatPixelDataToInt: false,
      },
      beforeSend: function (xhr) {
        xhr.setRequestHeader(
          "Authorization",
          `Bearer ...`
        );

        xhr.setRequestHeader(
          "Accept",
          'multipart/related; type="image/jpeg"; transfer-syntax=1.2.840.10008.1.2.4.50'
        );
      },
      onloadend: function (event, params) {
        // ..
      },
    });

    let maxWebWorkers = 1;

    if (navigator.hardwareConcurrency) {
      maxWebWorkers = Math.min(navigator.hardwareConcurrency, 7);
    }

    var config = {
      maxWebWorkers,
      startWebWorkersOnDemand: false,
      taskConfiguration: {
        decodeTask: {
          initializeCodecsOnStartup: false,
          strict: false,
        },
      },
      webWorkerTaskPaths: [
        "https://unpkg.com/[email protected]/dist/610.bundle.min.worker.js",
        "https://unpkg.com/[email protected]/dist/888.bundle.min.worker.js",
      ],
    };

    cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
  }

  private static initProviders(orgID: string) {
    const { calibratedPixelSpacingMetadataProvider } = cornerstone.utilities;
    cornerstone.metaData.addProvider(
      ptScalingMetaDataProvider.get.bind(ptScalingMetaDataProvider),
      10000
    );
    cornerstone.metaData.addProvider(
      calibratedPixelSpacingMetadataProvider.get.bind(
        calibratedPixelSpacingMetadataProvider
      ),
      11000
    );

    cornerstone.metaData.addProvider(customMetaDataProvider, 12000);
  }

Preferred Setup: The preference is to retrieve images as JPEG rather than octet-stream for improved loading performance.

VERSIONS:
"@cornerstonejs/core": "^0.27.1",
"@cornerstonejs/streaming-image-volume-loader": "^0.11.2",
"cornerstone-wado-image-loader": "^4.10.2",

You can try with this DICOM sample:
1.2.840.113619.2.25.1.1762306543.872804962.230.zip

Any recommendations for optimal configuration settings to handle JPEG image retrieval effectively would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions