@fnndsc/argus 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{t as T,E as R,e as M,B as We,v as Ae,a as ne,b as F,s as ke,c as Fe,f as oe,cw as ue,c8 as Ne,bW as P,aK as z,cx as fe,aJ as Y,ag as se,V as G,cy as ge,cz as D,cA as Ue,cB as Ge,cC as Be,bL as He,at as O,aO as ze,bi as B,cD as me,bN as je,cE as he,bt as $e,b_ as qe,cF as ie,cG as E,cH as H,cI as J,cJ as L,cK as re,cL as Je,cM as Ke,cN as Ze,bC as pe,am as Q,b8 as ee,cO as Xe,cP as Ye,ai as Qe,ar as we,bm as te,i as Ie,L as Ve,bK as Se,cQ as be,bA as Z,bG as et,bc as ve,bz as N,cR as ae,cS as Ee,bP as ye,cT as tt,cr as nt,K as ot,cU as st,cV as it,c1 as rt,cW as at,cX as ct,bf as lt,cY as dt,cZ as ut,c_ as ft,c$ as gt,bp as mt,d0 as ht,d1 as pt,d2 as wt,d3 as It,d4 as Vt,d5 as St,d6 as bt,d7 as vt,bg as Et,d8 as yt,av as Rt,d9 as Ct,da as Pt,H as Tt,b7 as xt,bk as Mt,db as Dt,dc as Ot,J as _t,dd as Lt,bo as Wt,de as At,df as kt,bq as Ft,dg as Nt,bs as Ut,dh as Gt,bR as Bt,di as Ht,dj as zt,bF as jt,bj as $t,dk as qt,bh as Jt,bn as Kt,dl as Zt,dm as Xt,dn as Yt,dp as Qt,dq as en,dr as tn,ds as nn,dt as on,bl as sn,bZ as rn,du as an,bT as cn,dv as ln,bS as dn,bv as un,br as fn,ct as gn,dw as mn,dx as hn,bI as pn,dy as wn,M as In,dz as Vn,dA as Sn,bw as bn,dB as vn,bD as En,bJ as yn,dC as Rn,dD as Cn,bM as Pn,dE as Tn,dF as xn,dG as Mn,bY as Dn}from"./Settings-aPI1L0Hv.js";import"./Texture-B5_yVp0g.js";import"./cornerstoneEngine-A1IbMa9k.js";function On(e){return!!(e&&typeof e.setVolumes=="function"&&typeof e.addVolumes=="function")}async function _n(e,t,n,o=!1,i=!1){const s=n.map(r=>{const a=e.getViewport(r);if(!a)throw new Error(`Viewport with Id ${r} does not exist`);if(!On(a))throw new Error("setVolumesForViewports only supports viewports that implement setVolumes");return a});await Promise.all(s.map(r=>r.setVolumes(t,o,i)))}function Ln(e,t,n=0){const o=e.getOpenGLRenderWindow?.()?.getCanvas?.();o&&(o.addEventListener("webglcontextlost",()=>{console.warn(`CornerstoneRender: WebGL context lost (renderingEngine=${t}, context=${n})`),T(M,R.WEBGL_CONTEXT_LOST,{renderingEngineId:t,contextIndex:n})}),o.addEventListener("webglcontextrestored",()=>{T(M,R.WEBGL_CONTEXT_RESTORED,{renderingEngineId:t,contextIndex:n})}))}class Wn extends We{constructor(t){super(t),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.offscreenMultiRenderWindow&&this.performVtkDrawCall();const n=this._getViewportsAsArray(),o=[];for(let i=0;i<n.length;i++){const s=n[i];if(this._needsRender.has(s.id)){const r=this.renderViewportUsingCustomOrVtkPipeline(s);if(o.push(r),s.setRendered(),this._needsRender.delete(s.id),this._needsRender.size===0)break}}this._animationFrameSet=!1,this._animationFrameHandle=null,o.forEach(i=>{i?.element&&T(i.element,R.IMAGE_RENDERED,i)})},this.useCPURendering||this.ensureOffscreenResources()}ensureOffscreenResources(){this.offscreenMultiRenderWindow||(this.offscreenMultiRenderWindow=Ae.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer),Ln(this.offscreenMultiRenderWindow,this.id))}enableVTKjsDrivenViewport(t){this.ensureOffscreenResources();const o=this._getViewportsAsArray().filter(l=>ne(l.type)===!1),i=o.map(l=>l.canvas),s=F(t.element);i.push(s);const{offScreenCanvasWidth:r,offScreenCanvasHeight:a}=this._resizeOffScreenCanvas(i),c=this._resize(o,r,a),d={...t,canvas:s};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:r,offScreenCanvasHeight:a,xOffset:c})}addVtkjsDrivenViewport(t,n){this.ensureOffscreenResources();const{element:o,canvas:i,viewportId:s,type:r,defaultOptions:a}=t;o.tabIndex=-1,ke(o);const{offScreenCanvasWidth:c,offScreenCanvasHeight:d,xOffset:l}=n,{sxStartDisplayCoords:u,syStartDisplayCoords:f,sxEndDisplayCoords:m,syEndDisplayCoords:w,sx:V,sy:h,sWidth:g,sHeight:b}=this._getViewportCoordsOnOffScreenCanvas(t,c,d,l);this.offscreenMultiRenderWindow.addRenderer({viewport:[u,f,m,w],id:s,background:a.background?a.background:[0,0,0]});const S={id:s,element:o,renderingEngineId:this.id,type:r,canvas:i,sx:V,sy:h,sWidth:g,sHeight:b,defaultOptions:a||{}},v=Fe(t);if(!v)throw new Error(`Viewport Type ${r} is not supported`);const p=new v(S);p.requestedType=t.requestedType??r,this._viewports.set(s,p);const y={element:o,viewportId:s,renderingEngineId:this.id};p.suppressEvents||T(M,R.ELEMENT_ENABLED,y)}setVtkjsDrivenViewports(t){if(t.length){const n=t.map(r=>F(r.element));n.forEach(r=>{const a=window.devicePixelRatio||1,c=r.getBoundingClientRect();r.width=c.width*a,r.height=c.height*a});const{offScreenCanvasWidth:o,offScreenCanvasHeight:i}=this._resizeOffScreenCanvas(n);let s=0;for(let r=0;r<t.length;r++){const a=t[r],c=n[r],d={...a,canvas:c};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:o,offScreenCanvasHeight:i,xOffset:s}),s+=c.width}}}_resizeVTKViewports(t,n=!0,o=!0){const i=t.map(s=>F(s.element));if(i.forEach(s=>{const r=window.devicePixelRatio||1;s.width=s.clientWidth*r,s.height=s.clientHeight*r}),i.length){const{offScreenCanvasWidth:s,offScreenCanvasHeight:r}=this._resizeOffScreenCanvas(i);this._resize(t,s,r)}t.forEach(s=>{const r=s.getCamera(),a=s.getRotation(),{flipHorizontal:c}=r,d=s;d.resetViewStateForResize?d.resetViewStateForResize():d.resetCameraForResize();const l=s.getDisplayArea();n&&(l?(c&&s.setCamera({flipHorizontal:c}),a&&s.setViewPresentation({rotation:a})):s.setCamera(r))}),o&&this.render()}performVtkDrawCall(){const{offscreenMultiRenderWindow:t}=this,n=t.getRenderWindow(),o=t.getRenderers();if(o.length){for(let i=0;i<o.length;i++){const{renderer:s,id:r}=o[i],a=r.split("::")[0];this._needsRender.has(a)?s.setDraw(!0):s.setDraw(!1)}n.render();for(let i=0;i<o.length;i++)o[i].renderer.setDraw(!1)}}renderViewportUsingCustomOrVtkPipeline(t){let n;if(t.sWidth<oe||t.sHeight<oe){console.warn("Viewport is too small",t.sWidth,t.sHeight);return}if(ne(t.type)===!0)n=t.customRenderViewportToCanvas();else{if(!this.offscreenMultiRenderWindow)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const{offscreenMultiRenderWindow:o}=this,r=o.getOpenGLRenderWindow().get3DContext().canvas;n=this._renderViewportFromVtkCanvasToOnscreenCanvas(t,r)}return n}_renderViewportFromVtkCanvasToOnscreenCanvas(t,n){const{element:o,canvas:i,sx:s,sy:r,sWidth:a,sHeight:c,id:d,renderingEngineId:l,suppressEvents:u}=t,{width:f,height:m}=i;return i.getContext("2d").drawImage(n,s,r,a,c,0,0,f,m),{element:o,suppressEvents:u,viewportId:d,renderingEngineId:l,viewportStatus:t.viewportStatus}}_resizeOffScreenCanvas(t){const{offScreenCanvasContainer:n,offscreenMultiRenderWindow:o}=this,i=Math.max(...t.map(r=>r.height));let s=0;return t.forEach(r=>{s+=r.width}),n.width=s,n.height=i,o.resize(),{offScreenCanvasWidth:s,offScreenCanvasHeight:i}}_resize(t,n,o){let i=0;for(let s=0;s<t.length;s++){const r=t[s],{sxStartDisplayCoords:a,syStartDisplayCoords:c,sxEndDisplayCoords:d,syEndDisplayCoords:l,sx:u,sy:f,sWidth:m,sHeight:w}=this._getViewportCoordsOnOffScreenCanvas(r,n,o,i);i+=r.canvas.width,r.sx=u,r.sy=f,r.sWidth=m,r.sHeight=w,this.offscreenMultiRenderWindow.getRenderer(r.id).setViewport(a,c,d,l)}return i}_getViewportCoordsOnOffScreenCanvas(t,n,o,i){const{canvas:s}=t,{width:r,height:a}=s,c=i,d=0,l=c/n,u=d+(o-a)/o,f=r/n,m=a/o;return{sxStartDisplayCoords:l,syStartDisplayCoords:u,sxEndDisplayCoords:l+f,syEndDisplayCoords:u+m,sx:c,sy:d,sWidth:r,sHeight:a}}}function No(e){return!!(e&&typeof e.canvasToWorld=="function"&&typeof e.worldToCanvas=="function")}function Uo(e){return!!(e&&typeof e.getZoom=="function"&&typeof e.setZoom=="function")}function Go(e){return!!(e&&typeof e.getPan=="function"&&typeof e.setPan=="function")}function An(e){return!!(e&&typeof e.getFrameOfReferenceUID=="function")}class kn{constructor(){this._targetsEventListeners=new Map}addEventListener(t,n,o,i){let s=this._targetsEventListeners.get(t);s||(s=new ue(t),this._targetsEventListeners.set(t,s)),s.addEventListener(n,o,i)}removeEventListener(t,n,o,i){const s=this._targetsEventListeners.get(t);s&&(s.removeEventListener(n,o,i),s.isEmpty&&this._targetsEventListeners.delete(t))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([t,n])=>{n.reset(),this._targetsEventListeners.delete(t)})}}const Fn=Object.freeze(Object.defineProperty({__proto__:null,MultiTargetEventListenerManager:kn,TargetEventListeners:ue},Symbol.toStringTag,{value:"Module"}));function Nn(e,t){const n=e.getSize();for(let o=0;o<n;o++){const i=[];e.getNodeValue(o,i),i[1]=i[1]*t,i[2]=i[2]*t,i[3]=i[3]*t,e.setNodeValue(o,i)}}const Un=Symbol("LastRuntimeId"),Gn={},Bn=4294967295,Hn="-";function zn(e,t,n){return jn(e!==null&&typeof e=="object"?e:Gn,Un,(typeof n=="number"&&n>0?n:Bn)>>>0).join(typeof t=="string"?t:Hn)}function jn(e,t,n){let o=e[t];o instanceof Array||(o=[0],Object.defineProperty(e,t,{value:o}));for(let i=!0,s=0;i&&s<o.length;++s){let r=o[s]|0;r<n?(i=!1,r=r+1):(r=0,s+1===o.length&&o.push(0)),o[s]=r}return o}const $n=Ne;function qn(e,t,n=1e-5){return Math.abs(e[0]+t[0])<n&&Math.abs(e[1]+t[1])<n&&Math.abs(e[2]+t[2])<n}function Jn(e,t){return!(e[0]<0||e[0]>=t[0]||e[1]<0||e[1]>=t[1]||e[2]<0||e[2]>=t[2])}function Kn(e,t){return!(e[0]<-P||e[0]>=t[0]+P||e[1]<-P||e[1]>=t[1]+P||e[2]<-P||e[2]>=t[2]+P)}function Zn(e,t){let n;t?n=[Y(t)]:n=z();const o=[];return n.forEach(i=>{const s=e.getActors(),r=i.getViewports().filter(fe);for(const a of r){const c=a.getActors();if(c.length!==s.length)continue;s.every(({uid:l})=>c.find(u=>l===u.uid))&&o.push(a)}}),o}function Re(e,t,n=void 0,o="_thumbnails",i={displayArea:{imageArea:[1,1]}}){if(!e||!(e instanceof HTMLCanvasElement))throw new Error("canvas element is required");const s=!t.imageId,r=!s&&t,a=s&&t,d=`renderGPUViewport-${r.imageId||a.volumeId}`,l=document.createElement("div"),u=window.devicePixelRatio||1;i.displayArea||(i.displayArea={imageArea:[1,1]});const f=e.width,m=e.height;l.style.width=`${f/u+se}px`,l.style.height=`${m/u+se}px`,l.style.visibility="hidden",l.style.position="absolute",document.body.appendChild(l);const w=d.split(":").join("-");l.setAttribute("viewport-id-for-remove",w);const V=F(l),h=Y(o)||new Wn(o);let g=h.getViewport(d);if(!g){const b={viewportId:d,type:s?G.ORTHOGRAPHIC:G.STACK,element:l,defaultOptions:{...i,suppressEvents:!0}};h.enableElement(b),g=h.getViewport(d)}return new Promise(b=>{let S=!1,{viewReference:v}=i;const p=y=>{if(S)return;if(v){const A=v;v=null,g.setViewReference(A),g.render();return}e.getContext("2d").drawImage(V,0,0,V.width,V.height,0,0,e.width,e.height);const I=g.canvasToWorld([0,0]),C=g.canvasToWorld([V.width/u,0]),$=g.canvasToWorld([0,V.height/u]),_=D([0,0,0],g.canvasToWorld([1/u,0]),I),W=D([0,0,0],g.canvasToWorld([0,1/u]),I),q=1;S=!0,l.removeEventListener(R.IMAGE_RENDERED,p),setTimeout(()=>{h.disableElement(d),document.querySelectorAll(`[viewport-id-for-remove="${w}"]`).forEach(Le=>{Le.remove()})},0),b({origin:I,bottomLeft:$,topRight:C,thicknessMm:q,rightVector:_,downVector:W})};l.addEventListener(R.IMAGE_RENDERED,p),s?g.setVolumes([a],!1,!0):g.renderImageObject(t),g.resetCamera(),n==="PT"&&!ge(r)&&g.setProperties({voiRange:{lower:r.minPixelValue,upper:r.maxPixelValue}}),g.render()})}function Ce(e,t,n,o,i){if(t.volumeId)throw new Error("Unsupported volume rendering for CPU");const r=t,a=Ue(e,r,n),c={canvas:e,viewport:a,image:r,renderingTools:{}};c.transform=Ge(c);const d=!0;return new Promise((l,u)=>{Be(c,d),l(null)})}function Xn(e){const{canvas:t,imageId:n,viewReference:o,requestType:i=He.Thumbnail,priority:s=-5,renderingEngineId:r="_thumbnails",useCPURendering:a=!1,thumbnail:c=!1,imageAspect:d=!1,viewportOptions:l}=e,u=o?.volumeId,f=u&&!n,m=o&&l?{...l,viewReference:o}:l,w=a?Ce:Re;return new Promise((V,h)=>{function g(p,y){const{modality:x}=B(me.GENERAL_SERIES,y)||{},I=!f&&p,C=f&&p;I&&(I.isPreScaled=I.isPreScaled||I.preScale?.scaled),c&&(t.height=256,t.width=256),d&&I&&(t.width=I&&t.height*I.width/I.height),t.style.width=`${t.width/devicePixelRatio}px`,t.style.height=`${t.height/devicePixelRatio}px`,C&&a&&h(new Error("CPU rendering of volume not supported")),w(t,p,x,r,m).then(V)}function b(p,y){console.error(p,y),h(p)}function S(p,y,x){return je(p,x).then(I=>{g.call(this,I,p)},I=>{b.call(this,I,p)})}const v={useRGBA:!!a,requestType:i};if(u){const p=O.getVolume(u);p||h(new Error(`Volume id ${u} not found in cache`));const y=p.imageIds[0];g(p,y)}else ze.addRequest(S.bind(null,n,null,v),i,{imageId:n},s)})}function Yn(e){const t=z(),n=[];return t.forEach(o=>{o.getViewports().filter(he).forEach(s=>{s.hasImageURI(e)&&n.push(s)})}),n}function Qn(e,t){const n=eo(e,t);return n?n.index:null}function eo(e,t){const n=t.getImageIds(),o=t.getCurrentImageIdIndex();if(n.length===0)return null;const i=c=>{const d=to(c);if(!d)return null;const l=$e(d.planeNormal,d.imagePositionPatient);return qe(l,e)},s={distance:i(n[o])??1/0,index:o},r=n.slice(o+1);for(let c=0;c<r.length;c++){const d=r[c],l=i(d);if(l!==null)if(l<=s.distance)s.distance=l,s.index=c+o+1;else break}const a=n.slice(0,o);for(let c=a.length-1;c>=0;c--){const d=a[c],l=i(d);if(!(l===null||l===s.distance))if(l<s.distance)s.distance=l,s.index=c;else break}return s.distance===1/0?null:s}function to(e){const t=B(me.IMAGE_PLANE,e);if(!t||!(t.rowCosines instanceof Array&&t.rowCosines.length===3)||!(t.columnCosines instanceof Array&&t.columnCosines.length===3)||!(t.imagePositionPatient instanceof Array&&t.imagePositionPatient.length===3))return null;const{rowCosines:n,columnCosines:o,imagePositionPatient:i}=t,s=ie(E(),...n),r=ie(E(),...o),a=H(E(),s,r);return{rowCosines:n,columnCosines:o,imagePositionPatient:i,planeNormal:a}}function no(e){const{width:t,height:n}=e.getCanvas(),{sliceToIndexMatrix:o,indexToSliceMatrix:i}=e.getSliceViewInfo(),s=J(e,[0,0]),r=J(e,[t-1,0]),a=J(e,[0,n-1]),c=D(E(),r,s),d=D(E(),a,s),l=H(E(),c,d);L(c,c),L(d,d),L(l,l);const u=Math.max(Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])),f=Math.max(Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2]));if(!re(1,u)||!re(1,f))throw new Error("getCurrentVolumeViewportSlice is not available for rotate/oblique viewports");const{voxelManager:m}=e.getImageData(),w=e.getSliceViewInfo(),V=m.getSliceData(w);return{width:w.width,height:w.height,scalarData:V,sliceToIndexMatrix:o,indexToSliceMatrix:i}}const oo=.05;function so(e,t){const n=e.getSliceIndex(),o=t.getSliceIndex(),i=B("imagePlaneModule",n.toString()),s=B("imagePlaneModule",o.toString());if(!i||!s){console.log("Viewport spatial registration requires image plane module");return}const{imageOrientationPatient:r}=s;if(!i.imageOrientationPatient.every((f,m)=>Math.abs(f-r[m])<oo)){console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",i?.imageOrientationPatient,s?.imageOrientationPatient);return}const c=i.imagePositionPatient,d=s.imagePositionPatient,l=Je(E(),c,d),u=Ke(Ze(),l);pe.add([e.id,t.id],u)}function io(e){const{imageData:t,dimensions:n}=e.getImageData()||{};if(!t||!n)return[];const{canvas:o}=e,i=window.devicePixelRatio,s=[0,0],r=[o.width/i,0],a=[o.width/i,o.height/i],c=[0,o.height/i],d=e.canvasToWorld(s),l=e.canvasToWorld(r),u=e.canvasToWorld(a),f=e.canvasToWorld(c),m=t.worldToIndex(d),w=t.worldToIndex(l),V=t.worldToIndex(u),h=t.worldToIndex(f);return ro({dimensions:n,imageData:t,topLeftImage:m,topRightImage:w,bottomRightImage:V,bottomLeftImage:h,topLeftWorld:d,topRightWorld:l,bottomRightWorld:u,bottomLeftWorld:f})}function ro({dimensions:e,imageData:t,topLeftImage:n,topRightImage:o,bottomRightImage:i,bottomLeftImage:s,topLeftWorld:r,topRightWorld:a,bottomRightWorld:c,bottomLeftWorld:d}){const l=k(n,e)?r:t.indexToWorld([0,0,0]),u=k(o,e)?a:t.indexToWorld([e[0]-1,0,0]),f=k(i,e)?c:t.indexToWorld([e[0]-1,e[1]-1,0]),m=k(s,e)?d:t.indexToWorld([0,e[1]-1,0]);return[l,u,m,f]}function k(e,t){return e[0]>0||e[0]<t[0]-1||e[1]>0||e[1]<t[1]-1||e[2]>0||e[2]<t[2]-1}function j(e){if(!e)return;const{viewportUid:t,renderingEngineUid:n}=e.dataset;return Pe(t,n)}function Pe(e,t){if(!t||!e)return;const n=Y(t);if(!n||n.hasBeenDestroyed)return;const o=n.getViewport(e);if(!o)return;const i=An(o)?o.getFrameOfReferenceUID():void 0;return{viewport:o,renderingEngine:n,viewportId:e,renderingEngineId:t,FrameOfReferenceUID:i}}function Bo(e){const t=z();for(let n=0;n<t.length;n++){const o=t[n];if(o.getViewport(e))return Pe(e,o.id)}}function Ho(){const e=[];return z().forEach(n=>{n.getViewports().forEach(({element:i})=>{e.push(j(i))})}),e}function ao(e){const t=j(e);if(!t)return;const{viewport:n}=t;if(!(n instanceof Q))throw new Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${n.type}`);return n.getCornerstoneImage()}async function co({viewport:e,options:t={}}){const n=e.getRenderingEngine();let o=t.volumeId||`${ee()}`;o.split(":").length===0&&(o=`${Xe()}:${o}`);const{id:i,element:s}=e,r=t.viewportId||i,a=e.getImageIds(),c=e.getViewPresentation(),d=e.getViewReference();n.enableElement({viewportId:r,type:G.ORTHOGRAPHIC,element:s,defaultOptions:{background:t.background,orientation:t.orientation}}),(await Ye(o,{imageIds:a})).load();const u=n.getViewport(r);await _n(n,[{volumeId:o}],[r]);const f=()=>{u.render(),s.removeEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f)};return s.addEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f),u.setViewPresentation(c),u.setViewReference(d),u.render(),u}async function lo({viewport:e,options:t}){const n=e,{id:o,element:i}=n,s=e.getRenderingEngine(),{background:r}=t,a=t.viewportId||o,c=O.getVolume(n.getVolumeId());if(!(c instanceof Qe))throw new Error("Currently, you cannot decache a volume that is not an ImageVolume. So, unfortunately, volumes such as nifti (which are basic Volume, without imageIds) cannot be decached.");const d={viewportId:a,type:G.STACK,element:i,defaultOptions:{background:r}},l=n.getViewReference();s.enableElement(d);const u=s.getViewport(a);return await u.setStack(c.imageIds),u.setViewReference(l),u.render(),u}function Te(e,t=2){if(Array.isArray(e))return e.map(i=>Te(i,t)).join(", ");if(e==null||e==="")return"NaN";e=Number(e);const n=Math.abs(e);if(n<1e-4)return`${e}`;const o=n>=100?t-2:n>=10?t-1:n>=1?t:n>=.1?t+1:n>=.01?t+2:n>=.001?t+3:t+4;return e.toFixed(o)}function uo(e){return Math.round(e/P)*P}function fo(e,t,n){const o=e.length===t*n*4,i=e.length===t*n*3;if(o||i){const s=new Float32Array(t*n);let r=0,a=0;const c=o?4:3;for(let d=0;d<t;d++)for(let l=0;l<n;l++){const u=e[r],f=e[r+1],m=e[r+2];s[a]=(u+f+m)/3,r+=c,a++}return s}else return e}function go(e){if(e instanceof we)return O.getVolume(e.getVolumeId()).imageIds;if(e.getImageIds)return e.getImageIds()}function mo(e,t){const n=[...e];return t>=n.length?(ce(n),n):(ce(n),n.slice(0,t))}function ce(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}function K(e){const t=e.toString(16);return t.length==1?"0"+t:t}function ho(e,t,n){return"#"+K(e)+K(t)+K(n)}function po(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}const wo=Object.freeze(Object.defineProperty({__proto__:null,hexToRgb:po,rgbToHex:ho},Symbol.toStringTag,{value:"Module"}));function Io(e,t){if(e===t)return!0;if(e==null||t==null)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return console.debug("Error in JSON.stringify during deep comparison:",n),e===t}}function xe(e,t){const n=e,o=n.getActors?.()??[];return(t?o.find(s=>s.referencedId===t)??o.find(s=>s.referencedId?.endsWith(`:${t}`)):void 0)?.referencedId??(t?te(t):void 0)??n.getDefaultActor?.()?.referencedId}function Me(e,t,n){if(!n)throw new Error("getVolume is required, use the utilities export instead");if(Ie(e)){const o=xe(e,t),i=o?n(o):void 0,s=e.getImageData?.();return{modality:i?.metadata?.Modality??s?.metadata?.Modality,isPreScaled:le(i?.scaling)}}if(typeof e.setVolumes=="function"){const i=t?te(t):e.getVolumeId(),s=i?n(i):void 0;return{modality:s?.metadata?.Modality,isPreScaled:le(s?.scaling)}}if(typeof e.setStack=="function"){const o=e,{preScale:i}=o.getImageData()||{};return{modality:o.modality,isPreScaled:!!i?.scaled}}}function le(e){return!!e&&Object.keys(e).length>0}function Vo(e,t,n){const o=Me(e,t,n);if(!o)throw new Error("Invalid viewport type");return o.modality}function So(e){const{imageIdGroups:t,splittingTag:n}=Ve(e);return{isDynamicVolume:t.length>1,timePoints:t,splittingTag:n}}function bo(e,t){const n=e.length,{rescaleSlope:o,rescaleIntercept:i,suvbw:s}=t;if(t.modality==="PT"&&typeof s=="number")for(let r=0;r<n;r++)e[r]=s*(e[r]*o+i);else for(let r=0;r<n;r++)e[r]=e[r]*o+i;return e}function De(e,t,n){return Math.min(Math.max(t,e),n)}function Oe(e,t){if(!j(e.element))throw new Error("Scroll::Viewport is not enabled (it might be disabled)");if(e instanceof Q&&e.getImageIds().length===0)throw new Error("Scroll::Stack Viewport has no images");const{volumeId:o,delta:i,scrollSlabs:s}=t;if(e instanceof we)vo(e,o,i,s);else{if(typeof e.getCurrentImageIdIndex!="function"||typeof e.scroll!="function")return;const r=e.getCurrentImageIdIndex();if(r+i>e.getImageIds().length-1||r+i<0){const a={imageIdIndex:r,direction:i};T(M,R.STACK_SCROLL_OUT_OF_BOUNDS,a)}e.scroll(i,t.debounceLoading,t.loop)}}function vo(e,t,n,o=!1){const i=o,{numScrollSteps:s,currentStepIndex:r,sliceRangeInfo:a}=Se(e,t,i);if(s===0||!a)return;const{sliceRange:c,spacingInNormalDirection:d,camera:l}=a,{focalPoint:u,viewPlaneNormal:f,position:m}=l,{newFocalPoint:w,newPosition:V}=be(u,m,c,f,d,n);e.setCamera({focalPoint:w,position:V}),e.render();const h=r+n,g={volumeId:t,viewport:e,delta:n,desiredStepIndex:h,currentStepIndex:r,numScrollSteps:s,currentImageId:e.getCurrentImageId()};(h>s||h<0)&&e.getCurrentImageId()?T(M,R.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,g):T(M,R.VOLUME_VIEWPORT_SCROLL,g)}async function Eo(e,t={}){const{imageIndex:n,debounceLoading:o,volumeId:i}=t,s=j(e);if(!s)throw new Error("Element has been disabled");const{viewport:r}=s,{imageIndex:a,numberOfSlices:c}=yo(r,o),l=Ro(c,n)-a;Oe(r,{delta:l,debounceLoading:o,volumeId:i})}function yo(e,t){return e instanceof Q?{numberOfSlices:e.getImageIds().length,imageIndex:t?e.getTargetImageIdIndex():e.getCurrentImageIdIndex()}:{numberOfSlices:e.getNumberOfSlices(),imageIndex:e.getSliceIndex()}}function Ro(e,t){const n=e-1;return De(t,0,n)}function Co(e,t,n={}){const o=O.getVolume(e);if(!o)throw new Error(`Referenced volume with id ${e} does not exist.`);const{metadata:i,spacing:s,direction:r,dimensions:a}=o,{minX:c,maxX:d,minY:l,maxY:u,minZ:f,maxZ:m}=t,w=[Math.min(c,d),Math.min(l,u),Math.min(f,m)],V=Z(o.imageData,w),h=[Math.abs(d-c)+1,Math.abs(u-l)+1,Math.abs(m-f)+1],{targetBuffer:g}=n,b={metadata:i,dimensions:h,spacing:s,origin:V,direction:r,targetBuffer:g,scalarData:g?.type==="Float32Array"?new Float32Array(h[0]*h[1]*h[2]):void 0},S=et(ee(),b),v=S.voxelManager.getCompleteScalarDataArray(),p=h[0]*h[1],y=a[0]*a[1],x=o.voxelManager.getCompleteScalarDataArray();for(let I=0;I<h[2];I++)for(let C=0;C<h[1];C++){const $=Z(S.imageData,[0,C,I]),_=ve(o.imageData,$),W=_[2]*y+_[1]*a[0]+_[0],q=x.slice(W,W+h[0]),A=I*p+C*h[0];v.set(q,A)}return S.voxelManager.setCompleteScalarDataArray(v),S}function Po(e,t){const{viewUp:n,viewPlaneNormal:o}=t,i=N(e,[0,0,0]),s=ae(E(),n),r=ae(E(),o),a=H(E(),s,r),c=D(E(),N(e,s),i),d=D(E(),N(e,r),i);L(c,c),L(d,d);const l=H(E(),c,d);return{worldVecRowDir:a,worldVecColDir:s,worldVecSliceDir:r,ijkVecRowDir:l,ijkVecColDir:c,ijkVecSliceDir:d}}function To(e,t,n,o){const[i,s,r]=t,a=i*s;let c=0,d=0,l=0;const[u,f,m]=n.map(Math.round);for(let g=m-o;g<=m+o;g++)if(!(g<0||g>=r)){for(let b=f-o;b<=f+o;b++)if(!(b<0||b>=s))for(let S=u-o;S<=u+o;S++){if(S<0||S>=i)continue;const v=g*a+b*i+S,p=e[v];c+=p,d+=p*p,l++}}if(l===0){const g=m*a+f*i+u;return g>=0&&g<e.length?{mean:e[g],stdDev:0,count:1}:{mean:0,stdDev:0,count:0}}const w=c/l,V=d/l-w*w,h=Math.sqrt(Math.max(0,V));return{mean:w,stdDev:h,count:l}}const de=1e-6;function xo(e,t){const{lower:n,upper:o}=t.voiRange,i=o-n,s=t.VOILUTFunction,r=a=>t.invert===!0?1-a:a;if(s===Ee.SAMPLED_SIGMOID||s==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=Math.max(Math.abs(c),1e-12);return r(1/(1+Math.exp(-4*(e-a)/d)))}return i===0||!Number.isFinite(i)?r(0):r(U((e-n)/i))}function X(e,t){const{lower:n,upper:o}=t.voiRange,i=t.VOILUTFunction,s=t.invert===!0?U(1-U(e)):U(e);if(i===Ee.SAMPLED_SIGMOID||i==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=_e(s,de,1-de);return tt(d,a,c)}const r=o-n;return r===0||!Number.isFinite(r)?n:n+s*r}function Mo(e,t,n){const o=Math.min(e,t),i=Math.max(e,t),s=X(o,n),r=X(i,n);return{rawMin:Math.min(s,r),rawMax:Math.max(s,r)}}function U(e){return Number.isFinite(e)?_e(e,0,1):0}function _e(e,t,n){return Math.min(n,Math.max(t,e))}const{getPixelSpacingInformation:Do,calculateRadiographicPixelSpacing:Oo,getERMF:_o}=nt,Lo=(e,t)=>Vo(e,t,O.getVolume),Wo=(e,t)=>Me(e,t,O.getVolume),zo=Object.freeze(Object.defineProperty({__proto__:null,ECGUtilities:ft,FrameRange:gt,HistoryMemo:mt,PointsManager:at,ProgressiveIterator:it,RLEVoxelMap:st,VideoUtilities:ht,VoxelManager:ot,WSIUtilities:pt,actorIsA:wt,applyPreset:It,asArray:Vt,autoLoad:St,buildMetadata:bt,calculateNeighborhoodStats:To,calculateRadiographicPixelSpacing:Oo,calculateSpacingBetweenImageIds:vt,calculateViewportsSpatialRegistration:so,calibratedPixelSpacingMetadataProvider:$n,clamp:ut,clip:De,clonePoint3:Et,color:wo,colormap:yt,convertColorArrayToRgbString:Rt,convertStackToVolumeViewport:co,convertToGrayscale:fo,convertVolumeToStackViewport:lo,createLinearRGBTransferFunction:Ct,createSigmoidRGBTransferFunction:Pt,createSubVolume:Co,decimate:Tt,deepClone:xt,deepEqual:Io,deepMerge:Mt,eventListener:Fn,fnv1aHash:Dt,generateFrameImageId:Ot,generateVolumePropsFromImageIds:_t,genericMetadataProvider:Lt,genericViewportDisplaySetMetadataProvider:Wt,getAcquisitionPlaneOrientation:At,getBufferConfiguration:kt,getClosestImageId:Ft,getClosestStackImageIndexForPoint:Qn,getCubeSizeInView:Nt,getCurrentVolumeViewportSlice:no,getDynamicVolumeInfo:So,getERMF:_o,getImageDataMetadata:Ut,getImageLegacy:ao,getImageSliceDataForVolumeViewport:Gt,getMinMax:Bt,getNormalizedAspectRatio:dt,getPixelSpacingInformation:Do,getRandomSampleFromArray:mo,getRuntimeId:zn,getScalingDescriptor:Wo,getScalingParameters:Ht,getSliceRange:zt,getSpacingInNormalDirection:jt,getTargetVolumeAndSpacingInNormalDir:$t,getVOIRangeFromWindowLevel:qt,getViewportContentMode:Jt,getViewportImageCornersInWorld:io,getViewportImageIds:go,getViewportModality:Lo,getViewportsWithImageURI:Yn,getViewportsWithVolumeId:Kt,getVoiFromSigmoidRGBTransferFunction:Zt,getVolumeActorCorners:Xt,getVolumeDirectionVectors:Po,getVolumeId:te,getVolumeSliceRangeInfo:Yt,getVolumeViewReferenceId:Qt,getVolumeViewportScrollInfo:Se,getVolumeViewportsContainingSameVolumes:Zn,handleMultiframe4D:en,hasFloatScalingParameters:tn,hasNaNValues:nn,hasOwn:on,imageIdToURI:sn,imageRetrieveMetadataProvider:ct,imageToWorldCoords:rn,indexAlmostWithinDimensions:Kn,indexWithinDimensions:Jn,invertRgbTransferFunction:an,isEqual:lt,isEqualAbs:cn,isEqualNegative:ln,isGenericViewport:Ie,isImageActor:dn,isNumber:un,isOpposite:qn,isPTPrescaledWithSUV:ge,isValidVolume:fn,isVideoTransferSyntax:gn,jumpToSlice:Eo,loadImageToCanvas:Xn,logger:rt,makeVolumeMetadata:mn,mapMappedBandToRawRange:Mo,mapScalarToViewportVoiIntensity:xo,mapViewportVoiIntensityToScalar:X,planar:hn,pointInShapeCallback:pn,renderToCanvasCPU:Ce,renderToCanvasGPU:Re,resolveGenericViewportVolumeId:xe,rotateToViewCoordinates:wn,roundNumber:Te,roundToPrecision:uo,scaleArray:bo,scaleRgbTransferFunction:Nn,scroll:Oe,snapFocalPointToSlice:be,sortImageIdsAndGetSpacing:In,spatialRegistrationMetadataProvider:pe,splitImageIdsBy4DTags:Ve,transferFunctionUtils:Vn,transformIndexToWorld:Z,transformWorldToIndex:ve,transformWorldToIndexContinuous:N,triggerEvent:T,updatePlaneRestriction:Sn,updateVTKImageDataWithCornerstoneImage:bn,uuidv4:ee,viewportIsInStackMode:vn,viewportIsInVolumeMode:En,viewportSupportsDisplaySetPresentation:yn,viewportSupportsImageSlices:he,viewportSupportsStackCalibration:Rn,viewportSupportsStackCompatibility:Cn,viewportSupportsVolumeActors:fe,viewportSupportsVolumeCompatibility:Pn,viewportSupportsVolumeId:Tn,viewportSupportsVolumeURI:xn,windowLevel:Mn,worldToImageCoords:Dn},Symbol.toStringTag,{value:"Module"}));export{Oe as A,no as B,De as C,qn as D,io as E,fo as F,On as G,kn as M,Wn as T,Ln as a,Pe as b,Bo as c,Ho as d,An as e,Go as f,j as g,Uo as h,zn as i,Io as j,mo as k,Wo as l,Yn as m,Kn as n,Qn as o,so as p,Eo as q,Te as r,_n as s,Jn as t,zo as u,No as v,uo as w,Po as x,Co as y,To as z};
1
+ import{t as T,E as R,e as M,B as We,v as Ae,a as ne,b as F,s as ke,c as Fe,f as oe,cw as ue,c8 as Ne,bW as P,aK as z,cx as fe,aJ as Y,ag as se,V as G,cy as ge,cz as D,cA as Ue,cB as Ge,cC as Be,bL as He,at as O,aO as ze,bi as B,cD as me,bN as je,cE as he,bt as $e,b_ as qe,cF as ie,cG as E,cH as H,cI as J,cJ as L,cK as re,cL as Je,cM as Ke,cN as Ze,bC as pe,am as Q,b8 as ee,cO as Xe,cP as Ye,ai as Qe,ar as we,bm as te,i as Ie,L as Ve,bK as Se,cQ as be,bA as Z,bG as et,bc as ve,bz as N,cR as ae,cS as Ee,bP as ye,cT as tt,cr as nt,K as ot,cU as st,cV as it,c1 as rt,cW as at,cX as ct,bf as lt,cY as dt,cZ as ut,c_ as ft,c$ as gt,bp as mt,d0 as ht,d1 as pt,d2 as wt,d3 as It,d4 as Vt,d5 as St,d6 as bt,d7 as vt,bg as Et,d8 as yt,av as Rt,d9 as Ct,da as Pt,H as Tt,b7 as xt,bk as Mt,db as Dt,dc as Ot,J as _t,dd as Lt,bo as Wt,de as At,df as kt,bq as Ft,dg as Nt,bs as Ut,dh as Gt,bR as Bt,di as Ht,dj as zt,bF as jt,bj as $t,dk as qt,bh as Jt,bn as Kt,dl as Zt,dm as Xt,dn as Yt,dp as Qt,dq as en,dr as tn,ds as nn,dt as on,bl as sn,bZ as rn,du as an,bT as cn,dv as ln,bS as dn,bv as un,br as fn,ct as gn,dw as mn,dx as hn,bI as pn,dy as wn,M as In,dz as Vn,dA as Sn,bw as bn,dB as vn,bD as En,bJ as yn,dC as Rn,dD as Cn,bM as Pn,dE as Tn,dF as xn,dG as Mn,bY as Dn}from"./Settings-aNXPqSS8.js";import"./Texture-_eyqfeUw.js";import"./cornerstoneEngine-BogSQ_CU.js";function On(e){return!!(e&&typeof e.setVolumes=="function"&&typeof e.addVolumes=="function")}async function _n(e,t,n,o=!1,i=!1){const s=n.map(r=>{const a=e.getViewport(r);if(!a)throw new Error(`Viewport with Id ${r} does not exist`);if(!On(a))throw new Error("setVolumesForViewports only supports viewports that implement setVolumes");return a});await Promise.all(s.map(r=>r.setVolumes(t,o,i)))}function Ln(e,t,n=0){const o=e.getOpenGLRenderWindow?.()?.getCanvas?.();o&&(o.addEventListener("webglcontextlost",()=>{console.warn(`CornerstoneRender: WebGL context lost (renderingEngine=${t}, context=${n})`),T(M,R.WEBGL_CONTEXT_LOST,{renderingEngineId:t,contextIndex:n})}),o.addEventListener("webglcontextrestored",()=>{T(M,R.WEBGL_CONTEXT_RESTORED,{renderingEngineId:t,contextIndex:n})}))}class Wn extends We{constructor(t){super(t),this._renderFlaggedViewports=()=>{this._throwIfDestroyed(),this.offscreenMultiRenderWindow&&this.performVtkDrawCall();const n=this._getViewportsAsArray(),o=[];for(let i=0;i<n.length;i++){const s=n[i];if(this._needsRender.has(s.id)){const r=this.renderViewportUsingCustomOrVtkPipeline(s);if(o.push(r),s.setRendered(),this._needsRender.delete(s.id),this._needsRender.size===0)break}}this._animationFrameSet=!1,this._animationFrameHandle=null,o.forEach(i=>{i?.element&&T(i.element,R.IMAGE_RENDERED,i)})},this.useCPURendering||this.ensureOffscreenResources()}ensureOffscreenResources(){this.offscreenMultiRenderWindow||(this.offscreenMultiRenderWindow=Ae.newInstance(),this.offScreenCanvasContainer=document.createElement("div"),this.offscreenMultiRenderWindow.setContainer(this.offScreenCanvasContainer),Ln(this.offscreenMultiRenderWindow,this.id))}enableVTKjsDrivenViewport(t){this.ensureOffscreenResources();const o=this._getViewportsAsArray().filter(l=>ne(l.type)===!1),i=o.map(l=>l.canvas),s=F(t.element);i.push(s);const{offScreenCanvasWidth:r,offScreenCanvasHeight:a}=this._resizeOffScreenCanvas(i),c=this._resize(o,r,a),d={...t,canvas:s};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:r,offScreenCanvasHeight:a,xOffset:c})}addVtkjsDrivenViewport(t,n){this.ensureOffscreenResources();const{element:o,canvas:i,viewportId:s,type:r,defaultOptions:a}=t;o.tabIndex=-1,ke(o);const{offScreenCanvasWidth:c,offScreenCanvasHeight:d,xOffset:l}=n,{sxStartDisplayCoords:u,syStartDisplayCoords:f,sxEndDisplayCoords:m,syEndDisplayCoords:w,sx:V,sy:h,sWidth:g,sHeight:b}=this._getViewportCoordsOnOffScreenCanvas(t,c,d,l);this.offscreenMultiRenderWindow.addRenderer({viewport:[u,f,m,w],id:s,background:a.background?a.background:[0,0,0]});const S={id:s,element:o,renderingEngineId:this.id,type:r,canvas:i,sx:V,sy:h,sWidth:g,sHeight:b,defaultOptions:a||{}},v=Fe(t);if(!v)throw new Error(`Viewport Type ${r} is not supported`);const p=new v(S);p.requestedType=t.requestedType??r,this._viewports.set(s,p);const y={element:o,viewportId:s,renderingEngineId:this.id};p.suppressEvents||T(M,R.ELEMENT_ENABLED,y)}setVtkjsDrivenViewports(t){if(t.length){const n=t.map(r=>F(r.element));n.forEach(r=>{const a=window.devicePixelRatio||1,c=r.getBoundingClientRect();r.width=c.width*a,r.height=c.height*a});const{offScreenCanvasWidth:o,offScreenCanvasHeight:i}=this._resizeOffScreenCanvas(n);let s=0;for(let r=0;r<t.length;r++){const a=t[r],c=n[r],d={...a,canvas:c};this.addVtkjsDrivenViewport(d,{offScreenCanvasWidth:o,offScreenCanvasHeight:i,xOffset:s}),s+=c.width}}}_resizeVTKViewports(t,n=!0,o=!0){const i=t.map(s=>F(s.element));if(i.forEach(s=>{const r=window.devicePixelRatio||1;s.width=s.clientWidth*r,s.height=s.clientHeight*r}),i.length){const{offScreenCanvasWidth:s,offScreenCanvasHeight:r}=this._resizeOffScreenCanvas(i);this._resize(t,s,r)}t.forEach(s=>{const r=s.getCamera(),a=s.getRotation(),{flipHorizontal:c}=r,d=s;d.resetViewStateForResize?d.resetViewStateForResize():d.resetCameraForResize();const l=s.getDisplayArea();n&&(l?(c&&s.setCamera({flipHorizontal:c}),a&&s.setViewPresentation({rotation:a})):s.setCamera(r))}),o&&this.render()}performVtkDrawCall(){const{offscreenMultiRenderWindow:t}=this,n=t.getRenderWindow(),o=t.getRenderers();if(o.length){for(let i=0;i<o.length;i++){const{renderer:s,id:r}=o[i],a=r.split("::")[0];this._needsRender.has(a)?s.setDraw(!0):s.setDraw(!1)}n.render();for(let i=0;i<o.length;i++)o[i].renderer.setDraw(!1)}}renderViewportUsingCustomOrVtkPipeline(t){let n;if(t.sWidth<oe||t.sHeight<oe){console.warn("Viewport is too small",t.sWidth,t.sHeight);return}if(ne(t.type)===!0)n=t.customRenderViewportToCanvas();else{if(!this.offscreenMultiRenderWindow)throw new Error("GPU not available, and using a viewport with no custom render pipeline.");const{offscreenMultiRenderWindow:o}=this,r=o.getOpenGLRenderWindow().get3DContext().canvas;n=this._renderViewportFromVtkCanvasToOnscreenCanvas(t,r)}return n}_renderViewportFromVtkCanvasToOnscreenCanvas(t,n){const{element:o,canvas:i,sx:s,sy:r,sWidth:a,sHeight:c,id:d,renderingEngineId:l,suppressEvents:u}=t,{width:f,height:m}=i;return i.getContext("2d").drawImage(n,s,r,a,c,0,0,f,m),{element:o,suppressEvents:u,viewportId:d,renderingEngineId:l,viewportStatus:t.viewportStatus}}_resizeOffScreenCanvas(t){const{offScreenCanvasContainer:n,offscreenMultiRenderWindow:o}=this,i=Math.max(...t.map(r=>r.height));let s=0;return t.forEach(r=>{s+=r.width}),n.width=s,n.height=i,o.resize(),{offScreenCanvasWidth:s,offScreenCanvasHeight:i}}_resize(t,n,o){let i=0;for(let s=0;s<t.length;s++){const r=t[s],{sxStartDisplayCoords:a,syStartDisplayCoords:c,sxEndDisplayCoords:d,syEndDisplayCoords:l,sx:u,sy:f,sWidth:m,sHeight:w}=this._getViewportCoordsOnOffScreenCanvas(r,n,o,i);i+=r.canvas.width,r.sx=u,r.sy=f,r.sWidth=m,r.sHeight=w,this.offscreenMultiRenderWindow.getRenderer(r.id).setViewport(a,c,d,l)}return i}_getViewportCoordsOnOffScreenCanvas(t,n,o,i){const{canvas:s}=t,{width:r,height:a}=s,c=i,d=0,l=c/n,u=d+(o-a)/o,f=r/n,m=a/o;return{sxStartDisplayCoords:l,syStartDisplayCoords:u,sxEndDisplayCoords:l+f,syEndDisplayCoords:u+m,sx:c,sy:d,sWidth:r,sHeight:a}}}function No(e){return!!(e&&typeof e.canvasToWorld=="function"&&typeof e.worldToCanvas=="function")}function Uo(e){return!!(e&&typeof e.getZoom=="function"&&typeof e.setZoom=="function")}function Go(e){return!!(e&&typeof e.getPan=="function"&&typeof e.setPan=="function")}function An(e){return!!(e&&typeof e.getFrameOfReferenceUID=="function")}class kn{constructor(){this._targetsEventListeners=new Map}addEventListener(t,n,o,i){let s=this._targetsEventListeners.get(t);s||(s=new ue(t),this._targetsEventListeners.set(t,s)),s.addEventListener(n,o,i)}removeEventListener(t,n,o,i){const s=this._targetsEventListeners.get(t);s&&(s.removeEventListener(n,o,i),s.isEmpty&&this._targetsEventListeners.delete(t))}reset(){Array.from(this._targetsEventListeners.entries()).forEach(([t,n])=>{n.reset(),this._targetsEventListeners.delete(t)})}}const Fn=Object.freeze(Object.defineProperty({__proto__:null,MultiTargetEventListenerManager:kn,TargetEventListeners:ue},Symbol.toStringTag,{value:"Module"}));function Nn(e,t){const n=e.getSize();for(let o=0;o<n;o++){const i=[];e.getNodeValue(o,i),i[1]=i[1]*t,i[2]=i[2]*t,i[3]=i[3]*t,e.setNodeValue(o,i)}}const Un=Symbol("LastRuntimeId"),Gn={},Bn=4294967295,Hn="-";function zn(e,t,n){return jn(e!==null&&typeof e=="object"?e:Gn,Un,(typeof n=="number"&&n>0?n:Bn)>>>0).join(typeof t=="string"?t:Hn)}function jn(e,t,n){let o=e[t];o instanceof Array||(o=[0],Object.defineProperty(e,t,{value:o}));for(let i=!0,s=0;i&&s<o.length;++s){let r=o[s]|0;r<n?(i=!1,r=r+1):(r=0,s+1===o.length&&o.push(0)),o[s]=r}return o}const $n=Ne;function qn(e,t,n=1e-5){return Math.abs(e[0]+t[0])<n&&Math.abs(e[1]+t[1])<n&&Math.abs(e[2]+t[2])<n}function Jn(e,t){return!(e[0]<0||e[0]>=t[0]||e[1]<0||e[1]>=t[1]||e[2]<0||e[2]>=t[2])}function Kn(e,t){return!(e[0]<-P||e[0]>=t[0]+P||e[1]<-P||e[1]>=t[1]+P||e[2]<-P||e[2]>=t[2]+P)}function Zn(e,t){let n;t?n=[Y(t)]:n=z();const o=[];return n.forEach(i=>{const s=e.getActors(),r=i.getViewports().filter(fe);for(const a of r){const c=a.getActors();if(c.length!==s.length)continue;s.every(({uid:l})=>c.find(u=>l===u.uid))&&o.push(a)}}),o}function Re(e,t,n=void 0,o="_thumbnails",i={displayArea:{imageArea:[1,1]}}){if(!e||!(e instanceof HTMLCanvasElement))throw new Error("canvas element is required");const s=!t.imageId,r=!s&&t,a=s&&t,d=`renderGPUViewport-${r.imageId||a.volumeId}`,l=document.createElement("div"),u=window.devicePixelRatio||1;i.displayArea||(i.displayArea={imageArea:[1,1]});const f=e.width,m=e.height;l.style.width=`${f/u+se}px`,l.style.height=`${m/u+se}px`,l.style.visibility="hidden",l.style.position="absolute",document.body.appendChild(l);const w=d.split(":").join("-");l.setAttribute("viewport-id-for-remove",w);const V=F(l),h=Y(o)||new Wn(o);let g=h.getViewport(d);if(!g){const b={viewportId:d,type:s?G.ORTHOGRAPHIC:G.STACK,element:l,defaultOptions:{...i,suppressEvents:!0}};h.enableElement(b),g=h.getViewport(d)}return new Promise(b=>{let S=!1,{viewReference:v}=i;const p=y=>{if(S)return;if(v){const A=v;v=null,g.setViewReference(A),g.render();return}e.getContext("2d").drawImage(V,0,0,V.width,V.height,0,0,e.width,e.height);const I=g.canvasToWorld([0,0]),C=g.canvasToWorld([V.width/u,0]),$=g.canvasToWorld([0,V.height/u]),_=D([0,0,0],g.canvasToWorld([1/u,0]),I),W=D([0,0,0],g.canvasToWorld([0,1/u]),I),q=1;S=!0,l.removeEventListener(R.IMAGE_RENDERED,p),setTimeout(()=>{h.disableElement(d),document.querySelectorAll(`[viewport-id-for-remove="${w}"]`).forEach(Le=>{Le.remove()})},0),b({origin:I,bottomLeft:$,topRight:C,thicknessMm:q,rightVector:_,downVector:W})};l.addEventListener(R.IMAGE_RENDERED,p),s?g.setVolumes([a],!1,!0):g.renderImageObject(t),g.resetCamera(),n==="PT"&&!ge(r)&&g.setProperties({voiRange:{lower:r.minPixelValue,upper:r.maxPixelValue}}),g.render()})}function Ce(e,t,n,o,i){if(t.volumeId)throw new Error("Unsupported volume rendering for CPU");const r=t,a=Ue(e,r,n),c={canvas:e,viewport:a,image:r,renderingTools:{}};c.transform=Ge(c);const d=!0;return new Promise((l,u)=>{Be(c,d),l(null)})}function Xn(e){const{canvas:t,imageId:n,viewReference:o,requestType:i=He.Thumbnail,priority:s=-5,renderingEngineId:r="_thumbnails",useCPURendering:a=!1,thumbnail:c=!1,imageAspect:d=!1,viewportOptions:l}=e,u=o?.volumeId,f=u&&!n,m=o&&l?{...l,viewReference:o}:l,w=a?Ce:Re;return new Promise((V,h)=>{function g(p,y){const{modality:x}=B(me.GENERAL_SERIES,y)||{},I=!f&&p,C=f&&p;I&&(I.isPreScaled=I.isPreScaled||I.preScale?.scaled),c&&(t.height=256,t.width=256),d&&I&&(t.width=I&&t.height*I.width/I.height),t.style.width=`${t.width/devicePixelRatio}px`,t.style.height=`${t.height/devicePixelRatio}px`,C&&a&&h(new Error("CPU rendering of volume not supported")),w(t,p,x,r,m).then(V)}function b(p,y){console.error(p,y),h(p)}function S(p,y,x){return je(p,x).then(I=>{g.call(this,I,p)},I=>{b.call(this,I,p)})}const v={useRGBA:!!a,requestType:i};if(u){const p=O.getVolume(u);p||h(new Error(`Volume id ${u} not found in cache`));const y=p.imageIds[0];g(p,y)}else ze.addRequest(S.bind(null,n,null,v),i,{imageId:n},s)})}function Yn(e){const t=z(),n=[];return t.forEach(o=>{o.getViewports().filter(he).forEach(s=>{s.hasImageURI(e)&&n.push(s)})}),n}function Qn(e,t){const n=eo(e,t);return n?n.index:null}function eo(e,t){const n=t.getImageIds(),o=t.getCurrentImageIdIndex();if(n.length===0)return null;const i=c=>{const d=to(c);if(!d)return null;const l=$e(d.planeNormal,d.imagePositionPatient);return qe(l,e)},s={distance:i(n[o])??1/0,index:o},r=n.slice(o+1);for(let c=0;c<r.length;c++){const d=r[c],l=i(d);if(l!==null)if(l<=s.distance)s.distance=l,s.index=c+o+1;else break}const a=n.slice(0,o);for(let c=a.length-1;c>=0;c--){const d=a[c],l=i(d);if(!(l===null||l===s.distance))if(l<s.distance)s.distance=l,s.index=c;else break}return s.distance===1/0?null:s}function to(e){const t=B(me.IMAGE_PLANE,e);if(!t||!(t.rowCosines instanceof Array&&t.rowCosines.length===3)||!(t.columnCosines instanceof Array&&t.columnCosines.length===3)||!(t.imagePositionPatient instanceof Array&&t.imagePositionPatient.length===3))return null;const{rowCosines:n,columnCosines:o,imagePositionPatient:i}=t,s=ie(E(),...n),r=ie(E(),...o),a=H(E(),s,r);return{rowCosines:n,columnCosines:o,imagePositionPatient:i,planeNormal:a}}function no(e){const{width:t,height:n}=e.getCanvas(),{sliceToIndexMatrix:o,indexToSliceMatrix:i}=e.getSliceViewInfo(),s=J(e,[0,0]),r=J(e,[t-1,0]),a=J(e,[0,n-1]),c=D(E(),r,s),d=D(E(),a,s),l=H(E(),c,d);L(c,c),L(d,d),L(l,l);const u=Math.max(Math.abs(c[0]),Math.abs(c[1]),Math.abs(c[2])),f=Math.max(Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2]));if(!re(1,u)||!re(1,f))throw new Error("getCurrentVolumeViewportSlice is not available for rotate/oblique viewports");const{voxelManager:m}=e.getImageData(),w=e.getSliceViewInfo(),V=m.getSliceData(w);return{width:w.width,height:w.height,scalarData:V,sliceToIndexMatrix:o,indexToSliceMatrix:i}}const oo=.05;function so(e,t){const n=e.getSliceIndex(),o=t.getSliceIndex(),i=B("imagePlaneModule",n.toString()),s=B("imagePlaneModule",o.toString());if(!i||!s){console.log("Viewport spatial registration requires image plane module");return}const{imageOrientationPatient:r}=s;if(!i.imageOrientationPatient.every((f,m)=>Math.abs(f-r[m])<oo)){console.log("Viewport spatial registration only supported for same orientation (hence translation only) for now",i?.imageOrientationPatient,s?.imageOrientationPatient);return}const c=i.imagePositionPatient,d=s.imagePositionPatient,l=Je(E(),c,d),u=Ke(Ze(),l);pe.add([e.id,t.id],u)}function io(e){const{imageData:t,dimensions:n}=e.getImageData()||{};if(!t||!n)return[];const{canvas:o}=e,i=window.devicePixelRatio,s=[0,0],r=[o.width/i,0],a=[o.width/i,o.height/i],c=[0,o.height/i],d=e.canvasToWorld(s),l=e.canvasToWorld(r),u=e.canvasToWorld(a),f=e.canvasToWorld(c),m=t.worldToIndex(d),w=t.worldToIndex(l),V=t.worldToIndex(u),h=t.worldToIndex(f);return ro({dimensions:n,imageData:t,topLeftImage:m,topRightImage:w,bottomRightImage:V,bottomLeftImage:h,topLeftWorld:d,topRightWorld:l,bottomRightWorld:u,bottomLeftWorld:f})}function ro({dimensions:e,imageData:t,topLeftImage:n,topRightImage:o,bottomRightImage:i,bottomLeftImage:s,topLeftWorld:r,topRightWorld:a,bottomRightWorld:c,bottomLeftWorld:d}){const l=k(n,e)?r:t.indexToWorld([0,0,0]),u=k(o,e)?a:t.indexToWorld([e[0]-1,0,0]),f=k(i,e)?c:t.indexToWorld([e[0]-1,e[1]-1,0]),m=k(s,e)?d:t.indexToWorld([0,e[1]-1,0]);return[l,u,m,f]}function k(e,t){return e[0]>0||e[0]<t[0]-1||e[1]>0||e[1]<t[1]-1||e[2]>0||e[2]<t[2]-1}function j(e){if(!e)return;const{viewportUid:t,renderingEngineUid:n}=e.dataset;return Pe(t,n)}function Pe(e,t){if(!t||!e)return;const n=Y(t);if(!n||n.hasBeenDestroyed)return;const o=n.getViewport(e);if(!o)return;const i=An(o)?o.getFrameOfReferenceUID():void 0;return{viewport:o,renderingEngine:n,viewportId:e,renderingEngineId:t,FrameOfReferenceUID:i}}function Bo(e){const t=z();for(let n=0;n<t.length;n++){const o=t[n];if(o.getViewport(e))return Pe(e,o.id)}}function Ho(){const e=[];return z().forEach(n=>{n.getViewports().forEach(({element:i})=>{e.push(j(i))})}),e}function ao(e){const t=j(e);if(!t)return;const{viewport:n}=t;if(!(n instanceof Q))throw new Error(`An image can only be fetched for a stack viewport and not for a viewport of type: ${n.type}`);return n.getCornerstoneImage()}async function co({viewport:e,options:t={}}){const n=e.getRenderingEngine();let o=t.volumeId||`${ee()}`;o.split(":").length===0&&(o=`${Xe()}:${o}`);const{id:i,element:s}=e,r=t.viewportId||i,a=e.getImageIds(),c=e.getViewPresentation(),d=e.getViewReference();n.enableElement({viewportId:r,type:G.ORTHOGRAPHIC,element:s,defaultOptions:{background:t.background,orientation:t.orientation}}),(await Ye(o,{imageIds:a})).load();const u=n.getViewport(r);await _n(n,[{volumeId:o}],[r]);const f=()=>{u.render(),s.removeEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f)};return s.addEventListener(R.VOLUME_VIEWPORT_NEW_VOLUME,f),u.setViewPresentation(c),u.setViewReference(d),u.render(),u}async function lo({viewport:e,options:t}){const n=e,{id:o,element:i}=n,s=e.getRenderingEngine(),{background:r}=t,a=t.viewportId||o,c=O.getVolume(n.getVolumeId());if(!(c instanceof Qe))throw new Error("Currently, you cannot decache a volume that is not an ImageVolume. So, unfortunately, volumes such as nifti (which are basic Volume, without imageIds) cannot be decached.");const d={viewportId:a,type:G.STACK,element:i,defaultOptions:{background:r}},l=n.getViewReference();s.enableElement(d);const u=s.getViewport(a);return await u.setStack(c.imageIds),u.setViewReference(l),u.render(),u}function Te(e,t=2){if(Array.isArray(e))return e.map(i=>Te(i,t)).join(", ");if(e==null||e==="")return"NaN";e=Number(e);const n=Math.abs(e);if(n<1e-4)return`${e}`;const o=n>=100?t-2:n>=10?t-1:n>=1?t:n>=.1?t+1:n>=.01?t+2:n>=.001?t+3:t+4;return e.toFixed(o)}function uo(e){return Math.round(e/P)*P}function fo(e,t,n){const o=e.length===t*n*4,i=e.length===t*n*3;if(o||i){const s=new Float32Array(t*n);let r=0,a=0;const c=o?4:3;for(let d=0;d<t;d++)for(let l=0;l<n;l++){const u=e[r],f=e[r+1],m=e[r+2];s[a]=(u+f+m)/3,r+=c,a++}return s}else return e}function go(e){if(e instanceof we)return O.getVolume(e.getVolumeId()).imageIds;if(e.getImageIds)return e.getImageIds()}function mo(e,t){const n=[...e];return t>=n.length?(ce(n),n):(ce(n),n.slice(0,t))}function ce(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}function K(e){const t=e.toString(16);return t.length==1?"0"+t:t}function ho(e,t,n){return"#"+K(e)+K(t)+K(n)}function po(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}const wo=Object.freeze(Object.defineProperty({__proto__:null,hexToRgb:po,rgbToHex:ho},Symbol.toStringTag,{value:"Module"}));function Io(e,t){if(e===t)return!0;if(e==null||t==null)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return console.debug("Error in JSON.stringify during deep comparison:",n),e===t}}function xe(e,t){const n=e,o=n.getActors?.()??[];return(t?o.find(s=>s.referencedId===t)??o.find(s=>s.referencedId?.endsWith(`:${t}`)):void 0)?.referencedId??(t?te(t):void 0)??n.getDefaultActor?.()?.referencedId}function Me(e,t,n){if(!n)throw new Error("getVolume is required, use the utilities export instead");if(Ie(e)){const o=xe(e,t),i=o?n(o):void 0,s=e.getImageData?.();return{modality:i?.metadata?.Modality??s?.metadata?.Modality,isPreScaled:le(i?.scaling)}}if(typeof e.setVolumes=="function"){const i=t?te(t):e.getVolumeId(),s=i?n(i):void 0;return{modality:s?.metadata?.Modality,isPreScaled:le(s?.scaling)}}if(typeof e.setStack=="function"){const o=e,{preScale:i}=o.getImageData()||{};return{modality:o.modality,isPreScaled:!!i?.scaled}}}function le(e){return!!e&&Object.keys(e).length>0}function Vo(e,t,n){const o=Me(e,t,n);if(!o)throw new Error("Invalid viewport type");return o.modality}function So(e){const{imageIdGroups:t,splittingTag:n}=Ve(e);return{isDynamicVolume:t.length>1,timePoints:t,splittingTag:n}}function bo(e,t){const n=e.length,{rescaleSlope:o,rescaleIntercept:i,suvbw:s}=t;if(t.modality==="PT"&&typeof s=="number")for(let r=0;r<n;r++)e[r]=s*(e[r]*o+i);else for(let r=0;r<n;r++)e[r]=e[r]*o+i;return e}function De(e,t,n){return Math.min(Math.max(t,e),n)}function Oe(e,t){if(!j(e.element))throw new Error("Scroll::Viewport is not enabled (it might be disabled)");if(e instanceof Q&&e.getImageIds().length===0)throw new Error("Scroll::Stack Viewport has no images");const{volumeId:o,delta:i,scrollSlabs:s}=t;if(e instanceof we)vo(e,o,i,s);else{if(typeof e.getCurrentImageIdIndex!="function"||typeof e.scroll!="function")return;const r=e.getCurrentImageIdIndex();if(r+i>e.getImageIds().length-1||r+i<0){const a={imageIdIndex:r,direction:i};T(M,R.STACK_SCROLL_OUT_OF_BOUNDS,a)}e.scroll(i,t.debounceLoading,t.loop)}}function vo(e,t,n,o=!1){const i=o,{numScrollSteps:s,currentStepIndex:r,sliceRangeInfo:a}=Se(e,t,i);if(s===0||!a)return;const{sliceRange:c,spacingInNormalDirection:d,camera:l}=a,{focalPoint:u,viewPlaneNormal:f,position:m}=l,{newFocalPoint:w,newPosition:V}=be(u,m,c,f,d,n);e.setCamera({focalPoint:w,position:V}),e.render();const h=r+n,g={volumeId:t,viewport:e,delta:n,desiredStepIndex:h,currentStepIndex:r,numScrollSteps:s,currentImageId:e.getCurrentImageId()};(h>s||h<0)&&e.getCurrentImageId()?T(M,R.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS,g):T(M,R.VOLUME_VIEWPORT_SCROLL,g)}async function Eo(e,t={}){const{imageIndex:n,debounceLoading:o,volumeId:i}=t,s=j(e);if(!s)throw new Error("Element has been disabled");const{viewport:r}=s,{imageIndex:a,numberOfSlices:c}=yo(r,o),l=Ro(c,n)-a;Oe(r,{delta:l,debounceLoading:o,volumeId:i})}function yo(e,t){return e instanceof Q?{numberOfSlices:e.getImageIds().length,imageIndex:t?e.getTargetImageIdIndex():e.getCurrentImageIdIndex()}:{numberOfSlices:e.getNumberOfSlices(),imageIndex:e.getSliceIndex()}}function Ro(e,t){const n=e-1;return De(t,0,n)}function Co(e,t,n={}){const o=O.getVolume(e);if(!o)throw new Error(`Referenced volume with id ${e} does not exist.`);const{metadata:i,spacing:s,direction:r,dimensions:a}=o,{minX:c,maxX:d,minY:l,maxY:u,minZ:f,maxZ:m}=t,w=[Math.min(c,d),Math.min(l,u),Math.min(f,m)],V=Z(o.imageData,w),h=[Math.abs(d-c)+1,Math.abs(u-l)+1,Math.abs(m-f)+1],{targetBuffer:g}=n,b={metadata:i,dimensions:h,spacing:s,origin:V,direction:r,targetBuffer:g,scalarData:g?.type==="Float32Array"?new Float32Array(h[0]*h[1]*h[2]):void 0},S=et(ee(),b),v=S.voxelManager.getCompleteScalarDataArray(),p=h[0]*h[1],y=a[0]*a[1],x=o.voxelManager.getCompleteScalarDataArray();for(let I=0;I<h[2];I++)for(let C=0;C<h[1];C++){const $=Z(S.imageData,[0,C,I]),_=ve(o.imageData,$),W=_[2]*y+_[1]*a[0]+_[0],q=x.slice(W,W+h[0]),A=I*p+C*h[0];v.set(q,A)}return S.voxelManager.setCompleteScalarDataArray(v),S}function Po(e,t){const{viewUp:n,viewPlaneNormal:o}=t,i=N(e,[0,0,0]),s=ae(E(),n),r=ae(E(),o),a=H(E(),s,r),c=D(E(),N(e,s),i),d=D(E(),N(e,r),i);L(c,c),L(d,d);const l=H(E(),c,d);return{worldVecRowDir:a,worldVecColDir:s,worldVecSliceDir:r,ijkVecRowDir:l,ijkVecColDir:c,ijkVecSliceDir:d}}function To(e,t,n,o){const[i,s,r]=t,a=i*s;let c=0,d=0,l=0;const[u,f,m]=n.map(Math.round);for(let g=m-o;g<=m+o;g++)if(!(g<0||g>=r)){for(let b=f-o;b<=f+o;b++)if(!(b<0||b>=s))for(let S=u-o;S<=u+o;S++){if(S<0||S>=i)continue;const v=g*a+b*i+S,p=e[v];c+=p,d+=p*p,l++}}if(l===0){const g=m*a+f*i+u;return g>=0&&g<e.length?{mean:e[g],stdDev:0,count:1}:{mean:0,stdDev:0,count:0}}const w=c/l,V=d/l-w*w,h=Math.sqrt(Math.max(0,V));return{mean:w,stdDev:h,count:l}}const de=1e-6;function xo(e,t){const{lower:n,upper:o}=t.voiRange,i=o-n,s=t.VOILUTFunction,r=a=>t.invert===!0?1-a:a;if(s===Ee.SAMPLED_SIGMOID||s==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=Math.max(Math.abs(c),1e-12);return r(1/(1+Math.exp(-4*(e-a)/d)))}return i===0||!Number.isFinite(i)?r(0):r(U((e-n)/i))}function X(e,t){const{lower:n,upper:o}=t.voiRange,i=t.VOILUTFunction,s=t.invert===!0?U(1-U(e)):U(e);if(i===Ee.SAMPLED_SIGMOID||i==="SIGMOID"){const{windowCenter:a,windowWidth:c}=ye(n,o),d=_e(s,de,1-de);return tt(d,a,c)}const r=o-n;return r===0||!Number.isFinite(r)?n:n+s*r}function Mo(e,t,n){const o=Math.min(e,t),i=Math.max(e,t),s=X(o,n),r=X(i,n);return{rawMin:Math.min(s,r),rawMax:Math.max(s,r)}}function U(e){return Number.isFinite(e)?_e(e,0,1):0}function _e(e,t,n){return Math.min(n,Math.max(t,e))}const{getPixelSpacingInformation:Do,calculateRadiographicPixelSpacing:Oo,getERMF:_o}=nt,Lo=(e,t)=>Vo(e,t,O.getVolume),Wo=(e,t)=>Me(e,t,O.getVolume),zo=Object.freeze(Object.defineProperty({__proto__:null,ECGUtilities:ft,FrameRange:gt,HistoryMemo:mt,PointsManager:at,ProgressiveIterator:it,RLEVoxelMap:st,VideoUtilities:ht,VoxelManager:ot,WSIUtilities:pt,actorIsA:wt,applyPreset:It,asArray:Vt,autoLoad:St,buildMetadata:bt,calculateNeighborhoodStats:To,calculateRadiographicPixelSpacing:Oo,calculateSpacingBetweenImageIds:vt,calculateViewportsSpatialRegistration:so,calibratedPixelSpacingMetadataProvider:$n,clamp:ut,clip:De,clonePoint3:Et,color:wo,colormap:yt,convertColorArrayToRgbString:Rt,convertStackToVolumeViewport:co,convertToGrayscale:fo,convertVolumeToStackViewport:lo,createLinearRGBTransferFunction:Ct,createSigmoidRGBTransferFunction:Pt,createSubVolume:Co,decimate:Tt,deepClone:xt,deepEqual:Io,deepMerge:Mt,eventListener:Fn,fnv1aHash:Dt,generateFrameImageId:Ot,generateVolumePropsFromImageIds:_t,genericMetadataProvider:Lt,genericViewportDisplaySetMetadataProvider:Wt,getAcquisitionPlaneOrientation:At,getBufferConfiguration:kt,getClosestImageId:Ft,getClosestStackImageIndexForPoint:Qn,getCubeSizeInView:Nt,getCurrentVolumeViewportSlice:no,getDynamicVolumeInfo:So,getERMF:_o,getImageDataMetadata:Ut,getImageLegacy:ao,getImageSliceDataForVolumeViewport:Gt,getMinMax:Bt,getNormalizedAspectRatio:dt,getPixelSpacingInformation:Do,getRandomSampleFromArray:mo,getRuntimeId:zn,getScalingDescriptor:Wo,getScalingParameters:Ht,getSliceRange:zt,getSpacingInNormalDirection:jt,getTargetVolumeAndSpacingInNormalDir:$t,getVOIRangeFromWindowLevel:qt,getViewportContentMode:Jt,getViewportImageCornersInWorld:io,getViewportImageIds:go,getViewportModality:Lo,getViewportsWithImageURI:Yn,getViewportsWithVolumeId:Kt,getVoiFromSigmoidRGBTransferFunction:Zt,getVolumeActorCorners:Xt,getVolumeDirectionVectors:Po,getVolumeId:te,getVolumeSliceRangeInfo:Yt,getVolumeViewReferenceId:Qt,getVolumeViewportScrollInfo:Se,getVolumeViewportsContainingSameVolumes:Zn,handleMultiframe4D:en,hasFloatScalingParameters:tn,hasNaNValues:nn,hasOwn:on,imageIdToURI:sn,imageRetrieveMetadataProvider:ct,imageToWorldCoords:rn,indexAlmostWithinDimensions:Kn,indexWithinDimensions:Jn,invertRgbTransferFunction:an,isEqual:lt,isEqualAbs:cn,isEqualNegative:ln,isGenericViewport:Ie,isImageActor:dn,isNumber:un,isOpposite:qn,isPTPrescaledWithSUV:ge,isValidVolume:fn,isVideoTransferSyntax:gn,jumpToSlice:Eo,loadImageToCanvas:Xn,logger:rt,makeVolumeMetadata:mn,mapMappedBandToRawRange:Mo,mapScalarToViewportVoiIntensity:xo,mapViewportVoiIntensityToScalar:X,planar:hn,pointInShapeCallback:pn,renderToCanvasCPU:Ce,renderToCanvasGPU:Re,resolveGenericViewportVolumeId:xe,rotateToViewCoordinates:wn,roundNumber:Te,roundToPrecision:uo,scaleArray:bo,scaleRgbTransferFunction:Nn,scroll:Oe,snapFocalPointToSlice:be,sortImageIdsAndGetSpacing:In,spatialRegistrationMetadataProvider:pe,splitImageIdsBy4DTags:Ve,transferFunctionUtils:Vn,transformIndexToWorld:Z,transformWorldToIndex:ve,transformWorldToIndexContinuous:N,triggerEvent:T,updatePlaneRestriction:Sn,updateVTKImageDataWithCornerstoneImage:bn,uuidv4:ee,viewportIsInStackMode:vn,viewportIsInVolumeMode:En,viewportSupportsDisplaySetPresentation:yn,viewportSupportsImageSlices:he,viewportSupportsStackCalibration:Rn,viewportSupportsStackCompatibility:Cn,viewportSupportsVolumeActors:fe,viewportSupportsVolumeCompatibility:Pn,viewportSupportsVolumeId:Tn,viewportSupportsVolumeURI:xn,windowLevel:Mn,worldToImageCoords:Dn},Symbol.toStringTag,{value:"Module"}));export{Oe as A,no as B,De as C,qn as D,io as E,fo as F,On as G,kn as M,Wn as T,Ln as a,Pe as b,Bo as c,Ho as d,An as e,Go as f,j as g,Uo as h,zn as i,Io as j,mo as k,Wo as l,Yn as m,Kn as n,Qn as o,so as p,Eo as q,Te as r,_n as s,Jn as t,zo as u,No as v,uo as w,Po as x,Co as y,To as z};