dicomweb-proxy
Version:
A proxy to translate between dicomweb and dimse
2 lines • 39 kB
JavaScript
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9977],{18262:(t,e,n)=>{n.d(e,{A:()=>h});var a=n(85204),i=n(15327);const o="viewport-element";function s(t,e){if(a.wk.svgNodeCache[t])return a.wk.svgNodeCache[t][e]?a.wk.svgNodeCache[t][e].domRef:void 0}function r(t,e,n,i){if(!a.wk.svgNodeCache[e])return null;a.wk.svgNodeCache[e][i]={touched:!0,domRef:n},t.appendChild(n)}function l(t,e){a.wk.svgNodeCache[t]&&a.wk.svgNodeCache[t][e]&&(a.wk.svgNodeCache[t][e].touched=!0)}function d(t,e){a.wk.svgNodeCache[e]&&Object.keys(a.wk.svgNodeCache[e]).forEach((n=>{const i=a.wk.svgNodeCache[e][n];!i.touched&&i.domRef&&(t.removeChild(i.domRef),delete a.wk.svgNodeCache[e][n])}))}const c=function(t){const e=(0,i.getEnabledElement)(t),{viewportId:n,renderingEngineId:c}=e,h=`${n}:${c}`,g=function(t){const e=`.${o}`,n=t.querySelector(e),a=n?.querySelector(":scope > .svg-layer");return a}(t);return Object.keys(a.wk.svgNodeCache[h]).forEach((t=>{a.wk.svgNodeCache[h][t].touched=!1})),{svgLayerElement:g,svgNodeCacheForCanvas:a.wk.svgNodeCache,getSvgNode:s.bind(this,h),appendNode:r.bind(this,g,h),setNodeTouched:l.bind(this,h),clearUntouched:d.bind(this,g,h)}};const h=function(t,e){const n=c(t);e(n),n.clearUntouched()}},12004:(t,e,n)=>{n.d(e,{A:()=>s});var a=n(97181),i=n(85899),o=n(56442);const s=function(t,e,n,s,r,l={},d=""){const{color:c,fill:h,width:g,lineWidth:u,lineDash:m,fillOpacity:v,strokeOpacity:p}=Object.assign({color:"rgb(0, 255, 0)",fill:"transparent",width:"2",lineDash:void 0,lineWidth:void 0,strokeOpacity:1,fillOpacity:1},l),f=u||g,w=(0,a.A)(e,"circle",n),I=t.getSvgNode(w),C={cx:`${s[0]}`,cy:`${s[1]}`,r:`${r}`,stroke:c,fill:h,"stroke-width":f,"stroke-dasharray":m,"fill-opacity":v,"stroke-opacity":p};if(I)(0,i.A)(C,I),t.setNodeTouched(w);else{const e=document.createElementNS("http://www.w3.org/2000/svg","circle");""!==d&&e.setAttribute("data-id",d),(0,o.A)(C,e),t.appendNode(e,w)}}},56745:(t,e,n)=>{n.d(e,{A:()=>i});var a=n(94042);const i=function(t,e,n,i,o={}){i.forEach(((i,s)=>{(0,a.A)(t,e,n,i,o,s)}))}},1595:(t,e,n)=>{n.d(e,{A:()=>r});var a=n(26290),i=n(92118),o=n(90554);const s=function(t,e,n,a,s,r,l={}){const d=a.length>0?(0,o.A)(a,s):s,c=function(t){const{x:e,y:n,height:a,width:i}=t,o=i/2,s=a/2;return[[e+o,n],[e,n+s],[e+o,n+a],[e+i,n+s]]}(r),h=(0,o.A)(c,d),g=Object.assign({color:"rgb(255, 255, 0)",lineWidth:"1",lineDash:"2,3"},l);(0,i.A)(t,e,`link-${n}`,d,h,g)};const r=function(t,e,n,i,o,r,l,d={}){const c=Object.assign({handleRadius:"6",centering:{x:!1,y:!0}},d),h=(0,a.A)(t,e,n,i,o,c);return s(t,e,n,r,o,h,c),h}},97530:(t,e,n)=>{n.d(e,{A:()=>i});n(97181);var a=n(75076);function i(t,e,n,i,o,s={},r=""){const l=[i[0],i[1]],d=[o[0],i[1]],c=[i[0],o[1]],h=[o[0],o[1]];(0,a.A)(t,e,n,[l,d,c,h],s,r)}},92686:(t,e,n)=>{n.d(e,{Y:()=>r});var a=n(67772),i=n(53486),o=n(99737),s=n(15327);const r=new class{constructor(){this.config={global:{},segmentations:{},viewportsStyle:{}}}setStyle(t,e){const{viewportId:n,segmentationId:a,type:i,segmentIndex:o}=t,s=this.getStyle(t);let r;if(r=n||a?this.copyActiveToInactiveIfNotProvided({...s,...e},i):{...s,...e},!i)throw new Error("Type is required to set a style");if(n){this.config.viewportsStyle[n]||(this.config.viewportsStyle[n]={renderInactiveSegmentations:!1,representations:{}});const t=this.config.viewportsStyle[n].representations;if(a){t[a]||(t[a]={}),t[a][i]||(t[a][i]={});const e=t[a][i];void 0!==o?(e.perSegment||(e.perSegment={}),e.perSegment[o]=r):e.allSegments=r}else{const e="__allSegmentations__";t[e]||(t[e]={}),t[e][i]||(t[e][i]={}),t[e][i].allSegments=r}}else if(a){this.config.segmentations[a]||(this.config.segmentations[a]={}),this.config.segmentations[a][i]||(this.config.segmentations[a][i]={});const t=this.config.segmentations[a][i];void 0!==o?(t.perSegment||(t.perSegment={}),t.perSegment[o]=r):t.allSegments=r}else this.config.global[i]=r}copyActiveToInactiveIfNotProvided(t,e){const n={...t};if(e===o.SegmentationRepresentations.Labelmap){const t=n;t.renderOutlineInactive??=t.renderOutline,t.outlineWidthInactive??=t.outlineWidth,t.renderFillInactive??=t.renderFill,t.fillAlphaInactive??=t.fillAlpha,t.outlineOpacityInactive??=t.outlineOpacity}else if(e===o.SegmentationRepresentations.Contour){const t=n;t.outlineWidthInactive??=t.outlineWidth,t.outlineOpacityInactive??=t.outlineOpacity,t.outlineDashInactive??=t.outlineDash,t.renderOutlineInactive??=t.renderOutline,t.renderFillInactive??=t.renderFill,t.fillAlphaInactive??=t.fillAlpha}return n}getStyle(t){const{viewportId:e,segmentationId:n,type:a,segmentIndex:i}=t;let o=this.getDefaultStyle(a),s=!1;if(this.config.global[a]&&(o={...o,...this.config.global[a]}),this.config.segmentations[n]?.[a]&&(o={...o,...this.config.segmentations[n][a].allSegments},void 0!==i&&this.config.segmentations[n][a].perSegment?.[i]&&(o={...o,...this.config.segmentations[n][a].perSegment[i]})),e&&this.config.viewportsStyle[e]){s=this.config.viewportsStyle[e].renderInactiveSegmentations;const t="__allSegmentations__";this.config.viewportsStyle[e].representations[t]?.[a]&&(o={...o,...this.config.viewportsStyle[e].representations[t][a].allSegments}),n&&this.config.viewportsStyle[e].representations[n]?.[a]&&(o={...o,...this.config.viewportsStyle[e].representations[n][a].allSegments},void 0!==i&&this.config.viewportsStyle[e].representations[n][a].perSegment?.[i]&&(o={...o,...this.config.viewportsStyle[e].representations[n][a].perSegment[i]}))}return o}getRenderInactiveSegmentations(t){return this.config.viewportsStyle[t]?.renderInactiveSegmentations}setRenderInactiveSegmentations(t,e){this.config.viewportsStyle[t]||(this.config.viewportsStyle[t]={renderInactiveSegmentations:!1,representations:{}}),this.config.viewportsStyle[t].renderInactiveSegmentations=e}getDefaultStyle(t){switch(t){case o.SegmentationRepresentations.Labelmap:return(0,i.A)();case o.SegmentationRepresentations.Contour:return(0,a.A)();case o.SegmentationRepresentations.Surface:return{};default:throw new Error(`Unknown representation type: ${t}`)}}clearSegmentationStyle(t){this.config.segmentations[t]&&delete this.config.segmentations[t]}clearAllSegmentationStyles(){this.config.segmentations={}}clearViewportStyle(t){this.config.viewportsStyle[t]&&delete this.config.viewportsStyle[t]}clearAllViewportStyles(){for(const t in this.config.viewportsStyle){const e=this.config.viewportsStyle[t].renderInactiveSegmentations;this.config.viewportsStyle[t]={renderInactiveSegmentations:e,representations:{}}}}resetToGlobalStyle(){this.clearAllSegmentationStyles(),this.clearAllViewportStyles()}hasCustomStyle(t){const{type:e}=t,n=this.getStyle(t),a=this.getDefaultStyle(e);return!s.utilities.deepEqual(n,a)}}},98798:(t,e,n)=>{n.d(e,{Q:()=>s});var a=n(15327),i=n(99737),o=n(64063);function s(t,e,n){const s={segmentationId:t,modifiedSlicesToUse:e,segmentIndex:n};(0,o.HM)(t),(0,a.triggerEvent)(a.eventTarget,i.Events.SEGMENTATION_DATA_MODIFIED,s)}},67165:(t,e,n)=>{n.d(e,{T:()=>i});var a=n(59475);function i(t){return a._6.getActiveSegmentation(t)}},33658:(t,e,n)=>{n.d(e,{I:()=>i});var a=n(59475);function i(t,e){return a._6.getSegmentationRepresentationVisibility(t,e)}},44188:(t,e,n)=>{n.d(e,{A:()=>o});var a=n(33283),i=n(18682);const o=function({segmentationId:t,type:e,data:n}){const o=(0,a.T)(t);if(!o)throw new Error(`Segmentation ${t} not found`);switch(o.representationData[e]&&console.warn(`Representation data of type ${e} already exists for segmentation ${t}, overwriting it.`),e){case i.A.Labelmap:case i.A.Contour:case i.A.Surface:n&&(o.representationData[e]=n);break;default:throw new Error(`Invalid representation type ${e}`)}}},65136:(t,e,n)=>{n.d(e,{A:()=>o});var a=n(15327),i=n(85204);const o=function(t,e){e||(e=(0,a.getRenderingEngines)().find((e=>e.getViewports().find((e=>e.id===t))))?.id);const n=i.wk.toolGroups.filter((n=>n.viewportsInfo.some((n=>n.renderingEngineId===e&&(!n.viewportId||n.viewportId===t)))));if(n.length){if(n.length>1)throw new Error(`Multiple tool groups found for renderingEngineId: ${e} and viewportId: ${t}. You should only\n have one tool group per viewport in a renderingEngine.`);return n[0]}}},37590:(t,e,n)=>{n.d(e,{A:()=>r});var a=n(15327),i=n(49906),o=n(28220);class s extends o.A{static{this.toolName="PlanarFreehandContourSegmentationTool"}constructor(t){super(a.utilities.deepMerge({configuration:{calculateStats:!1,allowOpenContours:!1}},t))}isContourSegmentationTool(){return!0}renderAnnotationInstance(t){const e=t.annotation,{invalidated:n}=e,a=super.renderAnnotationInstance(t);if(n){const{segmentationId:t}=e.data.segmentation;(0,i.triggerSegmentationDataModified)(t)}return a}}const r=s},28220:(t,e,n)=>{n.d(e,{A:()=>O});var a=n(15327),i=n(3823),o=n(4096),s=n(95527),r=n(13165),l=n(27730),d=n(60810),c=n(58640),h=n(55927),g=n(92400),u=n(57999),m=n(69855),v=n(70734),p=n(58161),f=n(44049),w=n(17328),I=n(473),C=n(92984),S=n(18990),E=n(73262),y=n(93843),D=n(36320),b=n(99737),A=n(40634);const{pointCanProjectOnLine:T}=s.polyline,{EPSILON:M}=a.CONSTANTS,x=1-M;class _ extends D.A{static{this.toolName="PlanarFreehandROI"}constructor(t={},e={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,contourHoleAdditionModifierKey:b.KeyboardBindings.Shift,alwaysRenderOpenContourHandles:{enabled:!1,radius:2},allowOpenContours:!0,closeContourProximity:10,checkCanvasEditFallbackProximity:6,makeClockWise:!0,subPixelResolution:4,smoothing:{smoothOnAdd:!1,smoothOnEdit:!1,knotsRatioPercentageOnAdd:40,knotsRatioPercentageOnEdit:40},interpolation:{enabled:!1,onInterpolationComplete:null},decimate:{enabled:!1,epsilon:.1},displayOnePointAsCrosshairs:!1,calculateStats:!0,getTextLines:k,statsCalculator:E.BasicStatsCalculator}}){super(t,e),this.isDrawing=!1,this.isEditingClosed=!1,this.isEditingOpen=!1,this.addNewAnnotation=t=>{const e=t.detail,{element:n}=e,a=this.createAnnotation(t);this.addAnnotation(a,n);const i=(0,d.getViewportIdsWithToolToRender)(n,this.getToolName());return this.activateDraw(t,a,i),t.preventDefault(),(0,c.A)(i),a},this.handleSelectedCallback=(t,e,n)=>{const a=t.detail,{element:i}=a,o=(0,d.getViewportIdsWithToolToRender)(i,this.getToolName());this.activateOpenContourEndEdit(t,e,o,n)},this.toolSelectedCallback=(t,e)=>{const n=t.detail,{element:a}=n,i=(0,d.getViewportIdsWithToolToRender)(a,this.getToolName());e.data.contour.closed?this.activateClosedContourEdit(t,e,i):this.activateOpenContourEdit(t,e,i),t.preventDefault()},this.isPointNearTool=(t,e,n,i)=>{const o=(0,a.getEnabledElement)(t),{viewport:s}=o,{polyline:r}=e.data.contour;let l=s.worldToCanvas(r[0]);for(let t=1;t<r.length;t++){const e=l,a=s.worldToCanvas(r[t]);if(T(n,e,a,i))return!0;l=a}if(!e.data.contour.closed)return!1;const d=s.worldToCanvas(r[0]),c=s.worldToCanvas(r[r.length-1]);return T(n,d,c,i)},this.cancel=t=>{const e=this.isDrawing,n=this.isEditingOpen,a=this.isEditingClosed;e?this.cancelDrawing(t):n?this.cancelOpenContourEdit(t):a&&this.cancelClosedContourEdit(t)},this._calculateCachedStats=(t,e,n,i)=>{const{data:r}=t,{cachedStats:l}=r,{polyline:d,closed:c}=r.contour,h=Object.keys(l);for(let n=0;n<h.length;n++){const i=h[n],g=this.getTargetImageData(i);if(!g)continue;const{imageData:u,metadata:m}=g,v=d.map((t=>e.worldToCanvas(t))),p={isPreScaled:(0,S.u)(e,i),isSuvScaled:this.isSuvScaled(e,i,t.metadata.referencedImageId)},f=(0,A.j)(m.Modality,t.metadata.referencedImageId,p),w=(0,o.Op)(g,(()=>{const t=r.contour.polyline,n=t.length,i=new Array(n);for(let a=0;a<n;a++)i[a]=e.worldToCanvas(t[a]);const{maxX:o,maxY:l,minX:d,minY:c}=s.polyline.getAABB(i),h=e.canvasToWorld([d,c]),g=a.utilities.transformWorldToIndex(u,h),m=e.canvasToWorld([o,l]);return[g,a.utilities.transformWorldToIndex(u,m)]}));c?this.updateClosedCachedStats({targetId:i,viewport:e,canvasCoordinates:v,points:d,imageData:u,metadata:m,cachedStats:l,modalityUnit:f,calibratedScale:w}):this.updateOpenCachedStats({metadata:m,canvasCoordinates:v,targetId:i,cachedStats:l,modalityUnit:f,calibratedScale:w})}const g=t.invalidated;return t.invalidated=!1,g&&(0,f.triggerAnnotationModified)(t,i.viewport.element,b.ChangeTypes.StatsUpdated),l},this._renderStats=(t,e,n,a)=>{const{data:i}=t,o=this.getTargetId(e),s={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:n.viewport.id},r=this.getLinkedTextBoxStyle(s,t);if(!r.visibility)return;const l=this.configuration.getTextLines(i,o);if(!l||0===l.length)return;const d=i.contour.polyline.map((t=>e.worldToCanvas(t)));if(!i.handles.textBox.hasMoved){const t=(0,I.getTextBoxCoordsCanvas)(d);i.handles.textBox.worldPosition=e.canvasToWorld(t)}const c=e.worldToCanvas(i.handles.textBox.worldPosition),h=(0,w.drawLinkedTextBox)(a,t.annotationUID??"","1",l,c,d,{},r),{x:g,y:u,width:m,height:v}=h;i.handles.textBox.worldBoundingBox={topLeft:e.canvasToWorld([g,u]),topRight:e.canvasToWorld([g+m,u]),bottomLeft:e.canvasToWorld([g,u+v]),bottomRight:e.canvasToWorld([g+m,u+v])}},(0,h.A)(this),(0,g.A)(this),(0,u.A)(this),(0,m.A)(this),(0,v.A)(this),(0,p.A)(this),this._throttledCalculateCachedStats=(0,l.A)(this._calculateCachedStats,100,{trailing:!0})}filterInteractableAnnotationsForElement(t,e){if(!e||!e.length)return;const n=(0,a.getEnabledElement)(t),{viewport:i}=n;let o;if(i instanceof a.VolumeViewport){const t=i.getCamera(),{spacingInNormalDirection:n}=a.utilities.getTargetVolumeAndSpacingInNormalDir(i,t);o=this.filterAnnotationsWithinSlice(e,t,n)}else o=(0,r.filterAnnotationsForDisplay)(i,e);return o}filterAnnotationsWithinSlice(t,e,n){const{viewPlaneNormal:a}=e,o=t.filter((t=>{const e=t.metadata.viewPlaneNormal,n=Math.abs(i.eR.dot(a,e))>x;return e&&n}));if(!o.length)return[];const s=n/2,{focalPoint:r}=e,l=[];for(const t of o){const e=t.data.contour.polyline[0];if(!t.isVisible)continue;const n=i.eR.create();i.eR.sub(n,r,e);const o=i.eR.dot(n,a);Math.abs(o)<s&&l.push(t)}return l}isContourSegmentationTool(){return!1}createAnnotation(t){const e=t.detail.currentPoints.world,n=super.createAnnotation(t);return a.utilities.deepMerge(n,{data:{contour:{polyline:[[...e]]},label:"",cachedStats:{}},onInterpolationComplete:t=>{t.data.handles.points.length=0}})}getAnnotationStyle(t){return super.getAnnotationStyle(t)}renderAnnotationInstance(t){const{enabledElement:e,targetId:n,svgDrawingHelper:a}=t,i=t.annotation;let o=!1;const{viewport:s,renderingEngine:r}=e,l=this.isDrawing,d=this.isEditingOpen,c=this.isEditingClosed;if(l||d||c){const t=this.commonData.annotation.annotationUID;if(i.annotationUID===t)if(l)this.renderContourBeingDrawn(e,a,i);else if(c)this.renderClosedContourBeingEdited(e,a,i);else{if(!d)throw new Error(`Unknown ${this.getToolName()} annotation rendering state`);this.renderOpenContourBeingEdited(e,a,i)}else this.configuration.displayOnePointAsCrosshairs&&1===i.data.contour.polyline.length?this.renderPointContourWithMarker(e,a,i):this.renderContour(e,a,i);o=!0}else this.configuration.displayOnePointAsCrosshairs&&1===i.data.contour.polyline.length?this.renderPointContourWithMarker(e,a,i):this.renderContour(e,a,i);if(this.configuration.calculateStats)return this._calculateStatsIfActive(i,n,s,r,e),this._renderStats(i,s,e,a),o}_calculateStatsIfActive(t,e,n,a,i){const o=this.commonData?.annotation.annotationUID;if((t.annotationUID!==o||this.commonData?.movingTextBox)&&!this.commonData?.movingTextBox){const{data:o}=t;o.cachedStats[e]?.unit?t.invalidated&&this._throttledCalculateCachedStats(t,n,a,i):(o.cachedStats[e]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null,unit:null},this._calculateCachedStats(t,n,a,i))}}updateClosedCachedStats({viewport:t,points:e,imageData:n,metadata:o,cachedStats:r,targetId:l,modalityUnit:d,canvasCoordinates:c,calibratedScale:h}){const{scale:g,areaUnit:u,unit:m}=h,{voxelManager:v}=t.getImageData(),p=c[0],f=t.canvasToWorld(p),w=t.canvasToWorld([p[0]+1,p[1]]),I=t.canvasToWorld([p[0],p[1]+1]),S=i.eR.distance(f,w),E=i.eR.distance(f,I),D=a.utilities.transformWorldToIndex(n,e[0]);D[0]=Math.floor(D[0]),D[1]=Math.floor(D[1]),D[2]=Math.floor(D[2]);let b=D[0],A=D[0],T=D[1],M=D[1],x=D[2],_=D[2];for(let t=1;t<e.length;t++){const i=a.utilities.transformWorldToIndex(n,e[t]);i[0]=Math.floor(i[0]),i[1]=Math.floor(i[1]),i[2]=Math.floor(i[2]),b=Math.min(b,i[0]),A=Math.max(A,i[0]),T=Math.min(T,i[1]),M=Math.max(M,i[1]),x=Math.min(x,i[2]),_=Math.max(_,i[2])}const k=a.utilities.transformWorldToIndex(n,e[1]);k[0]=Math.floor(k[0]),k[1]=Math.floor(k[1]),k[2]=Math.floor(k[2]);let O=s.polyline.getArea(c)/g/g;O*=S*E;const N=.01*(A-b),R=.01*(M-T),U=.01*(_-x);b=Math.floor(b-N),A=Math.ceil(A+N),T=Math.floor(T-R),M=Math.ceil(M+R),x=Math.floor(x-U),_=Math.ceil(_+U);const P=[[b,A],[T,M],[x,_]],L=n.indexToWorld([A,M,_]),W=t.worldToCanvas(L);let B=0,V=[],$=0;const H=v.forEach(this.configuration.statsCalculator.statsCallback,{imageData:n,isInObject:(e,n)=>{let a=!0;const i=t.worldToCanvas(e);return i[1]!=B&&($=0,B=i[1],V=(0,C.getLineSegmentIntersectionsCoordinates)(c,i,[W[0],i[1]]),V.sort((function(t,e){return t[0]===e[0]?0:t[0]<e[0]?-1:1}))),V.length&&i[0]>V[0][0]&&(V.shift(),$++),$%2==0&&(a=!1),a},boundsIJK:P,returnPoints:this.configuration.storePointData}),F=this.configuration.statsCalculator.getStatistics();r[l]={Modality:o.Modality,area:O,perimeter:(0,y.A)(c,closed)/g,mean:F.mean?.value,max:F.max?.value,stdDev:F.stdDev?.value,statsArray:F.array,pointsInShape:H,areaUnit:u,modalityUnit:d,unit:m}}updateOpenCachedStats({targetId:t,metadata:e,canvasCoordinates:n,cachedStats:a,modalityUnit:i,calibratedScale:o}){const{scale:s,unit:r}=o;a[t]={Modality:e.Modality,length:(0,y.A)(n,!1)/s,modalityUnit:i,unit:r}}}function k(t,e){const n=t.cachedStats[e],{area:i,mean:o,stdDev:s,length:r,perimeter:l,max:d,isEmptyArea:c,unit:h,areaUnit:g,modalityUnit:u}=n||{},m=[];if(i){const t=c?"Area: Oblique not supported":`Area: ${a.utilities.roundNumber(i)} ${g}`;m.push(t)}return o&&m.push(`Mean: ${a.utilities.roundNumber(o)} ${u}`),Number.isFinite(d)&&m.push(`Max: ${a.utilities.roundNumber(d)} ${u}`),s&&m.push(`Std Dev: ${a.utilities.roundNumber(s)} ${u}`),l&&m.push(`Perimeter: ${a.utilities.roundNumber(l)} ${h}`),r&&m.push(`${a.utilities.roundNumber(r)} ${h}`),m}const O=_},4010:(t,e,n)=>{n.d(e,{A:()=>A});var a=n(85817),i=n(15327),o=n(4096),s=n(27730),r=n(6802),l=n(2076),d=n(29601),c=n(44049),h=n(17328),g=n(85204),u=n(99737),m=n(60810),v=n(33657),p=n(473),f=n(35489),w=n(7001),I=n(58640),C=n(40634),S=n(18990),E=n(73262);const{transformWorldToIndex:y}=i.utilities;class D extends a.EC{static{this.toolName="RectangleROI"}constructor(t={},e={supportedInteractionTypes:["Mouse","Touch"],configuration:{storePointData:!1,shadow:!0,preventHandleOutsideImage:!1,calculateStats:!0,getTextLines:b,statsCalculator:E.BasicStatsCalculator}}){super(t,e),this.addNewAnnotation=t=>{const e=t.detail,{currentPoints:n,element:a}=e,o=n.world,s=(0,i.getEnabledElement)(a),{viewport:l}=s;this.isDrawing=!0;const d=this.constructor.createAnnotationForViewport(l,{data:{handles:{points:[[...o],[...o],[...o],[...o]],textBox:{hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}}},cachedStats:{}}});(0,r.lC)(d,a);const c=(0,m.getViewportIdsWithToolToRender)(a,this.getToolName());return this.editData={annotation:d,viewportIdsToRender:c,handleIndex:3,movingTextBox:!1,newAnnotation:!0,hasMoved:!1},this._activateDraw(a),(0,w.hideElementCursor)(a),t.preventDefault(),(0,I.A)(c),d},this.isPointNearTool=(t,e,n,a)=>{const o=(0,i.getEnabledElement)(t),{viewport:s}=o,{data:r}=e,{points:l}=r.handles,d=s.worldToCanvas(l[0]),c=s.worldToCanvas(l[3]),h=this._getRectangleImageCoordinates([d,c]),g=[n[0],n[1]],{left:u,top:m,width:p,height:f}=h;return v.distanceToPoint([u,m,p,f],g)<=a},this.toolSelectedCallback=(t,e)=>{const n=t.detail,{element:a}=n;e.highlighted=!0;const o=(0,m.getViewportIdsWithToolToRender)(a,this.getToolName());this.editData={annotation:e,viewportIdsToRender:o,movingTextBox:!1},this._activateModify(a),(0,w.hideElementCursor)(a);const s=(0,i.getEnabledElement)(a),{renderingEngine:r}=s;(0,I.A)(o),t.preventDefault()},this.handleSelectedCallback=(t,e,n)=>{const a=t.detail,{element:o}=a,{data:s}=e;e.highlighted=!0;let r,l=!1;n.worldPosition?l=!0:r=s.handles.points.findIndex((t=>t===n));const d=(0,m.getViewportIdsWithToolToRender)(o,this.getToolName());this.editData={annotation:e,viewportIdsToRender:d,handleIndex:r,movingTextBox:l},this._activateModify(o),(0,w.hideElementCursor)(o);const c=(0,i.getEnabledElement)(o),{renderingEngine:h}=c;(0,I.A)(d),t.preventDefault()},this._endCallback=t=>{const e=t.detail,{element:n}=e,{annotation:a,viewportIdsToRender:i,newAnnotation:o,hasMoved:s}=this.editData,{data:l}=a;o&&!s||(l.handles.activeHandleIndex=null,this._deactivateModify(n),this._deactivateDraw(n),(0,w.resetElementCursor)(n),this.doneEditMemo(),this.editData=null,this.isDrawing=!1,this.isHandleOutsideImage&&this.configuration.preventHandleOutsideImage&&(0,r.O8)(a.annotationUID),(0,I.A)(i),o&&(0,c.triggerAnnotationCompleted)(a))},this._dragCallback=t=>{this.isDrawing=!0;const e=t.detail,{element:n}=e,{annotation:a,viewportIdsToRender:o,handleIndex:s,movingTextBox:r,newAnnotation:l}=this.editData;this.createMemo(n,a,{newAnnotation:l});const{data:d}=a;if(r){const{deltaPoints:t}=e,n=t.world,{textBox:a}=d.handles,{worldPosition:i}=a;i[0]+=n[0],i[1]+=n[1],i[2]+=n[2],a.hasMoved=!0}else if(void 0===s){const{deltaPoints:t}=e,n=t.world,{points:i}=d.handles;i.forEach((t=>{t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]})),a.invalidated=!0}else{const{currentPoints:t}=e,o=(0,i.getEnabledElement)(n),{worldToCanvas:r,canvasToWorld:l}=o.viewport,c=t.world,{points:h}=d.handles;let g,u,m,v,p,f,w,I;switch(h[s]=[...c],s){case 0:case 3:g=r(h[0]),v=r(h[3]),u=[v[0],g[1]],m=[g[0],v[1]],f=l(u),w=l(m),h[1]=f,h[2]=w;break;case 1:case 2:u=r(h[1]),m=r(h[2]),g=[m[0],u[1]],v=[u[0],m[1]],p=l(g),I=l(v),h[0]=p,h[3]=I}a.invalidated=!0}this.editData.hasMoved=!0;(0,i.getEnabledElement)(n);(0,I.A)(o),a.invalidated&&(0,c.triggerAnnotationModified)(a,n,u.ChangeTypes.HandlesUpdated)},this.cancel=t=>{if(this.isDrawing){this.isDrawing=!1,this._deactivateDraw(t),this._deactivateModify(t),(0,w.resetElementCursor)(t);const{annotation:e,viewportIdsToRender:n,newAnnotation:a}=this.editData,{data:i}=e;return e.highlighted=!1,i.handles.activeHandleIndex=null,(0,I.A)(n),a&&(0,c.triggerAnnotationCompleted)(e),this.editData=null,e.annotationUID}},this._activateDraw=t=>{g.wk.isInteractingWithTool=!0,t.addEventListener(u.Events.MOUSE_UP,this._endCallback),t.addEventListener(u.Events.MOUSE_DRAG,this._dragCallback),t.addEventListener(u.Events.MOUSE_MOVE,this._dragCallback),t.addEventListener(u.Events.MOUSE_CLICK,this._endCallback),t.addEventListener(u.Events.TOUCH_END,this._endCallback),t.addEventListener(u.Events.TOUCH_DRAG,this._dragCallback),t.addEventListener(u.Events.TOUCH_TAP,this._endCallback)},this._deactivateDraw=t=>{g.wk.isInteractingWithTool=!1,t.removeEventListener(u.Events.MOUSE_UP,this._endCallback),t.removeEventListener(u.Events.MOUSE_DRAG,this._dragCallback),t.removeEventListener(u.Events.MOUSE_MOVE,this._dragCallback),t.removeEventListener(u.Events.MOUSE_CLICK,this._endCallback),t.removeEventListener(u.Events.TOUCH_END,this._endCallback),t.removeEventListener(u.Events.TOUCH_DRAG,this._dragCallback),t.removeEventListener(u.Events.TOUCH_TAP,this._endCallback)},this._activateModify=t=>{g.wk.isInteractingWithTool=!0,t.addEventListener(u.Events.MOUSE_UP,this._endCallback),t.addEventListener(u.Events.MOUSE_DRAG,this._dragCallback),t.addEventListener(u.Events.MOUSE_CLICK,this._endCallback),t.addEventListener(u.Events.TOUCH_END,this._endCallback),t.addEventListener(u.Events.TOUCH_DRAG,this._dragCallback),t.addEventListener(u.Events.TOUCH_TAP,this._endCallback)},this._deactivateModify=t=>{g.wk.isInteractingWithTool=!1,t.removeEventListener(u.Events.MOUSE_UP,this._endCallback),t.removeEventListener(u.Events.MOUSE_DRAG,this._dragCallback),t.removeEventListener(u.Events.MOUSE_CLICK,this._endCallback),t.removeEventListener(u.Events.TOUCH_END,this._endCallback),t.removeEventListener(u.Events.TOUCH_DRAG,this._dragCallback),t.removeEventListener(u.Events.TOUCH_TAP,this._endCallback)},this.renderAnnotation=(t,e)=>{let n=!1;const{viewport:a}=t,{element:o}=a;let s=(0,r.Rh)(this.getToolName(),o);if(!s?.length)return n;if(s=this.filterInteractableAnnotationsForElement(o,s),!s?.length)return n;const c=this.getTargetId(a),g=a.getRenderingEngine(),u={toolGroupId:this.toolGroupId,toolName:this.getToolName(),viewportId:t.viewport.id};for(let o=0;o<s.length;o++){const r=s[o],{annotationUID:m,data:v}=r,{points:f,activeHandleIndex:w}=v.handles,I=f.map((t=>a.worldToCanvas(t)));u.annotationUID=m;const{color:C,lineWidth:S,lineDash:E}=this.getAnnotationStyle({annotation:r,styleSpecifier:u}),{viewPlaneNormal:y,viewUp:D}=a.getCamera();if(v.cachedStats[c]&&null!=v.cachedStats[c].areaUnit){if(r.invalidated&&(this._throttledCalculateCachedStats(r,y,D,g,t),a instanceof i.VolumeViewport)){const{referencedImageId:t}=r.metadata;for(const e in v.cachedStats)if(e.startsWith("imageId")){g.getStackViewports().find((e=>{const n=i.utilities.imageIdToURI(t),a=e.hasImageURI(n),o=i.utilities.imageIdToURI(e.getCurrentImageId());return a&&o!==n}))&&delete v.cachedStats[e]}}}else v.cachedStats[c]={Modality:null,area:null,max:null,mean:null,stdDev:null,areaUnit:null},this._calculateCachedStats(r,y,D,g,t);if(!a.getRenderingEngine())return console.warn("Rendering Engine has been destroyed"),n;let b;if(!(0,d.isAnnotationVisible)(m))continue;if((0,l.isAnnotationLocked)(m)||this.editData||null===w||(b=[I[w]]),b){const t="0";(0,h.drawHandles)(e,m,t,b,{color:C})}const A=`${m}-rect`,T="0";(0,h.drawRectByCoordinates)(e,m,T,I,{color:C,lineDash:E,lineWidth:S},A),n=!0;const M=this.getLinkedTextBoxStyle(u,r);if(!M.visibility){v.handles.textBox={hasMoved:!1,worldPosition:[0,0,0],worldBoundingBox:{topLeft:[0,0,0],topRight:[0,0,0],bottomLeft:[0,0,0],bottomRight:[0,0,0]}};continue}const x=this.configuration.getTextLines(v,c);if(!x||0===x.length)continue;if(!v.handles.textBox.hasMoved){const t=(0,p.getTextBoxCoordsCanvas)(I);v.handles.textBox.worldPosition=a.canvasToWorld(t)}const _=a.worldToCanvas(v.handles.textBox.worldPosition),k="1",O=(0,h.drawLinkedTextBox)(e,m,k,x,_,I,{},M),{x:N,y:R,width:U,height:P}=O;v.handles.textBox.worldBoundingBox={topLeft:a.canvasToWorld([N,R]),topRight:a.canvasToWorld([N+U,R]),bottomLeft:a.canvasToWorld([N,R+P]),bottomRight:a.canvasToWorld([N+U,R+P])}}return n},this._getRectangleImageCoordinates=t=>{const[e,n]=t;return{left:Math.min(e[0],n[0]),top:Math.min(e[1],n[1]),width:Math.abs(e[0]-n[0]),height:Math.abs(e[1]-n[1])}},this._calculateCachedStats=(t,e,n,a,i)=>{if(!this.configuration.calculateStats)return;const{data:s}=t,{viewport:r}=i,{element:l}=r,d=s.handles.points[0],h=s.handles.points[3],{cachedStats:g}=s,m=Object.keys(g);for(let a=0;a<m.length;a++){const i=m[a],s=this.getTargetImageData(i);if(!s)continue;const{dimensions:l,imageData:c,metadata:u,voxelManager:v}=s,p=y(c,d);p[0]=Math.floor(p[0]),p[1]=Math.floor(p[1]),p[2]=Math.floor(p[2]);const w=y(c,h);if(w[0]=Math.floor(w[0]),w[1]=Math.floor(w[1]),w[2]=Math.floor(w[2]),this._isInsideVolume(p,w,l)){this.isHandleOutsideImage=!1;const a=[[Math.min(p[0],w[0]),Math.max(p[0],w[0])],[Math.min(p[1],w[1]),Math.max(p[1],w[1])],[Math.min(p[2],w[2]),Math.max(p[2],w[2])]],{worldWidth:l,worldHeight:m}=(0,f.A)(e,n,d,h),I=[p,w],{scale:E,areaUnit:y}=(0,o.Op)(s,I),D=Math.abs(l*m)/(E*E),b={isPreScaled:(0,S.u)(r,i),isSuvScaled:this.isSuvScaled(r,i,t.metadata.referencedImageId)},A=(0,C.j)(u.Modality,t.metadata.referencedImageId,b),T=v.forEach(this.configuration.statsCalculator.statsCallback,{boundsIJK:a,imageData:c,returnPoints:this.configuration.storePointData}),M=this.configuration.statsCalculator.getStatistics();g[i]={Modality:u.Modality,area:D,mean:M.mean?.value,stdDev:M.stdDev?.value,max:M.max?.value,statsArray:M.array,pointsInShape:T,areaUnit:y,modalityUnit:A}}else this.isHandleOutsideImage=!0,g[i]={Modality:u.Modality}}const v=t.invalidated;return t.invalidated=!1,v&&(0,c.triggerAnnotationModified)(t,l,u.ChangeTypes.StatsUpdated),g},this._isInsideVolume=(t,e,n)=>i.utilities.indexWithinDimensions(t,n)&&i.utilities.indexWithinDimensions(e,n),this._throttledCalculateCachedStats=(0,s.A)(this._calculateCachedStats,100,{trailing:!0})}static{this.hydrate=(t,e,n)=>{const a=(0,i.getEnabledElementByViewportId)(t);if(!a)return;const{FrameOfReferenceUID:o,referencedImageId:s,viewPlaneNormal:l,instance:d,viewport:c}=this.hydrateBase(D,a,e,n),h={annotationUID:n?.annotationUID||i.utilities.uuidv4(),data:{handles:{points:e,activeHandleIndex:null},label:"",cachedStats:{}},highlighted:!1,autoGenerated:!1,invalidated:!1,isLocked:!1,isVisible:!0,metadata:{toolName:d.getToolName(),viewPlaneNormal:l,FrameOfReferenceUID:o,referencedImageId:s,...n}};(0,r.lC)(h,c.element),(0,I.A)([c.id])}}}function b(t,e){const n=t.cachedStats[e],{area:a,mean:o,max:s,stdDev:r,areaUnit:l,modalityUnit:d}=n;if(null==o)return;const c=[];return c.push(`Area: ${i.utilities.roundNumber(a)} ${l}`),c.push(`Mean: ${i.utilities.roundNumber(o)} ${d}`),c.push(`Max: ${i.utilities.roundNumber(s)} ${d}`),c.push(`Std Dev: ${i.utilities.roundNumber(r)} ${d}`),c}const A=D},23631:(t,e,n)=>{n.d(e,{A:()=>C});var a=n(15327),i=n(85817),o=n(18682),s=n(67165),r=n(26795),l=n(33283),d=n(64485),c=n(97577),h=n(93733),g=n(60740),u=n(99737),m=n(2397),v=n(82056),p=n(13165),f=n(92984),w=n(49906),I=n(99522);class C extends i.oS{static{this.previewData={preview:null,element:null,timerStart:0,timer:null,startPoint:[NaN,NaN],isDrag:!1}}constructor(t,e){super(t,e),this.memoMap=new Map,this.acceptedMemoIds=new Map,this.centerSegmentIndexInfo={segmentIndex:null,hasSegmentIndex:!1,hasPreviewIndex:!1,changedIndices:[]}}_historyRedoHandler(t){const{id:e,operationType:n}=t.detail;if("labelmap"===n){if(this.acceptedMemoIds.has(e)){this._hoverData=null;const t=this.acceptedMemoIds.get(e),n=t?.element,i=this.getOperationData(n);i.segmentIndex=t?.segmentIndex,n&&this.applyActiveStrategyCallback((0,a.getEnabledElement)(n),i,u.StrategyCallbacks.AcceptPreview)}this._previewData.isDrag=!0}}get _previewData(){return C.previewData}createMemo(t,e){const n=e.id;if(this.memo&&this.memo.segmentationVoxelManager===e)return this.memo;let a=this.memoMap.get(n);return a?a.redoVoxelManager&&(a=m.createLabelmapMemo(t,e),this.memoMap.set(n,a)):(a=m.createLabelmapMemo(t,e),this.memoMap.set(n,a)),this.memo=a,a}createEditData(t){const e=(0,a.getEnabledElement)(t),{viewport:n}=e,i=(0,s.T)(n.id);if(!i){const t=new CustomEvent(a.Enums.Events.ERROR_EVENT,{detail:{type:"Segmentation",message:"No active segmentation detected, create a segmentation representation before using the brush tool"},cancelable:!0});return a.eventTarget.dispatchEvent(t),null}const{segmentationId:o}=i,d=(0,r.getLockedSegmentIndices)(o),{representationData:c}=(0,l.T)(o);return this.getEditData({viewport:n,representationData:c,segmentsLocked:d,segmentationId:o})}getEditData({viewport:t,representationData:e,segmentsLocked:n,segmentationId:i}){if(t instanceof a.BaseVolumeViewport){const{volumeId:i}=e[o.A.Labelmap],s=t.getActors();if(t instanceof d.x){const t=new CustomEvent(a.Enums.Events.ERROR_EVENT,{detail:{type:"Segmentation",message:"Cannot perform brush operation on the selected viewport"},cancelable:!0});return a.eventTarget.dispatchEvent(t),null}const r=s.map((t=>a.cache.getVolume(t.referencedId))),l=a.cache.getVolume(i),c=r.find((t=>a.utilities.isEqual(t.dimensions,l.dimensions)))?.volumeId||r[0]?.volumeId;return{volumeId:i,referencedVolumeId:this.configuration.threshold?.volumeId??c,segmentsLocked:n}}{const e=(0,c.vl)(t.id,i);if(!e)return;return{imageId:e,segmentsLocked:n}}}createHoverData(t,e){const n=(0,a.getEnabledElement)(t),{viewport:i}=n,o=i.getCamera(),{viewPlaneNormal:s,viewUp:r}=o,l=[i.id],{segmentIndex:d,segmentationId:c,segmentColor:h}=this.getActiveSegmentationData(i)||{};return{brushCursor:{metadata:{viewPlaneNormal:[...s],viewUp:[...r],FrameOfReferenceUID:i.getFrameOfReferenceUID(),referencedImageId:"",toolName:this.getToolName(),segmentColor:h},data:{}},centerCanvas:e,segmentIndex:d,viewport:i,segmentationId:c,segmentColor:h,viewportIdsToRender:l}}getActiveSegmentationData(t){const e=t.id,n=(0,s.T)(e);if(!n)return;const{segmentationId:a}=n,i=(0,g.Q)(a);if(!i)return;return{segmentIndex:i,segmentationId:a,segmentColor:(0,h.getSegmentIndexColor)(e,a,i)}}getOperationData(t){const e=this._editData||this.createEditData(t),{segmentIndex:n,segmentationId:i,brushCursor:o}=this._hoverData||this.createHoverData(t),{data:s,metadata:r={}}=o||{},{viewPlaneNormal:l,viewUp:d}=r,c=this.configuration.preview?.previewColors?.[n],{viewport:g}=(0,a.getEnabledElement)(t),u=(0,h.getSegmentIndexColor)(g.id,i,n);if(!c&&!u)return;let m=null,v=null;this.configuration.preview.enabled&&(m=c||function(t,e,n,a,i=.4){return[Math.round(t+(255-t)*i),Math.round(e+(255-e)*i),Math.round(n+(255-n)*i),a]}(...u),v=255);return{...e,points:s?.handles?.points,segmentIndex:n,viewPlaneNormal:l,previewOnHover:!this._previewData.isDrag,toolGroupId:this.toolGroupId,segmentationId:i,viewUp:d,centerSegmentIndexInfo:this.centerSegmentIndexInfo,activeStrategy:this.configuration.activeStrategy,configuration:this.configuration,previewColor:m,previewSegmentIndex:v,createMemo:this.createMemo.bind(this)}}addPreview(t=this._previewData.element,e){const{_previewData:n}=this,i=e?.acceptReject;!0===i?this.acceptPreview(t):!1===i&&this.rejectPreview(t);const o=(0,a.getEnabledElement)(t),s=this.applyActiveStrategyCallback(o,this.getOperationData(t),u.StrategyCallbacks.AddPreview);return n.isDrag=!0,s}rejectPreview(t=this._previewData.element){if(!t)return;this.doneEditMemo();const e=(0,a.getEnabledElement)(t);this.applyActiveStrategyCallback(e,this.getOperationData(t),u.StrategyCallbacks.RejectPreview),this._previewData.preview=null,this._previewData.isDrag=!1}acceptPreview(t=this._previewData.element){if(!t)return;const e=this.getOperationData(t);this.memo&&this.memo.id&&this.acceptedMemoIds.set(this.memo.id,{element:t,segmentIndex:e.segmentIndex});const n=(0,a.getEnabledElement)(t);this.applyActiveStrategyCallback(n,e,u.StrategyCallbacks.AcceptPreview),this.doneEditMemo(),this._previewData.preview=null,this._previewData.isDrag=!1}static viewportContoursToLabelmap(t,e){const n=e?.removeContours??!0,a=(0,v.getAllAnnotations)(),i=(0,p.filterAnnotationsForDisplay)(t,a);if(!i?.length)return;const o=i.filter((t=>t.data.contour?.polyline?.length));if(!o.length)return;const s=new C({},{configuration:{strategies:{FILL_INSIDE_CIRCLE:I.fillInsideCircle},activeStrategy:"FILL_INSIDE_CIRCLE"}}).addPreview(t.element),{memo:r,segmentationId:l}=s,d=r?.voxelManager,c=d.sourceVoxelManager||d,{dimensions:h}=d,u=t.getDefaultActor().actor.getMapper().getInputData();for(const t of o){const e=[[1/0,-1/0],[1/0,-1/0],[1/0,-1/0]],{polyline:a}=t.data.contour;for(const t of a){u.worldToIndex(t).forEach(((t,n)=>{e[n][0]=Math.min(e[n][0],t),e[n][1]=Math.max(e[n][1],t)}))}e.forEach(((t,e)=>{t[0]=Math.round(Math.max(0,t[0])),t[1]=Math.round(Math.min(h[e]-1,t[1]))}));const i=(0,g.Q)(l),o=t.data.handles?.[0]||a[0],s=u.worldToIndex(o).map(Math.round),r=c.getAtIJKPoint(s)||0;let m=!1,p=!1;for(const t of a){const e=u.worldToIndex(t).map(Math.round),n=c.getAtIJKPoint(e);n===r?m=!0:n>=0&&(p=!0)}const w=m&&p?r:0===r?i:0;for(let t=e[0][0];t<=e[0][1];t++)for(let n=e[1][0];n<=e[1][1];n++)for(let i=e[2][0];i<=e[2][1];i++){const e=u.indexToWorld([t,n,i]);(0,f.isPointInsidePolyline3D)(e,a)&&d.setAtIJK(t,n,i,w)}n&&(0,v.removeAnnotation)(t.annotationUID)}const m=d.getArrayOfModifiedSlices();(0,w.triggerSegmentationDataModified)(l,m)}}},85263:(t,e,n)=>{n.d(e,{V:()=>i});var a=n(33283);function i(t){if(t.parentAnnotationUID)return;if(!t.data.segmentation)throw new Error("addContourSegmentationAnnotation: annotation does not have a segmentation data");const{segmentationId:e,segmentIndex:n}=t.data.segmentation,i=(0,a.T)(e);i.representationData.Contour||(i.representationData.Contour={annotationUIDsMap:new Map});let{annotationUIDsMap:o}=i.representationData.Contour;o||(o=new Map);let s=o?.get(n);s||(s=new Set,o.set(n,s)),o.set(n,s.add(t.annotationUID))}},52905:(t,e,n)=>{n.d(e,{A:()=>i});var a=n(45217);const i=function(t,e,n){let i,o,s,r,l,d,c=0,h=!1,g=!1,u=!0;const m=!e&&0!==e&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof t)throw new TypeError("Expected a function");function v(e){const n=i,a=o;return i=o=void 0,c=e,r=t.apply(a,n),r}function p(t,e){return m?window.requestAnimationFrame(t):setTimeout(t,e)}function f(t){const n=t-d;return void 0===d||n>=e||n<0||g&&t-c>=s}function w(){const t=Date.now();if(f(t))return I(t);l=p(w,function(t){const n=t-c,a=e-(t-d);return g?Math.min(a,s-n):a}(t))}function I(t){return l=void 0,u&&i?v(t):(i=o=void 0,r)}function C(...t){const n=Date.now(),a=f(n);if(i=t,o=this,d=n,a){if(void 0===l)return function(t){return c=t,l=p(w,e),h?v(t):r}(d);if(g)return l=p(w,e),v(d)}return void 0===l&&(l=p(w,e)),r}return e=Number(e)||0,(0,a.A)(n)&&(h=Boolean(n.leading),g="maxWait"in n,s=g?Math.max(Number(n.maxWait)||0,e):s,u="trailing"in n?Boolean(n.trailing):u),C.cancel=function(){void 0!==l&&function(t){if(m)return window.cancelAnimationFrame(t);clearTimeout(t)}(l),c=0,i=d=o=l=void 0},C.flush=function(){return void 0===l?r:I(Date.now())},C.pending=function(){return void 0!==l},C}},1239:(t,e,n)=>{function a(t){const e=function(t){const e=[t[0],t[1]].sort(s),n=[t[0],t[1]].sort(r),a=e[e.length-1],i=n[0],o=n[n.length-1];return{top:i,bottom:o,right:a};function s(t,e){return t[0]<e[0]?-1:1}function r(t,e){return t[1]<e[1]?-1:1}}(t),n=(e.top[1]+e.bottom[1])/2;return[e.right[0],n]}n.d(e,{A:()=>a})},40133:(t,e,n)=>{n.d(e,{A:()=>i});var a=n(15295);function i(t){const e=(0,a.A)(t);return e.length?e[0]:void 0}},45217:(t,e,n)=>{n.d(e,{A:()=>a});const a=function(t){const e=typeof t;return null!==t&&("object"===e||"function"===e)}},62783:(t,e,n)=>{function a(t,e){const{center:n,radius:a}=t,i=t.radius2||a*a;return(e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])+(e[2]-n[2])*(e[2]-n[2])<=i}n.d(e,{d:()=>a})},26384:(t,e,n)=>{n.d(e,{l:()=>r});var a=n(3823),i=n(15327);const{isEqual:o}=i.utilities,s=[a.eR.fromValues(1,0,0),a.eR.fromValues(0,1,0),a.eR.fromValues(0,0,1)];function r(t){const e=a.eR.subtract(a.eR.create(),t[0],t[1]),n=a.eR.subtract(a.eR.create(),t[0],t[2]);return[...l(e,s),...l(n,s)].every((t=>o(t,0)||o(t,90)||o(t,180)||o(t,270)))}function l(t,e){return e.map((e=>180*a.eR.angle(t,e)/Math.PI))}},27730:(t,e,n)=>{n.d(e,{A:()=>o});var a=n(52905),i=n(45217);const o=function(t,e,n){let o=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return(0,i.A)(n)&&(o="leading"in n?Boolean(n.leading):o,s="trailing"in n?Boolean(n.trailing):s),(0,a.A)(t,e,{leading:o,trailing:s,maxWait:e})}},18990:(t,e,n)=>{n.d(e,{u:()=>i});var a=n(15327);function i(t,e){if(t instanceof a.BaseVolumeViewport){const t=a.utilities.getVolumeId(e),n=a.cache.getVolume(t);return!!n?.scaling&&Object.keys(n.scaling).length>0}if(t instanceof a.StackViewport){const{preScale:e}=t.getImageData()||{};return!!e?.scaled}return!1}}}]);
//# sourceMappingURL=9977.bundle.2adb0e3fbbd7756e9471.js.map