Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
facuescobar opened this issue Dec 3, 2020 · 2 comments

Comments

@facuescobar
Copy link

facuescobar commented Dec 3, 2020

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,
            },
        },
    })
}
@remimi
Copy link

remimi commented Mar 31, 2021

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.

@bfblackjack
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants