react-cornerstone-viewport icon indicating copy to clipboard operation
react-cornerstone-viewport copied to clipboard

react-cornerstone-viewport not loading images with dicomweb or wadors prefix.

Open facuescobar opened this issue 5 years ago • 2 comments

Hi,

As we can find in examples, react-cornerstone-viewport only works with .dcm files.

What do I need to load images with dicomweb or wadors prefix as OHIF is doing?

OHIF is sending Image URLS (instance frames) with wadors: prefix and react-cornerstone-viewport is loading and displaying them in the canvas, as you can see in the following image

Screen Shot 2020-12-03 at 4 57 36 PM

This is my cornestone setup

/*
 * Init Cornerstone
 */

import dicomParser from 'dicom-parser'
import cornerstone from 'cornerstone-core'
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
import cornerstoneMath from 'cornerstone-math'
import cornerstoneTools from 'cornerstone-tools'
import Hammer from 'hammerjs'

export default function initCornerstone(csToolsConfig) {
    // Cornerstone Tools
    cornerstoneTools.external.cornerstone = cornerstone
    cornerstoneTools.external.Hammer = Hammer
    cornerstoneTools.external.cornerstoneMath = cornerstoneMath
    cornerstoneTools.loadHandlerManager.setErrorLoadingHandler(
        (element, imageId, error) => {
            console.error(imageId) // eslint-disable-line no-console
            throw error
        }
    )
    const defaultCsToolsConfig = csToolsConfig || {
        globalToolSyncEnabled: true,
        showSVGCursors: true,
        autoResizeViewports: false,
    }

    cornerstoneTools.init(defaultCsToolsConfig)

    // WADO Image Loader
    cornerstoneWADOImageLoader.external.cornerstone = cornerstone
    cornerstoneWADOImageLoader.external.dicomParser = dicomParser
    cornerstoneWADOImageLoader.webWorkerManager.initialize({
        maxWebWorkers: navigator.hardwareConcurrency || 1,
        startWebWorkersOnDemand: true,
        taskConfiguration: {
            decodeTask: {
                initializeCodecsOnStartup: false,
                usePDFJS: false,
                strict: false,
            },
        },
    })
}

facuescobar avatar Dec 03 '20 20:12 facuescobar

Hi !

I'm beginning to use cornerstone but i think it's because of the way Cornerstone is built. Because cornerstoneWADOImageLoader is a specific image loader registered in cornerstone Doc image loader and you can see in this doc also that the scheme is used to use the proper image loader for cornerstone.

I'm not sure but maybe it'll answer your question.

remimi avatar Mar 31 '21 13:03 remimi

Inquiring on this as well. wadors: prefix on the image load results in errors using this React plugin, such as "cannot read "samplesPerPixel property" as it is "undefined" per console errors.

bfblackjack avatar Jun 12 '22 22:06 bfblackjack