Creating ohif:compatibility package to enable IE11 support
This commit is contained in:
parent
66bc4e2105
commit
1f8eda7b82
@ -26,6 +26,7 @@ clinical:hipaa-logger
|
||||
aldeed:simple-schema # Third party package to deal with schemas
|
||||
|
||||
# OHIF Packages
|
||||
ohif:compatibility
|
||||
ohif:design
|
||||
ohif:core
|
||||
ohif:user
|
||||
|
||||
@ -87,6 +87,7 @@ natestrauser:select2@4.0.3
|
||||
npm-bcrypt@0.9.2
|
||||
npm-mongo@2.2.11_2
|
||||
observe-sequence@1.0.14
|
||||
ohif:compatibility@0.0.1
|
||||
ohif:core@0.0.1
|
||||
ohif:cornerstone@0.0.1
|
||||
ohif:design@0.0.1
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
# but you can also edit it by hand.
|
||||
|
||||
# OHIF Packages
|
||||
ohif:compatibility
|
||||
ohif:design
|
||||
ohif:core
|
||||
ohif:header
|
||||
|
||||
@ -72,6 +72,7 @@ mongo-id@1.0.6
|
||||
natestrauser:select2@4.0.3
|
||||
npm-mongo@2.2.11_2
|
||||
observe-sequence@1.0.14
|
||||
ohif:compatibility@0.0.1
|
||||
ohif:core@0.0.1
|
||||
ohif:cornerstone@0.0.1
|
||||
ohif:design@0.0.1
|
||||
|
||||
11
Packages/ohif-compatibility/client/ie.js
Normal file
11
Packages/ohif-compatibility/client/ie.js
Normal file
@ -0,0 +1,11 @@
|
||||
/* jshint -W060 */
|
||||
// Check if browser is IE and add the polyfill scripts
|
||||
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
|
||||
const writeScript = fileName => {
|
||||
const src = `/packages/ohif_compatibility/public/js/${fileName}`;
|
||||
document.write(`<script src="${src}"><\/script>`);
|
||||
};
|
||||
|
||||
writeScript('svgxuse.min.js');
|
||||
writeScript('typedarray.js');
|
||||
}
|
||||
1
Packages/ohif-compatibility/client/index.js
Normal file
1
Packages/ohif-compatibility/client/index.js
Normal file
@ -0,0 +1 @@
|
||||
import './ie';
|
||||
19
Packages/ohif-compatibility/package.js
Normal file
19
Packages/ohif-compatibility/package.js
Normal file
@ -0,0 +1,19 @@
|
||||
Package.describe({
|
||||
name: 'ohif:compatibility',
|
||||
summary: 'OHIF assets to keep compatibility with older browsers',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.4');
|
||||
|
||||
// Meteor packages
|
||||
api.use('ecmascript');
|
||||
|
||||
// Assets to be imported dynamically
|
||||
api.addAssets('public/js/svgxuse.min.js', 'client');
|
||||
api.addAssets('public/js/typedarray.js', 'client');
|
||||
|
||||
// Client imports
|
||||
api.addFiles('client/index.js', 'client');
|
||||
});
|
||||
12
Packages/ohif-compatibility/public/js/svgxuse.min.js
vendored
Normal file
12
Packages/ohif-compatibility/public/js/svgxuse.min.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/*!
|
||||
* @copyright Copyright (c) 2017 IcoMoon.io
|
||||
* @license Licensed under MIT license
|
||||
* See https://github.com/Keyamoon/svgxuse
|
||||
* @version 1.2.4
|
||||
*/
|
||||
(function(){if("undefined"!==typeof window&&window.addEventListener){var e=Object.create(null),n,t,d=function(){clearTimeout(t);t=setTimeout(n,100)},q=function(){},u=function(){var f;window.addEventListener("resize",d,!1);window.addEventListener("orientationchange",d,!1);window.MutationObserver?(f=new MutationObserver(d),f.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),q=function(){try{f.disconnect(),window.removeEventListener("resize",d,!1),window.removeEventListener("orientationchange",
|
||||
d,!1)}catch(w){}}):(document.documentElement.addEventListener("DOMSubtreeModified",d,!1),q=function(){document.documentElement.removeEventListener("DOMSubtreeModified",d,!1);window.removeEventListener("resize",d,!1);window.removeEventListener("orientationchange",d,!1)})},v=function(f){function e(a){var c;void 0!==a.protocol?c=a:(c=document.createElement("a"),c.href=a);return c.protocol.replace(/:/g,"")+c.host}var d,p;window.XMLHttpRequest&&(d=new XMLHttpRequest,p=e(location),f=e(f),d=void 0===d.withCredentials&&
|
||||
""!==f&&f!==p?XDomainRequest||void 0:XMLHttpRequest);return d};n=function(){function d(){--r;0===r&&(q(),u())}function l(a){return function(){!0!==e[a.base]&&(a.isXlink?a.useEl.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+a.hash):a.useEl.setAttribute("href","#"+a.hash))}}function n(a){return function(){var c=document.body,b=document.createElement("x");a.onload=null;b.innerHTML=a.responseText;if(b=b.getElementsByTagName("svg")[0])b.setAttribute("aria-hidden","true"),b.style.position=
|
||||
"absolute",b.style.width=0,b.style.height=0,b.style.overflow="hidden",c.insertBefore(b,c.firstChild);d()}}function p(a){return function(){a.onerror=null;a.ontimeout=null;d()}}var a,c,m,g,r=0,b,k=!1,h;q();h=document.getElementsByTagName("use");for(g=0;g<h.length;g+=1){try{c=h[g].getBoundingClientRect()}catch(x){c=!1}(a=h[g].getAttribute("href"))?k=!1:(a=h[g].getAttributeNS("http://www.w3.org/1999/xlink","href"),k=!0);m=a&&a.split?a.split("#"):["",""];a=m[0];m=m[1];b=c&&0===c.left&&0===c.right&&0===
|
||||
c.top&&0===c.bottom;c&&0===c.width&&0===c.height&&!b?a.length&&(b=e[a],!0!==b&&setTimeout(l({useEl:h[g],base:a,hash:m,isXlink:k}),0),void 0===b&&(k=v(a),void 0!==k&&(b=new k,e[a]=b,b.onload=n(b),b.onerror=p(b),b.ontimeout=p(b),b.open("GET",a),b.send(),r+=1))):b?a.length&&e[a]&&setTimeout(l({useEl:h[g],base:a,hash:m,isXlink:k}),0):void 0===e[a]?e[a]=!0:e[a].onload&&(e[a].abort(),delete e[a].onload,e[a]=!0)}h="";r+=1;d()};var l;l=function(){window.removeEventListener("load",l,!1);t=setTimeout(n,0)};
|
||||
"complete"!==document.readyState?window.addEventListener("load",l,!1):l()}})();
|
||||
1048
Packages/ohif-compatibility/public/js/typedarray.js
Normal file
1048
Packages/ohif-compatibility/public/js/typedarray.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
|
||||
},
|
||||
wadors: {
|
||||
|
||||
|
||||
},
|
||||
internal: {
|
||||
options : {
|
||||
@ -373,7 +373,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
var deferred = $.Deferred();
|
||||
var imageFrame = cornerstoneWADOImageLoader.getImageFrame(imageId);
|
||||
var decodePromise = cornerstoneWADOImageLoader.decodeImageFrame(imageFrame, transferSyntax, pixelData, canvas, options);
|
||||
decodePromise.then(function(imageFrame) {
|
||||
decodePromise.then(function(imageFrame) {
|
||||
//var imagePixelModule = metaDataProvider('imagePixelModule', imageId);
|
||||
var imagePlaneModule = cornerstone.metaData.get('imagePlaneModule', imageId);
|
||||
var voiLutModule = cornerstone.metaData.get('voiLutModule', imageId);
|
||||
@ -905,7 +905,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
}
|
||||
});
|
||||
});
|
||||
return deferred.promise();
|
||||
return deferred.promise();
|
||||
|
||||
};
|
||||
}(cornerstoneWADOImageLoader));
|
||||
@ -922,9 +922,9 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
var start = new Date().getTime();
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
|
||||
var uri = imageId.substring(7);
|
||||
|
||||
|
||||
// check to make sure we have metadata for this imageId
|
||||
var metaData = cornerstoneWADOImageLoader.wadors.metaDataManager.get(imageId);
|
||||
if(metaData === undefined) {
|
||||
@ -1450,7 +1450,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
var parsedImageId = cornerstoneWADOImageLoader.wadouri.parseImageId(uri);
|
||||
var fileIndex = parseInt(parsedImageId.url);
|
||||
var file = cornerstoneWADOImageLoader.wadouri.fileManager.get(fileIndex);
|
||||
|
||||
|
||||
// create a deferred object
|
||||
var deferred = $.Deferred();
|
||||
|
||||
@ -1702,7 +1702,6 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
seriesInstanceUID: dataSet.string('x0020000e'),
|
||||
seriesNumber: dataSet.intString('x00200011'),
|
||||
studyInstanceUID: dataSet.string('x0020000d'),
|
||||
seriesInstanceUID: dataSet.string('x0020000e'),
|
||||
seriesDate: dicomParser.parseDA(dataSet.string('x00080021')),
|
||||
seriesTime: dicomParser.parseTM(dataSet.string('x00080031') || '')
|
||||
};
|
||||
@ -1805,7 +1804,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
|
||||
// module exports
|
||||
cornerstoneWADOImageLoader.wadouri.parseImageId = parseImageId;
|
||||
|
||||
|
||||
}(cornerstoneWADOImageLoader));
|
||||
/**
|
||||
* Function to deal with unpacking a binary frame
|
||||
@ -1825,7 +1824,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
for (var i = 0; i < pixelsPerFrame; i++) {
|
||||
// Compute byte position
|
||||
var bytePos = Math.floor(i / 8);
|
||||
|
||||
|
||||
// Get the current byte
|
||||
var byte = byteArray[bytePos + frameOffset];
|
||||
|
||||
@ -2144,7 +2143,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
|
||||
function xhrRequest(url, imageId, headers) {
|
||||
headers = headers || {};
|
||||
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
// Make the request for the DICOM P10 SOP Instance
|
||||
@ -2155,7 +2154,7 @@ if(typeof cornerstoneWADOImageLoader === 'undefined'){
|
||||
Object.keys(headers).forEach(function (key) {
|
||||
xhr.setRequestHeader(key, headers[key]);
|
||||
});
|
||||
|
||||
|
||||
// handle response data
|
||||
xhr.onreadystatechange = function () {
|
||||
// TODO: consider sending out progress messages here as we receive the pixel data
|
||||
|
||||
@ -133,44 +133,44 @@ export class MetadataProvider {
|
||||
getFrameIncrementPointer(image) {
|
||||
const dataSet = image.data;
|
||||
let frameInstancePointer = '';
|
||||
|
||||
|
||||
if (parsingUtils.isValidDataSet(dataSet)) {
|
||||
const frameInstancePointerNames = {
|
||||
'x00181063': 'frameTime',
|
||||
'x00181065': 'frameTimeVector'
|
||||
}
|
||||
|
||||
|
||||
// (0028,0009) = Frame Increment Pointer
|
||||
const frameInstancePointerTag = parsingUtils.attributeTag(dataSet, 'x00280009');
|
||||
frameInstancePointer = frameInstancePointerNames[frameInstancePointerTag];
|
||||
} else {
|
||||
frameInstancePointer = image.instance['frameIncrementPointer'];
|
||||
}
|
||||
|
||||
|
||||
return frameInstancePointer || '';
|
||||
}
|
||||
|
||||
|
||||
getFrameTimeVector(image) {
|
||||
const dataSet = image.data;
|
||||
|
||||
|
||||
if (parsingUtils.isValidDataSet(dataSet)) {
|
||||
// Frame Increment Pointer points to Frame Time Vector (0018,1065) field
|
||||
return parsingUtils.floatArray(dataSet, 'x00181065');
|
||||
}
|
||||
|
||||
|
||||
return image.instance['frameTimeVector'];
|
||||
}
|
||||
|
||||
|
||||
getFrameTime(image) {
|
||||
const dataSet = image.data;
|
||||
|
||||
|
||||
if (parsingUtils.isValidDataSet(dataSet)) {
|
||||
// Frame Increment Pointer points to Frame Time (0018,1063) field or is not defined (for addtional flexibility).
|
||||
// Yet another value is possible for this field (5200,9230 for Multi-frame Functional Groups)
|
||||
// but that case is currently not supported.
|
||||
return dataSet.floatString('x00181063', -1);
|
||||
}
|
||||
|
||||
|
||||
return image.instance['frameTime'];
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ ecmascript@0.6.1 # Enable ECMAScript2015+ syntax in app code
|
||||
shell-server@0.2.1 # Server-side component of the `meteor shell` command
|
||||
|
||||
# OHIF Packages
|
||||
ohif:compatibility
|
||||
ohif:core
|
||||
ohif:header
|
||||
ohif:design
|
||||
|
||||
@ -72,6 +72,7 @@ mrt:moment@2.8.1
|
||||
natestrauser:select2@4.0.3
|
||||
npm-mongo@2.2.11_2
|
||||
observe-sequence@1.0.14
|
||||
ohif:compatibility@0.0.1
|
||||
ohif:core@0.0.1
|
||||
ohif:cornerstone@0.0.1
|
||||
ohif:design@0.0.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user