ohif-viewer/src/config.js

38 lines
995 B
JavaScript
Raw Normal View History

import dicomParser from 'dicom-parser'
import cornerstone from 'cornerstone-core'
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
import OHIF from 'ohif-core'
import version from './version.js'
window.info = {
2019-01-30 12:24:34 +01:00
version,
homepage: `${process.env.PUBLIC_URL}`,
}
// For debugging
window.cornerstone = cornerstone
window.cornerstoneWADOImageLoader = cornerstoneWADOImageLoader
cornerstoneWADOImageLoader.external.cornerstone = cornerstone
cornerstoneWADOImageLoader.external.dicomParser = dicomParser
OHIF.user.getAccessToken = () => {
2019-01-30 12:24:34 +01:00
// TODO: Get the Redux store from somewhere else
const state = window.store.getState()
2019-01-30 12:24:34 +01:00
if (!state.oidc || !state.oidc.user) {
return
2019-01-30 12:24:34 +01:00
}
return state.oidc.user.access_token
}
cornerstoneWADOImageLoader.configure({
2019-01-30 12:24:34 +01:00
beforeSend: function(xhr) {
const headers = OHIF.DICOMWeb.getAuthorizationHeader()
2019-01-30 12:24:34 +01:00
if (headers.Authorization) {
xhr.setRequestHeader('Authorization', headers.Authorization)
}
},
})