From 67e3194546473061908affe34c4ce1a8caf9e661 Mon Sep 17 00:00:00 2001 From: ivmartel Date: Thu, 4 Oct 2018 23:13:02 +0200 Subject: [PATCH 1/3] Bumped version number to v0.26.0-beta --- package.json | 2 +- src/dicom/dicomParser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 64278100ee..0ffb3999b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dwv", - "version": "0.25.1", + "version": "0.26.0-beta", "description": "DICOM Web Viewer.", "keywords": [ "DICOM", diff --git a/src/dicom/dicomParser.js b/src/dicom/dicomParser.js index c9594a2a63..4c2b1c5da7 100755 --- a/src/dicom/dicomParser.js +++ b/src/dicom/dicomParser.js @@ -7,7 +7,7 @@ dwv.dicom = dwv.dicom || {}; * Get the version of the library. * @return {String} The version of the library. */ -dwv.getVersion = function () { return "0.25.1"; }; +dwv.getVersion = function () { return "0.26.0-beta"; }; /** * Clean string: trim and remove ending. From 771f977787bf2153b5e50660c044bd72aec66a31 Mon Sep 17 00:00:00 2001 From: ivmartel Date: Mon, 8 Oct 2018 23:38:22 +0200 Subject: [PATCH 2/3] Use layer container parent as reference. Fixes #581. --- src/app/application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/application.js b/src/app/application.js index 6d1baa581f..2535e679b1 100644 --- a/src/app/application.js +++ b/src/app/application.js @@ -364,7 +364,8 @@ dwv.App = function () * @return {width, height} The width and height of the div. */ this.getLayerContainerSize = function () { - var div = document.getElementById(containerDivId); + var ldiv = self.getElement("layerContainer"); + var div = ldiv.parentNode; // remove the height of other elements of the container div var height = div.offsetHeight; var kids = div.children; From 9b463414a94d9b7a31f14f3f5ddc0846271e5eaa Mon Sep 17 00:00:00 2001 From: ivmartel Date: Mon, 8 Oct 2018 23:42:48 +0200 Subject: [PATCH 3/3] Bumped version number to v0.25.2 --- dist/dwv.js | 7 ++++--- dist/dwv.min.js | 4 ++-- package.json | 2 +- src/dicom/dicomParser.js | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dist/dwv.js b/dist/dwv.js index 236e36d718..6667457728 100644 --- a/dist/dwv.js +++ b/dist/dwv.js @@ -1,4 +1,4 @@ -/*! dwv 0.25.1 2018-10-04 23:08:54 */ +/*! dwv 0.25.2 2018-10-08 23:41:22 */ // Inspired from umdjs // See https://github.com/umdjs/umd/blob/master/templates/returnExports.js (function (root, factory) { @@ -423,7 +423,8 @@ dwv.App = function () * @return {width, height} The width and height of the div. */ this.getLayerContainerSize = function () { - var div = document.getElementById(containerDivId); + var ldiv = self.getElement("layerContainer"); + var div = ldiv.parentNode; // remove the height of other elements of the container div var height = div.offsetHeight; var kids = div.children; @@ -3598,7 +3599,7 @@ dwv.dicom = dwv.dicom || {}; * Get the version of the library. * @return {String} The version of the library. */ -dwv.getVersion = function () { return "0.25.1"; }; +dwv.getVersion = function () { return "0.25.2"; }; /** * Clean string: trim and remove ending. diff --git a/dist/dwv.min.js b/dist/dwv.min.js index 30e24fc4b7..1ee5c17d88 100644 --- a/dist/dwv.min.js +++ b/dist/dwv.min.js @@ -1,3 +1,3 @@ -/*! dwv 0.25.1 2018-10-04 23:08:55 */ +/*! dwv 0.25.2 2018-10-08 23:41:23 */ -!function(e,t){"function"==typeof define&&define.amd?define(["i18next","i18next-xhr-backend","i18next-browser-languagedetector","jszip","konva"],t):"object"==typeof module&&module.exports?module.exports=t(require("i18next"),require("i18next-xhr-backend"),require("i18next-browser-languagedetector"),require("jszip"),require("konva"),null):e.dwv=t(e.i18next,e.i18nextXHRBackend,e.i18nextBrowserLanguageDetector,e.JSZip,e.Konva,e.MagicWand)}(this,function(a,s,l,t,T,f){var W=void 0!==W?W:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};(H=H||{}).App=function(){var v,o=this,a=null,s=null,l=null,u=0,c=0,d=0,T=null,r=1,S=1,i={x:0,y:0},x={x:0,y:0},g=null,m=null,h=null,p=null,L=null,I=null,f=null,C=null,y=new H.html.Style,P=null,F=null,D=null,A=null,E={},w="./";function O(e,t){R([e],new H.io.UrlsLoader,{requestHeaders:t})}function b(e,t,n){D=t;var i=W.onkeydown;W.onkeydown=function(e){e.ctrlKey&&88===e.keyCode&&(console.log("crtl-x pressed!"),o.abortLoad())},o.reset();var r="";r=void 0!==e[0].name?e[0].name:e[0],d=1===e.length&&"zip"!==r.split(".").pop().toLowerCase()&&!H.utils.endsWith(r,"DICOMDIR")&&!H.utils.endsWith(r,".dcmdir"),t.setDefaultCharacterSet(v),t.onload=function(e){a&&g.append(e.view),function(e){if(g)return;g=e.view,m=new H.ViewController(g),p=e.info,L&&L.update(e.info);s=g.getImage();var t=(a=s).getGeometry().getSize();u=t.getNumberOfColumns(),c=t.getNumberOfRows(),function(e,t){var n=o.getElement("imageLayer");(f=new H.html.Layer(n)).initialise(e,t),f.fillContext(),f.setStyleDisplay(!0);var i=o.getElement("drawDiv");i&&(C=new H.DrawController(i)).create(e,t),o.fitToSize(o.getLayerContainerSize()),o.resetLayout()}(u,c),l=f.getContext().createImageData(u,c),g.addEventListener("wl-width-change",o.onWLChange),g.addEventListener("wl-center-change",o.onWLChange),g.addEventListener("colour-change",o.onColourChange),g.addEventListener("slice-change",o.onSliceChange),g.addEventListener("frame-change",o.onFrameChange),g.addEventListener("wl-width-change",q),g.addEventListener("wl-center-change",q),g.addEventListener("colour-change",q),g.addEventListener("position-change",q),g.addEventListener("slice-change",q),g.addEventListener("frame-change",q);P&&P.initAndDisplay(f);var n=o.getElement("dropBox");if(n){n.removeEventListener("dragover",Q),n.removeEventListener("dragleave",B),n.removeEventListener("drop",V),H.html.removeNode(n);var i=o.getElement("layerContainer");i.addEventListener("dragover",Q),i.addEventListener("dragleave",B),i.addEventListener("drop",V)}o.getElement("infoLayer")&&((h=new H.InfoController(T)).create(o),h.toggleListeners(o,g));o.initWLDisplay(),U()}(e)},t.onerror=function(e){G(e)},t.onabort=function(e){!function(e){e.message?console.warn(e.message):console.warn("Abort called.");H.gui.displayProgress(100)}(e)},t.onloadend=function(){W.onkeydown=i,C&&C.activateDrawLayer(m),q({type:"load-progress",lengthComputable:!0,loaded:100,total:100}),q({type:"load-end"}),D=null},t.onprogress=k,q({type:"load-start"}),t.load(e,n)}function R(e,t,n){t.onload=function(e){var t=new H.State;t.apply(o,t.fromJSON(e))},t.onerror=function(e){G(e)},t.load(e,n)}function q(e){if(void 0!==E[e.type])for(var t=0;tc){for(var p=h.length/c,f=[],C=0,y=0;y";for(var c=1;c]+>/g,"").toLowerCase().indexOf(n[o])<0?i="none":n[o].length&&H.html.highlight(n[o],t.rows[r]),t.rows[r].style.display=i}},H.html.dehighlight=function(e){for(var t=0;t]+>/g,"")),n.parentNode);3!==n.nodeType&&H.html.dehighlight(n)}},H.html.highlight=function(e,t){for(var n=0;n=t){var l=s[t].firstChild.data;s[t].firstChild.data=H.i18n(r+l+o)}}},H.html.makeCellEditable=function(e,t,n){if(void 0!==e){var i=document.createElement("input");t?i.onchange=t:i.disabled=!0,i.value=e.firstChild.data,void 0===n||"color"===n&&!H.browser.hasInputColor()?i.type="text":i.type=n,H.html.cleanNode(e);var r=document.createElement("form");r.onsubmit=function(e){e.preventDefault()},r.appendChild(i),e.appendChild(r)}else console.warn("Cannot create input for non existing cell.")},H.html.setCursorToPointer=function(){document.body.style.cursor="pointer"},H.html.setCursorToDefault=function(){document.body.style.cursor="default"},H.html.createHtmlSelect=function(e,t,n,i){var r=document.createElement("select");r.className=e;var o,a=void 0===n?"":n+".",s=void 0!==i,l=function(e){var t=a+e+".name";return s?H.i18nExists(t)?H.i18n(t):e:H.i18n(t)};if(t instanceof Array)for(var u in t)t.hasOwnProperty(u)&&((o=document.createElement("option")).value=t[u],o.appendChild(document.createTextNode(l(t[u]))),r.appendChild(o));else{if("object"!=typeof t)throw new Error("Unsupported input list type.");for(var c in t)(o=document.createElement("option")).value=c,o.appendChild(document.createTextNode(l(c))),r.appendChild(o)}return r},H.html.displayElement=function(e,t){e.style.display=t?"":"none"},H.html.toggleDisplay=function(e){"none"===e.style.display?e.style.display="":e.style.display="none"},H.html.appendElement=function(e,t){e.appendChild(t),H.gui.refreshElement(e)},H.html.createHiddenElement=function(e,t){var n=document.createElement(e);return n.className=t,n.style.display="none",n},(H=H||{}).gui=H.gui||{},H.gui.base=H.gui.base||{},H.gui.info=H.gui.info||{},H.gui.base.plot=function(){},H.gui.info.MiniColourMap=function(h,p){this.create=function(){var e=h.getElementsByClassName("colour-map-info");0!==e.length&&H.html.removeNodes(e);var t=document.createElement("canvas");t.className="colour-map-info",t.width=98,t.height=10,h.appendChild(t)},this.update=function(e){for(var t,n=e.wc,i=e.ww,r=h.getElementsByClassName("colour-map-info")[0],o=r.getContext("2d"),a=p.getViewController().getColourMap(),s=o.getImageData(0,0,r.width,r.height),l=0,u=p.getImage().getRescaledDataRange().min,c=(p.getImage().getRescaledDataRange().max-u)/r.width,d=0,S=n-.5-(i-1)/2,x=n-.5+(i-1)/2,g=0;gn.getMax()?t:e})},H.image.filter.Sharpen=function(){this.getName=function(){return"Sharpen"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},H.image.filter.Sharpen.prototype.update=function(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])},H.image.filter.Sobel=function(){this.getName=function(){return"Sobel"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},H.image.filter.Sobel.prototype.update=function(){var e=this.getOriginalImage(),t=e.convolute2D([1,0,-1,2,0,-2,1,0,-1]),n=e.convolute2D([1,2,1,0,0,0,-1,-2,-1]);return t.compose(n,function(e,t){return Math.sqrt(e*e+t*t)})},(H=H||{}).image=H.image||{},H.image.Size=function(e,t,n){this.getNumberOfColumns=function(){return e},this.getNumberOfRows=function(){return t},this.getNumberOfSlices=function(){return n||1}},H.image.Size.prototype.getSliceSize=function(){return this.getNumberOfColumns()*this.getNumberOfRows()},H.image.Size.prototype.getTotalSize=function(){return this.getSliceSize()*this.getNumberOfSlices()},H.image.Size.prototype.equals=function(e){return null!==e&&this.getNumberOfColumns()===e.getNumberOfColumns()&&this.getNumberOfRows()===e.getNumberOfRows()&&this.getNumberOfSlices()===e.getNumberOfSlices()},H.image.Size.prototype.isInBounds=function(e,t,n){return!(e<0||e>this.getNumberOfColumns()-1||t<0||t>this.getNumberOfRows()-1||n<0||n>this.getNumberOfSlices()-1)},H.image.Size.prototype.toString=function(){return"("+this.getNumberOfColumns()+", "+this.getNumberOfRows()+", "+this.getNumberOfSlices()+")"},H.image.Spacing=function(e,t,n){this.getColumnSpacing=function(){return e},this.getRowSpacing=function(){return t},this.getSliceSpacing=function(){return n||1}},H.image.Spacing.prototype.equals=function(e){return null!==e&&this.getColumnSpacing()===e.getColumnSpacing()&&this.getRowSpacing()===e.getRowSpacing()&&this.getSliceSpacing()===e.getSliceSpacing()},H.image.Spacing.prototype.toString=function(){return"("+this.getColumnSpacing()+", "+this.getRowSpacing()+", "+this.getSliceSpacing()+")"},H.image.Geometry=function(e,n,t,o){void 0===e&&(e=new H.math.Point3D(0,0,0));var a=[e];void 0===o&&(o=new H.math.getIdentityMat33),this.getOrigin=function(){return e},this.getOrigins=function(){return a},this.getSize=function(){return n},this.getSpacing=function(){return t},this.getOrientation=function(){return o},this.getSliceIndex=function(e){for(var t=0,n=e.getDistance(a[0]),i=0,r=0;r=2*H.image.lut.range_max/3?H.image.lut.range_max-1:0},H.image.lut.toMaxFirstThird=function(e){var t=3*e;return t>H.image.lut.range_max-1?H.image.lut.range_max-1:t},H.image.lut.toMaxSecondThird=function(e){var t=H.image.lut.range_max/3,n=0;return t<=e&&(n=3*(e-t))>H.image.lut.range_max-1?H.image.lut.range_max-1:n},H.image.lut.toMaxThirdThird=function(e){var t=H.image.lut.range_max/3,n=0;return 2*t<=e&&(n=3*(e-2*t))>H.image.lut.range_max-1?H.image.lut.range_max-1:n},H.image.lut.zero=function(){return 0},H.image.lut.id=function(e){return e},H.image.lut.invId=function(e){return H.image.lut.range_max-1-e},H.image.lut.plain={red:H.image.lut.buildLut(H.image.lut.id),green:H.image.lut.buildLut(H.image.lut.id),blue:H.image.lut.buildLut(H.image.lut.id)},H.image.lut.invPlain={red:H.image.lut.buildLut(H.image.lut.invId),green:H.image.lut.buildLut(H.image.lut.invId),blue:H.image.lut.buildLut(H.image.lut.invId)},H.image.lut.rainbow={blue:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,247,239,231,223,215,207,199,191,183,175,167,159,151,143,135,127,119,111,103,95,87,79,71,63,55,47,39,31,23,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,193,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3],red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},H.image.lut.hot={red:H.image.lut.buildLut(H.image.lut.toMaxFirstThird),green:H.image.lut.buildLut(H.image.lut.toMaxSecondThird),blue:H.image.lut.buildLut(H.image.lut.toMaxThirdThird)},H.image.lut.hot_iron={red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255]},H.image.lut.pet={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,128,126,124,122,120,118,116,114,112,110,108,106,104,102,100,98,96,94,92,90,88,86,84,82,80,78,76,74,72,70,68,66,64,63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,252,248,244,240,236,232,228,224,220,216,212,208,204,200,196,192,188,184,180,176,172,168,164,160,156,152,148,144,140,136,132,128,124,120,116,112,108,104,100,96,92,88,84,80,76,72,68,64,60,56,52,48,44,40,36,32,28,24,20,16,12,8,4,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,255]},H.image.lut.hot_metal_blue={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,52,55,57,59,62,64,66,69,71,74,76,78,81,83,85,88,90,93,96,99,102,105,108,111,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,166,169,172,175,178,181,184,187,190,194,198,201,205,209,213,217,221,224,228,232,236,240,244,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,9,11,13,15,17,19,21,23,24,26,28,30,32,34,36,38,40,41,43,45,47,49,51,53,55,56,58,60,62,64,66,68,70,72,73,75,77,79,81,83,85,87,88,90,92,94,96,98,100,102,104,105,107,109,111,113,115,117,119,120,122,124,126,128,130,132,134,136,137,139,141,143,145,147,149,151,152,154,156,158,160,162,164,166,168,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,201,203,205,207,209,211,213,215,216,218,220,222,224,226,228,229,231,233,235,237,239,240,242,244,246,248,250,251,253,255],blue:[0,2,4,6,8,10,12,14,16,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,197,194,191,188,185,182,179,176,174,171,168,165,162,159,156,153,150,144,138,132,126,121,115,109,103,97,91,85,79,74,68,62,56,50,47,44,41,38,35,32,29,26,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,176,179,182,185,188,191,194,197,200,203,206,210,213,216,219,223,226,229,232,236,239,242,245,249,252,255]},H.image.lut.pet_20step={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,192,192,192,192,192,192,192,192,192,192,192,192,192,176,176,176,176,176,176,176,176,176,176,176,176,176,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,96,96,96,96,96,96,96,96,96,96,96,96,96,144,144,144,144,144,144,144,144,144,144,144,144,144,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,176,176,176,176,176,176,176,176,176,176,176,176,176,144,144,144,144,144,144,144,144,144,144,144,144,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,128,176,176,176,176,176,176,176,176,176,176,176,176,176,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,64,64,64,64,64,64,64,64,64,64,64,64,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255]},H.image.lut.test={red:H.image.lut.buildLut(H.image.lut.id),green:H.image.lut.buildLut(H.image.lut.zero),blue:H.image.lut.buildLut(H.image.lut.zero)},(H=H||{}).image=H.image||{},H.image.WindowLevel=function(t,n){if(0===n)throw new Error("A window level with a width of zero is not possible.");var i=0,r=0,o=255,a=null,s=null,l=null,u=null;function c(){var e=t+i;a=e-.5-(n-1)/2,s=e-.5+(n-1)/2,l=(o-r)/(n-1),u=(-(e-.5)/(n-1)+.5)*(o-r)+r}c(),this.getCenter=function(){return t},this.getWidth=function(){return n},this.setRange=function(e,t){r=parseInt(e,10),o=parseInt(t,10),c()},this.setSignedOffset=function(e){i=e,c()},this.apply=function(e){return e<=a?r:s=d.getNumberOfFrames())&&(n!==(n=e)&&1!==d.getNumberOfFrames()&&(this.fireEvent({type:"frame-change",frame:n}),this.setCurrentPosition(this.getCurrentPosition(),!0)),!0)},this.append=function(e){var t=this.getImage().appendSlice(e.getImage());t<=this.getCurrentPosition().k&&this.setCurrentPosition({i:this.getCurrentPosition().i,j:this.getCurrentPosition().j,k:this.getCurrentPosition().k+1},!0),this.addWindowPresets(e.getWindowPresets(),t)},this.appendFrameBuffer=function(e){this.getImage().appendFrameBuffer(e)},this.setWindowLevel=function(e,t,n){if(1<=t){var i=this.getCurrentPosition().k,r=null,o=d.getRescaleSlopeAndIntercept(i);if(o&&void 0!==o){var a=S[o.toString()];a&&void 0!==a&&(r=a.getWindowLevel())}void 0===n&&(n="manual"),x=n;var s=new H.image.WindowLevel(e,t);if(0===Object.keys(S).length){var l=new H.image.lut.Rescale(d.getRescaleSlopeAndIntercept(0),d.getMeta().BitsStored),u=new H.image.lut.Window(l,d.getMeta().IsSigned);this.addWindowLut(u)}for(var c in S)S[c].setWindowLevel(s);r&&void 0!==r?(r.getWidth()!==t&&this.fireEvent({type:"wl-width-change",wc:e,ww:t}),r.getCenter()!==e&&this.fireEvent({type:"wl-center-change",wc:e,ww:t})):(this.fireEvent({type:"wl-width-change",wc:e,ww:t}),this.fireEvent({type:"wl-center-change",wc:e,ww:t}))}},this.setWindowLevelPreset=function(e){var t=this.getWindowPresets()[e];if(void 0===t)throw new Error("Unknown window level preset: '"+e+"'");"minmax"===e&&void 0===t.wl&&(t.wl=this.getWindowLevelMinMax()),void 0!==t.perslice&&!0===t.perslice&&(t={wl:t.wl[this.getCurrentPosition().k]}),this.setWindowLevel(t.wl.getCenter(),t.wl.getWidth(),e)},this.setWindowLevelPresetById=function(e){var t=Object.keys(this.getWindowPresets());this.setWindowLevelPreset(t[e])},this.clone=function(){var e=new H.image.View(this.getImage());for(var t in S)e.addWindowLut(S[t]);return e.setListeners(this.getListeners()),e};var r={};this.getListeners=function(){return r},this.setListeners=function(e){r=e}},H.image.View.prototype.getWindowLevelMinMax=function(){var e=this.getImage().getRescaledDataRange(),t=e.min,n=e.max-t,i=t+n/2;return new H.image.WindowLevel(i,n)},H.image.View.prototype.setWindowLevelMinMax=function(){var e=this.getWindowLevelMinMax();this.setWindowLevel(e.getCenter(),e.getWidth(),"minmax")},H.image.View.prototype.generateImageData=function(e){var t=this.getCurrentWindowLut(),n=this.getImage(),i=n.getGeometry().getSize().getSliceSize(),r=i*this.getCurrentPosition().k,o=this.getCurrentFrame()?this.getCurrentFrame():0,a=0,s=0,l=0,u=n.getPhotometricInterpretation();switch(u){case"MONOCHROME1":case"MONOCHROME2":for(var c=this.getColourMap(),d=r+i,S=r;Sn.getEnd().getX()?0:-1,g=n.getBegin().getY()>n.getEnd().getY()?-1:.5,m=new T.Label({x:n.getEnd().getX()+25*x,y:n.getEnd().getY()+15*g,name:"label"});m.add(S),m.add(new T.Tag);var h=new T.Group;return h.name("line-group"),h.add(i),h.add(d),h.add(m),h.visible(!0),h},H.tool.UpdateArrow=function(e){var t=e.getParent(),n=t.getChildren(function(e){return"shape"===e.name()})[0],i=t.getChildren(function(e){return"shape-triangle"===e.name()})[0],r=t.getChildren(function(e){return"label"===e.name()})[0],o=t.getChildren(function(e){return"begin"===e.id()})[0],a=t.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":o.x(e.x()),o.y(e.y());break;case"end":a.x(e.x()),a.y(e.y())}var s=o.x()-n.x(),l=o.y()-n.y(),u=a.x()-n.x(),c=a.y()-n.y();n.points([s,l,u,c]);var d=new H.math.Point2D(o.x(),o.y()),S=new H.math.Point2D(a.x(),a.y()),x=new H.math.Line(d,S),g=new H.math.Point2D(s,l),m=new H.math.Point2D(u,c),h=H.math.getPerpendicularLine(x,g,10),p=H.math.getPerpendicularLine(x,m,10);n.hitFunc(function(e){e.beginPath(),e.moveTo(h.getBegin().getX(),h.getBegin().getY()),e.lineTo(h.getEnd().getX(),h.getEnd().getY()),e.lineTo(p.getEnd().getX(),p.getEnd().getY()),e.lineTo(p.getBegin().getX(),p.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});var f=new H.math.Point2D(x.getBegin().getX(),x.getBegin().getY()-10),C=new H.math.Line(x.getBegin(),f),y=H.math.getAngle(x,C),D=y*Math.PI/180;i.x(x.getBegin().getX()+i.radius()*Math.sin(D)),i.y(x.getBegin().getY()+i.radius()*Math.cos(D)),i.rotation(-y);var v=r.getText();v.quant=null,v.setText(v.textExpr);var T=x.getBegin().getX()>x.getEnd().getX()?0:-1,L=x.getBegin().getY()>x.getEnd().getY()?-1:.5,I={x:x.getEnd().getX()+25*T,y:x.getEnd().getY()+15*L};r.position(I)},(H=H||{}).tool=H.tool||{};T=T||{};H.tool.Draw=function(x,e){var i=this,n=null,r=!1;this.shapeFactoryList=e;var o=null,a=null,s=null;this.shapeName=0;var l=[],u=null,g=new H.tool.ShapeEditor(x);g.setDrawEventCallback(D);var m=new T.Group,t=new T.Line({points:[-10,-10,10,10],stroke:"red"}),c=new T.Line({points:[10,-10,-10,10],stroke:"red"});m.width(20),m.height(20),m.add(t),m.add(c),this.style=new H.html.Style;var d={},h=null;function S(e){s&&s.destroy(),(s=o.create(e,i.style,x.getImage())).getChildren(H.draw.isNodeNameShape)[0].listening(!1),h.hitGraphEnabled(!1),h.add(s),h.draw()}function p(e){s&&s.destroy();var t=o.create(e,i.style,x.getImage());t.id(H.math.guid()),x.getDrawController().getCurrentPosGroup().add(t),h.hitGraphEnabled(!0),(a=new H.tool.DrawGroupCommand(t,i.shapeName,h)).onExecute=D,a.onUndo=D,a.execute(),x.addToUndoStack(a),i.setShapeOn(t)}function f(){C(!0)}function C(e){h.listening(e),h.hitGraphEnabled(e);var t=x.getDrawController().getCurrentPosGroup().getChildren();e?(x.addToolCanvasListeners(x.getDrawStage().getContent()),t.forEach(function(e){i.setShapeOn(e)})):(x.removeToolCanvasListeners(x.getDrawStage().getContent()),t.forEach(function(e){var t;(t=e).off("mouseover"),t.off("mouseout"),t.draggable(!1),t.off("dragstart.draw"),t.off("dragmove.draw"),t.off("dragend.draw"),t.off("dblclick")})),h.draw()}function y(e){var t=x.getDrawStage();return{x:t.offset().x+e.x/t.scale().x,y:t.offset().y+e.y/t.scale().y}}function D(e){if(void 0!==d[e.type])for(var t=0;ti.getEnd().getX()?0:-1,x=i.getBegin().getY()>i.getEnd().getY()?-1:.5,g=new T.Label({x:i.getEnd().getX()+25*S,y:i.getEnd().getY()+15*x,name:"label"});g.add(d),g.add(new T.Tag);var m=new T.Group;return m.name("ruler-group"),m.add(r),m.add(s),m.add(u),m.add(g),m.visible(!0),m},H.tool.UpdateRuler=function(e,t){var n=e.getParent(),i=n.getChildren(function(e){return"shape"===e.name()})[0],r=n.getChildren(function(e){return"shape-tick0"===e.name()})[0],o=n.getChildren(function(e){return"shape-tick1"===e.name()})[0],a=n.getChildren(function(e){return"label"===e.name()})[0],s=n.getChildren(function(e){return"begin"===e.id()})[0],l=n.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":s.x(e.x()),s.y(e.y());break;case"end":l.x(e.x()),l.y(e.y())}var u=s.x()-i.x(),c=s.y()-i.y(),d=l.x()-i.x(),S=l.y()-i.y();i.points([u,c,d,S]);var x=new H.math.Point2D(s.x(),s.y()),g=new H.math.Point2D(l.x(),l.y()),m=new H.math.Line(x,g),h=new H.math.Point2D(u,c),p=new H.math.Point2D(d,S),f=H.math.getPerpendicularLine(m,h,10);r.points([f.getBegin().getX(),f.getBegin().getY(),f.getEnd().getX(),f.getEnd().getY()]);var C=H.math.getPerpendicularLine(m,p,10);o.points([C.getBegin().getX(),C.getBegin().getY(),C.getEnd().getX(),C.getEnd().getY()]),i.hitFunc(function(e){e.beginPath(),e.moveTo(f.getBegin().getX(),f.getBegin().getY()),e.lineTo(f.getEnd().getX(),f.getEnd().getY()),e.lineTo(C.getEnd().getX(),C.getEnd().getY()),e.lineTo(C.getBegin().getX(),C.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});var y=t.quantifyLine(m),D=a.getText();D.quant=y,D.setText(H.utils.replaceFlags(D.textExpr,D.quant));var v=m.getBegin().getX()>m.getEnd().getX()?0:-1,T=m.getBegin().getY()>m.getEnd().getY()?-1:.5,L={x:m.getEnd().getX()+25*v,y:m.getEnd().getY()+15*T};a.position(L)},(H=H||{}).tool=H.tool||{},H.tool.Scroll=function(o){var a=this,t=null;this.started=!1;var n=null;function i(e){var t=1!==o.getImage().getGeometry().getSize().getNumberOfSlices(),n=1!==o.getImage().getNumberOfFrames();e?t?o.getViewController().incrementSliceNb():n&&o.getViewController().incrementFrameNb():t?o.getViewController().decrementSliceNb():n&&o.getViewController().decrementFrameNb()}this.mousedown=function(e){o.getViewController().isPlaying()&&o.getViewController().stop(),a.started=!0,a.x0=e._x,a.y0=e._y},this.mousemove=function(e){if(a.started){var t=e._y-a.y0,n=15c){for(var p=h.length/c,f=[],C=0,y=0;y";for(var c=1;c]+>/g,"").toLowerCase().indexOf(n[o])<0?i="none":n[o].length&&H.html.highlight(n[o],t.rows[r]),t.rows[r].style.display=i}},H.html.dehighlight=function(e){for(var t=0;t]+>/g,"")),n.parentNode);3!==n.nodeType&&H.html.dehighlight(n)}},H.html.highlight=function(e,t){for(var n=0;n=t){var l=s[t].firstChild.data;s[t].firstChild.data=H.i18n(r+l+o)}}},H.html.makeCellEditable=function(e,t,n){if(void 0!==e){var i=document.createElement("input");t?i.onchange=t:i.disabled=!0,i.value=e.firstChild.data,void 0===n||"color"===n&&!H.browser.hasInputColor()?i.type="text":i.type=n,H.html.cleanNode(e);var r=document.createElement("form");r.onsubmit=function(e){e.preventDefault()},r.appendChild(i),e.appendChild(r)}else console.warn("Cannot create input for non existing cell.")},H.html.setCursorToPointer=function(){document.body.style.cursor="pointer"},H.html.setCursorToDefault=function(){document.body.style.cursor="default"},H.html.createHtmlSelect=function(e,t,n,i){var r=document.createElement("select");r.className=e;var o,a=void 0===n?"":n+".",s=void 0!==i,l=function(e){var t=a+e+".name";return s?H.i18nExists(t)?H.i18n(t):e:H.i18n(t)};if(t instanceof Array)for(var u in t)t.hasOwnProperty(u)&&((o=document.createElement("option")).value=t[u],o.appendChild(document.createTextNode(l(t[u]))),r.appendChild(o));else{if("object"!=typeof t)throw new Error("Unsupported input list type.");for(var c in t)(o=document.createElement("option")).value=c,o.appendChild(document.createTextNode(l(c))),r.appendChild(o)}return r},H.html.displayElement=function(e,t){e.style.display=t?"":"none"},H.html.toggleDisplay=function(e){"none"===e.style.display?e.style.display="":e.style.display="none"},H.html.appendElement=function(e,t){e.appendChild(t),H.gui.refreshElement(e)},H.html.createHiddenElement=function(e,t){var n=document.createElement(e);return n.className=t,n.style.display="none",n},(H=H||{}).gui=H.gui||{},H.gui.base=H.gui.base||{},H.gui.info=H.gui.info||{},H.gui.base.plot=function(){},H.gui.info.MiniColourMap=function(h,p){this.create=function(){var e=h.getElementsByClassName("colour-map-info");0!==e.length&&H.html.removeNodes(e);var t=document.createElement("canvas");t.className="colour-map-info",t.width=98,t.height=10,h.appendChild(t)},this.update=function(e){for(var t,n=e.wc,i=e.ww,r=h.getElementsByClassName("colour-map-info")[0],o=r.getContext("2d"),a=p.getViewController().getColourMap(),s=o.getImageData(0,0,r.width,r.height),l=0,u=p.getImage().getRescaledDataRange().min,c=(p.getImage().getRescaledDataRange().max-u)/r.width,d=0,S=n-.5-(i-1)/2,x=n-.5+(i-1)/2,g=0;gn.getMax()?t:e})},H.image.filter.Sharpen=function(){this.getName=function(){return"Sharpen"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},H.image.filter.Sharpen.prototype.update=function(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])},H.image.filter.Sobel=function(){this.getName=function(){return"Sobel"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},H.image.filter.Sobel.prototype.update=function(){var e=this.getOriginalImage(),t=e.convolute2D([1,0,-1,2,0,-2,1,0,-1]),n=e.convolute2D([1,2,1,0,0,0,-1,-2,-1]);return t.compose(n,function(e,t){return Math.sqrt(e*e+t*t)})},(H=H||{}).image=H.image||{},H.image.Size=function(e,t,n){this.getNumberOfColumns=function(){return e},this.getNumberOfRows=function(){return t},this.getNumberOfSlices=function(){return n||1}},H.image.Size.prototype.getSliceSize=function(){return this.getNumberOfColumns()*this.getNumberOfRows()},H.image.Size.prototype.getTotalSize=function(){return this.getSliceSize()*this.getNumberOfSlices()},H.image.Size.prototype.equals=function(e){return null!==e&&this.getNumberOfColumns()===e.getNumberOfColumns()&&this.getNumberOfRows()===e.getNumberOfRows()&&this.getNumberOfSlices()===e.getNumberOfSlices()},H.image.Size.prototype.isInBounds=function(e,t,n){return!(e<0||e>this.getNumberOfColumns()-1||t<0||t>this.getNumberOfRows()-1||n<0||n>this.getNumberOfSlices()-1)},H.image.Size.prototype.toString=function(){return"("+this.getNumberOfColumns()+", "+this.getNumberOfRows()+", "+this.getNumberOfSlices()+")"},H.image.Spacing=function(e,t,n){this.getColumnSpacing=function(){return e},this.getRowSpacing=function(){return t},this.getSliceSpacing=function(){return n||1}},H.image.Spacing.prototype.equals=function(e){return null!==e&&this.getColumnSpacing()===e.getColumnSpacing()&&this.getRowSpacing()===e.getRowSpacing()&&this.getSliceSpacing()===e.getSliceSpacing()},H.image.Spacing.prototype.toString=function(){return"("+this.getColumnSpacing()+", "+this.getRowSpacing()+", "+this.getSliceSpacing()+")"},H.image.Geometry=function(e,n,t,o){void 0===e&&(e=new H.math.Point3D(0,0,0));var a=[e];void 0===o&&(o=new H.math.getIdentityMat33),this.getOrigin=function(){return e},this.getOrigins=function(){return a},this.getSize=function(){return n},this.getSpacing=function(){return t},this.getOrientation=function(){return o},this.getSliceIndex=function(e){for(var t=0,n=e.getDistance(a[0]),i=0,r=0;r=2*H.image.lut.range_max/3?H.image.lut.range_max-1:0},H.image.lut.toMaxFirstThird=function(e){var t=3*e;return t>H.image.lut.range_max-1?H.image.lut.range_max-1:t},H.image.lut.toMaxSecondThird=function(e){var t=H.image.lut.range_max/3,n=0;return t<=e&&(n=3*(e-t))>H.image.lut.range_max-1?H.image.lut.range_max-1:n},H.image.lut.toMaxThirdThird=function(e){var t=H.image.lut.range_max/3,n=0;return 2*t<=e&&(n=3*(e-2*t))>H.image.lut.range_max-1?H.image.lut.range_max-1:n},H.image.lut.zero=function(){return 0},H.image.lut.id=function(e){return e},H.image.lut.invId=function(e){return H.image.lut.range_max-1-e},H.image.lut.plain={red:H.image.lut.buildLut(H.image.lut.id),green:H.image.lut.buildLut(H.image.lut.id),blue:H.image.lut.buildLut(H.image.lut.id)},H.image.lut.invPlain={red:H.image.lut.buildLut(H.image.lut.invId),green:H.image.lut.buildLut(H.image.lut.invId),blue:H.image.lut.buildLut(H.image.lut.invId)},H.image.lut.rainbow={blue:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,247,239,231,223,215,207,199,191,183,175,167,159,151,143,135,127,119,111,103,95,87,79,71,63,55,47,39,31,23,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,193,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3],red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},H.image.lut.hot={red:H.image.lut.buildLut(H.image.lut.toMaxFirstThird),green:H.image.lut.buildLut(H.image.lut.toMaxSecondThird),blue:H.image.lut.buildLut(H.image.lut.toMaxThirdThird)},H.image.lut.hot_iron={red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255]},H.image.lut.pet={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,128,126,124,122,120,118,116,114,112,110,108,106,104,102,100,98,96,94,92,90,88,86,84,82,80,78,76,74,72,70,68,66,64,63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,252,248,244,240,236,232,228,224,220,216,212,208,204,200,196,192,188,184,180,176,172,168,164,160,156,152,148,144,140,136,132,128,124,120,116,112,108,104,100,96,92,88,84,80,76,72,68,64,60,56,52,48,44,40,36,32,28,24,20,16,12,8,4,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,255]},H.image.lut.hot_metal_blue={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,52,55,57,59,62,64,66,69,71,74,76,78,81,83,85,88,90,93,96,99,102,105,108,111,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,166,169,172,175,178,181,184,187,190,194,198,201,205,209,213,217,221,224,228,232,236,240,244,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,9,11,13,15,17,19,21,23,24,26,28,30,32,34,36,38,40,41,43,45,47,49,51,53,55,56,58,60,62,64,66,68,70,72,73,75,77,79,81,83,85,87,88,90,92,94,96,98,100,102,104,105,107,109,111,113,115,117,119,120,122,124,126,128,130,132,134,136,137,139,141,143,145,147,149,151,152,154,156,158,160,162,164,166,168,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,201,203,205,207,209,211,213,215,216,218,220,222,224,226,228,229,231,233,235,237,239,240,242,244,246,248,250,251,253,255],blue:[0,2,4,6,8,10,12,14,16,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,197,194,191,188,185,182,179,176,174,171,168,165,162,159,156,153,150,144,138,132,126,121,115,109,103,97,91,85,79,74,68,62,56,50,47,44,41,38,35,32,29,26,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,176,179,182,185,188,191,194,197,200,203,206,210,213,216,219,223,226,229,232,236,239,242,245,249,252,255]},H.image.lut.pet_20step={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,192,192,192,192,192,192,192,192,192,192,192,192,192,176,176,176,176,176,176,176,176,176,176,176,176,176,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,96,96,96,96,96,96,96,96,96,96,96,96,96,144,144,144,144,144,144,144,144,144,144,144,144,144,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,176,176,176,176,176,176,176,176,176,176,176,176,176,144,144,144,144,144,144,144,144,144,144,144,144,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,128,176,176,176,176,176,176,176,176,176,176,176,176,176,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,64,64,64,64,64,64,64,64,64,64,64,64,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255]},H.image.lut.test={red:H.image.lut.buildLut(H.image.lut.id),green:H.image.lut.buildLut(H.image.lut.zero),blue:H.image.lut.buildLut(H.image.lut.zero)},(H=H||{}).image=H.image||{},H.image.WindowLevel=function(t,n){if(0===n)throw new Error("A window level with a width of zero is not possible.");var i=0,r=0,o=255,a=null,s=null,l=null,u=null;function c(){var e=t+i;a=e-.5-(n-1)/2,s=e-.5+(n-1)/2,l=(o-r)/(n-1),u=(-(e-.5)/(n-1)+.5)*(o-r)+r}c(),this.getCenter=function(){return t},this.getWidth=function(){return n},this.setRange=function(e,t){r=parseInt(e,10),o=parseInt(t,10),c()},this.setSignedOffset=function(e){i=e,c()},this.apply=function(e){return e<=a?r:s=d.getNumberOfFrames())&&(n!==(n=e)&&1!==d.getNumberOfFrames()&&(this.fireEvent({type:"frame-change",frame:n}),this.setCurrentPosition(this.getCurrentPosition(),!0)),!0)},this.append=function(e){var t=this.getImage().appendSlice(e.getImage());t<=this.getCurrentPosition().k&&this.setCurrentPosition({i:this.getCurrentPosition().i,j:this.getCurrentPosition().j,k:this.getCurrentPosition().k+1},!0),this.addWindowPresets(e.getWindowPresets(),t)},this.appendFrameBuffer=function(e){this.getImage().appendFrameBuffer(e)},this.setWindowLevel=function(e,t,n){if(1<=t){var i=this.getCurrentPosition().k,r=null,o=d.getRescaleSlopeAndIntercept(i);if(o&&void 0!==o){var a=S[o.toString()];a&&void 0!==a&&(r=a.getWindowLevel())}void 0===n&&(n="manual"),x=n;var s=new H.image.WindowLevel(e,t);if(0===Object.keys(S).length){var l=new H.image.lut.Rescale(d.getRescaleSlopeAndIntercept(0),d.getMeta().BitsStored),u=new H.image.lut.Window(l,d.getMeta().IsSigned);this.addWindowLut(u)}for(var c in S)S[c].setWindowLevel(s);r&&void 0!==r?(r.getWidth()!==t&&this.fireEvent({type:"wl-width-change",wc:e,ww:t}),r.getCenter()!==e&&this.fireEvent({type:"wl-center-change",wc:e,ww:t})):(this.fireEvent({type:"wl-width-change",wc:e,ww:t}),this.fireEvent({type:"wl-center-change",wc:e,ww:t}))}},this.setWindowLevelPreset=function(e){var t=this.getWindowPresets()[e];if(void 0===t)throw new Error("Unknown window level preset: '"+e+"'");"minmax"===e&&void 0===t.wl&&(t.wl=this.getWindowLevelMinMax()),void 0!==t.perslice&&!0===t.perslice&&(t={wl:t.wl[this.getCurrentPosition().k]}),this.setWindowLevel(t.wl.getCenter(),t.wl.getWidth(),e)},this.setWindowLevelPresetById=function(e){var t=Object.keys(this.getWindowPresets());this.setWindowLevelPreset(t[e])},this.clone=function(){var e=new H.image.View(this.getImage());for(var t in S)e.addWindowLut(S[t]);return e.setListeners(this.getListeners()),e};var r={};this.getListeners=function(){return r},this.setListeners=function(e){r=e}},H.image.View.prototype.getWindowLevelMinMax=function(){var e=this.getImage().getRescaledDataRange(),t=e.min,n=e.max-t,i=t+n/2;return new H.image.WindowLevel(i,n)},H.image.View.prototype.setWindowLevelMinMax=function(){var e=this.getWindowLevelMinMax();this.setWindowLevel(e.getCenter(),e.getWidth(),"minmax")},H.image.View.prototype.generateImageData=function(e){var t=this.getCurrentWindowLut(),n=this.getImage(),i=n.getGeometry().getSize().getSliceSize(),r=i*this.getCurrentPosition().k,o=this.getCurrentFrame()?this.getCurrentFrame():0,a=0,s=0,l=0,u=n.getPhotometricInterpretation();switch(u){case"MONOCHROME1":case"MONOCHROME2":for(var c=this.getColourMap(),d=r+i,S=r;Sn.getEnd().getX()?0:-1,g=n.getBegin().getY()>n.getEnd().getY()?-1:.5,m=new T.Label({x:n.getEnd().getX()+25*x,y:n.getEnd().getY()+15*g,name:"label"});m.add(S),m.add(new T.Tag);var h=new T.Group;return h.name("line-group"),h.add(i),h.add(d),h.add(m),h.visible(!0),h},H.tool.UpdateArrow=function(e){var t=e.getParent(),n=t.getChildren(function(e){return"shape"===e.name()})[0],i=t.getChildren(function(e){return"shape-triangle"===e.name()})[0],r=t.getChildren(function(e){return"label"===e.name()})[0],o=t.getChildren(function(e){return"begin"===e.id()})[0],a=t.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":o.x(e.x()),o.y(e.y());break;case"end":a.x(e.x()),a.y(e.y())}var s=o.x()-n.x(),l=o.y()-n.y(),u=a.x()-n.x(),c=a.y()-n.y();n.points([s,l,u,c]);var d=new H.math.Point2D(o.x(),o.y()),S=new H.math.Point2D(a.x(),a.y()),x=new H.math.Line(d,S),g=new H.math.Point2D(s,l),m=new H.math.Point2D(u,c),h=H.math.getPerpendicularLine(x,g,10),p=H.math.getPerpendicularLine(x,m,10);n.hitFunc(function(e){e.beginPath(),e.moveTo(h.getBegin().getX(),h.getBegin().getY()),e.lineTo(h.getEnd().getX(),h.getEnd().getY()),e.lineTo(p.getEnd().getX(),p.getEnd().getY()),e.lineTo(p.getBegin().getX(),p.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});var f=new H.math.Point2D(x.getBegin().getX(),x.getBegin().getY()-10),C=new H.math.Line(x.getBegin(),f),y=H.math.getAngle(x,C),D=y*Math.PI/180;i.x(x.getBegin().getX()+i.radius()*Math.sin(D)),i.y(x.getBegin().getY()+i.radius()*Math.cos(D)),i.rotation(-y);var v=r.getText();v.quant=null,v.setText(v.textExpr);var T=x.getBegin().getX()>x.getEnd().getX()?0:-1,L=x.getBegin().getY()>x.getEnd().getY()?-1:.5,I={x:x.getEnd().getX()+25*T,y:x.getEnd().getY()+15*L};r.position(I)},(H=H||{}).tool=H.tool||{};T=T||{};H.tool.Draw=function(x,e){var i=this,n=null,r=!1;this.shapeFactoryList=e;var o=null,a=null,s=null;this.shapeName=0;var l=[],u=null,g=new H.tool.ShapeEditor(x);g.setDrawEventCallback(D);var m=new T.Group,t=new T.Line({points:[-10,-10,10,10],stroke:"red"}),c=new T.Line({points:[10,-10,-10,10],stroke:"red"});m.width(20),m.height(20),m.add(t),m.add(c),this.style=new H.html.Style;var d={},h=null;function S(e){s&&s.destroy(),(s=o.create(e,i.style,x.getImage())).getChildren(H.draw.isNodeNameShape)[0].listening(!1),h.hitGraphEnabled(!1),h.add(s),h.draw()}function p(e){s&&s.destroy();var t=o.create(e,i.style,x.getImage());t.id(H.math.guid()),x.getDrawController().getCurrentPosGroup().add(t),h.hitGraphEnabled(!0),(a=new H.tool.DrawGroupCommand(t,i.shapeName,h)).onExecute=D,a.onUndo=D,a.execute(),x.addToUndoStack(a),i.setShapeOn(t)}function f(){C(!0)}function C(e){h.listening(e),h.hitGraphEnabled(e);var t=x.getDrawController().getCurrentPosGroup().getChildren();e?(x.addToolCanvasListeners(x.getDrawStage().getContent()),t.forEach(function(e){i.setShapeOn(e)})):(x.removeToolCanvasListeners(x.getDrawStage().getContent()),t.forEach(function(e){var t;(t=e).off("mouseover"),t.off("mouseout"),t.draggable(!1),t.off("dragstart.draw"),t.off("dragmove.draw"),t.off("dragend.draw"),t.off("dblclick")})),h.draw()}function y(e){var t=x.getDrawStage();return{x:t.offset().x+e.x/t.scale().x,y:t.offset().y+e.y/t.scale().y}}function D(e){if(void 0!==d[e.type])for(var t=0;ti.getEnd().getX()?0:-1,x=i.getBegin().getY()>i.getEnd().getY()?-1:.5,g=new T.Label({x:i.getEnd().getX()+25*S,y:i.getEnd().getY()+15*x,name:"label"});g.add(d),g.add(new T.Tag);var m=new T.Group;return m.name("ruler-group"),m.add(r),m.add(s),m.add(u),m.add(g),m.visible(!0),m},H.tool.UpdateRuler=function(e,t){var n=e.getParent(),i=n.getChildren(function(e){return"shape"===e.name()})[0],r=n.getChildren(function(e){return"shape-tick0"===e.name()})[0],o=n.getChildren(function(e){return"shape-tick1"===e.name()})[0],a=n.getChildren(function(e){return"label"===e.name()})[0],s=n.getChildren(function(e){return"begin"===e.id()})[0],l=n.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":s.x(e.x()),s.y(e.y());break;case"end":l.x(e.x()),l.y(e.y())}var u=s.x()-i.x(),c=s.y()-i.y(),d=l.x()-i.x(),S=l.y()-i.y();i.points([u,c,d,S]);var x=new H.math.Point2D(s.x(),s.y()),g=new H.math.Point2D(l.x(),l.y()),m=new H.math.Line(x,g),h=new H.math.Point2D(u,c),p=new H.math.Point2D(d,S),f=H.math.getPerpendicularLine(m,h,10);r.points([f.getBegin().getX(),f.getBegin().getY(),f.getEnd().getX(),f.getEnd().getY()]);var C=H.math.getPerpendicularLine(m,p,10);o.points([C.getBegin().getX(),C.getBegin().getY(),C.getEnd().getX(),C.getEnd().getY()]),i.hitFunc(function(e){e.beginPath(),e.moveTo(f.getBegin().getX(),f.getBegin().getY()),e.lineTo(f.getEnd().getX(),f.getEnd().getY()),e.lineTo(C.getEnd().getX(),C.getEnd().getY()),e.lineTo(C.getBegin().getX(),C.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});var y=t.quantifyLine(m),D=a.getText();D.quant=y,D.setText(H.utils.replaceFlags(D.textExpr,D.quant));var v=m.getBegin().getX()>m.getEnd().getX()?0:-1,T=m.getBegin().getY()>m.getEnd().getY()?-1:.5,L={x:m.getEnd().getX()+25*v,y:m.getEnd().getY()+15*T};a.position(L)},(H=H||{}).tool=H.tool||{},H.tool.Scroll=function(o){var a=this,t=null;this.started=!1;var n=null;function i(e){var t=1!==o.getImage().getGeometry().getSize().getNumberOfSlices(),n=1!==o.getImage().getNumberOfFrames();e?t?o.getViewController().incrementSliceNb():n&&o.getViewController().incrementFrameNb():t?o.getViewController().decrementSliceNb():n&&o.getViewController().decrementFrameNb()}this.mousedown=function(e){o.getViewController().isPlaying()&&o.getViewController().stop(),a.started=!0,a.x0=e._x,a.y0=e._y},this.mousemove=function(e){if(a.started){var t=e._y-a.y0,n=15