@edsilv/ami.js
Version:
<p align="center"> <img src="https://user-images.githubusercontent.com/214063/46479857-4cd66e80-c7f0-11e8-9585-5748409c9490.png" width="60%"> </p>
1 lines • 1.31 MB
JavaScript
var AMI=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=114)}([function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(43),r=i(4),o=i(77);function a(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}Object.assign(a.prototype,{isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e=new o.a;return function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new o.a;return function(t,i){return this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*n-a*i,c=s*i+a*t-r*n,h=s*n+r*i-o*t,u=-r*t-o*i-a*n;return this.x=l*s+u*-r+c*-a-h*-o,this.y=c*s+u*-o+h*-r-l*-a,this.z=h*s+u*-a+l*-o-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(){var e=new r.a;return function(t){return this.applyMatrix4(e.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld)}}(),transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e=new a,t=new a;return function(i,n){return e.set(i,i,i),t.set(n,n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new a;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new a;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(n.a.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,i){var n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}})},function(e,t,i){"use strict";i.r(t);var n=i(5),r=i(24),o=i(101),a=i(103),s=i(4),l=i(0),c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.bbox=function(e,t){return n.a.vector3(e)&&n.a.vector3(t)?t.x>=0&&t.y>=0&&t.z>=0?{min:e.clone().sub(t),max:e.clone().add(t)}:(window.console.log("halfDimensions must be >= 0."),window.console.log(t),!1):(window.console.log("Invalid center or plane halfDimensions."),!1)},e.minMax=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[65535,-32768],i=e.length,n=0;n<i;n++){var r=e[n];t[0]=Math.min(t[0],r),t[1]=Math.max(t[1],r)}return t},e.isElement=function(e){try{return e instanceof HTMLElement}catch(t){return"object"===(void 0===e?"undefined":c(e))&&1===e.nodeType&&"object"===c(e.style)&&"object"===c(e.ownerDocument)}},e.isString=function(e){return"string"==typeof e||e instanceof String},e.parseUrl=function(e){var t=new URL(e,"http://fix.me"),i={filename:t.searchParams.get("filename"),extension:"",pathname:t.pathname,query:t.search};i.filename||(i.filename=i.pathname.split("/").pop());var n=i.filename.split(".");i.extension=n.length>1?n.pop():"dicom";return(!isNaN(i.extension)||-1!==["asp","aspx","go","gs","hs","jsp","js","php","pl","py","rb","htm","html"].indexOf(i.extension)||i.query&&i.query.includes("contentType=application%2Fdicom"))&&(i.extension="dicom"),i},e.ijk2LPS=function(e,t,i,n,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new s.a,a=new s.a;return a.set(e.x*n.y,t.x*n.x,i.x*n.z,r.x,e.y*n.y,t.y*n.x,i.y*n.z,r.y,e.z*n.y,t.z*n.x,i.z*n.z,r.z,0,0,0,1),a.premultiply(o),a},e.aabb2LPS=function(e,t,i,n){var r=new s.a;return r.set(e.x,t.x,i.x,n.x,e.y,t.y,i.y,n.y,e.z,t.z,i.z,n.z,0,0,0,1),r},e.worldToData=function(e,t){var i=(new l.a).copy(t).applyMatrix4(e);return i.addScalar(.5).floor(),i},e.value=function(e,t){window.console.warn("value is deprecated, please use getPixelData instead"),this.getPixelData(e,t)},e.getPixelData=function(e,t){return t.z>=0&&t.z<e._frame.length?e._frame[t.z].getPixelData(t.x,t.y):null},e.setPixelData=function(e,t,i){if(!(t.z>=0&&t.z<e._frame.length))return null;e._frame[t.z].setPixelData(t.x,t.y,i)},e.rescaleSlopeIntercept=function(e,t,i){return e*t+i},e.centerOfMass=function(e){for(var t=new l.a(0,0,0),i=0;i<e.length;i++)t.x+=e[i].x,t.y+=e[i].y,t.z+=e[i].z;return t.divideScalar(e.length),t},e.orderIntersections=function(e,t){for(var i=this.centerOfMass(e),n=new l.a(e[0].x-i.x,e[0].y-i.y,e[0].z-i.z).normalize(),r=new l.a(0,0,0).crossVectors(n,t).normalize(),o=[],a=0;a<e.length;a++){var s=new l.a(e[a].x,e[a].y,e[a].z);s.direction=new l.a(e[a].x-i.x,e[a].y-i.y,e[a].z-i.z).normalize();var c=n.dot(s.direction),h=r.dot(s.direction);s.xy={x:c,y:h};var u=Math.atan2(h,c)*(180/Math.PI);s.angle=u,o.push(s)}o.sort(function(e,t){return e.angle-t.angle});for(var f=[o[0]],d=1;d<o.length;d++)Math.abs(o[d-1].angle-o[d].angle)>1e-4&&f.push(o[d]);return f},e.getRoI=function(t,i,n){t.geometry.computeBoundingBox();var a=(new r.a).setFromObject(t),s=a.min.clone().project(i),l=a.max.clone().project(i),c=i.controls.domElement.offsetWidth,h=i.controls.domElement.offsetHeight,u=new o.a,f=[];s.x=Math.round((s.x+1)*c/2),s.y=Math.round((1-s.y)*h/2),l.x=Math.round((l.x+1)*c/2),l.y=Math.round((1-l.y)*h/2);var d=[Math.min(s.x,l.x),Math.max(s.x,l.x)];s.x=d[0],l.x=d[1];var p=[Math.min(s.y,l.y),Math.max(s.y,l.y)];s.y=p[0],l.y=p[1];for(var _=[],m=null,b=s.x;b<=l.x;b++)for(var y=s.y;y<=l.y;y++)u.setFromCamera({x:b/c*2-1,y:-y/h*2+1},i),0!==(_=u.intersectObject(t)).length&&null!==(m=e.getPixelData(n,e.worldToData(n.lps2IJK,_[0].point)))&&1===n.numberOfChannels&&f.push(e.rescaleSlopeIntercept(m,n.rescaleSlope,n.rescaleIntercept));if(0===f.length)return null;var g=f.reduce(function(e,t){return e+t})/f.length;return{min:f.reduce(function(e,t){return e<t?e:t}),max:f.reduce(function(e,t){return e>t?e:t}),mean:g,sd:Math.sqrt(f.reduce(function(e,t){return e+Math.pow(t-g,2)},0)/f.length)}},e.getGeometryArea=function(e){if(e.faces.length<1)return 0;var t=0,i=e.vertices;return e.faces.forEach(function(e){t+=new a.a(i[e.a],i[e.b],i[e.c]).getArea()}),t},e}();t.default=h},function(e,t,i){"use strict";i.d(t,"b",function(){return a});var n=i(3),r=i(7),o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.THREE;return void 0===e||void 0===e.Object3D?null:function(t){function i(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,t.call(this,n,r,o));return a._widgetType="Handle",!0===o.hideHandleMesh&&(a.visible=!1),a._plane={position:new e.Vector3,direction:new e.Vector3},a._offset=new e.Vector3,a._raycaster=new e.Raycaster,a._active=!1,a._hovered=!1,a._tracking=!1,a._mouse=new e.Vector2,a._initialized=!1,a._material=null,a._geometry=null,a._mesh=null,a._meshHovered=!1,a._dom=null,a._domHovered=!1,a._screenPosition=a.worldToScreen(a._worldPosition),a.create(),a.initOffsets(),a.onResize=a.onResize.bind(a),a.onMove=a.onMove.bind(a),a.onHover=a.onHover.bind(a),a.addEventListeners(),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,t),i.prototype.addEventListeners=function(){window.addEventListener("resize",this.onResize),this._dom.addEventListener("mouseenter",this.onHover),this._dom.addEventListener("mouseleave",this.onHover),this._container.addEventListener("wheel",this.onMove)},i.prototype.removeEventListeners=function(){window.removeEventListener("resize",this.onResize),this._dom.removeEventListener("mouseenter",this.onHover),this._dom.removeEventListener("mouseleave",this.onHover),this._container.removeEventListener("wheel",this.onMove)},i.prototype.onResize=function(){this.initOffsets()},i.prototype.onHover=function(e){e&&this.hoverDom(e),this.hoverMesh(),this._hovered=this._meshHovered||this._domHovered,this._container.style.cursor=this._hovered?"pointer":"default"},i.prototype.hoverMesh=function(){var e=this._raycaster.intersectObject(this._mesh);this._meshHovered=e.length>0},i.prototype.hoverDom=function(e){this._domHovered="mouseenter"===e.type},i.prototype.onStart=function(e){var t=this.getMouseOffsets(e,this._container);if(this._mouse.set(t.x,t.y),this._raycaster.setFromCamera(this._mouse,this._camera),this._raycaster.ray.position=this._raycaster.ray.origin,this._hovered){if(this._active=!0,this._controls.enabled=!1,this._targetMesh){var i=this._raycaster.intersectObject(this._targetMesh);i.length>0&&this._offset.copy(i[0].point).sub(this._worldPosition)}else{this._plane.position.copy(this._worldPosition),this._plane.direction.copy(this._camera.getWorldDirection());var n=r.a.rayPlane(this._raycaster.ray,this._plane);null!==n&&this._offset.copy(n).sub(this._plane.position)}this.update()}},i.prototype.onMove=function(e,t){var i=this.getMouseOffsets(e,this._container);if(this._mouse.set(i.x,i.y),this._raycaster.setFromCamera(this._mouse,this._camera),this._raycaster.ray.position=this._raycaster.ray.origin,this._active||t)if(this._dragged=!0,null!==this._targetMesh){var n=this._raycaster.intersectObject(this._targetMesh);n.length>0&&this._worldPosition.copy(n[0].point.sub(this._offset))}else{0===this._plane.direction.length()&&(this._plane.position.copy(this._worldPosition),this._plane.direction.copy(this._camera.getWorldDirection()));var o=r.a.rayPlane(this._raycaster.ray,this._plane);null!==o&&this._worldPosition.copy(o.sub(this._offset))}else this.onHover(null);this.update()},i.prototype.onEnd=function(){!0!==this._tracking&&(!this._dragged&&this._active&&this._initialized&&(this._selected=!this._selected),this._initialized=!0,this._active=!1,this._dragged=!1,this._controls.enabled=!0,this.update())},i.prototype.create=function(){this.createMesh(),this.createDOM()},i.prototype.createMesh=function(){this._geometry=new e.SphereGeometry(1,16,16),this._material=new e.MeshBasicMaterial({wireframe:!0,wireframeLinewidth:2}),this.updateMeshColor(),this._mesh=new e.Mesh(this._geometry,this._material),this._mesh.position.copy(this._worldPosition),this._mesh.visible=!0,this.add(this._mesh)},i.prototype.createDOM=function(){this._dom=document.createElement("div"),this._dom.className="widgets-handle",this._dom.style.transform="translate3D(\n "+this._screenPosition.x+"px,\n "+(this._screenPosition.y-this._container.offsetHeight)+"px, 0)",this.updateDOMColor(),this._container.appendChild(this._dom)},i.prototype.update=function(){this.updateColor(),this._screenPosition=this.worldToScreen(this._worldPosition),this.updateMeshColor(),this.updateMeshPosition(),this.updateDOMColor(),this.updateDOMPosition()},i.prototype.updateMeshColor=function(){this._material&&this._material.color.set(this._color)},i.prototype.updateMeshPosition=function(){this._mesh&&this._mesh.position.copy(this._worldPosition)},i.prototype.updateDOMPosition=function(){this._dom&&(this._dom.style.transform="translate3D("+this._screenPosition.x+"px,\n "+(this._screenPosition.y-this._container.offsetHeight)+"px, 0)")},i.prototype.updateDOMColor=function(){this._dom.style.borderColor=this._color},i.prototype.showMesh=function(){!0!==this._params.hideMesh&&!0!==this._params.hideHandleMesh&&(this.visible=!0)},i.prototype.free=function(){this.removeEventListeners(),this._container.removeChild(this._dom),this.remove(this._mesh),this._mesh.geometry.dispose(),this._mesh.geometry=null,this._mesh.material.dispose(),this._mesh.material=null,this._mesh=null,this._geometry.dispose(),this._geometry=null,this._material.vertexShader=null,this._material.fragmentShader=null,this._material.uniforms=null,this._material.dispose(),this._material=null,t.prototype.free.call(this)},i.prototype.hideDOM=function(){this._dom.style.display="none"},i.prototype.showDOM=function(){this._dom.style.display=""},o(i,[{key:"screenPosition",get:function(){return this._screenPosition},set:function(e){this._screenPosition=e}},{key:"active",get:function(){return this._active},set:function(e){this._active=e,this._controls.enabled=!this._active,this.update()}},{key:"tracking",get:function(){return this._tracking},set:function(e){this._tracking=e,this.update()}}]),i}(Object(n.widgetsBase)(e))};t.a=a()},function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(i(63)),a=i(12),s=r(i(1)),l=function(e){return void 0===e&&(e=window.THREE),void 0===e||void 0===e.Object3D?null:function(t){function i(i,n,r){var s=t.call(this)||this;if(s._widgetType="Base",s._params=r,!0===r.hideMesh&&(s.visible=!1),null===document.getElementById("ami-widgets")){var l=document.createElement("style");l.id="ami-widgets",l.innerHTML=o.default.code,document.head.appendChild(l)}return s._enabled=!0,s._selected=!1,s._hovered=!0,s._active=!0,s._colors={default:a.COLORS.blue,active:a.COLORS.yellow,hover:a.COLORS.red,select:a.COLORS.green,text:a.COLORS.white,error:a.COLORS.lightRed},s._color=s._colors.default,s._dragged=!1,s._displayed=!0,s._targetMesh=i,s._controls=n,s._camera=n.object,s._container=n.domElement,s._worldPosition=new e.Vector3,r.worldPosition?s._worldPosition.copy(r.worldPosition):null!==s._targetMesh&&s._worldPosition.copy(s._targetMesh.position),s}return n(i,t),i.prototype.initOffsets=function(){var e=this._container.getBoundingClientRect(),t=document.body,i=document.documentElement,n=window.pageYOffset||i.scrollTop||t.scrollTop,r=window.pageXOffset||i.scrollLeft||t.scrollLeft,o=i.clientTop||t.clientTop||0,a=i.clientLeft||t.clientLeft||0;this._offsets={top:Math.round(e.top+n-o),left:Math.round(e.left+r-a)}},i.prototype.getMouseOffsets=function(e,t){return{x:(e.clientX-this._offsets.left)/t.offsetWidth*2-1,y:-(e.clientY-this._offsets.top)/t.offsetHeight*2+1,screenX:e.clientX-this._offsets.left,screenY:e.clientY-this._offsets.top}},i.prototype.getArea=function(e){for(var t=0,i=e.length-1,n=0;n<e.length;n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y),i=n;return Math.abs(t/2)},i.prototype.getRegionByXY=function(e,t){var i=null;return e.some(function(e,n){if(t.x>=e.x0&&t.x<=e.x1&&t.y>=e.y0&&t.y<=e.y1)return i=n,!0}),i},i.prototype.getPointInRegion=function(t,i){return t?new e.Vector2((i.x-t.x0-(t.axisX||0))*t.deltaX,(i.y-t.y0-(t.axisY||0))*t.deltaY):null},i.prototype.getUsPoint=function(e,t){return this.getPointInRegion(e[this.getRegionByXY(e,t)],t)},i.prototype.getUsDistance=function(e,t){var i=this._params.ultrasoundRegions||[];if(i.length<1)return null;var n=this.getRegionByXY(i,e),r=this.getRegionByXY(i,t);return null===n||null===r||n!==r||"cm"!==i[n].unitsX||"cm"!==i[n].unitsY?null:this.getPointInRegion(i[n],e).distanceTo(this.getPointInRegion(i[n],t))},i.prototype.getDistanceData=function(e,t,i){var n=null,r=null;if(i)n=e.distanceTo(t)*i;else if(this._params.ultrasoundRegions&&this._params.lps2IJK){var o=this.getUsDistance(s.default.worldToData(this._params.lps2IJK,e),s.default.worldToData(this._params.lps2IJK,t));null!==o?(n=10*o,r="mm"):(n=e.distanceTo(t),r=this._params.pixelSpacing?"mm":"units")}else n=e.distanceTo(t);return{distance:n,units:r}},i.prototype.getLineData=function(t,i){var n=i.clone().sub(t),r=i.clone().add(t).multiplyScalar(.5),o=n.length(),a=n.angleTo(new e.Vector3(1,0,0));return{line:n,length:o,transformX:r.x-o/2,transformY:r.y-this._container.offsetHeight,transformAngle:t.y<i.y?a:-a,center:r}},i.prototype.getRectData=function(t,i){var n=i.clone().sub(t),r=n.clone().projectOnVector(new e.Vector3(0,1,0)),o=t.clone().min(i);return{width:n.clone().projectOnVector(new e.Vector3(1,0,0)).length(),height:r.length(),transformX:o.x,transformY:o.y-this._container.offsetHeight,paddingVector:r.clone().normalize()}},i.prototype.adjustLabelTransform=function(t,i,n){var r=Math.round(i.x-(n?0:t.offsetWidth/2)),o=Math.round(i.y-(n?0:t.offsetHeight/2))-this._container.offsetHeight;return r<0?r=r>-t.offsetWidth?0:r+t.offsetWidth:r>this._container.offsetWidth-t.offsetWidth&&(r=r<this._container.offsetWidth?this._container.offsetWidth-t.offsetWidth:r-t.offsetWidth),o<-this._container.offsetHeight?o=o>-this._container.offsetHeight-t.offsetHeight?-this._container.offsetHeight:o+t.offsetHeight:o>-t.offsetHeight&&(o=o<0?-t.offsetHeight:o-t.offsetHeight),new e.Vector2(r,o)},i.prototype.worldToScreen=function(e){var t=e.clone();return t.project(this._camera),t.x=Math.round((t.x+1)*this._container.offsetWidth/2),t.y=Math.round((1-t.y)*this._container.offsetHeight/2),t.z=0,t},i.prototype.update=function(){window.console.log("update() should be overloaded!")},i.prototype.updateColor=function(){this._active?this._color=this._colors.active:this._hovered?this._color=this._colors.hover:this._selected?this._color=this._colors.select:this._color=this._colors.default},i.prototype.setDefaultColor=function(e){this._colors.default=e,this._handles&&this._handles.forEach(function(t){return t._colors.default=e}),this.update()},i.prototype.show=function(){this.showDOM(),this.showMesh(),this.update(),this._displayed=!0},i.prototype.hide=function(){this.hideDOM(),this.hideMesh(),this._displayed=!1},i.prototype.hideDOM=function(){window.console.log("hideDOM() should be overloaded!")},i.prototype.showDOM=function(){window.console.log("showDOM() should be overloaded!")},i.prototype.hideMesh=function(){this.visible=!1},i.prototype.showMesh=function(){!0!==this._params.hideMesh&&(this.visible=!0)},i.prototype.free=function(){this._camera=null,this._container=null,this._controls=null,this._params=null,this._targetMesh=null},Object.defineProperty(i.prototype,"widgetType",{get:function(){return this._widgetType},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"targetMesh",{get:function(){return this._targetMesh},set:function(e){this._targetMesh=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"worldPosition",{get:function(){return this._worldPosition},set:function(e){this._worldPosition.copy(e),this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"hovered",{get:function(){return this._hovered},set:function(e){this._hovered=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"dragged",{get:function(){return this._dragged},set:function(e){this._dragged=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayed",{get:function(){return this._displayed},set:function(e){this._displayed=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"active",{get:function(){return this._active},set:function(e){this._active=e,this.update()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e,this.update()},enumerable:!0,configurable:!0}),i}(e.Object3D)};t.widgetsBase=l,t.default=l()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0);function r(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(r.prototype,{isMatrix4:!0,set:function(e,t,i,n,r,o,a,s,l,c,h,u,f,d,p,_){var m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=n,m[1]=r,m[5]=o,m[9]=a,m[13]=s,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=f,m[7]=d,m[11]=p,m[15]=_,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new r).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e=new n.a;return function(t){var i=this.elements,n=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[3]=0,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[7]=0,i[8]=n[8]*a,i[9]=n[9]*a,i[10]=n[10]*a,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,n=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*c,f=o*h,d=a*c,p=a*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=f+d*l,t[5]=u-p*l,t[9]=-a*s,t[2]=p-u*l,t[6]=d+f*l,t[10]=o*s}else if("YXZ"===e.order){var _=s*c,m=s*h,b=l*c,y=l*h;t[0]=_+y*a,t[4]=b*a-m,t[8]=o*l,t[1]=o*h,t[5]=o*c,t[9]=-a,t[2]=m*a-b,t[6]=y+_*a,t[10]=o*s}else if("ZXY"===e.order){_=s*c,m=s*h,b=l*c,y=l*h;t[0]=_-y*a,t[4]=-o*h,t[8]=b+m*a,t[1]=m+b*a,t[5]=o*c,t[9]=y-_*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){u=o*c,f=o*h,d=a*c,p=a*h;t[0]=s*c,t[4]=d*l-f,t[8]=u*l+p,t[1]=s*h,t[5]=p*l+u,t[9]=f*l-d,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var g=o*s,v=o*l,A=a*s,w=a*l;t[0]=s*c,t[4]=w-g*h,t[8]=A*h+v,t[1]=h,t[5]=o*c,t[9]=-a*c,t[2]=-l*c,t[6]=v*h+A,t[10]=g-w*h}else if("XZY"===e.order){g=o*s,v=o*l,A=a*s,w=a*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=g*h+w,t[5]=o*c,t[9]=v*h-A,t[2]=A*h-v,t[6]=a*c,t[10]=w*h+g}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(){var e=new n.a(0,0,0),t=new n.a(1,1,1);return function(i){return this.compose(e,i,t)}}(),lookAt:function(){var e=new n.a,t=new n.a,i=new n.a;return function(n,r,o){var a=this.elements;return i.subVectors(n,r),0===i.lengthSq()&&(i.z=1),i.normalize(),e.crossVectors(o,i),0===e.lengthSq()&&(1===Math.abs(o.z)?i.x+=1e-4:i.z+=1e-4,i.normalize(),e.crossVectors(o,i)),e.normalize(),t.crossVectors(i,e),a[0]=e.x,a[4]=t.x,a[8]=i.x,a[1]=e.y,a[5]=t.y,a[9]=i.y,a[2]=e.z,a[6]=t.z,a[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,o=i[0],a=i[4],s=i[8],l=i[12],c=i[1],h=i[5],u=i[9],f=i[13],d=i[2],p=i[6],_=i[10],m=i[14],b=i[3],y=i[7],g=i[11],v=i[15],A=n[0],w=n[4],x=n[8],k=n[12],I=n[1],S=n[5],E=n[9],C=n[13],B=n[2],M=n[6],P=n[10],T=n[14],D=n[3],R=n[7],O=n[11],G=n[15];return r[0]=o*A+a*I+s*B+l*D,r[4]=o*w+a*S+s*M+l*R,r[8]=o*x+a*E+s*P+l*O,r[12]=o*k+a*C+s*T+l*G,r[1]=c*A+h*I+u*B+f*D,r[5]=c*w+h*S+u*M+f*R,r[9]=c*x+h*E+u*P+f*O,r[13]=c*k+h*C+u*T+f*G,r[2]=d*A+p*I+_*B+m*D,r[6]=d*w+p*S+_*M+m*R,r[10]=d*x+p*E+_*P+m*O,r[14]=d*k+p*C+_*T+m*G,r[3]=b*A+y*I+g*B+v*D,r[7]=b*w+y*S+g*M+v*R,r[11]=b*x+y*E+g*P+v*O,r[15]=b*k+y*C+g*T+v*G,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new n.a;return function(t){for(var i=0,n=t.count;i<n;i++)e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.applyMatrix4(this),t.setXYZ(i,e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],o=e[1],a=e[5],s=e[9],l=e[13],c=e[2],h=e[6],u=e[10],f=e[14];return e[3]*(+r*s*h-n*l*h-r*a*u+i*l*u+n*a*f-i*s*f)+e[7]*(+t*s*f-t*l*u+r*o*u-n*o*f+n*l*c-r*s*c)+e[11]*(+t*l*h-t*a*f-r*o*h+i*o*f+r*a*c-i*l*c)+e[15]*(-n*a*c-t*s*h+t*a*u+n*o*h-i*o*u+i*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,n=e.elements,r=n[0],o=n[1],a=n[2],s=n[3],l=n[4],c=n[5],h=n[6],u=n[7],f=n[8],d=n[9],p=n[10],_=n[11],m=n[12],b=n[13],y=n[14],g=n[15],v=d*y*u-b*p*u+b*h*_-c*y*_-d*h*g+c*p*g,A=m*p*u-f*y*u-m*h*_+l*y*_+f*h*g-l*p*g,w=f*b*u-m*d*u+m*c*_-l*b*_-f*c*g+l*d*g,x=m*d*h-f*b*h-m*c*p+l*b*p+f*c*y-l*d*y,k=r*v+o*A+a*w+s*x;if(0===k){var I="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(I);return console.warn(I),this.identity()}var S=1/k;return i[0]=v*S,i[1]=(b*p*s-d*y*s-b*a*_+o*y*_+d*a*g-o*p*g)*S,i[2]=(c*y*s-b*h*s+b*a*u-o*y*u-c*a*g+o*h*g)*S,i[3]=(d*h*s-c*p*s-d*a*u+o*p*u+c*a*_-o*h*_)*S,i[4]=A*S,i[5]=(f*y*s-m*p*s+m*a*_-r*y*_-f*a*g+r*p*g)*S,i[6]=(m*h*s-l*y*s-m*a*u+r*y*u+l*a*g-r*h*g)*S,i[7]=(l*p*s-f*h*s+f*a*u-r*p*u-l*a*_+r*h*_)*S,i[8]=w*S,i[9]=(m*d*s-f*b*s-m*o*_+r*b*_+f*o*g-r*d*g)*S,i[10]=(l*b*s-m*c*s+m*o*u-r*b*u-l*o*g+r*c*g)*S,i[11]=(f*c*s-l*d*s-f*o*u+r*d*u+l*o*_-r*c*_)*S,i[12]=x*S,i[13]=(f*b*a-m*d*a+m*o*p-r*b*p-f*o*y+r*d*y)*S,i[14]=(m*c*a-l*b*a-m*o*h+r*b*h+l*o*y-r*c*y)*S,i[15]=(l*d*a-f*c*a+f*o*h-r*d*h-l*o*p+r*c*p)*S,this},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,o=e.x,a=e.y,s=e.z,l=r*o,c=r*a;return this.set(l*o+i,l*a-n*s,l*s+n*a,0,l*a+n*s,c*a+i,c*s-n*o,0,l*s-n*a,c*s+n*o,r*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(e,t,i){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,i){var n=this.elements,r=t._x,o=t._y,a=t._z,s=t._w,l=r+r,c=o+o,h=a+a,u=r*l,f=r*c,d=r*h,p=o*c,_=o*h,m=a*h,b=s*l,y=s*c,g=s*h,v=i.x,A=i.y,w=i.z;return n[0]=(1-(p+m))*v,n[1]=(f+g)*v,n[2]=(d-y)*v,n[3]=0,n[4]=(f-g)*A,n[5]=(1-(u+m))*A,n[6]=(_+b)*A,n[7]=0,n[8]=(d+y)*w,n[9]=(_-b)*w,n[10]=(1-(u+p))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:function(){var e=new n.a,t=new r;return function(i,n,r){var o=this.elements,a=e.set(o[0],o[1],o[2]).length(),s=e.set(o[4],o[5],o[6]).length(),l=e.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),i.x=o[12],i.y=o[13],i.z=o[14],t.copy(this);var c=1/a,h=1/s,u=1/l;return t.elements[0]*=c,t.elements[1]*=c,t.elements[2]*=c,t.elements[4]*=h,t.elements[5]*=h,t.elements[6]*=h,t.elements[8]*=u,t.elements[9]*=u,t.elements[10]*=u,n.setFromRotationMatrix(t),r.x=a,r.y=s,r.z=l,this}}(),makePerspective:function(e,t,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(t-e),l=2*r/(i-n),c=(t+e)/(t-e),h=(i+n)/(i-n),u=-(o+r)/(o-r),f=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,i,n,r,o){var a=this.elements,s=1/(t-e),l=1/(i-n),c=1/(o-r),h=(t+e)*s,u=(i+n)*l,f=(o+r)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}})},function(e,t,i){"use strict";var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.matrix4=function(e){return!(null===e||void 0===e||!e.hasOwnProperty("elements")||16!==e.elements.length||"function"!=typeof e.identity||"function"!=typeof e.copy||"function"!=typeof e.determinant)},e.vector3=function(e){return!(!(null!==e&&void 0!==e&&e.hasOwnProperty("x")&&e.hasOwnProperty("y")&&e.hasOwnProperty("z"))||e.hasOwnProperty("w"))},e.box=function(e){return!!(null!==e&&void 0!==e&&e.hasOwnProperty("center")&&this.vector3(e.center)&&e.hasOwnProperty("halfDimensions")&&this.vector3(e.halfDimensions)&&e.halfDimensions.x>=0&&e.halfDimensions.y>=0&&e.halfDimensions.z>=0)},e.ray=function(e){return!!(null!==e&&void 0!==e&&e.hasOwnProperty("position")&&this.vector3(e.position)&&e.hasOwnProperty("direction")&&this.vector3(e.direction))},e}();t.a=n},function(e,t,i){"use strict";var n=i(8),r=i(105),o=i(104);var a=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this));return i.name="interpolationIdentity",i._currentVoxel="currentVoxel",i._dataValue="dataValue",i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.api=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._base,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._currentVoxel,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._dataValue;return this._base=e,this.compute(t,i)},t.prototype.compute=function(e,t){return this.computeDefinition(),this._base._functions[this._name]=this._definition,this._name+"("+e+", "+t+");"},t.prototype.computeDefinition=function(){this._definition="\nvoid "+this._name+"(in vec3 currentVoxel, out vec4 dataValue){\n // lower bound\n vec3 rcurrentVoxel = vec3(floor(currentVoxel.x + 0.5 ), floor(currentVoxel.y + 0.5 ), floor(currentVoxel.z + 0.5 ));\n ivec3 voxel = ivec3(int(rcurrentVoxel.x), int(rcurrentVoxel.y), int(rcurrentVoxel.z));\n\n vec4 tmp = vec4(0., 0., 0., 0.);\n int offset = 0;\n\n "+o.a.api(this._base,"voxel","tmp","offset")+"\n "+r.a.api(this._base,"tmp","offset","dataValue")+"\n}\n "},t}(n.a);t.a=new a},function(e,t,i){"use strict";var n=i(1),r=i(5),o=i(4),a=i(0);var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.aabbPlane=function(e,t){var i=[];if(!this.validateAabb(e)||!this.validatePlane(t))return window.console.log("Invalid aabb or plane provided."),!1;var r=new o.a;r.getInverse(e.toAABB);var s=t.direction.clone().applyMatrix4(e.toAABB),l=new a.a(0,0,0).applyMatrix4(e.toAABB),c=this.posdir(t.position.clone().applyMatrix4(e.toAABB),new a.a(s.x-l.x,s.y-l.y,s.z-l.z).normalize()),h=n.default.bbox(e.center,e.halfDimensions),u=new a.a(new a.a(1,0,0),new a.a(0,1,0),new a.a(0,0,1)),f=this.posdir(new a.a(e.center.x-e.halfDimensions.x,e.center.y-e.halfDimensions.y,e.center.z-e.halfDimensions.z),u.x);this.rayPlaneInBBox(f,c,h,i),f.direction=u.y,this.rayPlaneInBBox(f,c,h,i),f.direction=u.z,this.rayPlaneInBBox(f,c,h,i);var d=this.posdir(new a.a(e.center.x+e.halfDimensions.x,e.center.y+e.halfDimensions.y,e.center.z+e.halfDimensions.z),u.x);this.rayPlaneInBBox(d,c,h,i),d.direction=u.y,this.rayPlaneInBBox(d,c,h,i),d.direction=u.z,this.rayPlaneInBBox(d,c,h,i);var p=this.posdir(new a.a(e.center.x+e.halfDimensions.x,e.center.y-e.halfDimensions.y,e.center.z-e.halfDimensions.z),u.y);this.rayPlaneInBBox(p,c,h,i),p.direction=u.z,this.rayPlaneInBBox(p,c,h,i);var _=this.posdir(new a.a(e.center.x-e.halfDimensions.x,e.center.y+e.halfDimensions.y,e.center.z-e.halfDimensions.z),u.x);this.rayPlaneInBBox(_,c,h,i),_.direction=u.z,this.rayPlaneInBBox(_,c,h,i);var m=this.posdir(new a.a(e.center.x-e.halfDimensions.x,e.center.y-e.halfDimensions.y,e.center.z+e.halfDimensions.z),u.x);return this.rayPlaneInBBox(m,c,h,i),m.direction=u.y,this.rayPlaneInBBox(m,c,h,i),i.map(function(e){return e.applyMatrix4(r)}),i},e.rayPlane=function(e,t){if(0!==e.direction.dot(t.direction)){var i=(t.direction.x*(t.position.x-e.position.x)+t.direction.y*(t.position.y-e.position.y)+t.direction.z*(t.position.z-e.position.z))/(t.direction.x*e.direction.x+t.direction.y*e.direction.y+t.direction.z*e.direction.z);return new a.a(e.position.x+i*e.direction.x,e.position.y+i*e.direction.y,e.position.z+i*e.direction.z)}return null},e.rayBox=function(e,t){var i=[],r=n.default.bbox(t.center,t.halfDimensions),o=this.posdir(new a.a(r.min.x,t.center.y,t.center.z),new a.a(-1,0,0));return this.rayPlaneInBBox(e,o,r,i),o=this.posdir(new a.a(r.max.x,t.center.y,t.center.z),new a.a(1,0,0)),this.rayPlaneInBBox(e,o,r,i),o=this.posdir(new a.a(t.center.x,r.min.y,t.center.z),new a.a(0,-1,0)),this.rayPlaneInBBox(e,o,r,i),o=this.posdir(new a.a(t.center.x,r.max.y,t.center.z),new a.a(0,1,0)),this.rayPlaneInBBox(e,o,r,i),o=this.posdir(new a.a(t.center.x,t.center.y,r.min.z),new a.a(0,0,-1)),this.rayPlaneInBBox(e,o,r,i),o=this.posdir(new a.a(t.center.x,t.center.y,r.max.z),new a.a(0,0,1)),this.rayPlaneInBBox(e,o,r,i),i},e.rayPlaneInBBox=function(e,t,i,n){var r=this.rayPlane(e,t);r&&this.inBBox(r,i)&&(n.find(this.findIntersection(r))||n.push(r))},e.findIntersection=function(e){return function(t,i,n){return e.x===t.x&&e.y===t.y&&e.z===t.z}},e.inBBox=function(e,t){return!!(e&&e.x>=t.min.x-1e-4&&e.y>=t.min.y-1e-4&&e.z>=t.min.z-1e-4&&e.x<=t.max.x+1e-4&&e.y<=t.max.y+1e-4&&e.z<=t.max.z+1e-4)},e.posdir=function(e,t){return{position:e,direction:t}},e.validatePlane=function(e){return null===e?(window.console.log("Invalid plane."),window.console.log(e),!1):r.a.vector3(e.position)?!!r.a.vector3(e.direction)||(window.console.log("Invalid plane.direction."),window.console.log(e.direction),!1):(window.console.log("Invalid plane.position."),window.console.log(e.position),!1)},e.validateAabb=function(e){return null===e?(window.console.log("Invalid aabb."),window.console.log(e),!1):r.a.matrix4(e.toAABB)?r.a.vector3(e.center)?!!(r.a.vector3(e.halfDimensions)&&e.halfDimensions.x>=0&&e.halfDimensions.y>=0&&e.halfDimensions.z>=0)||(window.console.log("Invalid aabb.halfDimensions."),window.console.log(e.halfDimensions),!1):(window.console.log("Invalid aabb.center."),window.console.log(e.center),!1):(window.console.log("Invalid aabb.toAABB: "),window.console.log(e.toAABB),!1)},e}();t.a=s},function(e,t,i){"use strict";var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name="shadersBase",this._base={_functions:{},_uniforms:{}},this._definition=""}return n(e,[{key:"name",get:function(){return this._name},set:function(e){this._name=e}}]),e}();t.a=r},function(e,t,i){"use strict";var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._rightHanded=!0}return e.prototype.pixelRepresentation=function(){return 0},e.prototype.pixelPaddingValue=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return null},e.prototype.modality=function(){return"unknown"},e.prototype.segmentationType=function(){return"unknown"},e.prototype.segmentationSegments=function(){return[]},e.prototype.referencedSegmentNumber=function(e){return-1},e.prototype.rightHanded=function(){return this._rightHanded},e.prototype.spacingBetweenSlices=function(){return null},e.prototype.numberOfChannels=function(){return 1},e.prototype.sliceThickness=function(){return null},e.prototype.dimensionIndexValues=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return null},e.prototype.instanceNumber=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:0},e.prototype.windowCenter=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return null},e.prototype.windowWidth=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return null},e.prototype.rescaleSlope=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return 1},e.prototype.rescaleIntercept=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return 0},e.prototype.ultrasoundRegions=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return[]},e.prototype.frameTime=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return null},e.prototype._decompressUncompressed=function(){},e.prototype._swap16=function(e){return(255&e)<<8|e>>8&255},e.prototype._swap32=function(e){return(255&e)<<24|(65280&e)<<8|e>>8&65280|e>>24&255},e.prototype.invert=function(){return!1},e.prototype.transferSyntaxUID=function(){return"no value provided"},e.prototype.studyDate=function(){return"no value provided"},e.prototype.studyDescription=function(){return"no value provided"},e.prototype.seriesDate=function(){return"no value provided"},e.prototype.seriesDescription=function(){return"no value provided"},e.prototype.patientID=function(){return"no value provided"},e.prototype.patientName=function(){return"no value provided"},e.prototype.patientAge=function(){return"no value provided"},e.prototype.patientBirthdate=function(){return"no value provided"},e.prototype.patientSex=function(){return"no value provided"},e.prototype.minMaxPixelData=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],i=e.length,n=0;n<i;n++){var r=e[n];t[0]=Math.min(t[0],r),t[1]=Math.max(t[1],r)}return t},e}();t.a=n},function(e,t,i){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,i,n,r){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+n),r);else for(var o=0;o<n;o++)e[r+o]=t[i+o]},flattenChunks:function(e){var t,i,n,r,o,a;for(n=0,t=0,i=e.length;t<i;t++)n+=e[t].length;for(a=new Uint8Array(n),r=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,r),r+=o.length;return a}},o={arraySet:function(e,t,i,n,r){for(var o=0;o<n;o++)e[r+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(n)},function(e,t,i){"use strict";var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||function(e,t,i){this.buffer=new DataView(e,t,i),this.index=0},n.lossless.DataStream.prototype.get16=function(){var e=this.buffer.getUint16(this.index,!1);return this.index+=2,e},n.lossless.DataStream.prototype.get8=function(){var e=this.buffer.getUint8(this.index);return this.index+=1,e},"undefined"!==typeof e&&e.exports&&(e.exports=n.lossless.DataStream)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.blue="#00B0FF",e.yellow="#FFEB3B",e.red="#F50057",e.green="#76FF03",e.white="#FFF",e.lightRed="#F77"}(t.COLORS||(t.COLORS={}));var n=function(){function e(){}return e.cielab2XYZ=function(e,t,i){var n=(e+16)/116,r=t/500+n,o=n-i/200;return n=Math.pow(n,3)>.008856?Math.pow(n,3):(n-16/116)/7.787,[95.047*(r=Math.pow(r,3)>.008856?Math.pow(r,3):(r-16/116)/7.787),100*n,108.883*(o=Math.pow(o,3)>.008856?Math.pow(o,3):(o-16/116)/7.787)]},e.xyz2RGB=function(e,t,i){var n=3.2406*(e/=100)+-1.5372*(t/=100)+-.4986*(i/=100),r=-.9689*e+1.8758*t+.0415*i,o=.0557*e+-.204*t+1.057*i;return n>.0031308?n=1.055*Math.pow(n,1/2.4)-.055:n*=12.92,r>.0031308?r=1.055*Math.pow(r,1/2.4)-.055:r*=12.92,o>.0031308?o=1.055*Math.pow(o,1/2.4)-.055:o*=12.92,[n*=255,r*=255,o*=255]},e.cielab2RGB=function(e,t,i){if(void 0===e&&(e=50),void 0===t&&(t=0),void 0===i&&(i=0),!(e>=0&&e<=100))return null;var n=this.cielab2XYZ(e,t,i),r=n[0],o=n[1],a=n[2];return this.xyz2RGB(r,o,a)},e}();t.default=n},function(e,t,i){"use strict";var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._id=-1}return e.prototype.mergeModels=function(e,t){if(!this._validateModelArray(e)||!this._validateModelArray(t))return window.console.log("invalid inputs provided."),!1;for(var i=0,n=t.length;i<n;i++)for(var r=0,o=e.length;r<o&&!e[r].merge(t[i]);r++)r===e.length-1&&e.push(t[i]);return!0},e.prototype.merge=function(e){return!!this.validate(e)&&this._id===e._id},e.prototype.validate=function(e){return!(!e||null===e||"function"!=typeof e.merge)},e.prototype._validateModelArray=function(e){if(null===e||Array!==e.constructor