2017-02-13 21:49:02 +01:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2017-03-01 22:43:11 +01:00
|
|
|
import { OHIF } from 'meteor/ohif:core';
|
2017-02-13 21:49:02 +01:00
|
|
|
import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone';
|
|
|
|
|
|
|
|
|
|
Meteor.startup(function() {
|
2017-03-29 22:14:57 +02:00
|
|
|
const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1);
|
2017-02-13 21:49:02 +01:00
|
|
|
const config = {
|
2017-03-29 22:14:57 +02:00
|
|
|
maxWebWorkers: maxWebWorkers,
|
|
|
|
|
startWebWorkersOnDemand: true,
|
|
|
|
|
webWorkerPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'),
|
2017-02-13 21:49:02 +01:00
|
|
|
taskConfiguration: {
|
2017-03-29 22:14:57 +02:00
|
|
|
decodeTask: {
|
|
|
|
|
loadCodecsOnStartup: true,
|
|
|
|
|
initializeCodecsOnStartup: false,
|
2017-03-01 22:43:11 +01:00
|
|
|
codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'),
|
2017-02-13 21:49:02 +01:00
|
|
|
usePDFJS: false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
|
2018-07-19 13:57:23 +02:00
|
|
|
|
|
|
|
|
cornerstoneWADOImageLoader.configure({
|
|
|
|
|
beforeSend: function(xhr) {
|
2018-09-23 10:57:21 +02:00
|
|
|
const headers = OHIF.DICOMWeb.getAuthorizationHeader();
|
2018-07-19 13:57:23 +02:00
|
|
|
|
2018-09-23 10:57:21 +02:00
|
|
|
if (headers.Authorization) {
|
|
|
|
|
xhr.setRequestHeader("Authorization", headers.Authorization);
|
2018-07-19 13:57:23 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-03-29 22:14:57 +02:00
|
|
|
});
|
2018-09-21 20:02:29 +02:00
|
|
|
|
|
|
|
|
if (Meteor.settings &&
|
|
|
|
|
Meteor.settings.public &&
|
|
|
|
|
Meteor.settings.public.clientOnly === true) {
|
|
|
|
|
Meteor.disconnect();
|
|
|
|
|
}
|