36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { OHIF } from 'meteor/ohif:core';
|
|
import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone';
|
|
import * as cornerstoneWebImageLoader from 'cornerstone-web-image-loader';
|
|
|
|
Meteor.startup(function() {
|
|
const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1);
|
|
const config = {
|
|
maxWebWorkers: maxWebWorkers,
|
|
startWebWorkersOnDemand: true,
|
|
webWorkerPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'),
|
|
taskConfiguration: {
|
|
decodeTask: {
|
|
loadCodecsOnStartup: true,
|
|
initializeCodecsOnStartup: false,
|
|
codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'),
|
|
usePDFJS: false
|
|
}
|
|
}
|
|
};
|
|
|
|
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
|
|
cornerstoneWebImageLoader.external.cornerstone = cornerstone;
|
|
|
|
let configureAuthorization = {
|
|
beforeSend: function(xhr){
|
|
if (OHIF.viewer.authorizationToken) {
|
|
xhr.setRequestHeader('Authorization', OHIF.viewer.authorizationToken);
|
|
}
|
|
}
|
|
};
|
|
|
|
cornerstoneWADOImageLoader.configure(configureAuthorization);
|
|
cornerstoneWebImageLoader.configure(configureAuthorization);
|
|
});
|