From 47916ff6a1690857ea23c4dafac5c8a83c4437f8 Mon Sep 17 00:00:00 2001 From: github-actions-bot Date: Mon, 9 Dec 2024 12:54:25 +0000 Subject: [PATCH] Updates --- asset-manifest.json | 10 +++++----- index.html | 2 +- static/js/687.902a8ade.chunk.js | 2 -- static/js/687.902a8ade.chunk.js.map | 1 - static/js/687.cd0a08b4.chunk.js | 2 ++ static/js/687.cd0a08b4.chunk.js.map | 1 + static/js/{main.8fe53f05.js => main.991ec8ac.js} | 6 +++--- ...f05.js.LICENSE.txt => main.991ec8ac.js.LICENSE.txt} | 0 .../js/{main.8fe53f05.js.map => main.991ec8ac.js.map} | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 static/js/687.902a8ade.chunk.js delete mode 100644 static/js/687.902a8ade.chunk.js.map create mode 100644 static/js/687.cd0a08b4.chunk.js create mode 100644 static/js/687.cd0a08b4.chunk.js.map rename static/js/{main.8fe53f05.js => main.991ec8ac.js} (99%) rename static/js/{main.8fe53f05.js.LICENSE.txt => main.991ec8ac.js.LICENSE.txt} (100%) rename static/js/{main.8fe53f05.js.map => main.991ec8ac.js.map} (99%) diff --git a/asset-manifest.json b/asset-manifest.json index 9c662449..e1a87fda 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,13 +1,13 @@ { "files": { "main.css": "https://imagingdatacommons.github.io/slim/static/css/main.e6c13ad2.css", - "main.js": "https://imagingdatacommons.github.io/slim/static/js/main.8fe53f05.js", + "main.js": "https://imagingdatacommons.github.io/slim/static/js/main.991ec8ac.js", "static/css/808.7fe7ed89.chunk.css": "https://imagingdatacommons.github.io/slim/static/css/808.7fe7ed89.chunk.css", "static/js/808.f9e665d9.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/808.f9e665d9.chunk.js", "static/css/912.9a70f995.chunk.css": "https://imagingdatacommons.github.io/slim/static/css/912.9a70f995.chunk.css", "static/js/912.520d065f.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/912.520d065f.chunk.js", "static/js/103.1b0d43fe.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/103.1b0d43fe.chunk.js", - "static/js/687.902a8ade.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/687.902a8ade.chunk.js", + "static/js/687.cd0a08b4.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/687.cd0a08b4.chunk.js", "static/js/dicomMicroscopyViewer.min.js.map": "https://imagingdatacommons.github.io/slim/static/js/dicomMicroscopyViewer.min.js.map", "static/js/dicomMicroscopyViewer.min.js": "https://imagingdatacommons.github.io/slim/static/js/dicomMicroscopyViewer.min.js", "static/js/index.worker.min.worker.js.map": "https://imagingdatacommons.github.io/slim/static/js/index.worker.min.worker.js.map", @@ -15,16 +15,16 @@ "static/js/index.worker.min.worker.js": "https://imagingdatacommons.github.io/slim/static/js/index.worker.min.worker.js", "index.html": "https://imagingdatacommons.github.io/slim/index.html", "main.e6c13ad2.css.map": "https://imagingdatacommons.github.io/slim/static/css/main.e6c13ad2.css.map", - "main.8fe53f05.js.map": "https://imagingdatacommons.github.io/slim/static/js/main.8fe53f05.js.map", + "main.991ec8ac.js.map": "https://imagingdatacommons.github.io/slim/static/js/main.991ec8ac.js.map", "808.7fe7ed89.chunk.css.map": "https://imagingdatacommons.github.io/slim/static/css/808.7fe7ed89.chunk.css.map", "808.f9e665d9.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/808.f9e665d9.chunk.js.map", "912.9a70f995.chunk.css.map": "https://imagingdatacommons.github.io/slim/static/css/912.9a70f995.chunk.css.map", "912.520d065f.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/912.520d065f.chunk.js.map", "103.1b0d43fe.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/103.1b0d43fe.chunk.js.map", - "687.902a8ade.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/687.902a8ade.chunk.js.map" + "687.cd0a08b4.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/687.cd0a08b4.chunk.js.map" }, "entrypoints": [ "static/css/main.e6c13ad2.css", - "static/js/main.8fe53f05.js" + "static/js/main.991ec8ac.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 2dd35026..3c55f414 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Slim
\ No newline at end of file +Slim
\ No newline at end of file diff --git a/static/js/687.902a8ade.chunk.js b/static/js/687.902a8ade.chunk.js deleted file mode 100644 index 3ed11bd0..00000000 --- a/static/js/687.902a8ade.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkslim=self.webpackChunkslim||[]).push([[687],{4687:(e,t,n)=>{n.d(t,{Z:()=>Dn});var i=n(5671),a=n(3144),o=n(7326),r=n(136),s=n(7277),l=n(2791),c=n(7689),d=n(1087),u=n(3695),h=n(586),p=n(9135),v=n(6014),m=n(4261),f=n(394),g=n(4970),S=n(184),y=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e="horizontal",t="14px";void 0!==this.props.hasLongValues&&this.props.hasLongValues&&(e="vertical",t="20px");var n=this.props.attributes.map((function(e,n){var i=(0,m.Z)();return(0,S.jsx)(f.Z.Item,{label:e.name,labelStyle:{lineHeight:t},contentStyle:{fontWeight:600,whiteSpace:"pre-line",lineHeight:"14px"},span:1,children:e.value},i)})),i=null;return void 0!==this.props.icon&&(i=(0,S.jsx)(this.props.icon,{})),(0,S.jsxs)(g.Z,{title:this.props.header,extra:i,size:"small",hoverable:this.props.selectable,bordered:void 0!==this.props.header,actions:this.props.methods,children:[(0,S.jsx)(f.Z,{column:1,size:"small",layout:e,bordered:!1,children:n}),this.props.children]})}}]),n}(l.Component);const C=y;const I=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[];return null!=this.props.metadata.ClinicalTrialSponsorName&&e.push.apply(e,[{name:"Sponsor Name",value:this.props.metadata.ClinicalTrialSponsorName},{name:"Protocol ID",value:this.props.metadata.ClinicalTrialProtocolID},{name:"Protocol Name",value:this.props.metadata.ClinicalTrialProtocolName},{name:"Site Name",value:this.props.metadata.ClinicalTrialSiteName}]),null!=this.props.metadata.ClinicalTrialTimePointID&&e.push({name:"Time Point ID",value:this.props.metadata.ClinicalTrialTimePointID}),(0,S.jsx)(C,{attributes:e})}}]),n}(l.Component);function b(e){return"object"===typeof e&&null!==e&&void 0!==e&&void 0!==e.Alphabetic?e.Alphabetic.split("^").join(" "):""}function w(e){if(null!==e&&void 0!==e){var t=e.substring(0,4),n=e.substring(4,6),i=e.substring(6,8);return"".concat(t,"-").concat(n,"-").concat(i)}return""}function x(e){if(null!==e&&void 0!==e){var t=e.substring(0,2),n=e.substring(2,4),i=e.substring(4,6);return"".concat(t,":").concat(n,":").concat(i)}return""}function D(e){return null!==e&&void 0!==e?{F:"Female",M:"Male",O:"Other"}[e]:""}const Z=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[{name:"ID",value:this.props.metadata.PatientID},{name:"Name",value:b(this.props.metadata.PatientName)},{name:"Gender",value:D(this.props.metadata.PatientSex)},{name:"Birthdate",value:w(this.props.metadata.PatientBirthDate)}];return(0,S.jsx)(C,{attributes:e})}}]),n}(l.Component);const V=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[{name:"Accession #",value:this.props.metadata.AccessionNumber},{name:"ID",value:this.props.metadata.StudyID},{name:"Date",value:w(this.props.metadata.StudyDate)},{name:"Time",value:x(this.props.metadata.StudyTime)}];return(0,S.jsx)(C,{attributes:e})}}]),n}(l.Component);var R,O=n(1413),j=n(6658);!function(e){e.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE="1.2.840.10008.5.1.4.1.1.77.1.6",e.COMPREHENSIVE_SR="1.2.840.10008.5.1.4.1.1.88.33",e.COMPREHENSIVE_3D_SR="1.2.840.10008.5.1.4.1.1.88.34",e.SEGMENTATION="1.2.840.10008.5.1.4.1.1.66.4",e.MICROSCOPY_BULK_SIMPLE_ANNOTATION="1.2.840.10008.5.1.4.1.1.91.1",e.PARAMETRIC_MAP="1.2.840.10008.5.1.4.1.1.30",e.ADVANCED_BLENDING_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.8",e.COLOR_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.2",e.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.1",e.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.3"}(R||(R={}));var M=Symbol("subscriptions"),E=Symbol("lastSubscriptionId"),P=function(){function e(){(0,i.Z)(this,e),this[M]={},this[E]=0}return(0,a.Z)(e,[{key:"subscribe",value:function(e,t){if(void 0===e)throw new Error("Trying to subscribe to an inexistent event");if("function"!==typeof t)throw new Error("The provided callback must be a function");this[M].hasOwnProperty(e)||(this[M][e]={});var n="sub".concat(this[E]++);this[M][e][n]=t}},{key:"unsubscribe",value:function(e,t){var n=this[M][e]||{};for(var i in n)t?n[i]===t&&delete n[i]:delete n[i]}},{key:"publish",value:function(e){if(void 0===e)throw new Error("Trying to publish an inexistent event");for(var t=this[M][e]||{},n=arguments.length,i=new Array(n>1?n-1:0),a=1;a0){var e=this.props.slide.overviewImages[0];null!==this.overviewViewportRef.current&&(this.overviewViewportRef.current.innerHTML="",console.info("instantiate viewer for OVERVIEW image of slide "+'"'.concat(e.ContainerIdentifier,'"')),this.overviewViewer=new j.viewer.OverviewImageViewer({client:this.props.clients[R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:e,resizeFactor:1,errorInterceptor:function(e){Q.onError(z,e)}}),this.overviewViewer.render({container:this.overviewViewportRef.current}))}this.setState({isLoading:!1})}},{key:"render",value:function(){void 0!==this.overviewViewer&&this.overviewViewer.resize();var e=[],t=this.props.slide.description;return null!=t&&""!==t&&e.push({name:"Description",value:t}),this.state.isLoading?(0,S.jsx)(p.fCD,{}):(0,S.jsx)(v.Z.Item,(0,O.Z)((0,O.Z)({style:{height:"100%"}},this.props),{},{children:(0,S.jsx)(C,{header:this.props.slide.containerIdentifier,attributes:e,selectable:!0,children:null!=this.overviewViewportRef.current&&(0,S.jsx)("div",{style:{height:"100px"},ref:this.overviewViewportRef})})}),this.props.slide.seriesInstanceUIDs[0])}}]),n}(l.Component);const $=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r0,checkedChildren:(0,S.jsx)(p.dSq,{}),unCheckedChildren:(0,S.jsx)(p.tgn,{})})}),(0,S.jsx)(v.Z,{selectedKeys:(0,te.Z)(this.props.selectedRoiUIDs.values()),onSelect:this.handleMenuItemSelection,onClick:this.handleMenuItemSelection,children:t})]})}}]),n}(l.Component);var Ce=n(914),Ie=n(6272),be=n(3020),we=n(5594),xe=n(2414),De=["annotationGroup","defaultStyle","isVisible","metadata","onVisibilityChange","onStyleChange"];const Ze=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleMeasurementSelection=a.handleMeasurementSelection.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.getCurrentColor=a.getCurrentColor.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({annotationGroupUID:this.props.annotationGroup.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{opacity:e}}),this.setState({currentStyle:{opacity:e,color:this.state.currentStyle.color,limitValues:this.state.currentStyle.limitValues}}))}},{key:"handleColorRChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"handleColorGChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"handleColorBChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"getCurrentColor",value:function(){var e;return null!=this.state.currentStyle.color?"#"+(16777216+((e=this.state.currentStyle.color)[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):"white"}},{key:"handleLowerLimitChange",value:function(e){null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:[e,t.currentStyle.limitValues[1]]}}:{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:[e,this.state.currentStyle.limitValues[1]]}}))}},{key:"handleUpperLimitChange",value:function(e){null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:[t.currentStyle.limitValues[0],e]}}:{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:[this.state.currentStyle.limitValues[0],e]}}))}},{key:"handleLimitChange",value:function(e){this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:e}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:e}})}},{key:"handleMeasurementSelection",value:function(e,t){var n=this;if(null!=e&&null!=t.children){var i=e.split("-"),a=new ve.sr.coding.CodedConcept({value:i[1],schemeDesignator:i[0],meaning:t.children});this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{measurement:a}}),this.setState((function(e){return{currentStyle:{opacity:e.currentStyle.opacity,measurement:a}}}))}else this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:this.props.defaultStyle.color}}),this.setState((function(e){return{currentStyle:{opacity:e.currentStyle.opacity,color:n.props.defaultStyle.color,limitValues:void 0}}}))}},{key:"render",value:function(){var e,t,n,i,a=this,o=this.props.metadata.AnnotationGroupSequence.findIndex((function(e){return e.AnnotationGroupUID===a.props.annotationGroup.uid})),r=this.props.metadata.AnnotationGroupSequence[o],s=[{name:"Property type",value:this.props.annotationGroup.propertyType.CodeMeaning},{name:"Property category",value:this.props.annotationGroup.propertyCategory.CodeMeaning},{name:"Graphic type",value:r.GraphicType},{name:"Annotation coordinate type",value:this.props.metadata.AnnotationCoordinateType}],l=null!==(e=r.MeasurementsSequence)&&void 0!==e?e:[],c=l.map((function(e,t){var n=e.ConceptNameCodeSequence[0];return(0,S.jsx)(ne.Z.Option,{value:"".concat(n.CodingSchemeDesignator,"-").concat(n.CodeValue),dropdownMatchSelectWidth:!1,size:"small",disabled:!a.props.isVisible,children:n.CodeMeaning},t)}));if(c.push((0,S.jsx)(ne.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",disabled:!this.props.isVisible,children:(0,S.jsx)(S.Fragment,{})},"-")),null!=this.state.currentStyle.color&&(t=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Color"}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Red"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Green"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,S.jsx)(le.Z,{plain:!0})]})),l.length>0){if(null!=this.state.currentStyle.limitValues){n=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Values of interest"}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!0,min:0,max:1e3,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:this.state.currentStyle.limitValues[0],max:1e3,size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[1],onChange:this.handleUpperLimitChange})})]})]})}i=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Exploration"}),(0,S.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:8,children:"Measurement"}),(0,S.jsx)(Ce.Z,{span:16,children:(0,S.jsx)(ne.Z,{style:{minWidth:"65px",width:"90%"},onSelect:this.handleMeasurementSelection,defaultValue:void 0,children:c},"annotation-group-measurements")})]})]})}var d=(0,S.jsxs)("div",{children:[t,n,(0,S.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]}),i]}),u=this.getCurrentColor(),h=this.state.isVisible&&null==this.state.currentStyle.measurement,m=this.props,f=(m.annotationGroup,m.defaultStyle,m.isVisible,m.metadata,m.onVisibilityChange,m.onStyleChange,(0,fe.Z)(m,De));return(0,S.jsx)(v.Z.Item,(0,O.Z)((0,O.Z)({style:{height:"100%",paddingLeft:"3px"}},f),{},{children:(0,S.jsxs)(ae.Z,{align:"start",children:[(0,S.jsx)("div",{style:{paddingLeft:"14px"},children:(0,S.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,S.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,S.jsx)(p.dSq,{}),unCheckedChildren:(0,S.jsx)(p.tgn,{})}),(0,S.jsx)(be.Z,{placement:"left",content:d,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,S.jsx)(xe.Z,{})})})]})}),(0,S.jsx)(we.Z,{offset:[-20,20],count:" ",style:{borderStyle:"solid",borderWidth:"1px",borderColor:"gray",visibility:h?"visible":"hidden",backgroundImage:"linear-gradient(to bottom, ".concat(u,", ").concat(u)},children:(0,S.jsx)(C,{header:this.props.annotationGroup.label,attributes:s,selectable:!0,hasLongValues:!0})})]})}),this.props.annotationGroup.uid)}}]),n}(l.Component);const Ve=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.annotationGroups.map((function(t,n){var i=t.uid;return(0,S.jsx)(Ze,{annotationGroup:t,metadata:e.props.metadata[i],isVisible:e.props.visibleAnnotationGroupUIDs.has(i),defaultStyle:e.props.defaultAnnotationGroupStyles[i],onVisibilityChange:e.props.onAnnotationGroupVisibilityChange,onStyleChange:e.props.onAnnotationGroupStyleChange},t.uid)}));return(0,S.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);const Re=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleClick=a.handleClick.bind((0,o.Z)(a)),a}return(0,a.Z)(n,[{key:"handleClick",value:function(e){void 0!==this.props.onClick&&this.props.onClick(e)}},{key:"render",value:function(){var e,t,n,i=this.props.icon;return void 0===i?null:(null!=this.props.label&&(t=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{type:"vertical"}),this.props.label]})),n=null!==(e=this.props.isSelected)&&void 0!==e&&e?(0,S.jsx)(re.Z,{onClick:this.handleClick,icon:(0,S.jsx)(i,{}),type:"primary",style:{lineHeight:"1.0"},children:t}):(0,S.jsx)(re.Z,{onClick:this.handleClick,icon:(0,S.jsx)(i,{}),type:"default",style:{lineHeight:"1.0"},children:t}),void 0!==this.props.tooltip?(0,S.jsx)(oe.Z,{title:this.props.tooltip,children:n}):n)}}]),n}(l.Component);const Oe=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){if(void 0===this.props.metadata)return null;var e=[{name:"Manufacturer",value:this.props.metadata.Manufacturer},{name:"Model Name",value:this.props.metadata.ManufacturerModelName},{name:"Device Serial Number",value:this.props.metadata.DeviceSerialNumber},{name:"Software Versions",value:this.props.metadata.SoftwareVersions}];return null!=this.props.metadata.InstitutionName&&e.push({name:"Institution Name",value:this.props.metadata.InstitutionName}),(0,S.jsx)(C,{attributes:e,hasLongValues:!0})}}]),n}(l.Component);var je=function(e){var t=e.content,n=e.name,i=[];return t.forEach((function(e){(function(e,t){var n=e.ConceptNameCodeSequence[0];return n.CodeValue===t.CodeValue&&n.CodingSchemeDesignator===t.CodingSchemeDesignator})(e,n)&&i.push(e)})),i},Me=function(e,t){return e.ValueType===t},Ee=function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});1!==t.length&&Q.onError(W,new N(L,'Content item "Imaging Measurements" not found.Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report".'));var n=t[0],i=je({content:n.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=[];return i.forEach((function(e){var t,n=[],i=e,o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"112040",schemeDesignator:"DCM",meaning:"Tracking Unique Identifier"})});0===o.length&&Q.onError(W,new N(L,'Content item "Tracking Unique Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'));var r=o[0];if(0===(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121071",schemeDesignator:"DCM",meaning:"Finding"})})).length&&Q.onError(W,new N(L,'Content item "Finding" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".')),0!==(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111001",schemeDesignator:"DCM",meaning:"Algorithm Name"})})).length){var s=o[0];n.push(s),t="Device"}else t="Person";if(0!==(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111003",schemeDesignator:"DCM",meaning:"Algorithm Version"})})).length){var l=o[0];n.push(l)}0===(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})})).length&&Q.onError(W,new N(L,'Content item "Image Region" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'));var c,d=o[0];if("POINT"===d.GraphicType)c=new j.scoord3d.Point({frameOfReferenceUID:d.ReferencedFrameOfReferenceUID,coordinates:d.GraphicData});else{for(var u=[],h=0;h TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'))}n.push.apply(n,(0,te.Z)(function(e){var t=e.content,n=[];return t.forEach((function(e){if(Me(e,ve.sr.valueTypes.ValueTypes.CODE)){var t=e;n.push(t)}})),n}({content:i.ContentSequence})));var p=function(e){var t=e.content,n=[];return t.forEach((function(e){if(Me(e,ve.sr.valueTypes.ValueTypes.NUM)){var t=e;n.push(t)}})),n}({content:i.ContentSequence}),v=new j.roi.ROI({scoord3d:c,uid:(0,m.Z)(),properties:{trackingUID:r.UID,observerType:t,evaluations:n,measurements:p}});a.push(v)})),a},Pe=(0,a.Z)((function e(t){(0,i.Z)(this,e),this.PersonObserverName=void 0,this.PersonObserverLoginName=void 0,this.DeviceObserverUID=void 0,this.DeviceObserverName=void 0,this.SpecimenUID=void 0,this.SpecimenIdentifier=void 0,this.ContainerIdentifier=void 0,this.ROIs=[];var n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121039",schemeDesignator:"DCM",meaning:"Specimen UID"})});0===n.length&&Q.onError(W,new N(L,'Content item "Specimen UID" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var a=n[0];this.SpecimenUID=a.UID,0===(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen Identifier"})})).length&&Q.onError(W,new N(L,'Content item "Specimen Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var o=n[0];this.SpecimenIdentifier=o.TextValue,0===(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111700",schemeDesignator:"DCM",meaning:"Specimen Container Identifier"})})).length&&Q.onError(W,new N(L,'Content item "Specimen Container Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var r=n[0];if(this.ContainerIdentifier=r.TextValue,0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121008",schemeDesignator:"DCM",meaning:"Person Observer Name"})})).length){var s=n[0];this.PersonObserverName=s.PersonName}if(0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"128774",schemeDesignator:"DCM",meaning:"Person Observer's Login Name"})})).length){var l=n[0];this.PersonObserverLoginName=l.TextValue}if((n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121012",schemeDesignator:"DCM",meaning:"Device Observer UID"})})).length>0){var c=n[0];this.DeviceObserverUID=c.UID}if(0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121013",schemeDesignator:"DCM",meaning:"Device Observer Name"})})).length){var d=n[0];this.DeviceObserverName=d.TextValue}this.ROIs=Ee(t)}));const Ue=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=new Pe(this.props.dataset),t=[{name:"ID",value:e.ContainerIdentifier}],n=[{name:"ID",value:e.SpecimenIdentifier}],i=[{name:"Name",value:e.PersonObserverName}],a=e.ROIs.map((function(e,t){var n="Region ".concat(t+1),i=[];return e.evaluations.forEach((function(e){e.ValueType===ve.sr.valueTypes.ValueTypes.CODE?i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.ConceptCodeSequence[0].CodeMeaning}):e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.TextValue})})),(0,S.jsx)(C,{header:n,attributes:i},e.uid)}));return(0,S.jsxs)("div",{children:[(0,S.jsx)(le.Z,{orientation:"left",children:"Patient"}),(0,S.jsx)(Z,{metadata:this.props.dataset}),(0,S.jsx)(le.Z,{orientation:"left",children:"Case"}),(0,S.jsx)(V,{metadata:this.props.dataset}),(0,S.jsx)(le.Z,{orientation:"left",children:"Slide"}),(0,S.jsx)(C,{attributes:t}),(0,S.jsx)(le.Z,{orientation:"left",children:"Specimen"}),(0,S.jsx)(C,{attributes:n}),(0,S.jsx)(le.Z,{orientation:"left",children:"Observer"}),(0,S.jsx)(C,{attributes:i}),(0,S.jsx)(le.Z,{orientation:"left",children:"Annotations"}),a]})}}]),n}(l.Component);var Ae=n(2126);const Te=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=null;return void 0!==this.props.groups&&(t=this.props.groups.map((function(e,t){return(0,S.jsx)(C,{header:e.name,attributes:e.attributes},t)}))),e=void 0!==this.props.type?"".concat(this.props.type,": ").concat(this.props.identifier):this.props.identifier,(0,S.jsxs)(Ae.ZP.Item,{children:[(0,S.jsx)(C,{header:e,attributes:this.props.attributes,hasLongValues:this.props.hasLongValues,children:t}),this.props.children]},this.props.uid)}}]),n}(l.Component);new ve.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),new ve.sr.coding.CodedConcept({value:"433465004",schemeDesignator:"SCT",meaning:"Sampling of tissue specimen"}),new ve.sr.coding.CodedConcept({value:"127790008",schemeDesignator:"SCT",meaning:"Specimen staining"}),new ve.sr.coding.CodedConcept({value:"9265001",schemeDesignator:"SCT",meaning:"Specimen processing"});var ke={FIXATIVE:new ve.sr.coding.CodedConcept({value:"430864009",schemeDesignator:"SCT",meaning:"Tissue fixative"}),EMBEDDING_MEDIUM:new ve.sr.coding.CodedConcept({value:"430863003",schemeDesignator:"SCT",meaning:"Embedding medium"})},Le=(0,O.Z)({SPECIMEN_IDENTIFIER:new ve.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen identifier"}),PARENT_SPECIMEN_IDENTIFIER:new ve.sr.coding.CodedConcept({value:"111705",schemeDesignator:"DCM",meaning:"Parent specimen identifier"}),PROCESSING_TYPE:new ve.sr.coding.CodedConcept({value:"111701",schemeDesignator:"DCM",meaning:"Processing type"}),DATETIME_OF_PROCESSING:new ve.sr.coding.CodedConcept({value:"111702",schemeDesignator:"DCM",meaning:"Datetime of processing"}),PROCESSING_STEP_DESCRIPTION:new ve.sr.coding.CodedConcept({value:"111703",schemeDesignator:"DCM",meaning:"Processing step description"}),COLLECTION_METHOD:new ve.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),SAMPLING_METHOD:new ve.sr.coding.CodedConcept({value:"111704",schemeDesignator:"DCM",meaning:"Sampling method"}),STAIN:new ve.sr.coding.CodedConcept({value:"424361007",schemeDesignator:"SCT",meaning:"Using substance"})},ke);const _e=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=this;if(void 0===this.props.metadata)return null;var n=this.props.metadata.SpecimenDescriptionSequence[this.props.index],i=[];if(void 0!==n.SpecimenShortDescription&&i.push({name:"Description",value:n.SpecimenShortDescription}),void 0!==n.PrimaryAnatomicStructureSequence&&n.PrimaryAnatomicStructureSequence.length>0){var a=n.PrimaryAnatomicStructureSequence;i.push({name:"Anatomical structure",value:a.map((function(e){return e.CodeMeaning})).join(", ")})}(null!==(e=n.SpecimenPreparationSequence)&&void 0!==e?e:[]).forEach((function(e,n){e.SpecimenPreparationStepContentItemSequence.forEach((function(e,n){var a=new ve.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var o=new ve.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});a.equals(Le.PROCESSING_TYPE)||(a.equals(Le.COLLECTION_METHOD)?i.push({name:"Collection method",value:o.CodeMeaning}):a.equals(Le.FIXATIVE)?i.push({name:"Tissue fixative",value:o.CodeMeaning}):a.equals(Le.EMBEDDING_MEDIUM)?i.push({name:"Tissue embedding medium",value:o.CodeMeaning}):a.equals(Le.STAIN)&&t.props.showstain&&i.push({name:"Tissue stain",value:o.CodeMeaning}))}else e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&(a.equals(Le.STAIN)&&t.props.showstain?i.push({name:"Tissue stain",value:e.TextValue}):a.equals(Le.PARENT_SPECIMEN_IDENTIFIER)&&i.push({name:"Parent specimen",value:e.TextValue}))}))}));var o=n.SpecimenUID,r=n.SpecimenIdentifier;return(0,S.jsx)(Te,{uid:o,identifier:r,attributes:i,hasLongValues:!0},o)}}]),n}(l.Component);const Ne=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=this;if(void 0===this.props.metadata)return null;var n=(null!==(e=this.props.metadata.SpecimenDescriptionSequence)&&void 0!==e?e:[]).map((function(e,n){return(0,S.jsx)(_e,{index:n,metadata:t.props.metadata,showstain:t.props.showstain},e.SpecimenUID)}));return(0,S.jsx)(Ae.ZP,{style:{overflowY:"auto"},children:n})}}]),n}(l.Component);var Ge=n(681),qe=n(2622),Fe=n(4215),ze=n(8272),Be=["defaultStyle","isRemovable","isVisible","metadata","onVisibilityChange","onStyleChange","onRemoval","opticalPath"];const We=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleLimitChange=a.handleLimitChange.bind((0,o.Z)(a)),a.handleLowerLimitChange=a.handleLowerLimitChange.bind((0,o.Z)(a)),a.handleUpperLimitChange=a.handleUpperLimitChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.handleRemoval=a.handleRemoval.bind((0,o.Z)(a)),a.getCurrentColors=a.getCurrentColors.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color,paletteColorLookupTable:a.props.defaultStyle.paletteColorLookupTable,limitValues:a.props.defaultStyle.limitValues}},a}return(0,a.Z)(n,[{key:"componentDidUpdate",value:function(e,t){this.props.defaultStyle!==e.defaultStyle&&this.setState({currentStyle:this.props.defaultStyle})}},{key:"handleVisibilityChange",value:function(e,t){var n=this.props.opticalPath.identifier;this.setState({isVisible:e}),this.props.onVisibilityChange({opticalPathIdentifier:n,isVisible:e})}},{key:"handleOpacityChange",value:function(e){if(null!=e){var t=this.props.opticalPath.identifier;this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{opacity:e}}),this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:e,limitValues:t.currentStyle.limitValues}}}))}}},{key:"handleColorRChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"handleColorGChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"handleColorBChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"getCurrentColors",value:function(){var e=function(e){return"#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1)};return null!=this.props.defaultStyle.paletteColorLookupTable?this.props.defaultStyle.paletteColorLookupTable.data.map((function(t){return e(t)})):null!=this.state.currentStyle.color?["#000000",e(this.state.currentStyle.color)]:["white","white"]}},{key:"handleLowerLimitChange",value:function(e){var t=this.props.opticalPath.identifier;null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:[e,t.currentStyle.limitValues[1]]}}:{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:[e,this.state.currentStyle.limitValues[1]]}}))}},{key:"handleUpperLimitChange",value:function(e){var t=this.props.opticalPath.identifier;null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:[t.currentStyle.limitValues[0],e]}}:{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:[this.state.currentStyle.limitValues[0],e]}}))}},{key:"handleLimitChange",value:function(e){var t=this.props.opticalPath.identifier;this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:e}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:e}})}},{key:"handleRemoval",value:function(){var e=this.props.opticalPath.identifier;this.props.onRemoval(e)}},{key:"render",value:function(){var e,t=this.props.opticalPath.identifier,n=this.props.opticalPath.description,i=[];void 0!==this.props.opticalPath.illuminationWaveLength&&i.push({name:"Illumination wavelength",value:"".concat(this.props.opticalPath.illuminationWaveLength," nm")}),void 0!==this.props.opticalPath.illuminationColor&&i.push({name:"Illumination color",value:this.props.opticalPath.illuminationColor.CodeMeaning});var a=null!==(e=this.props.metadata[0].SpecimenDescriptionSequence)&&void 0!==e?e:[];try{a.forEach((function(e){var t;(null!==(t=e.SpecimenPreparationSequence)&&void 0!==t?t:[]).forEach((function(e,t){e.SpecimenPreparationStepContentItemSequence.forEach((function(e,t){var n=new ve.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var a=new ve.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});n.equals(Le.PROCESSING_TYPE)||n.equals(Le.STAIN)&&i.push({name:"Tissue stain",value:a.CodeMeaning})}else e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&(n.equals(Le.PROCESSING_TYPE)||n.equals(Le.STAIN)&&i.push({name:"Tissue stain",value:e.TextValue}))}))}))}))}catch(f){Q.onError(B,new N(L,f.message))}var o,r,s=Math.pow(2,this.props.metadata[0].BitsAllocated)-1,l=null!=n?"".concat(t,": ").concat(n):t;if(this.props.opticalPath.isMonochromatic){var c,d;c=null!=this.state.currentStyle.color?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Color"}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Red"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Green"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Color"}),"Custom pseudo-coloring is disabled because pixels are colorized via a provided palette color lookup table."]}),null!=this.state.currentStyle.limitValues&&(d=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Values of interest"}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!0,min:0,max:s,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:this.state.currentStyle.limitValues[0],max:s,size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[1],onChange:this.handleUpperLimitChange})})]})]})),o=(0,S.jsxs)("div",{children:[d,c,(0,S.jsx)(le.Z,{plain:!0}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})]});var u=this.getCurrentColors();r=(0,S.jsx)(we.Z,{offset:[-20,20],count:" ",style:{borderStyle:"solid",borderWidth:"1px",borderColor:"gray",visibility:this.state.isVisible?"visible":"hidden",backgroundImage:"linear-gradient(to right, ".concat(u.toString(),")")},children:(0,S.jsx)(C,{header:l,attributes:i,selectable:!0,hasLongValues:!0})})}else o=(0,S.jsx)("div",{children:(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"60px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),r=(0,S.jsx)(C,{header:l,attributes:i,selectable:!0,hasLongValues:!0});var h=[];this.props.isRemovable&&h.push((0,S.jsx)(oe.Z,{title:"Remove Optical Path",children:(0,S.jsx)(re.Z,{type:"default",shape:"circle",icon:(0,S.jsx)(qe.Z,{}),onClick:this.handleRemoval})}));var p=this.props,m=(p.defaultStyle,p.isRemovable,p.isVisible,p.metadata,p.onVisibilityChange,p.onStyleChange,p.onRemoval,p.opticalPath,(0,fe.Z)(p,Be));return(0,S.jsx)(v.Z.Item,(0,O.Z)((0,O.Z)({style:{height:"100%",paddingLeft:"3px"}},m),{},{children:(0,S.jsxs)(ae.Z,{align:"start",children:[(0,S.jsx)("div",{style:{paddingLeft:"14px"},children:(0,S.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,S.jsx)(me.Z,{size:"small",checked:this.state.isVisible,onChange:this.handleVisibilityChange,checkedChildren:(0,S.jsx)(Fe.Z,{}),unCheckedChildren:(0,S.jsx)(ze.Z,{})}),(0,S.jsx)(be.Z,{placement:"left",content:o,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,S.jsx)(xe.Z,{})})}),h]})}),r]})}),this.props.opticalPath.identifier)}}]),n}(l.Component);var Ye=ne.Z.Option;const He=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).state={selectedOpticalPathIdentifier:void 0},a.handleItemAddition=a.handleItemAddition.bind((0,o.Z)(a)),a.handleItemRemoval=a.handleItemRemoval.bind((0,o.Z)(a)),a.handleItemSelectionChange=a.handleItemSelectionChange.bind((0,o.Z)(a)),a}return(0,a.Z)(n,[{key:"handleItemRemoval",value:function(e){this.props.onOpticalPathActivityChange({opticalPathIdentifier:e,isActive:!1})}},{key:"handleItemSelectionChange",value:function(e){this.setState({selectedOpticalPathIdentifier:e})}},{key:"handleItemAddition",value:function(){var e=this.state.selectedOpticalPathIdentifier;void 0!==e&&(this.props.onOpticalPathActivityChange({opticalPathIdentifier:e,isActive:!0}),this.setState({selectedOpticalPathIdentifier:void 0}))}},{key:"render",value:function(){var e=this;if(void 0===this.props.metadata)return null;var t,n=this.props.opticalPaths.length>1,i=[],a=[];return this.props.opticalPaths.forEach((function(t){var o=t.identifier,r=e.props.metadata[o],s=r[0].SeriesInstanceUID;r[0].OpticalPathSequence.forEach((function(o){var l,c=o.OpticalPathIdentifier,d=o.OpticalPathDescription;t.identifier===c&&(e.props.activeOpticalPathIdentifiers.has(c)?i.push((0,S.jsx)(We,{opticalPath:t,metadata:r,isVisible:e.props.visibleOpticalPathIdentifiers.has(c),defaultStyle:e.props.defaultOpticalPathStyles[c],onVisibilityChange:e.props.onOpticalPathVisibilityChange,onStyleChange:e.props.onOpticalPathStyleChange,onRemoval:e.handleItemRemoval,isRemovable:n},"".concat(s,"-").concat(c))):(l=""!==d?"".concat(c," - ").concat(d):"".concat(c),a.push((0,S.jsx)(Ye,{value:c,children:l},c))))}))})),n&&(t=(0,S.jsxs)(ae.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,S.jsx)(ne.Z,{defaultValue:"",style:{width:200},onChange:this.handleItemSelectionChange,value:this.state.selectedOpticalPathIdentifier,allowClear:!0,children:a}),(0,S.jsx)(oe.Z,{title:"Add",children:(0,S.jsx)(re.Z,{icon:(0,S.jsx)(Ge.Z,{}),type:"primary",onClick:this.handleItemAddition})})]})),(0,S.jsxs)(v.Z,{selectable:!1,children:[i,t]})}}]),n}(l.Component);var Xe=["defaultStyle","isVisible","mapping","metadata","onVisibilityChange","onStyleChange"];const Ke=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({mappingUID:this.props.mapping.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({mappingUID:this.props.mapping.uid,styleOptions:{opacity:e}}),this.setState((function(t){return{currentStyle:{opacity:e}}})))}},{key:"render",value:function(){var e=[{name:"Description",value:this.props.mapping.description}],t=(0,S.jsx)("div",{children:(0,S.jsxs)(se.Z,{justify:"center",align:"middle",children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),n=this.props,i=(n.defaultStyle,n.isVisible,n.mapping,n.metadata,n.onVisibilityChange,n.onStyleChange,(0,fe.Z)(n,Xe));return(0,S.jsx)(v.Z.Item,(0,O.Z)((0,O.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,S.jsxs)(ae.Z,{align:"start",children:[(0,S.jsx)("div",{style:{paddingLeft:"14px"},children:(0,S.jsx)(ae.Z,{direction:"vertical",align:"end",size:100,children:(0,S.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,S.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,S.jsx)(p.dSq,{}),unCheckedChildren:(0,S.jsx)(p.tgn,{})}),(0,S.jsx)(be.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,S.jsx)(xe.Z,{})})})]})})}),(0,S.jsx)(C,{header:this.props.mapping.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.mapping.uid)}}]),n}(l.Component);const Qe=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.mappings.map((function(t,n){var i=t.uid;return(0,S.jsx)(Ke,{mapping:t,metadata:e.props.metadata[i],isVisible:e.props.visibleMappingUIDs.has(i),defaultStyle:e.props.defaultMappingStyles[i],onVisibilityChange:e.props.onMappingVisibilityChange,onStyleChange:e.props.onMappingStyleChange},t.uid)}));return(0,S.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);var Je=["defaultStyle","isVisible","segment","metadata","onVisibilityChange","onStyleChange"];const $e=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({segmentUID:this.props.segment.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({segmentUID:this.props.segment.uid,styleOptions:{opacity:e}}),this.setState({currentStyle:{opacity:e}}))}},{key:"render",value:function(){var e=[{name:"Property Type",value:this.props.segment.propertyType.CodeMeaning},{name:"Property Category",value:this.props.segment.propertyCategory.CodeMeaning},{name:"Algorithm Name",value:this.props.segment.algorithmName}],t=(0,S.jsx)("div",{children:(0,S.jsxs)(se.Z,{justify:"center",align:"middle",children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),n=this.props,i=(n.defaultStyle,n.isVisible,n.segment,n.metadata,n.onVisibilityChange,n.onStyleChange,(0,fe.Z)(n,Je));return(0,S.jsx)(v.Z.Item,(0,O.Z)((0,O.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,S.jsxs)(ae.Z,{align:"start",children:[(0,S.jsx)("div",{style:{paddingLeft:"14px"},children:(0,S.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,S.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,S.jsx)(p.dSq,{}),unCheckedChildren:(0,S.jsx)(p.tgn,{})}),(0,S.jsx)(be.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,S.jsx)(xe.Z,{})})})]})}),(0,S.jsx)(C,{header:this.props.segment.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.segment.uid)}}]),n}(l.Component);const et=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.segments.map((function(t,n){var i=t.uid;return(0,S.jsx)($e,{segment:t,metadata:e.props.metadata[i],isVisible:e.props.visibleSegmentUIDs.has(i),defaultStyle:e.props.defaultSegmentStyles[i],onVisibilityChange:e.props.onSegmentVisibilityChange,onStyleChange:e.props.onSegmentStyleChange},t.uid)}));return(0,S.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);function tt(e){return function(t){var n=(0,c.TH)(),i=(0,c.s0)(),a=(0,c.UO)();return(0,S.jsx)(e,(0,O.Z)((0,O.Z)({},t),{},{location:n,navigate:i,params:a}))}}var nt=n(4942);const it=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.getCurrentColor=a.getCurrentColor.bind((0,o.Z)(a)),a.state={currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color}},a}return(0,a.Z)(n,[{key:"handleOpacityChange",value:function(e){var t=this;null!=e&&(this.props.annotationGroupsUIDs.forEach((function(n){t.props.onStyleChange({uid:n,styleOptions:{color:t.state.currentStyle.color,opacity:e}})})),this.setState({currentStyle:{opacity:e,color:this.state.currentStyle.color}}))}},{key:"handleColorRChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,opacity:e.currentStyle.opacity}}})),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity}})}))}}},{key:"handleColorGChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,opacity:e.currentStyle.opacity}}})),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity}})}))}}},{key:"handleColorBChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.setState((function(e){return{currentStyle:{color:n,opacity:e.currentStyle.opacity}}})),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity}})}))}}},{key:"getCurrentColor",value:function(){var e;return null!=this.state.currentStyle.color?"#"+(16777216+((e=this.state.currentStyle.color)[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):"white"}},{key:"render",value:function(){var e;return null!=this.state.currentStyle.color&&(e=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{plain:!0,children:"Color"}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Red"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Green"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,S.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,S.jsx)(Ce.Z,{span:14,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,S.jsx)(Ce.Z,{span:5,children:(0,S.jsx)(de.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,S.jsx)(le.Z,{plain:!0})]})),(0,S.jsxs)("div",{children:[e,(0,S.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,S.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,S.jsx)(Ce.Z,{span:12,children:(0,S.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,S.jsx)(Ce.Z,{span:6,children:(0,S.jsx)(de.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})]})}}]),n}(l.Component);const at=function(e){var t=e.category,n=e.onChange,i=e.checkedAnnotationUids,a=e.onStyleChange,o=e.defaultAnnotationStyles,r=t.types,s=r.every((function(e){return e.uids.every((function(e){return i.has(e)}))})),l=!s&&r.some((function(e){return e.uids.some((function(e){return i.has(e)}))})),c=function(e){var t=e.type,i=e.isVisible;t.uids.forEach((function(e){n({roiUID:e,isVisible:i})}))};return(0,S.jsx)(v.Z.Item,{style:{height:"100%",paddingLeft:"3px"},children:(0,S.jsx)(ae.Z,{align:"start",children:(0,S.jsxs)("div",{style:{paddingLeft:"14px",color:"black"},children:[(0,S.jsx)(ae.Z,{direction:"vertical",align:"end",children:(0,S.jsxs)(ie.Z,{indeterminate:l,checked:s,onChange:function(e){var t=e.target.checked;r.forEach((function(e){c({type:e,isVisible:t})}))},children:[(0,S.jsx)(oe.Z,{title:"".concat(t.CodeValue,":").concat(t.CodingSchemeDesignator),mouseEnterDelay:1,children:t.CodeMeaning}),(0,S.jsx)(be.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,S.jsx)(it,{annotationGroupsUIDs:r.reduce((function(e,t){return[].concat((0,te.Z)(e),(0,te.Z)(t.uids))}),[]),onStyleChange:a,defaultStyle:o[r[0].uids[0]]})},children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,S.jsx)(xe.Z,{})})})]})}),r.map((function(e){var t=e.CodeMeaning,n=e.CodingSchemeDesignator,r=e.CodeValue,s=e.uids,l=t.slice(0,22),d=l===t?t:"".concat(l,"..."),u=s.every((function(e){return i.has(e)})),h=!u&&s.some((function(e){return i.has(e)}));return(0,S.jsxs)("div",{style:{paddingLeft:"25px",width:"100%",display:"flex",flexDirection:"row"},children:[(0,S.jsx)(ie.Z,{indeterminate:h,checked:u,onChange:function(t){return c({type:e,isVisible:t.target.checked})}}),(0,S.jsxs)("div",{style:{paddingLeft:"5px"},children:[(0,S.jsx)(oe.Z,{title:"".concat(r,":").concat(n),mouseEnterDelay:1,children:d}),(0,S.jsx)(be.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,S.jsx)(it,{annotationGroupsUIDs:e.uids,onStyleChange:a,defaultStyle:o[e.uids[0]]})},children:(0,S.jsx)(re.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,S.jsx)(xe.Z,{})})})]})]},"".concat(e.CodingSchemeDesignator,":").concat(e.CodeMeaning))}))]})})},t.CodeMeaning)};const ot=function(e){var t=e.annotations,n=e.onChange,i=e.onStyleChange,a=e.defaultAnnotationStyles,o=e.checkedAnnotationUids,r=function(e){var t=null===e||void 0===e?void 0:e.reduce((function(e,t){var n,i,a=t.category,o=t.type,r=t.uid,s=a.CodeMeaning,l=o.CodeMeaning,c=null!==(n=e[s])&&void 0!==n?n:(0,O.Z)((0,O.Z)({},a),{},{types:{}}),d=null!==(i=c.types[l])&&void 0!==i?i:(0,O.Z)((0,O.Z)({},o),{},{uids:[]});return(0,O.Z)((0,O.Z)({},e),{},(0,nt.Z)({},s,(0,O.Z)((0,O.Z)({},c),{},{types:(0,O.Z)((0,O.Z)({},c.types),{},(0,nt.Z)({},l,(0,O.Z)((0,O.Z)({},d),{},{uids:[].concat((0,te.Z)(d.uids),[r])})))})))}),{});return Object.keys(t).forEach((function(e){var n=t[e].types,i=Object.keys(n).map((function(e){return n[e]}));t[e].types=i})),t}(t);if(0===Object.keys(r).length)return(0,S.jsx)(S.Fragment,{});var s=Object.keys(r).map((function(e){var t=r[e];return(0,S.jsx)(at,{category:t,onChange:n,onStyleChange:i,defaultAnnotationStyles:a,checkedAnnotationUids:o},t.CodeMeaning)}));return(0,S.jsx)(v.Z,{selectable:!1,children:s})};const rt=function(e){var t=e.xPosition,n=e.yPosition,i=e.attributes;return(0,S.jsx)("div",{style:{position:"fixed",top:"".concat(n,"px"),left:"".concat(t,"px"),backgroundColor:"rgba(230, 230, 230, 0.65)",minWidth:"150px",minHeight:"60px",padding:"20px",fontWeight:"bold",pointerEvents:"none"},children:i.map((function(e){return(0,S.jsxs)("div",{children:[e.name,": ",(0,S.jsx)("span",{style:{fontWeight:500},children:e.value})]},e.name)}))})};var st=[255,234,0],lt=[255,234,0,.2],ct=[0,0,0],dt=[[54,162,235],[181,65,98],[75,192,192],[255,158,64],[153,102,254],[255,205,86],[200,203,207]],ut=function(e){var t=e.CodingSchemeDesignator,n=e.CodeValue;return"".concat(t,"-").concat(n)},ht=function(e){var t=je({content:e.evaluations,name:new ve.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"})});if(0!==t.length){var n=t[0].ConceptCodeSequence[0];return ut(n)}console.warn("no finding found for ROI ".concat(e.uid))},pt=function(e){var t={color:st,width:2};null!=e.stroke&&(null!=e.stroke.color&&(t.color=e.stroke.color),null!=e.stroke.width&&(t.width=e.stroke.width));var n={color:lt};return null!=e.fill&&null!=e.fill.color&&(n.color=e.fill.color),{stroke:t,fill:n,image:{circle:{radius:null!=e.radius?e.radius:Math.max(5-t.width,1),stroke:t,fill:n}}}},vt=function(e){var t=e.clients,n=e.slide,i=e.preload;console.info("instantiate viewer for VOLUME images of slide "+'"'.concat(n.volumeImages[0].ContainerIdentifier,'"'));try{var a,o=new j.viewer.VolumeImageViewer({clientMapping:t,metadata:n.volumeImages,controls:["overview","position"],preload:i,errorInterceptor:function(e){Q.onError(z,e)}});return o.activateSelectInteraction({}),n.labelImages.length>0&&(console.info("instantiate viewer for LABEL image of slide "+'"'.concat(n.labelImages[0].ContainerIdentifier,'"')),a=new j.viewer.LabelImageViewer({client:t[R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:n.labelImages[0],resizeFactor:1,orientation:"vertical",errorInterceptor:function(e){Q.onError(z,e)}})),{volumeViewer:o,labelViewer:a}}catch(r){throw Q.onError(W,new N(_,"Failed to instantiate viewer")),r}},mt=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;(0,i.Z)(this,n),(a=t.call(this,e)).findingOptions=[],a.evaluationOptions={},a.measurements=[],a.geometryTypeOptions={},a.volumeViewportRef=void 0,a.labelViewportRef=void 0,a.volumeViewer=void 0,a.labelViewer=void 0,a.defaultRoiStyle={stroke:{color:st,width:2},fill:{color:lt},image:{circle:{fill:{color:st},radius:5}}},a.roiStyles={},a.defaultAnnotationStyles={},a.selectionColor=[140,184,198],a.selectedRoiStyle={stroke:{color:[].concat((0,te.Z)(a.selectionColor),[1]),width:3},fill:{color:[].concat((0,te.Z)(a.selectionColor),[.2])},image:{circle:{radius:5,fill:{color:[].concat((0,te.Z)(a.selectionColor),[1])}}}},a.loadPresentationStates=function(){console.info("search for Presentation State instances");var e=a.props.clients[R.ADVANCED_BLENDING_PRESENTATION_STATE];e.searchForInstances({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"PR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t,n){var i=j.metadata.formatMetadata(t).dataset;console.info('retrieve PR instance "'.concat(i.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:i.SeriesInstanceUID,sopInstanceUID:i.SOPInstanceUID}).then((function(e){var t=ve.aT.DicomMessage.readFile(e),o=j.metadata.formatMetadata(t.dict).dataset;if(a.props.slide.areVolumeImagesMonochrome){var r=o,s=!1;r.AdvancedBlendingSequence.forEach((function(e){s=a.props.slide.seriesInstanceUIDs.includes(e.SeriesInstanceUID)})),s&&(console.info("include Advanced Blending Presentation State instance "+'"'.concat(r.SOPInstanceUID,'"')),(0===n&&null==a.props.selectedPresentationStateUID||r.SOPInstanceUID===a.props.selectedPresentationStateUID)&&a.setPresentationState(r),a.setState((function(e){var t={};return e.presentationStates.forEach((function(e){t[e.SOPInstanceUID]=e})),t[r.SOPInstanceUID]=r,{presentationStates:Object.values(t)}})))}else console.info('ignore presentation state "'.concat(i.SOPInstanceUID,'", ')+"application of presentation states for color images has not (yet) been implemented")})).catch((function(e){Q.onError(W,new N(_,"Presentation State could not be loaded")),console.error("failed to load presentation state "+'of SOP instance "'.concat(i.SOPInstanceUID,'" ')+'of series "'.concat(i.SeriesInstanceUID,'" ')+'of study "'.concat(a.props.studyInstanceUID,'": '),e)}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Presentation State could not be loaded"))}))},a.setPresentationState=function(e){var t=a.volumeViewer.getAllOpticalPaths();console.info('apply Presentation State instance "'.concat(e.SOPInstanceUID,'"'));var n={};t.forEach((function(t){var i=t.identifier;a.volumeViewer.hideOpticalPath(i),a.volumeViewer.deactivateOpticalPath(i);var o=a.volumeViewer.getOpticalPathDefaultStyle(i);a.volumeViewer.setOpticalPathStyle(i,o),e.AdvancedBlendingSequence.forEach((function(e){var a=e.ReferencedInstanceSequence;void 0===a&&(a=e.ReferencedImageSequence),void 0!==a&&a.forEach((function(a){if(t.sopInstanceUIDs.includes(a.ReferencedSOPInstanceUID)){var o,r;if(null!=e.PaletteColorLookupTableSequence){var s=e.PaletteColorLookupTableSequence[0];o=new j.color.PaletteColorLookupTable({uid:null!=s.PaletteColorLookupTableUID?s.PaletteColorLookupTableUID:"",redDescriptor:s.RedPaletteColorLookupTableDescriptor,greenDescriptor:s.GreenPaletteColorLookupTableDescriptor,blueDescriptor:s.BluePaletteColorLookupTableDescriptor,redData:null!=s.RedPaletteColorLookupTableData?new Uint16Array(s.RedPaletteColorLookupTableData):void 0,greenData:null!=s.GreenPaletteColorLookupTableData?new Uint16Array(s.GreenPaletteColorLookupTableData):void 0,blueData:null!=s.BluePaletteColorLookupTableData?new Uint16Array(s.BluePaletteColorLookupTableData):void 0,redSegmentedData:null!=s.SegmentedRedPaletteColorLookupTableData?new Uint16Array(s.SegmentedRedPaletteColorLookupTableData):void 0,greenSegmentedData:null!=s.SegmentedGreenPaletteColorLookupTableData?new Uint16Array(s.SegmentedGreenPaletteColorLookupTableData):void 0,blueSegmentedData:null!=s.SegmentedBluePaletteColorLookupTableData?new Uint16Array(s.SegmentedBluePaletteColorLookupTableData):void 0})}if(null!=e.SoftcopyVOILUTSequence){var l=e.SoftcopyVOILUTSequence[0],c=l.WindowCenter,d=l.WindowWidth;r=[c-.5*d,c+.5*d]}n[i]={opacity:1,paletteColorLookupTable:o,limitValues:r}}}))}))}));var i=new Set;Object.keys(n).forEach((function(e){var t=n[e];null!=t?(a.volumeViewer.setOpticalPathStyle(e,t),a.volumeViewer.activateOpticalPath(e),a.volumeViewer.showOpticalPath(e),i.add(e)):(a.volumeViewer.hideOpticalPath(e),a.volumeViewer.deactivateOpticalPath(e))}));var o=new URLSearchParams(a.props.location.search);o.set("state",e.SOPInstanceUID),a.props.navigate({pathname:a.props.location.pathname,search:o.toString()},{replace:!0}),a.setState((function(t){return{activeOpticalPathIdentifiers:i,visibleOpticalPathIdentifiers:i,selectedPresentationStateUID:e.SOPInstanceUID}}))},a.getRoiStyle=function(e){return null==e?a.defaultRoiStyle:void 0!==a.roiStyles[e]?a.roiStyles[e]:a.defaultRoiStyle},a.addAnnotations=function(){console.info("search for Comprehensive 3D SR instances");var e=a.props.clients[R.COMPREHENSIVE_3D_SR];e.searchForInstances({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"SR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=j.metadata.formatMetadata(t).dataset;n.SOPClassUID===R.COMPREHENSIVE_3D_SR&&(console.info('retrieve SR instance "'.concat(n.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID,sopInstanceUID:n.SOPInstanceUID}).then((function(e){var t=ve.aT.DicomMessage.readFile(e),n=j.metadata.formatMetadata(t.dict).dataset;(function(e){var t=e.ContentTemplateSequence;return t.length>0&&"1500"===t[0].TemplateIdentifier})(n)?!function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121024",schemeDesignator:"DCM",meaning:"Subject Class"})});if(0===t.length)return!1;var n=t[0].ConceptCodeSequence[0],i=new ve.sr.coding.CodedConcept({value:n.CodeValue,meaning:n.CodeMeaning,schemeDesignator:n.CodingSchemeDesignator}),a=new ve.sr.coding.CodedConcept({value:"121027",meaning:"Specimen",schemeDesignator:"DCM"});return!!i.equals(a)}(n)?console.debug('ignore SR document "'.concat(n.SOPInstanceUID,'" ')+"because it does not describe a specimen subject"):!function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});if(0===t.length)return!1;var n=t[0],i=je({content:n.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=!1;return i.forEach((function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})});t.length>0&&t[0].ValueType===ve.sr.valueTypes.ValueTypes.SCOORD3D&&(a=!0)})),a}(n)?console.debug('ignore SR document "'.concat(n.SOPInstanceUID,'" ')+"because it does not contain any suitable ROI annotations"):new Pe(n).ROIs.forEach((function(e){console.info('add ROI "'.concat(e.uid,'"'));var t=e.scoord3d,i=a.props.slide.volumeImages[0];if(t.frameOfReferenceUID===i.FrameOfReferenceUID){var o=a.volumeViewer.getAllROIs().some((function(t){return function(e,t){if(e.scoord3d.graphicType!==t.scoord3d.graphicType)return!1;if(e.scoord3d.frameOfReferenceUID!==t.scoord3d.frameOfReferenceUID)return!1;if(e.scoord3d.graphicData.length!==t.scoord3d.graphicData.length)return!1;for(var n=0;n0){try{a.volumeViewer.addSegments(t)}catch(n){Q.onError(W,new N(_,"Segmentations cannot be displayed")),console.error("failed to add segments: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Retrieval of metadata of Segmentation instances failed."))}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Search for Segmentation instances failed."))}))},a.addParametricMaps=function(){console.info("search for Parametric Map instances");var e=a.props.clients[R.PARAMETRIC_MAP];e.searchForSeries({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"OT"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=j.metadata.formatMetadata(t).dataset;e.retrieveSeriesMetadata({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID}).then((function(e){var t=[];if(e.forEach((function(e){var n=new j.metadata.ParametricMap({metadata:e}),i=a.props.slide.volumeImages[0];n.FrameOfReferenceUID===i.FrameOfReferenceUID&&n.ContainerIdentifier===i.ContainerIdentifier?t.push(n):console.warn('skip Parametric Map instance "'.concat(n.SOPInstanceUID,'"'))})),t.length>0){try{a.volumeViewer.addParameterMappings(t)}catch(n){Q.onError(W,new N(_,"Parametric Map cannot be displayed")),console.error("failed to add mappings: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Retrieval of metadata of Parametric Map instances failed."))}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Search for Parametric Map instances failed."))}))},a.populateViewports=function(){console.info("populate viewports..."),a.setState({isLoading:!0,presentationStates:[]}),null!=a.volumeViewportRef.current&&a.volumeViewer.render({container:a.volumeViewportRef.current}),null!=a.labelViewportRef.current&&null!=a.labelViewer&&a.labelViewer.render({container:a.labelViewportRef.current}),a.setState({isLoading:!1}),a.setDefaultPresentationState(),a.loadPresentationStates(),a.addAnnotations(),a.addAnnotationGroups(),a.addSegmentations(),a.addParametricMaps()},a.onRoiModified=function(e){a.setState((function(e){return{visibleRoiUIDs:new Set(e.visibleRoiUIDs)}}))},a.onWindowResize=function(e){console.info("resize viewports"),a.volumeViewer.resize(),null!=a.labelViewer&&a.labelViewer.resize()},a.onRoiDrawn=function(e){var t=e.detail.payload,n=a.state.selectedFinding,i=a.state.selectedEvaluations;if(void 0!==t&&void 0!==n){console.debug('add ROI "'.concat(t.uid,'"'));var o=new ve.sr.valueTypes.CodeContentItem({name:new ve.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"}),value:n,relationshipType:"CONTAINS"});t.addEvaluation(o),i.forEach((function(e){var n=new ve.sr.valueTypes.CodeContentItem({name:e.name,value:e.value,relationshipType:"CONTAINS"});t.addEvaluation(n)}));var r=ut(n),s=a.getRoiStyle(r);a.volumeViewer.addROI(t,s),a.setState((function(e){var n=e.visibleRoiUIDs;return n.add(t.uid),{visibleRoiUIDs:n}}))}else console.debug('could not add ROI "'.concat(t.uid,'"'))},a.onRoiDoubleClicked=function(e){null!=e.detail.payload?a.setState({isSelectedRoiModalVisible:!0}):a.setState({isSelectedRoiModalVisible:!1})},a.setHoveredRoiAttributes=function(e){var t=[];e.evaluations.forEach((function(e){var n=e.ConceptNameCodeSequence[0].CodeValue,i=e.ConceptNameCodeSequence[0].CodeMeaning,a="".concat(i);if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var o=e.ConceptCodeSequence[0].CodeMeaning;"276214006"===n?t.push({name:"Property category",value:"".concat(o)}):"121071"===n?t.push({name:"Property type",value:"".concat(o)}):"111001"===n?t.push({name:"Algorithm Name",value:"".concat(o)}):t.push({name:a,value:"".concat(o)})}else if(e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT){var r=e;t.push({name:a,value:r.TextValue})}})),a.setState({hoveredRoiAttributes:t})},a.onPointerMove=function(e){var t=e.detail.payload,n=t.feature,i=t.event;if(null!=n){var o=i.originalEvent;a.setHoveredRoiAttributes(n),a.setState({isHoveredRoiTooltipVisible:!0,hoveredRoi:n,hoveredRoiTooltipX:o.clientX,hoveredRoiTooltipY:o.clientY})}else a.setState({isHoveredRoiTooltipVisible:!1})},a.onRoiSelected=function(e){var t=e.detail.payload;if(null!=t){console.debug('selected ROI "'.concat(t.uid,'"')),a.volumeViewer.setROIStyle(t.uid,a.selectedRoiStyle);var n=ht(t);a.volumeViewer.getAllROIs().forEach((function(e){e.uid!==t.uid&&a.volumeViewer.setROIStyle(e.uid,a.getRoiStyle(n))})),a.setState({selectedRoiUIDs:new Set([t.uid]),selectedRoi:t})}else a.setState({selectedRoiUIDs:new Set,selectedRoi:void 0})},a.onLoadingStarted=function(e){a.setState({isLoading:!0})},a.onLoadingEnded=function(e){a.setState({isLoading:!1})},a.onFrameLoadingStarted=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);a.setState((function(e){return e.loadingFrames.add(n),e}))},a.onFrameLoadingError=function(e){console.error("Failed to load frame")},a.onLoadingError=function(e){var t,n,i,a;console.error("Failed to load data");var o=null===(null===(t=e.detail)||void 0===t||null===(n=t.payload)||void 0===n?void 0:n.message)?"Failed to load data":null===(i=e.detail)||void 0===i||null===(a=i.payload)||void 0===a?void 0:a.message;Q.onError(W,new N(_,o))},a.onFrameLoadingEnded=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);if(a.setState((function(e){e.loadingFrames.delete(n);var t=!1;return e.loadingFrames.size>0&&(t=!0),{isLoading:t,loadingFrames:e.loadingFrames}})),t.sopClassUID===R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE&&a.props.slide.areVolumeImagesMonochrome){var i=t.channelIdentifier;if(!(i in a.state.pixelDataStatistics)&&null!=t.pixelArray){for(var o=Math.pow(2,16),r=Math.ceil(t.pixelArray.length/o),s=0,l=[],c=[],d=0;d=n&&t<=i)return void this.setState({selectedXCoordinate:t,isSelectedXCoordinateValid:!0})}this.setState({selectedXCoordinate:void 0,isSelectedXCoordinateValid:!1})}},{key:"handleYCoordinateSelection",value:function(e){if(null!=e){var t=Number(e),n=this.state.validYCoordinateRange[0],i=this.state.validYCoordinateRange[1];if(t>=n&&t<=i)return void this.setState({selectedYCoordinate:t,isSelectedYCoordinateValid:!0})}this.setState({selectedYCoordinate:void 0,isSelectedYCoordinateValid:!1})}},{key:"handleMagnificationSelection",value:function(e){null!=e&&e>0&&e<=40?this.setState({selectedMagnification:Number(e),isSelectedMagnificationValid:!0}):this.setState({selectedMagnification:void 0,isSelectedMagnificationValid:!1})}},{key:"handleSlidePositionSelection",value:function(){if(this.state.isSelectedXCoordinateValid&&this.state.isSelectedYCoordinateValid&&this.state.isSelectedMagnificationValid&&null!=this.state.selectedXCoordinate&&null!=this.state.selectedYCoordinate&&null!=this.state.selectedMagnification){console.info("select slide position "+"(".concat(this.state.selectedXCoordinate,", ")+"".concat(this.state.selectedYCoordinate,") ")+"at ".concat(this.state.selectedMagnification,"x magnification"));for(var e=.01/this.state.selectedMagnification,t=[],n=0;n1&&Q.onError(W,new N(_,"More than one specimen has been described for the slide"));var a,o=i.SpecimenDescriptionSequence[0];console.debug("create Observation Context"),void 0!==this.props.user?a=new ve.sr.templates.PersonObserverIdentifyingAttributes({name:this.props.user.name,loginName:this.props.user.email}):(console.warn("no user information available"),a=new ve.sr.templates.PersonObserverIdentifyingAttributes({name:"ANONYMOUS"}));var r=new ve.sr.templates.ObservationContext({observerPersonContext:new ve.sr.templates.ObserverContext({observerType:new ve.sr.coding.CodedConcept({value:"121006",schemeDesignator:"DCM",meaning:"Person"}),observerIdentifyingAttributes:a}),observerDeviceContext:new ve.sr.templates.ObserverContext({observerType:new ve.sr.coding.CodedConcept({value:"121007",schemeDesignator:"DCM",meaning:"Device"}),observerIdentifyingAttributes:new ve.sr.templates.DeviceObserverIdentifyingAttributes({uid:this.props.app.uid,manufacturerName:"MGH Computational Pathology",modelName:this.props.app.name})}),subjectContext:new ve.sr.templates.SubjectContext({subjectClass:new ve.sr.coding.CodedConcept({value:"121027",schemeDesignator:"DCM",meaning:"Specimen"}),subjectClassSpecificContext:new ve.sr.templates.SubjectContextSpecimen({uid:o.SpecimenUID,identifier:o.SpecimenIdentifier,containerIdentifier:i.ContainerIdentifier})})});console.debug("encode Imaging Measurements");for(var s=[],l=0;l0?(this.state.selectedRoiUIDs.forEach((function(t){void 0!==t?(console.info('remove ROI "'.concat(t,'"')),e.volumeViewer.removeROI(t),u.ZP.info("Annotation was removed")):u.ZP.warning("No annotation was selected for removal")})),this.setState({selectedRoiUIDs:new Set,isRoiTranslationActive:!1,isRoiDrawingActive:!1,isRoiModificationActive:!1})):(this.state.visibleRoiUIDs.forEach((function(t){console.info('remove ROI "'.concat(t,'"')),e.volumeViewer.removeROI(t)})),this.setState({visibleRoiUIDs:new Set,isRoiTranslationActive:!1,isRoiDrawingActive:!1,isRoiModificationActive:!1})),this.volumeViewer.activateSelectInteraction({})}},{key:"handleRoiVisibilityChange",value:function(){var e=this;console.info("toggle visibility of ROIs"),this.volumeViewer.areROIsVisible?(this.volumeViewer.deactivateDrawInteraction(),this.volumeViewer.deactivateSnapInteraction(),this.volumeViewer.deactivateTranslateInteraction(),this.volumeViewer.deactivateSelectInteraction(),this.volumeViewer.deactivateModifyInteraction(),this.volumeViewer.hideROIs(),this.setState({areRoisHidden:!0,isRoiDrawingActive:!1,isRoiModificationActive:!1,isRoiTranslationActive:!1})):(this.volumeViewer.showROIs(),this.volumeViewer.activateSelectInteraction({}),this.state.selectedRoiUIDs.forEach((function(t){void 0!==t&&e.volumeViewer.setROIStyle(t,e.selectedRoiStyle)})),this.setState({areRoisHidden:!1}))}},{key:"render",value:function(){var e=this,t=[],n=[],i=[],a=[];t.push.apply(t,(0,te.Z)(this.volumeViewer.getAllROIs())),n.push.apply(n,(0,te.Z)(this.volumeViewer.getAllSegments())),i.push.apply(i,(0,te.Z)(this.volumeViewer.getAllParameterMappings()));var o=this.volumeViewer.getAllAnnotationGroups(),r=null===o||void 0===o?void 0:o.filter((function(t){return t.referencedSeriesInstanceUID===e.props.seriesInstanceUID}));a.push.apply(a,(0,te.Z)(r));var s,c,d=t.map((function(e){return function(e){var t=e.uid,n=e.evaluations,i={category:{CodeValue:"undefined",CodeMeaning:"undefined",CodingSchemeDesignator:"undefined"},type:{CodeValue:"undefined",CodeMeaning:"undefined",CodingSchemeDesignator:"undefined"}};return n.forEach((function(e){var t=e.ConceptNameCodeSequence[0].CodeValue;if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var n=e.ConceptCodeSequence[0];"276214006"===t?i.category=(0,O.Z)({},n):"121071"===t&&(i.type=(0,O.Z)({},n))}})),(0,O.Z)((0,O.Z)({},i),{},{uid:t})}(e)})),u=["specimens","optical-paths","annotations","presentation-states"],m=this.state.generatedReport;void 0!==m&&(s=(0,S.jsx)(Ue,{dataset:m})),t.length>0&&(c=(0,S.jsx)(ye,{rois:t,selectedRoiUIDs:this.state.selectedRoiUIDs,visibleRoiUIDs:this.state.visibleRoiUIDs,onSelection:this.handleAnnotationSelection,onVisibilityChange:this.handleAnnotationVisibilityChange}));var g=this.findingOptions.map((function(e){return(0,S.jsx)(ne.Z.Option,{value:e.CodeValue,children:e.CodeMeaning},e.CodeValue)})),y={point:(0,S.jsx)(ne.Z.Option,{value:"point",children:"Point"},"point"),circle:(0,S.jsx)(ne.Z.Option,{value:"circle",children:"Circle"},"circle"),box:(0,S.jsx)(ne.Z.Option,{value:"box",children:"Box"},"box"),polygon:(0,S.jsx)(ne.Z.Option,{value:"polygon",children:"Polygon"},"polygon"),line:(0,S.jsx)(ne.Z.Option,{value:"line",children:"Line"},"line"),freehandpolygon:(0,S.jsx)(ne.Z.Option,{value:"freehandpolygon",children:"Polygon (freehand)"},"freehandpolygon"),freehandline:(0,S.jsx)(ne.Z.Option,{value:"freehandline",children:"Line (freehand)"},"freehandline")},C=[(0,S.jsx)(ne.Z,{style:{minWidth:130},onSelect:this.handleAnnotationFindingSelection,defaultActiveFirstOption:!0,children:g},"annotation-finding")],I=this.state.selectedFinding;if(void 0!==I){var b=ut(I);this.evaluationOptions[b].forEach((function(t){var n=t.values.map((function(e){return(0,S.jsx)(ne.Z.Option,{value:e.CodeValue,label:t.name,children:e.CodeMeaning},e.CodeValue)}));C.push((0,S.jsxs)(S.Fragment,{children:[t.name.CodeMeaning,(0,S.jsx)(ne.Z,{style:{minWidth:130},onSelect:e.handleAnnotationEvaluationSelection,allowClear:!0,onClear:e.handleAnnotationEvaluationClearance,defaultActiveFirstOption:!1,children:n})]}))}));var w=this.geometryTypeOptions[b].map((function(e){return y[e]}));C.push((0,S.jsxs)(S.Fragment,{children:["ROI geometry type",(0,S.jsx)(ne.Z,{style:{minWidth:130},onSelect:this.handleAnnotationGeometryTypeSelection,children:w},"annotation-geometry-type")]})),C.push((0,S.jsx)(ie.Z,{onChange:this.handleAnnotationMeasurementActivation,children:"measure"},"annotation-measurement"))}var x=(0,S.jsx)(v.Z.SubMenu,{title:"Specimens",children:(0,S.jsx)(Ne,{metadata:this.props.slide.volumeImages[0],showstain:!1})},"specimens"),D=(0,S.jsx)(v.Z.SubMenu,{title:"Equipment",children:(0,S.jsx)(Oe,{metadata:this.props.slide.volumeImages[0]})},"equipment"),Z=this.volumeViewer.getAllOpticalPaths();Z.sort((function(e,t){return 1===e.identifier.localeCompare(t.identifier)?1:1===t.identifier.localeCompare(e.identifier)?-1:0}));var V={},R={};Z.forEach((function(t){var n=t.identifier,i=e.volumeViewer.getOpticalPathMetadata(n);R[n]=i;var a=(0,O.Z)({},e.volumeViewer.getOpticalPathStyle(n));V[n]=a}));var j,M,E,P,U,A=(0,S.jsx)(v.Z.SubMenu,{title:"Optical Paths",children:(0,S.jsx)(He,{metadata:R,opticalPaths:Z,defaultOpticalPathStyles:V,visibleOpticalPathIdentifiers:this.state.visibleOpticalPathIdentifiers,activeOpticalPathIdentifiers:this.state.activeOpticalPathIdentifiers,onOpticalPathVisibilityChange:this.handleOpticalPathVisibilityChange,onOpticalPathStyleChange:this.handleOpticalPathStyleChange,onOpticalPathActivityChange:this.handleOpticalPathActivityChange,selectedPresentationStateUID:this.state.selectedPresentationStateUID})},"optical-paths");if(this.state.presentationStates.length>0){var T=[];this.state.presentationStates.forEach((function(e){T.push((0,S.jsx)(ne.Z.Option,{value:e.SOPInstanceUID,dropdownMatchSelectWidth:!1,size:"small",children:e.ContentDescription},e.SOPInstanceUID))})),T.push((0,S.jsx)(ne.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",children:(0,S.jsx)(S.Fragment,{})},"default-presentation-state")),j=(0,S.jsx)(v.Z.SubMenu,{title:"Presentation States",children:(0,S.jsxs)(ae.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,S.jsx)(ne.Z,{style:{minWidth:200,maxWidth:200},onSelect:this.handlePresentationStateSelection,value:this.state.selectedPresentationStateUID,children:T},"presentation-states"),(0,S.jsx)(oe.Z,{title:"Reset",children:(0,S.jsx)(re.Z,{icon:(0,S.jsx)(ue.Z,{}),type:"primary",onClick:this.handlePresentationStateReset})})]})},"presentation-states")}if(n.length>0){var k={},L={},_=this.volumeViewer.getAllSegments();_.forEach((function(t){k[t.uid]=e.volumeViewer.getSegmentStyle(t.uid),L[t.uid]=e.volumeViewer.getSegmentMetadata(t.uid)})),M=(0,S.jsx)(v.Z.SubMenu,{title:"Segmentations",children:(0,S.jsx)(et,{segments:_,metadata:L,defaultSegmentStyles:k,visibleSegmentUIDs:this.state.visibleSegmentUIDs,onSegmentVisibilityChange:this.handleSegmentVisibilityChange,onSegmentStyleChange:this.handleSegmentStyleChange})},"segmentations"),u.push("segmentations")}if(i.length>0){var N={},G={};i.forEach((function(t){N[t.uid]=e.volumeViewer.getParameterMappingStyle(t.uid),G[t.uid]=e.volumeViewer.getParameterMappingMetadata(t.uid)})),E=(0,S.jsx)(v.Z.SubMenu,{title:"Parametric Maps",children:(0,S.jsx)(Qe,{mappings:i,metadata:G,defaultMappingStyles:N,visibleMappingUIDs:this.state.visibleMappingUIDs,onMappingVisibilityChange:this.handleMappingVisibilityChange,onMappingStyleChange:this.handleMappingStyleChange})},"parmetric-maps"),u.push("parametric-maps")}if(d.length>0&&d.forEach((function(t){var n,i=e.volumeViewer.getROI(t.uid),a=ht(i),o=void 0!==e.roiStyles[a]?null===(n=e.roiStyles[a].stroke)||void 0===n?void 0:n.color.slice(0,3):dt[Object.keys(e.roiStyles).length%dt.length];e.defaultAnnotationStyles[t.uid]={color:o,opacity:.4},e.roiStyles[a]=e.generateRoiStyle(e.defaultAnnotationStyles[t.uid])})),a.length>0){var q={},F={};a.forEach((function(t){F[t.uid]=e.volumeViewer.getAnnotationGroupStyle(t.uid),q[t.uid]=e.volumeViewer.getAnnotationGroupMetadata(t.uid)})),P=(0,S.jsx)(v.Z.SubMenu,{title:"Annotation Groups",children:(0,S.jsx)(Ve,{annotationGroups:a,metadata:q,defaultAnnotationGroupStyles:F,visibleAnnotationGroupUIDs:this.state.visibleAnnotationGroupUIDs,onAnnotationGroupVisibilityChange:this.handleAnnotationGroupVisibilityChange,onAnnotationGroupStyleChange:this.handleAnnotationGroupStyleChange})},"annotation-groups"),u.push("annotationGroups")}var z="0px",B=[(0,S.jsx)(Re,{tooltip:"Draw ROI [Alt+D]",icon:p.vuA,onClick:this.handleRoiDrawing,isSelected:this.state.isRoiDrawingActive},"draw-roi-button"),(0,S.jsx)(Re,{tooltip:"Modify ROIs [Alt+M]",icon:p.eAi,onClick:this.handleRoiModification,isSelected:this.state.isRoiModificationActive},"modify-roi-button"),(0,S.jsx)(Re,{tooltip:"Translate ROIs [Alt+T]",icon:p.Jd7,onClick:this.handleRoiTranslation,isSelected:this.state.isRoiTranslationActive},"translate-roi-button"),(0,S.jsx)(Re,{tooltip:"Remove selected ROI [Alt+R]",onClick:this.handleRoiRemoval,icon:p.Xm5},"remove-roi-button"),(0,S.jsx)(Re,{tooltip:"Show/Hide ROIs [Alt+V]",icon:this.state.areRoisHidden?p.dSq:p.tgn,onClick:this.handleRoiVisibilityChange,isSelected:this.state.areRoisHidden},"toggle-roi-visibility-button"),(0,S.jsx)(Re,{tooltip:"Save ROIs [Alt+S]",icon:p.TvB,onClick:this.handleReportGeneration},"generate-report-button")],W=[(0,S.jsx)(Re,{tooltip:"Go to [Alt+G]",icon:p.Xe,onClick:this.handleGoTo},"go-to-slide-position-button")];this.props.enableAnnotationTools&&(U=(0,S.jsxs)(se.Z,{justify:"start",children:[B.map((function(e,t){return(0,S.jsx)(l.Fragment,{children:e},t)})),W.map((function(e,t){return(0,S.jsx)(l.Fragment,{children:e},t)}))]}),z="50px");var Y,H="default";if(this.state.isLoading&&(H="progress"),null!=this.state.selectedRoi){var X=[{name:"UID",value:this.state.selectedRoi.uid}],K=[{name:"Graphic type",value:this.state.selectedRoi.scoord3d.graphicType}],Q=[];this.state.selectedRoi.evaluations.forEach((function(e){if("CODE"===e.ValueType){var t=e;Q.push({name:t.ConceptNameCodeSequence[0].CodeMeaning,value:t.ConceptCodeSequence[0].CodeMeaning})}else{var n=e;Q.push({name:n.ConceptNameCodeSequence[0].CodeMeaning,value:n.TextValue})}}));var J={};this.state.selectedRoi.measurements.forEach((function(e){var t="default";if(null!=e.ContentSequence){var n=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121112",meaning:"Source of Measurement",schemeDesignator:"DCM"})});n.length>0&&(t=n[0].ReferencedSOPSequence[0].ReferencedOpticalPathIdentifier)}t in J||(J[t]=[]);var i=e.MeasuredValueSequence[0];J[t].push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:i.NumericValue.toString(),unit:i.MeasurementUnitsCodeSequence[0].CodeMeaning})}));var $=function(e){return e.map((function(e){var t;return t=null!=e.unit?"".concat(e.value," [").concat(e.unit,"]"):e.value,(0,S.jsx)(f.Z.Item,{label:e.name,children:t},e.name)}))},ee=$(X),me=$(K),fe=$(Q),ge=[];for(var Se in J){var Ce=$(J[Se]);"default"===Se?ge.push(Ce):ge.push((0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(le.Z,{orientation:"left",orientationMargin:0,dashed:!0,plain:!0,children:Se}),Ce]}))}Y=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(f.Z,{layout:"horizontal",column:1,children:ee}),(0,S.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Spatial coordinates"}),(0,S.jsx)(f.Z,{layout:"horizontal",column:1,children:me}),(0,S.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Evaluations"}),(0,S.jsx)(f.Z,{layout:"horizontal",column:1,children:fe}),(0,S.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Measurements"}),(0,S.jsx)(f.Z,{layout:"horizontal",column:1,children:ge})]})}return(0,S.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,S.jsxs)(h.Z.Content,{style:{height:"100%"},children:[U,(0,S.jsx)("div",{style:{height:"calc(100% - ".concat(z,")"),overflow:"hidden",cursor:H},ref:this.volumeViewportRef}),(0,S.jsx)(ce.Z,{open:this.state.isAnnotationModalVisible,title:"Configure annotations",onOk:this.handleAnnotationConfigurationCompletion,onCancel:this.handleAnnotationConfigurationCancellation,okText:"Select",children:(0,S.jsx)(ae.Z,{align:"start",direction:"vertical",children:C})}),(0,S.jsx)(ce.Z,{open:this.state.isSelectedRoiModalVisible,title:"Selected ROI",onCancel:this.handleRoiSelectionCancellation,maskClosable:!0,footer:null,children:(0,S.jsx)(ae.Z,{align:"start",direction:"vertical",children:Y})}),(0,S.jsx)(ce.Z,{open:this.state.isGoToModalVisible,title:"Go to slide position",onOk:this.handleSlidePositionSelection,onCancel:this.handleSlidePositionSelectionCancellation,okText:"Select",children:(0,S.jsxs)(ae.Z,{align:"start",direction:"vertical",children:[(0,S.jsx)(de.Z,{placeholder:"["+"".concat(this.state.validXCoordinateRange[0])+", "+"".concat(this.state.validXCoordinateRange[1])+"]",prefix:"X Coordinate [mm]",onChange:this.handleXCoordinateSelection,onPressEnter:this.handleXCoordinateSelection,controls:!1,addonAfter:this.state.isSelectedXCoordinateValid?(0,S.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,S.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,S.jsx)(de.Z,{placeholder:"["+"".concat(this.state.validYCoordinateRange[0])+", "+"".concat(this.state.validYCoordinateRange[1])+"]",prefix:"Y Coordinate [mm]",onChange:this.handleYCoordinateSelection,onPressEnter:this.handleYCoordinateSelection,controls:!1,addonAfter:this.state.isSelectedYCoordinateValid?(0,S.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,S.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,S.jsx)(de.Z,{placeholder:"[0 - 40]",prefix:"Magnification",onChange:this.handleMagnificationSelection,onPressEnter:this.handleMagnificationSelection,controls:!1,addonAfter:this.state.isSelectedMagnificationValid?(0,S.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,S.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})})]})}),(0,S.jsx)(ce.Z,{open:this.state.isReportModalVisible,title:"Verify and save report",onOk:this.handleReportVerification,onCancel:this.handleReportCancellation,okText:"Save",children:s})]}),(0,S.jsx)(h.Z.Sider,{width:300,reverseArrow:!0,style:{borderLeft:"solid",borderLeftWidth:.25,overflow:"hidden",background:"none"},children:(0,S.jsxs)(v.Z,{mode:"inline",defaultOpenKeys:u,style:{height:"100%"},inlineIndent:14,forceSubMenuRender:!0,onOpenChange:function(){setTimeout((function(){null!=e.labelViewer&&e.labelViewer.resize()}),100)},children:[null!=this.labelViewportRef.current&&(0,S.jsx)(v.Z.SubMenu,{title:"Slide label",children:(0,S.jsx)(v.Z.Item,{style:{height:"100%"},children:(0,S.jsx)("div",{style:{height:"220px"},ref:this.labelViewportRef})},"image")},"label"),x,D,A,j,(0,S.jsx)(v.Z.SubMenu,{title:"Annotations",children:c},"annotations"),P,0===d.length?(0,S.jsx)(S.Fragment,{}):(0,S.jsx)(v.Z.SubMenu,{title:"Annotation Categories",children:(0,S.jsx)(ot,{annotations:d,onChange:this.handleAnnotationVisibilityChange,checkedAnnotationUids:this.state.visibleRoiUIDs,onStyleChange:this.handleRoiStyleChange,defaultAnnotationStyles:this.defaultAnnotationStyles})},"annotation-category"),M,E]})}),this.state.isHoveredRoiTooltipVisible&&this.state.hoveredRoiAttributes.length>0?(0,S.jsx)(rt,{xPosition:this.state.hoveredRoiTooltipX,yPosition:this.state.hoveredRoiTooltipY,attributes:this.state.hoveredRoiAttributes}):(0,S.jsx)(S.Fragment,{})]})}}]),n}(l.Component);const ft=tt(mt);var gt,St=n(4165),yt=n(5861);!function(e){e.VOLUME="VOLUME",e.LABEL="LABEL",e.OVERVIEW="OVERVIEW",e.THUMBNAIL="THUMBNAIL"}(gt||(gt={}));var Ct=function(e,t){return e.ImageType[2]===t},It=function(e,t){return null!=e.AcquisitionUID&&e.AcquisitionUID===t.AcquisitionUID},bt=(0,a.Z)((function e(t){var n=this;(0,i.Z)(this,e),this.description=void 0,this.acquisitionUID=void 0,this.frameOfReferenceUID=void 0,this.containerIdentifier=void 0,this.seriesInstanceUIDs=void 0,this.opticalPathIdentifiers=void 0,this.pyramidUIDs=[],this.areVolumeImagesMonochrome=void 0,this.volumeImages=void 0,this.labelImages=void 0,this.overviewImages=void 0,0===t.images.length&&Q.onError(W,new N(L,'Value of option "images" have been non-zero length.'));var a=new Set([]),o=new Set([]),r=new Set([]),s=new Set([]),l={VOLUME:new Set([]),LABEL:new Set([]),OVERVIEW:new Set([])},c={VOLUME:{}},d=[],u=[],h=[];if(t.images.forEach((function(e){if(s.add(e.ContainerIdentifier),a.add(e.SeriesInstanceUID),e.OpticalPathSequence.forEach((function(e){r.add(e.OpticalPathIdentifier)})),null!=e.AcquisitionUID&&o.add(e.AcquisitionUID),Ct(e,gt.VOLUME)||Ct(e,gt.THUMBNAIL)){if(l.VOLUME.add(e.FrameOfReferenceUID),null!=e.PyramidUID)for(var t in r)c.VOLUME[t].add(e.PyramidUID);d.push(e)}else Ct(e,gt.LABEL)?(l.LABEL.add(e.FrameOfReferenceUID),u.push(e)):Ct(e,gt.OVERVIEW)&&(l.OVERVIEW.add(e.FrameOfReferenceUID),h.push(e))})),0===d.length)Q.onError(W,new N(L,"At least one VOLUME image must be provided for a slide."));else{o.size>1&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same number of Samples per Pixel."));var p=new Set([]);d.forEach((function(e){p.add(e.SamplesPerPixel)})),p.size>1&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same number of Samples per Pixel.")),d.filter((function(e){return"RESAMPLED"!==e.ImageType[3]})).length>r.size&&console.warn("the set of VOLUME images of a slide must contain only a single image that has not been resampled per optical path")}this.volumeImages=d,this.labelImages=u,this.overviewImages=h,this.seriesInstanceUIDs=(0,te.Z)(a),this.opticalPathIdentifiers=(0,te.Z)(r),1!==s.size&&Q.onError(W,new N(L,"All images of a slide must have the same Container Identifier.")),this.containerIdentifier=(0,te.Z)(s)[0],1!==l.VOLUME.size&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same Frame of Reference UID.")),this.frameOfReferenceUID=(0,te.Z)(l.VOLUME)[0];var v=!1;Object.keys(c.VOLUME).length>0&&(v=!0),this.opticalPathIdentifiers.forEach((function(e){null!=c.VOLUME[e]?c.VOLUME[e].size>1?Q.onError(W,new N(L,'All VOLUME images for optical path "'.concat(e,'"')+"must be part of the same multi-resolution pyramid.")):1===c.VOLUME[e].size?n.pyramidUIDs.push((0,te.Z)(c.VOLUME[e])[0]):Q.onError(W,new N(L,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it.")):v&&Q.onError(W,new N(L,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it."))})),o.size>1?Q.onError(W,new N(L,"All VOLUME images of a slide must be part of the same acquisition and have the same Acquisition UID.")):1===o.size?this.acquisitionUID=(0,te.Z)(o)[0]:this.acquisitionUID=null,this.areVolumeImagesMonochrome=1===this.volumeImages[0].SamplesPerPixel&&"MONOCHROME2"===this.volumeImages[0].PhotometricInterpretation,this.description=void 0!==t.description?t.description:""})),wt=function(e){var t=[];e.forEach((function(e){if(e.length>0){var n=e.filter((function(e){return Ct(e,gt.VOLUME)||Ct(e,gt.THUMBNAIL)}));if(n.length>0){var i,a=n[0],o=n.filter((function(e){return a.SamplesPerPixel===e.SamplesPerPixel})),r=t.findIndex((function(e){return function(e,t){if(e.frameOfReferenceUID===t.FrameOfReferenceUID&&e.containerIdentifier===t.ContainerIdentifier&&e.acquisitionUID===t.AcquisitionUID)return!0;return!1}(e,a)})),s=e.filter((function(e){return Ct(e,gt.LABEL)}));i=s.length>1?s.filter((function(e){return It(e,a)})):s;var l,c=e.filter((function(e){return Ct(e,gt.OVERVIEW)}));if(l=c.length>1?c.filter((function(e){return It(e,a)})):c,-1===r){var d={acquisitionUID:a.AcquisitionUID,frameOfReferenceUID:a.FrameOfReferenceUID,containerIdentifier:a.ContainerIdentifier,volumeImages:o,labelImages:i,overviewImages:l};t.push(d)}else{var u,h,p,v=t[r];(u=v.volumeImages).push.apply(u,(0,te.Z)(o)),(h=v.labelImages).push.apply(h,(0,te.Z)(i)),(p=v.overviewImages).push.apply(p,(0,te.Z)(l))}}}}));var n=t.map((function(e){return new bt({images:[].concat((0,te.Z)(e.volumeImages),(0,te.Z)(e.labelImages),(0,te.Z)(e.overviewImages))})}));return n=n.sort((function(e,t){var n=e.volumeImages[0],i=t.volumeImages[0];return null!=n.ContainerIdentifier&&null!=i.ContainerIdentifier?Number(n.ContainerIdentifier)-Number(i.ContainerIdentifier):0}))};var xt=function(){var e=(0,yt.Z)((0,St.Z)().mark((function e(t){var n,i,a,o,r,s,l,c,d;return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clients,i=t.studyInstanceUID,a=t.onSuccess,o=t.onError,e.prev=1,r=[],console.info('search for series of study "'.concat(i,'"...')),s=n[R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],e.next=7,s.searchForSeries({queryParams:{Modality:"SM",StudyInstanceUID:i}});case 7:return l=e.sent,e.next=10,Promise.all(l.map(function(){var e=(0,yt.Z)((0,St.Z)().mark((function e(t){var n,a,o,l,c;return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=j.metadata.formatMetadata(t),a=n.dataset,o=a,console.info('retrieve metadata of series "'.concat(o.SeriesInstanceUID,'"')),e.next=5,s.retrieveSeriesMetadata({studyInstanceUID:i,seriesInstanceUID:o.SeriesInstanceUID});case 5:l=e.sent,c=[],l.forEach((function(e){var t,n;if((null===(t=e["00080016"])||void 0===t||null===(n=t.Value)||void 0===n?void 0:n[0])===R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE){var i=new j.metadata.VLWholeSlideMicroscopyImage({metadata:e});c.push(i)}})),c.length>0&&r.push(c);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:c=wt(r),a(c),e.next=20;break;case 14:e.prev=14,e.t0=e.catch(1),console.error(e.t0),d=new N(L,"Image metadata could not be retrieved or decoded."),o(d),Q.onError(W,d);case 20:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),Dt=new Map,Zt=new Map,Vt=function(e){var t=e.clients,n=e.studyInstanceUID,i=(0,l.useState)([]),a=(0,ee.Z)(i,2),o=a[0],r=a[1],s=(0,l.useState)(!1),c=(0,ee.Z)(s,2),d=c[0],u=c[1],h=(0,l.useState)(null),p=(0,ee.Z)(h,2),v=p[0],m=p[1];return(0,l.useEffect)((function(){if(void 0===n)return r([]),void u(!1);var e=Dt.get(n);if(void 0!==e)return r(e),void u(!1);u(!0);var i=function(){var e=(0,yt.Z)((0,St.Z)().mark((function e(){var i,a;return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===(i=Zt.get(n))&&(i=new Promise((function(e,i){xt({clients:t,studyInstanceUID:n,onSuccess:function(t){Dt.set(n,t),e(t)},onError:function(e){i(e)}}).catch((function(e){i(e)}))})),Zt.set(n,i)),e.prev=2,e.next=5,i;case 5:a=e.sent,r(a),m(null),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),m(e.t0),r([]);case 14:return e.prev=14,Zt.delete(n),u(!1),e.finish(14);case 18:case"end":return e.stop()}}),e,null,[[2,10,14,18]])})));return function(){return e.apply(this,arguments)}}();i()}),[t,n]),{slides:o,isLoading:d,error:v}};function Rt(e){var t,n=e.clients,i=e.slides,a=e.user,o=e.app,r=e.preload,s=e.enableAnnotationTools,l=e.annotations,d=(0,c.UO)(),u=d.studyInstanceUID,h=d.seriesInstanceUID,p=(0,c.TH)(),v=i.find((function(e){return e.seriesInstanceUIDs.find((function(e){return e===h}))})),m=new URLSearchParams(p.search);m.has("access_token")||null===(t=m.get("state"))&&(t=void 0);var f=null;return null!=v&&(f=(0,S.jsx)(ft,{clients:n,studyInstanceUID:u,seriesInstanceUID:h,selectedPresentationStateUID:t,slide:v,preload:r,annotations:l,enableAnnotationTools:s,app:o,user:a})),f}const Ot=tt((function(e){var t=e.clients,n=e.studyInstanceUID,i=e.location,a=e.navigate,o=Vt({clients:t,studyInstanceUID:n}),r=o.slides;if(o.isLoading)return null;if(0===r.length)return null;var s=r[0].volumeImages;if(0===s.length)return null;var l,d,u=s[0];if(i.pathname.includes("series/")){var p=i.pathname.split("series/")[1];l=p.includes("/")?p.split("/")[0]:p}else l=s[0].SeriesInstanceUID;return null!=u.ClinicalTrialSponsorName&&(d=(0,S.jsx)(v.Z.SubMenu,{title:"Clinical Trial",children:(0,S.jsx)(I,{metadata:u})},"clinical-trial")),(0,S.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,S.jsx)(h.Z.Sider,{width:300,style:{height:"100%",borderRight:"solid",borderRightWidth:.25,overflow:"hidden",background:"none"},children:(0,S.jsxs)(v.Z,{mode:"inline",defaultOpenKeys:["patient","study","clinical-trial","slides"],style:{height:"100%"},inlineIndent:14,children:[(0,S.jsx)(v.Z.SubMenu,{title:"Patient",children:(0,S.jsx)(Z,{metadata:u})},"patient"),(0,S.jsx)(v.Z.SubMenu,{title:"Study",children:(0,S.jsx)(V,{metadata:u})},"study"),d,(0,S.jsx)(v.Z.SubMenu,{title:"Slides",children:(0,S.jsx)($,{clients:e.clients,metadata:r,selectedSeriesInstanceUID:l,onSeriesSelection:function(e){var t=e.seriesInstanceUID;console.info('switch to series "'.concat(t,'"'));var o="/studies/".concat(n)+"/series/".concat(t);i.pathname.includes("/projects/")&&(o=i.pathname,i.pathname.includes("/series/")?o=o.replace(/\/series\/[^/]+/,"/series/".concat(t)):o+="/series/".concat(t)),i.pathname.includes("/series/")&&null!=i.search&&(o+=i.search),a(o,{replace:!0})}})},"slides")]})}),(0,S.jsx)(c.Z5,{children:(0,S.jsx)(c.AW,{path:"/series/:seriesInstanceUID",element:(0,S.jsx)(Rt,{clients:e.clients,slides:r,preload:e.preload,annotations:e.annotations,enableAnnotationTools:e.enableAnnotationTools,app:e.app,user:e.user})})})]})}));var jt=n(63),Mt=n(7382),Et=n(6005),Pt=n(9529),Ut=n(127),At=n(4541),Tt=n(8527),kt=n(161),Lt=n(9761),_t=n(5485),Nt=n(7706),Gt=n(1730),qt=ve.ZP.data.DicomMetaDictionary,Ft=function(e){return"object"===typeof e&&null!==e?JSON.stringify(e):String(e)};function zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(void 0===e||null===e)return[];var n=Object.keys(e).filter((function(e){return"_vrMap"!==e}));return n.flatMap((function(n){var i,a,o=qt.nameMap[n],r=e[n];if(void 0===o){var s,l;return null==n.match(/[0-9A-Fa-f]{6}/g)?[]:[{tag:"(".concat(n.substring(0,4),",").concat(n.substring(4,8),")"),vr:"",keyword:"Private Tag",value:null!==(s=null===(l=r)||void 0===l?void 0:l.toString())&&void 0!==s?s:"",level:t}]}if("SQ"===o.vr&&void 0!==r){var c=Array.isArray(r)?r:[r],d={tag:o.tag,vr:o.vr,keyword:n,value:"Sequence with ".concat(c.length," item(s)"),level:t,children:[]};return d.children=c.map((function(e,n){return{tag:"".concat(o.tag,".").concat(n+1),vr:"Item",keyword:"Item ".concat(n+1),value:"Sequence Item ".concat(n+1),level:t+1,children:zt(e,t+2)}})),[d]}return Array.isArray(r)?r=r.map(Ft).join("\\"):"object"===typeof r&&null!==r&&(r=Ft(r)),[{tag:o.tag,vr:o.vr,keyword:n.replace("RETIRED_",""),value:null!==(i=null===(a=r)||void 0===a?void 0:a.toString())&&void 0!==i?i:"",level:t}]}))}function Bt(e){return zt(e).sort((function(e,t){return e.tag.localeCompare(t.tag)}))}var Wt=n(7762);const Yt={subscribe:Ht,_broadcastEvent:Qt,_unsubscribe:Xt,_isValidEvent:Kt};function Ht(e,t){var n=this;if(this._isValidEvent(e)){var i=(0,m.Z)(),a={id:i,callback:t};return Array.isArray(this.listeners[e])?this.listeners[e].push(a):this.listeners[e]=[a],{unsubscribe:function(){return n._unsubscribe(e,i)}}}throw new Error("Event ".concat(e," not supported."))}function Xt(e,t){if(void 0!==this.listeners[e]){var n=this.listeners[e];Array.isArray(n)?this.listeners[e]=n.filter((function(e){return e.id!==t})):this.listeners[e]=[]}}function Kt(e){return Object.values(this.EVENTS).includes(e)}function Qt(e,t){var n=Object.keys(this.listeners).length>0,i=Array.isArray(this.listeners[e]);n&&i&&this.listeners[e].forEach((function(e){e.callback(t)}))}const Jt=function(e,t){var n=[],i=new Map;return(0,O.Z)((0,O.Z)({SeriesInstanceUID:e,Modality:"",SeriesNumber:0,SeriesDescription:"",SeriesDate:"",SeriesTime:""},null===t||void 0===t?void 0:t[0]),{},{instances:n,addInstance:function(e){this.addInstances([e])},addInstances:function(e){for(var t=0,a=e.length;t1&&void 0!==arguments[1]&&arguments[1],n=e[0],i=n.StudyInstanceUID,a=n.SeriesInstanceUID,o=tn.studies.find((function(e){return e.StudyInstanceUID===i}));null==o&&(tn.studies.push($t(i)),o=tn.studies[tn.studies.length-1]),o.addInstancesToSeries(e),this._broadcastEvent(en.INSTANCES_ADDED,{StudyInstanceUID:i,SeriesInstanceUID:a,madeInClient:t})},updateSeriesMetadata:function(e){var t=e.StudyInstanceUID,n=e.SeriesInstanceUID;if(null!=an(t,n)){var i=nn(t);null!=i&&i.setSeriesMetadata(n,e)}},addSeriesMetadata:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0!==e&&0!==e.length&&void 0!==e[0]){var n=e[0].StudyInstanceUID,i=nn(n);null==i&&((i=$t(n)).StudyDescription=e[0].StudyDescription,null===e||void 0===e||e.forEach((function(e){var t,n;void 0===i||null!==(t=i.ModalitiesInStudy)&&void 0!==t&&t.includes(e.Modality)||(null===(n=i.ModalitiesInStudy)||void 0===n||n.push(e.Modality))})),i.NumberOfStudyRelatedSeries=e.length,tn.studies.push(i)),e.forEach((function(e){var t,n=e.SeriesInstanceUID;null===(t=i)||void 0===t||t.setSeriesMetadata(n,e)})),this._broadcastEvent(en.SERIES_ADDED,{StudyInstanceUID:n,seriesSummaryMetadata:e,madeInClient:t})}},addStudy:function(e){var t=e.StudyInstanceUID,n=tn.studies.find((function(e){return e.StudyInstanceUID===t}));if(null==n){var i=$t(t);i.PatientID=e.PatientID,i.PatientName=e.PatientName,i.StudyDate=e.StudyDate,i.ModalitiesInStudy=e.ModalitiesInStudy,i.StudyDescription=e.StudyDescription,i.AccessionNumber=e.AccessionNumber,i.NumInstances=e.NumInstances,tn.studies.push(i)}},getStudyInstanceUIDs:function(){return tn.studies.map((function(e){return e.StudyInstanceUID}))},getStudy:nn,getSeries:an,getInstance:function(e,t,n){var i=an(e,t);if(null!=i)return i.getInstance(n)},getInstanceByImageId:function(e){var t,n=(0,Wt.Z)(tn.studies);try{for(n.s();!(t=n.n()).done;){var i,a=t.value,o=(0,Wt.Z)(a.series);try{for(o.s();!(i=o.n()).done;){var r,s=i.value,l=(0,Wt.Z)(s.instances);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.imageId===e)return c}}catch(d){l.e(d)}finally{l.f()}}}catch(d){o.e(d)}finally{o.f()}}}catch(d){n.e(d)}finally{n.f()}},updateMetadataForSeries:function(e,t,n){var i=nn(e);if(null!=i){var a=i.series.find((function(e){return e.SeriesInstanceUID===t}));if(null!=a)a.instances.forEach((function(e){Object.keys(n).forEach((function(t){"object"===typeof n[t]?e[t]=(0,O.Z)((0,O.Z)({},e[t]),n[t]):e[t]=n[t]}))}))}},_broadcastEvent:function(e,t){}};const rn=Object.assign({},on,Yt);var sn=ne.Z.Option;const ln=function(e){var t,n,i=e.clients,a=e.studyInstanceUID,o=Vt({clients:i,studyInstanceUID:a}),r=o.slides,s=o.isLoading,c=(0,l.useState)(void 0),d=(0,ee.Z)(c,2),u=d[0],h=d[1],p=(0,l.useState)([]),v=(0,ee.Z)(p,2),m=v[0],f=v[1],g=(0,l.useState)(0),y=(0,ee.Z)(g,2),C=y[0],I=y[1],b=(0,l.useState)(1),w=(0,ee.Z)(b,2),x=w[0],D=w[1],Z=(0,l.useState)(""),V=(0,ee.Z)(Z,2),R=V[0],j=V[1],M=(0,l.useState)([]),E=(0,ee.Z)(M,2),P=E[0],U=E[1],A=(0,l.useState)(""),T=(0,ee.Z)(A,2),k=T[0],L=T[1],_=function(e,t){var n=(0,l.useState)(e),i=(0,ee.Z)(n,2),a=i[0],o=i[1];return(0,l.useEffect)((function(){var n=setTimeout((function(){o(e)}),t);return function(){clearTimeout(n)}}),[e,t]),a}(k,300);(0,l.useEffect)((function(){""===_?(j(""),U([])):j(_)}),[_]),(0,l.useEffect)((function(){var e=function(e){var t=Object.assign({},rn.getStudy(a));h(t)},t=rn.subscribe(rn.EVENTS.SERIES_ADDED,e),n=rn.subscribe(rn.EVENTS.INSTANCES_ADDED,e),i=Object.assign({},rn.getStudy(a));return h(i),function(){t.unsubscribe(),n.unsubscribe()}}),[a]),(0,l.useEffect)((function(){var e,t=[],n=[],i=[],a=0;r.length>0&&(t=r.map((function(e){var t=e.volumeImages;if(void 0===(null===t||void 0===t?void 0:t[0]))return null;var n=t[0],o=n.SeriesDate,r=n.SeriesTime,s=n.SeriesNumber,l=n.SeriesInstanceUID,c=n.SeriesDescription,d=n.Modality;i.push(l);var u={displaySetInstanceUID:a,SeriesDate:o,SeriesTime:r,SeriesInstanceUID:l,SeriesNumber:s,SeriesDescription:c,Modality:d,images:t};return a++,u})).filter((function(e){return null!==e}))),void 0!==u&&(null===(e=u.series)||void 0===e?void 0:e.length)>0&&(n=u.series.filter((function(e){return!i.includes(e.SeriesInstanceUID)})).map((function(e){var t,n={displaySetInstanceUID:a,SeriesDate:e.SeriesDate,SeriesTime:e.SeriesTime,SeriesNumber:e.SeriesNumber,SeriesDescription:e.SeriesDescription,SeriesInstanceUID:e.SeriesInstanceUID,Modality:e.Modality,images:(null===e||void 0===e||null===(t=e.instances)||void 0===t?void 0:t.length)>0?e.instances:[e]};return a++,n}))),f([].concat((0,te.Z)(t),(0,te.Z)(n)))}),[r,u]);var N=(0,l.useMemo)((function(){return m.sort((function(e,t){return Number(e.SeriesNumber)-Number(t.SeriesNumber)})),m.map((function(e,t){var n=e.SeriesDate,i=void 0===n?"":n,a=e.SeriesTime,o=void 0===a?"":a,r=e.SeriesNumber,s=void 0===r?"":r,l=e.SeriesDescription,c=void 0===l?"":l,d=e.Modality,u=void 0===d?"":d,h=function(e){var t=e.match(/^(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})(\d{2})/);if(null==t)return e;var n=(0,ee.Z)(t,7),i=n[1],a=n[2],o=n[3],r=n[4],s=n[5],l=n[6],c=parseInt(a),d=parseInt(o);if(c<1||c>12||d<1||d>31)return e;var u=new Date(parseInt(i),c-1,d,parseInt(r),parseInt(s),parseInt(l));if(u.getMonth()!==c-1||u.getDate()!==d)return e;var h=u.toLocaleDateString("en-US",{weekday:"short"}),p=u.toLocaleDateString("en-US",{month:"short"}),v=u.getDate(),m=u.getFullYear();return"".concat(h,", ").concat(p," ").concat(v," ").concat(m)}("".concat(i,":").concat(o).split(".")[0]);return{value:t,label:"".concat(s," (").concat(u,"): ").concat(c),description:h}}))}),[m]),G=(null===(t=m[C])||void 0===t?void 0:t.images.length)>1;console.debug("displaySets:",m);var q=(0,l.useMemo)((function(){var e;if(void 0===m[C])return{};var t=m[C].images.length;return e={1:"1"},(0,nt.Z)(e,Math.ceil(t/2),String(Math.ceil(t/2))),(0,nt.Z)(e,t,String(t)),e}),[C,m]),F=(0,l.useMemo)((function(){var e;return void 0===m[C]?[]:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.map((function(t,i){var a=""!==t.tag?t.tag.replace(/[(),]/g,""):i.toString(),o=""!==n?"".concat(n,"-").concat(a):a,r={key:o,tag:t.tag,vr:t.vr,keyword:t.keyword,value:t.value};return void 0!==t.children&&t.children.length>0&&(r.children=e(t.children,o)),r}))}(Bt(null===(e=m[C])||void 0===e?void 0:e.images[x-1]))}),[x,C,m]),z=(0,l.useMemo)((function(){if(void 0===R||""===R)return F;var e=R.toLowerCase(),t=new Set,n=function(t){var n,i,a,o,r,s,l,c;return(null!==(n=null===(i=t.tag)||void 0===i?void 0:i.toLowerCase())&&void 0!==n?n:"").includes(e)||(null!==(a=null===(o=t.vr)||void 0===o?void 0:o.toLowerCase())&&void 0!==a?a:"").includes(e)||(null!==(r=null===(s=t.keyword)||void 0===s?void 0:s.toLowerCase())&&void 0!==r?r:"").includes(e)||(null!==(l=null===(c=t.value)||void 0===c?void 0:c.toString().toLowerCase())&&void 0!==l?l:"").includes(e)},i=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[].concat((0,te.Z)(i),[t]),o=[];return n(t)&&o.push(a),null!=t.children&&t.children.forEach((function(t){var n=e(t,a);o=[].concat((0,te.Z)(o),(0,te.Z)(n))})),o},a=function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0===n.length||i>=n[0].length)return[];var a=new Map;return n.forEach((function(e){if(i0?(0,O.Z)((0,O.Z)({},a),{},{children:r}):a}))}(F.flatMap((function(e){return i(e)})));return U(Array.from(t)),a}),[F,R]);return s?(0,S.jsx)("div",{children:"Loading..."}):(0,S.jsx)("div",{className:"dicom-tag-browser",children:(0,S.jsxs)("div",{style:{width:"100%",padding:"16px 20px 20px"},children:[(0,S.jsxs)("div",{style:{display:"flex",gap:"24px",marginBottom:"32px"},children:[(0,S.jsxs)("div",{style:{flex:1},children:[(0,S.jsx)(_t.Z.Text,{strong:!0,style:{display:"block",marginBottom:"8px"},children:"Slides"}),(0,S.jsx)(ne.Z,{style:{width:"100%"},value:C,onChange:function(e){I(e),D(1)},optionLabelProp:"label",optionFilterProp:"label",children:N.map((function(e){return(0,S.jsx)(sn,{value:e.value,label:e.label,children:(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:e.label}),(0,S.jsx)("div",{style:{fontSize:"12px",color:"rgba(0, 0, 0, 0.45)"},children:e.description})]})},e.value)}))})]}),G&&(0,S.jsxs)("div",{style:{flex:1},children:[(0,S.jsxs)(_t.Z.Text,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Instance Number: ",x]}),(0,S.jsx)(Ie.Z,{min:1,max:null===(n=m[C])||void 0===n?void 0:n.images.length,value:x,onChange:function(e){return D(e)},marks:q,tooltip:{formatter:function(e){return void 0!==e?"Instance ".concat(e):""}}})]})]}),(0,S.jsx)(Et.Z,{style:{marginBottom:"20px"},placeholder:"Search DICOM tags...",prefix:(0,S.jsx)(Gt.Z,{}),onChange:function(e){return L(e.target.value)},value:k}),(0,S.jsx)(Nt.Z,{columns:[{title:"Tag",dataIndex:"tag",key:"tag",width:"30%"},{title:"VR",dataIndex:"vr",key:"vr",width:"5%"},{title:"Keyword",dataIndex:"keyword",key:"keyword",width:"30%"},{title:"Value",dataIndex:"value",key:"value",width:"40%"}],dataSource:z,pagination:!1,expandable:{expandedRowKeys:P,onExpandedRowsChange:function(e){return U(e)}},size:"small",scroll:{y:500}})]})})};const cn=tt(function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;(0,i.Z)(this,n),(a=t.call(this,e)).handleInfoButtonClick=function(){var e=(0,Lt.qY)(),t={browser:{},os:{}};null!=e&&(t.browser={name:null!=e.name?e.name:void 0,version:null!=e.version?e.version:void 0},t.os={name:null!=e.os?e.os:void 0}),ce.Z.info({title:"About",width:600,content:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(f.Z,{title:"Application",column:1,children:[(0,S.jsx)(f.Z.Item,{label:"Name",children:a.props.app.name}),(0,S.jsx)(f.Z.Item,{label:"Version",children:a.props.app.version}),(0,S.jsx)(f.Z.Item,{label:"Homepage",children:a.props.app.homepage})]}),(0,S.jsxs)(f.Z,{title:"Browser",column:1,children:[(0,S.jsx)(f.Z.Item,{label:"Name",children:t.browser.name}),(0,S.jsx)(f.Z.Item,{label:"Version",children:t.browser.version})]}),(0,S.jsx)(f.Z,{title:"Operating System",column:1,children:(0,S.jsx)(f.Z.Item,{label:"Name",children:t.os.name})})]}),onOk:function(){}})},a.handleDicomTagBrowserButtonClick=function(){var e,t=window.innerWidth-200;ce.Z.info({title:"DICOM Tag Browser",width:t,content:(0,S.jsx)(ln,{clients:a.props.clients,studyInstanceUID:null!==(e=a.props.params.studyInstanceUID)&&void 0!==e?e:""}),onOk:function(){}})},a.handleDebugButtonClick=function(){var e={Authentication:[],Communication:[],EncodingDecoding:[],Visualization:[]},t=a.state.errorObj.length;if(t>0)for(var n=0;n0||t.errorObj.length>0)&&this.props.location.pathname!==e.location.pathname&&this.setState({isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0,errorObj:[],errorCategory:[],warnings:[]})}},{key:"render",value:function(){var e,t=this,n=null;if(void 0!==this.props.user){var i=[];void 0!==this.props.onUserLogout&&i.push({label:"Logout",key:"user-logout",onClick:function(){void 0!==t.props.onUserLogout&&t.props.onUserLogout()}});var a={items:i};n=(0,S.jsx)(Mt.Z,{menu:a,trigger:["click"],children:(0,S.jsx)(Re,{icon:Pt.Z,onClick:function(e){return e.preventDefault()},label:"".concat(this.props.user.name," (").concat(this.props.user.email,")")})})}this.props.showWorklistButton&&(e=(0,S.jsx)(d.OL,{to:"/",children:(0,S.jsx)(Re,{icon:Ut.Z,tooltip:"Go to worklist"})}));var o,r=(0,S.jsx)(Re,{icon:At.Z,tooltip:"Get app info",onClick:this.handleInfoButtonClick}),s=(0,S.jsx)(we.Z,{count:this.state.errorObj.length,children:(0,S.jsx)(we.Z,{color:"green",count:this.state.warnings.length,children:(0,S.jsx)(Re,{icon:xe.Z,tooltip:"Debug info",onClick:this.handleDebugButtonClick})})}),l=this.props.location.pathname.includes("/studies/")?(0,S.jsx)(Re,{icon:Tt.Z,tooltip:"Dicom Tag Browser",onClick:this.handleDicomTagBrowserButtonClick}):null;this.props.showServerSelectionButton&&(o=(0,S.jsx)(Re,{icon:kt.Z,tooltip:"Select server",onClick:this.handleServerSelectionButtonClick}));var c=function(){var e=t.state.selectedServerUrl,n=!1;null!=e&&""!==e&&(e.startsWith("http://")||e.startsWith("https://"))&&(t.props.onServerSelection({url:e}),n=!0),t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!n,isServerSelectionDisabled:!0})};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h.Z.Header,{style:{width:"100%",padding:"0 14px"},children:(0,S.jsxs)(se.Z,{children:[(0,S.jsx)(Ce.Z,{children:(0,S.jsx)(ae.Z,{align:"center",direction:"horizontal",children:(0,S.jsx)("img",{src:"https://imagingdatacommons.github.io/slim/logo.svg",alt:"",style:{height:"64px",margin:"-14px"}})})}),(0,S.jsx)(Ce.Z,{flex:"auto"}),(0,S.jsx)(Ce.Z,{children:(0,S.jsxs)(ae.Z,{direction:"horizontal",children:[e,r,s,l,o,n]})})]})}),(0,S.jsx)(ce.Z,{open:this.state.isServerSelectionModalVisible,title:"Select DICOMweb server",onOk:c,onCancel:function(){t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0})},children:(0,S.jsx)(Et.Z,{placeholder:"Enter base URL of DICOMweb Study Service",onChange:function(e){var n=e.currentTarget.value,i=!0;if(null!=n)try{var a=new URL(n);a.protocol.startsWith("http")&&a.pathname.length>0&&(i=!1)}catch(o){}t.setState({selectedServerUrl:n,isServerSelectionDisabled:i})},onPressEnter:c,addonAfter:this.state.isServerSelectionDisabled?(0,S.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,S.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}})})})]})}}]),n}(l.Component));var dn=n(7063);const un=function(e){var t=e.title,n=e.message;return(0,S.jsx)("div",{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,S.jsx)(dn.ZP,{title:t,subTitle:n})})};const hn=tt(function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).defaultPageSize=20,a.handleSearch=function(e,t,n){t()},a.handleReset=function(e){e()},a.getColumnSearchProps=function(e){return{filterDropdown:function(t){var n=t.setSelectedKeys,i=t.selectedKeys,o=t.confirm,r=t.clearFilters;return(0,S.jsxs)("div",{style:{padding:8},children:[(0,S.jsx)(Et.Z,{placeholder:"Search",value:i[0],onChange:function(e){return n(void 0!==e.target.value?[e.target.value]:[])},onPressEnter:function(){return a.handleSearch(i,o,e)},style:{width:188,marginBottom:8,display:"block"}}),(0,S.jsxs)(ae.Z,{children:[(0,S.jsx)(re.Z,{type:"primary",onClick:function(){return a.handleSearch(i,o,e)},icon:(0,S.jsx)(Gt.Z,{}),size:"small",style:{width:90},children:"Search"}),(0,S.jsx)(re.Z,{onClick:function(){return a.handleReset(r)},size:"small",style:{width:90},children:"Reset"})]})]})},filterIcon:function(e){return(0,S.jsx)(Gt.Z,{style:{color:e?"#1890ff":void 0}})}}},a.fetchData=a.fetchData.bind((0,o.Z)(a)),a.handleClick=a.handleClick.bind((0,o.Z)(a)),a.handleChange=a.handleChange.bind((0,o.Z)(a)),a.state={studies:[],isLoading:!1,numStudies:0,pageSize:a.defaultPageSize},a}return(0,a.Z)(n,[{key:"searchForStudies",value:function(){var e=this,t={queryParams:{ModalitiesInStudy:"SM"}};this.props.clients[R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(t).then((function(t){e.setState({numStudies:t.length,studies:t.slice(0,e.state.pageSize).map((function(e){return j.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),Q.onError(F,new N(k,"An error occured. Search for studies failed."))}))}},{key:"componentDidMount",value:function(){this.searchForStudies()}},{key:"componentDidUpdate",value:function(e){this.props.clients!==e.clients&&this.searchForStudies()}},{key:"handleClick",value:function(e,t){this.props.navigate("/studies/".concat(t.StudyInstanceUID))}},{key:"fetchData",value:function(e){var t=this,n=e.offset,i=e.limit,a=e.searchCriteria,o={ModalitiesInStudy:"SM",offset:n,limit:i};if(void 0!==a){for(var r in a){var s=a[r];o[r]="PersonName"===r?"*".concat(s,"*"):s}o.fuzzymatching="true"}var l={queryParams:o};this.props.clients[R.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(l).then((function(e){t.setState({studies:e.map((function(e){return j.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),Q.onError(F,new N(k,"Request to search for studies failed."))}))}},{key:"handleChange",value:function(e,t){this.setState({isLoading:!0});var n=e.current;void 0===n&&(n=1);var i=e.pageSize;void 0===i&&(i=this.state.pageSize);var a=i*(n-1),o=i;console.debug("search for studies of page #".concat(n,"..."));var r={};for(var s in t)null!==t[s]&&(r[s]=t[s][0].toString());this.fetchData({offset:a,limit:o,searchCriteria:r}),this.setState({isLoading:!1,pageSize:i})}},{key:"render",value:function(){var e=this,t=[(0,O.Z)({title:"Accession Number",dataIndex:"AccessionNumber"},this.getColumnSearchProps("AccessionNumber")),(0,O.Z)({title:"Study ID",dataIndex:"StudyID"},this.getColumnSearchProps("StudyID")),{title:"Study Date",dataIndex:"StudyDate",render:function(e){return w(e)}},{title:"Study Time",dataIndex:"StudyTime",render:function(e){return x(e)}},(0,O.Z)({title:"Patient ID",dataIndex:"PatientID"},this.getColumnSearchProps("PatientID")),(0,O.Z)({title:"Patient's Name",dataIndex:"PatientName",render:function(e){return b(e)}},this.getColumnSearchProps("PatientName")),{title:"Patient's Sex",dataIndex:"PatientSex",render:function(e){return D(e)}},{title:"Patient's Birthdate",dataIndex:"PatientBirthDate",render:function(e){return w(e)}},{title:"Referring Physician's Name",dataIndex:"ReferringPhysicianName",render:function(e){return b(e)}},{title:"Modalities in Study",dataIndex:"ModalitiesInStudy",render:function(e){return void 0===e?"":String(e)}}],n={defaultPageSize:this.defaultPageSize,pageSize:this.state.pageSize,hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,showTotal:function(e,t){return"".concat(t[0],"-").concat(t[1]," of ").concat(e," studies")},total:this.state.numStudies};return(0,S.jsx)(Nt.Z,{style:{cursor:"pointer"},columns:t,rowKey:function(e){return e.StudyInstanceUID},dataSource:this.state.studies,pagination:n,onRow:function(t){return{onClick:function(n){return e.handleClick(n,t)}}},onChange:this.handleChange,size:"small",loading:this.state.isLoading})}}]),n}(l.Component));var pn=n(5685),vn=function(e,t){var n=t;return n.endsWith("/")||(n+="/"),new URL(e,n).toString()},mn=function(e){var t,n,i,a,o,r=new URLSearchParams(e.search),s=new URLSearchParams(e.hash.replace("#","?"));return Boolean(null!==(t=null!==(n=null!==(i=null!==(a=null!==(o=r.get("code"))&&void 0!==o?o:r.get("id_token"))&&void 0!==a?a:r.get("session_state"))&&void 0!==i?i:s.get("code"))&&void 0!==n?n:s.get("id_token"))&&void 0!==t?t:s.get("session_state"))},fn=function(e){var t;if(null!==e&&(t=e.profile),void 0!==t){if(void 0!==t.name&&void 0!==t.email)return{name:t.name,email:t.email};Q.onError(Y,new N(T,'Failed to obtain user "name" and "email".'))}else Q.onError(Y,new N(T,"Failed to obtain user profile."));return{name:void 0,email:void 0}},gn=(0,a.Z)((function e(t,n){var a=this;(0,i.Z)(this,e),this._oidc=void 0,this.signIn=function(){var e=(0,yt.Z)((0,St.Z)().mark((function e(t){var n,i,o,r;return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.onSignIn,i=function(e){var t=fn(e),i="".concat(e.token_type," ").concat(e.access_token);null!=n?(console.info("handling sign-in using provided callback function"),n({user:t,authorization:i})):console.warn("no callback function was provided to handle sign-in")},!mn(window.location)){e.next=10;break}return console.info("obtaining authorization"),e.next=6,a._oidc.signinCallback();case 6:null!=(o=e.sent)&&(console.info("obtained user data: ",o),i(o)),e.next=21;break;case 10:return e.next=12,a._oidc.getUser();case 12:if(null!==(r=e.sent)&&!r.expired){e.next=19;break}return console.info("authenticating user"),e.next=17,a._oidc.signinRedirect();case 17:e.next=21;break;case 19:console.info("user has already been authenticated"),i(r);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.signOut=(0,yt.Z)((0,St.Z)().mark((function e(){return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("signing out user and revoking authorization"),e.next=3,a._oidc.signoutRedirect();case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),this.getAuthorization=(0,yt.Z)((0,St.Z)().mark((function e(){return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._oidc.getUser().then((function(e){if(null!==e)return e.access_token;Q.onError(Y,new N(T,"Failed to obtain user profile."))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.getUser=(0,yt.Z)((0,St.Z)().mark((function e(){return(0,St.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._oidc.getUser().then((function(e){return null===e&&Q.onError(Y,new N(T,"Failed to obtain user information.")),fn(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));var o="code";void 0!==n.grantType&&"implicit"===n.grantType&&(o="id_token token"),this._oidc=new pn.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:o,loadUserInfo:!0,automaticSilentRenew:!0,revokeAccessTokenOnSignout:!0,post_logout_redirect_uri:"".concat(t,"/logout")}),null!=n.endSessionEndpoint&&this._oidc.metadataService.getMetadata().then((function(e){null!=n.endSessionEndpoint&&(e.end_session_endpoint=n.endSessionEndpoint,a._oidc=new pn.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:o,loadUserInfo:!0,automaticSilentRenew:!0,revokeAccessTokenOnSignout:!0,post_logout_redirect_uri:"".concat(t,"/logout"),metadata:e}))})).catch((function(e){console.error("failed to get metadata from authorization server: ",e)}))})),Sn=n(7659),yn=n(9158);const Cn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{retries:5,factor:3,minTimeout:1e3,maxTimeout:6e4,randomize:!0,retryableStatusCodes:[429,500]},t=e;null!=e.retries&&(t.retries=e.retries),null!=e.factor&&(t.factor=e.factor),null!=e.minTimeout&&(t.minTimeout=e.minTimeout),null!=e.maxTimeout&&(t.maxTimeout=e.maxTimeout),null!=e.randomize&&(t.randomize=e.randomize),null!=e.retryableStatusCodes&&(t.retryableStatusCodes=e.retryableStatusCodes);var n=function(e,n){var i=n.url,a=n.method;var o=e.send;return e.send=function(){var n=yn.operation(t);n.attempt((function(o){var r=e.onreadystatechange;e.onreadystatechange=function(){if(null!=r){for(var a=arguments.length,o=new Array(a),s=0;s1&&(console.warn("Requesting ".concat(i,"... (attempt: ").concat(o,")")),e.open(a,i,!0))}));for(var r=arguments.length,s=new Array(r),l=0;l1&&Q.onError(W,new N(k,"Only one store is supported for now."))}return(0,a.Z)(e,[{key:"baseURL",get:function(){return this.stores[0].client.baseURL}},{key:"headers",get:function(){return this.stores[0].client.headers}}]),e}();function wn(e){var t,n,i=e.clients,a=e.user,o=e.app,r=e.config,s=(0,c.UO)().studyInstanceUID,l=!(null!==(t=r.disableAnnotationTools)&&void 0!==t&&t),d=null!==(n=r.preload)&&void 0!==n&&n;return(0,S.jsx)(Ot,{clients:i,user:a,annotations:r.annotations,preload:d,app:o,enableAnnotationTools:l,studyInstanceUID:s})}function xn(e){var t=e.baseUri,n=e.gcpBaseUrl,i=e.settings,a=e.onError,o={default:0},r={};for(var s in i.forEach((function(e){if(null!=e.storageClasses)e.storageClasses.forEach((function(t){Object.values(R).includes(t)?t in o?o[t]+=1:o[t]=1:console.warn('unknown storage class "'.concat(t,'" specified ')+'for configured server "'.concat(e.id,'"'))}));else{if(window.location.pathname.includes("/projects/")){var i=window.location.pathname.split("/study/")[0],s="".concat(n).concat(i,"/dicomWeb");e.url=s}o.default+=1,r.default=new bn({baseUri:t,settings:[e],onError:a})}})),o.default>1&&Q.onError(W,new N(k,"Only one default server can be configured without specification of storage classes.")),o)"default"!==s&&o[s]>1&&Q.onError(W,new N(k,"Only one configured server can specify a given storage class. "+'Storage class "'.concat(s,'" is specified by more than one ')+"of the configured servers."));return Object.keys(o).length>1&&i.forEach((function(e){var n=new bn({baseUri:t,settings:[e],onError:a});null!=e.storageClasses&&e.storageClasses.forEach((function(e){r[e]=n}))})),Object.values(R).forEach((function(e){e in r||(r[e]=r.default)})),r}const Dn=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a,r;(0,i.Z)(this,n),(r=t.call(this,e)).auth=void 0,r.handleDICOMwebError=function(e,t){401===e.status?r.signIn():403===e.status&&Q.onError(F,new N(k,"User is not authorized to access DICOMweb resources."));var n=function(){Q.onError(F,new N(k,"An unexpected server error occured."))};void 0!==t.errorMessages?t.errorMessages.forEach((function(t){e.status===t.status?r.setState({error:{status:e.status,message:t.message}}):500===e.status&&n()})):500===e.status&&n()},r.handleSignIn=function(e){var t=e.user,n=e.authorization;for(var i in r.state.clients){r.state.clients[i].updateHeaders({Authorization:n})}var a=window.localStorage.getItem("slim_path"),o=window.localStorage.getItem("slim_search");if(null!=a&&a!==window.location.pathname){var s=a;null!=o&&(s+=o),window.location.href=s}window.localStorage.removeItem("slim_path"),window.localStorage.removeItem("slim_search"),r.setState({user:t})},console.info("instatiate app"),console.info('app is located at "'.concat(e.config.path,'"'));var s=window.location,l=s.protocol,c=s.host,d="".concat(l,"//").concat(c),h=vn(e.config.path,d),p=e.config.oidc;return void 0!==p&&(console.info("app uses the following OIDC configuration: ",e.config.oidc),r.auth=new gn(h,p)),0===e.config.servers.length&&Q.onError(W,new N(k,"One server needs to be configured.")),console.info("app uses the following DICOMweb server configuration: ",e.config.servers),r.handleServerSelection=r.handleServerSelection.bind((0,o.Z)(r)),u.ZP.config({duration:5}),r.addGcpSecondaryAnnotationServer(e.config),r.state={clients:xn({baseUri:d,gcpBaseUrl:null!==(a=e.config.gcpBaseUrl)&&void 0!==a?a:"https://healthcare.googleapis.com/v1",settings:e.config.servers,onError:r.handleDICOMwebError}),isLoading:!0,wasAuthSuccessful:!1},r}return(0,a.Z)(n,[{key:"addGcpSecondaryAnnotationServer",value:function(e){var t="gcp_secondary_annotation_server",n=new URLSearchParams(window.location.search).get("gcp");void 0===e.servers.find((function(e){return e.id===t}))&&"string"===typeof n&&e.servers.push({id:t,write:!0,url:n,storageClasses:[R.COMPREHENSIVE_SR,R.COMPREHENSIVE_3D_SR,R.SEGMENTATION,R.MICROSCOPY_BULK_SIMPLE_ANNOTATION,R.PARAMETRIC_MAP,R.ADVANCED_BLENDING_PRESENTATION_STATE,R.COLOR_SOFTCOPY_PRESENTATION_STATE,R.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,R.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE]})}},{key:"handleServerSelection",value:function(e){var t=e.url;console.info("select DICOMweb server: ",t);var n=new bn({baseUri:"",settings:[{id:"tmp",url:t,read:!0,write:!1}],onError:this.handleDICOMwebError});n.updateHeaders(this.state.clients.default.headers),this.setState((function(e){var t={};for(var i in e.clients)t[i]=n;return{clients:t}}))}},{key:"signIn",value:function(){var e=this;void 0!==this.auth?(console.info("try to sign in user"),this.auth.signIn({onSignIn:this.handleSignIn}).then((function(){console.info("sign-in was successful"),e.setState({isLoading:!1,wasAuthSuccessful:!0})})).catch((function(t){console.error(t),Q.onError(Y,new N(T,"Could not sign-in user.")),e.setState({isLoading:!1,redirectTo:void 0,wasAuthSuccessful:!1})}))):this.setState({isLoading:!1,redirectTo:void 0,wasAuthSuccessful:!0})}},{key:"componentDidMount",value:function(){null==window.localStorage.getItem("slim_path")&&(window.localStorage.setItem("slim_path",window.location.pathname),window.localStorage.setItem("slim_search",window.location.search)),this.signIn()}},{key:"render",value:function(){var e,t,n,i=this,a={name:this.props.name,version:this.props.version,homepage:this.props.homepage,uid:"1.2.826.0.1.3680043.9.7433.1.5",organization:this.props.config.organization},o=!(null!==(e=this.props.config.disableWorklist)&&void 0!==e&&e),r=null!==(t=this.props.config.enableServerSelection)&&void 0!==t&&t;n=o?(0,S.jsx)(hn,{clients:this.state.clients}):(0,S.jsx)("div",{children:"Worklist has been disabled."});var s,l=!1;null!=this.props.config.oidc&&null!=this.props.config.oidc.endSessionEndpoint?(s=function(){null!=i.auth&&i.auth.signOut()},l=!0):(s=function(){},l=!1);var u={height:"100vh"},v={height:"100%"};return void 0!==this.state.redirectTo?(0,S.jsx)(d.VK,{basename:this.props.config.path,children:(0,S.jsx)(c.Fg,{to:this.state.redirectTo,replace:!0})}):this.state.isLoading?(0,S.jsx)(d.VK,{basename:this.props.config.path,children:(0,S.jsxs)(h.Z,{style:u,children:[(0,S.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,showServerSelectionButton:!1,clients:this.state.clients}),(0,S.jsx)(h.Z.Content,{style:v,children:(0,S.jsx)(p.fCD,{})})]})}):this.state.wasAuthSuccessful?null!=this.state.error?(0,S.jsx)(un,{type:"error",message:this.state.error.message}):(0,S.jsx)(d.VK,{basename:this.props.config.path,children:(0,S.jsxs)(c.Z5,{children:[(0,S.jsx)(c.AW,{path:"/",element:(0,S.jsxs)(h.Z,{style:u,children:[(0,S.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,S.jsx)(h.Z.Content,{style:v,children:n})]})}),(0,S.jsx)(c.AW,{path:"/studies/:studyInstanceUID/*",element:(0,S.jsxs)(h.Z,{style:u,children:[(0,S.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,S.jsx)(h.Z.Content,{style:v,children:(0,S.jsx)(wn,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,S.jsx)(c.AW,{path:"/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:studyInstanceUID/*",element:(0,S.jsxs)(h.Z,{style:u,children:[(0,S.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,S.jsx)(h.Z.Content,{style:v,children:(0,S.jsx)(wn,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,S.jsx)(c.AW,{path:"/logout",element:(0,S.jsxs)(h.Z,{style:u,children:[(0,S.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),"Logged out"]})})]})}):(0,S.jsx)(un,{type:"error",message:"Sign-in failed."})}}]),n}(l.Component)}}]); -//# sourceMappingURL=687.902a8ade.chunk.js.map \ No newline at end of file diff --git a/static/js/687.902a8ade.chunk.js.map b/static/js/687.902a8ade.chunk.js.map deleted file mode 100644 index 7fd42dde..00000000 --- a/static/js/687.902a8ade.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/687.902a8ade.chunk.js","mappings":"6QA4BMA,EAAW,qGAqDd,OArDc,8BACf,WACE,IAAIC,EAAoC,aACpCC,EAAkB,YAEWC,IAA7BC,KAAKC,MAAMC,eAA+BF,KAAKC,MAAMC,gBACvDL,EAAS,WACTC,EAAkB,QAEpB,IAAMK,EAAQH,KAAKC,MAAMG,WAAWC,KAAI,SAACC,EAAiBC,GACxD,IAAMC,GAAMC,EAAAA,EAAAA,KACZ,OACE,SAAC,SAAiB,CAEhBC,MAAOJ,EAAKK,KACZC,WAAY,CACVC,WAAYf,GAEdgB,aAAc,CACZC,WAAY,IACZC,WAAY,WACZH,WAjBkB,QAmBpBI,KAAM,EAAE,SAEPX,EAAKY,OAZDV,EAeX,IACIW,EAAO,KAIX,YAHwBpB,IAApBC,KAAKC,MAAMkB,OACbA,GAAO,cAAMlB,MAAMkB,KAAI,MAGvB,UAAC,IAAI,CACHC,MAAOpB,KAAKC,MAAMoB,OAClBC,MAAOH,EACPI,KAAK,QACLC,UAAWxB,KAAKC,MAAMwB,WACtBC,cAAgC3B,IAAtBC,KAAKC,MAAMoB,OACrBM,QAAS3B,KAAKC,MAAM2B,QAAQ,WAE5B,SAAC,IAAY,CACXC,OAAQ,EACRN,KAAK,QACL1B,OAAQA,EACR6B,UAAU,EAAM,SAEfvB,IAEFH,KAAKC,MAAM6B,WAGlB,KAAC,EArDc,CAASC,EAAAA,WAwD1B,UC/BA,QAxCmB,qGAqChB,OArCgB,8BACjB,WACE,IAAM3B,EAAa,GAkCnB,OAjCoD,MAAhDJ,KAAKC,MAAM+B,SAASC,0BAEtB7B,EAAW8B,KAAI,MAAf9B,EACK,CACD,CACEO,KAAM,eACNO,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,IAAM,CAACr3B,MAAOqxC,EAAY,WACzB,SAAC,GAAM,CACLnoB,IAAK4nB,EACLnoB,KAAMlxB,KAAKiH,MAAMiqB,KACjBmc,oBAAoB,EACpBgB,kBAAmBruC,KAAKguC,sBACxBjB,aAAc4M,EAAmBD,OAAW35C,EAC5C+tC,0BAA2B2L,IAC3B,wBArFZ,SAAC,GAAQ,CAAC30C,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EAvYM,CAAShD,EAAAA,U","sources":["components/Description.tsx","components/ClinicalTrial.tsx","utils/values.ts","components/Patient.tsx","components/Study.tsx","data/uids.tsx","utils/PubSub.js","utils/CustomError.js","services/NotificationMiddleware.js","components/SlideItem.tsx","components/SlideList.tsx","components/AnnotationItem.tsx","components/AnnotationList.tsx","components/AnnotationGroupItem.tsx","components/AnnotationGroupList.tsx","components/Button.tsx","components/Equipment.tsx","utils/sr.tsx","components/Report.tsx","components/Item.tsx","data/specimens.tsx","components/SpecimenItem.tsx","components/SpecimenList.tsx","components/OpticalPathItem.tsx","components/OpticalPathList.tsx","components/MappingItem.tsx","components/MappingList.tsx","components/SegmentItem.tsx","components/SegmentList.tsx","utils/router.tsx","components/ColorSettingsMenu.tsx","components/AnnotationCategoryItem.tsx","components/AnnotationCategoryList.tsx","components/HoveredRoiTooltip.tsx","services/RoiToAnnotationAdapter.ts","components/SlideViewer.tsx","data/slides.tsx","services/fetchImageMetadata.ts","hooks/useSlides.ts","components/CaseViewer.tsx","components/DicomTagBrowser/dicomTagUtils.ts","utils/formatDicomDate.ts","utils/pubSubServiceInterface.ts","utils/createSeriesMetadata.ts","utils/createStudyMetadata.ts","services/DICOMMetadataStore.ts","hooks/useDebounce.ts","components/DicomTagBrowser/DicomTagBrowser.tsx","components/Header.tsx","components/InfoPage.tsx","components/Worklist.tsx","utils/url.tsx","auth/OidcManager.tsx","utils/xhrRetryHook.ts","DicomWebManager.ts","App.tsx"],"sourcesContent":["import React from 'react'\nimport { v4 as generateUUID } from 'uuid'\nimport { Card, Descriptions } from 'antd'\n\nexport interface Attribute {\n name: string\n value: any\n}\n\nexport interface AttributeGroup {\n name: string\n attributes: Attribute[]\n}\n\ninterface DescriptionProps {\n header?: string\n icon?: any\n attributes: Attribute[]\n selectable?: boolean\n hasLongValues?: boolean\n methods?: React.ReactNode[]\n children?: React.ReactNode\n}\n\n/**\n * React component for a description consisting of a header containing a\n * header and a body containing a list of name-value pairs.\n */\nclass Description extends React.Component {\n render (): React.ReactNode {\n let layout: 'horizontal' | 'vertical' = 'horizontal'\n let labelLineHeight = '14px'\n const contentLineHeight = '14px'\n if (this.props.hasLongValues !== undefined && this.props.hasLongValues) {\n layout = 'vertical'\n labelLineHeight = '20px'\n }\n const items = this.props.attributes.map((item: Attribute, index: number) => {\n const uid = generateUUID()\n return (\n \n {item.value}\n \n )\n })\n let icon = null\n if (this.props.icon !== undefined) {\n icon = \n }\n return (\n \n \n {items}\n \n {this.props.children}\n \n )\n }\n}\n\nexport default Description\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface ClinicalTrialProps {\n metadata: dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM ClinicalTrial Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass ClinicalTrial extends React.Component {\n render (): React.ReactNode {\n const attributes = []\n if (this.props.metadata.ClinicalTrialSponsorName != null) {\n // Attributes of Clinical Trial Subject module\n attributes.push(\n ...[\n {\n name: 'Sponsor Name',\n value: this.props.metadata.ClinicalTrialSponsorName\n },\n {\n name: 'Protocol ID',\n value: this.props.metadata.ClinicalTrialProtocolID\n },\n {\n name: 'Protocol Name',\n value: this.props.metadata.ClinicalTrialProtocolName\n },\n {\n name: 'Site Name',\n value: this.props.metadata.ClinicalTrialSiteName\n }\n ]\n )\n }\n if (this.props.metadata.ClinicalTrialTimePointID != null) {\n // Attributes of Clinical Trial Study module\n attributes.push(\n {\n name: 'Time Point ID',\n value: this.props.metadata.ClinicalTrialTimePointID\n }\n )\n }\n // Attributes of Clinical Trial Subject module\n return \n }\n}\n\nexport default ClinicalTrial\n","import * as dmv from 'dicom-microscopy-viewer'\n\nfunction parseName (value: dmv.metadata.PersonName|null|undefined): string {\n if (typeof value === 'object' && value !== null && value !== undefined) {\n if (value.Alphabetic !== undefined) {\n return value.Alphabetic.split('^').join(' ')\n }\n return ''\n }\n return ''\n}\n\nfunction parseDate (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n return `${year}-${month}-${day}`\n }\n return ''\n}\n\nfunction parseTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const hours = value.substring(0, 2)\n const minutes = value.substring(2, 4)\n const seconds = value.substring(4, 6)\n return `${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseDateTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n const hours = value.substring(8, 10)\n const minutes = value.substring(10, 12)\n const seconds = value.substring(12, 14)\n return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseSex (value: string|null|undefined): string {\n const lut: { [key: string]: string } = {\n F: 'Female',\n M: 'Male',\n O: 'Other'\n }\n if (value !== null && value !== undefined) {\n return lut[value]\n }\n return ''\n}\n\nexport { parseDate, parseDateTime, parseName, parseSex, parseTime }\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseName, parseSex, parseDate } from '../utils/values'\n\ninterface PatientProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Patient Information Entity that\n * displays common study-level, patient-related attributes of contained\n * DICOM Slide Microscopy images.\n */\nclass Patient extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'ID',\n value: this.props.metadata.PatientID\n },\n {\n name: 'Name',\n value: parseName(this.props.metadata.PatientName)\n },\n {\n name: 'Gender',\n value: parseSex(this.props.metadata.PatientSex)\n },\n {\n name: 'Birthdate',\n value: parseDate(this.props.metadata.PatientBirthDate)\n }\n ]\n return (\n \n )\n }\n}\n\nexport default Patient\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseDate, parseTime } from '../utils/values'\n\ninterface StudyProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Study Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass Study extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'Accession #',\n value: this.props.metadata.AccessionNumber\n },\n {\n name: 'ID',\n value: this.props.metadata.StudyID\n },\n {\n name: 'Date',\n value: parseDate(this.props.metadata.StudyDate)\n },\n {\n name: 'Time',\n value: parseTime(this.props.metadata.StudyTime)\n }\n ]\n return \n }\n}\n\nexport default Study\n","export enum StorageClasses {\n VL_WHOLE_SLIDE_MICROSCOPY_IMAGE = '1.2.840.10008.5.1.4.1.1.77.1.6',\n COMPREHENSIVE_SR = '1.2.840.10008.5.1.4.1.1.88.33',\n COMPREHENSIVE_3D_SR = '1.2.840.10008.5.1.4.1.1.88.34',\n SEGMENTATION = '1.2.840.10008.5.1.4.1.1.66.4',\n MICROSCOPY_BULK_SIMPLE_ANNOTATION = '1.2.840.10008.5.1.4.1.1.91.1',\n PARAMETRIC_MAP = '1.2.840.10008.5.1.4.1.1.30',\n ADVANCED_BLENDING_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.8',\n COLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.2',\n GRAYSCALE_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.1',\n PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.3'\n}\n","// Use symbols to prevent exposing private attributes\nconst _subscriptions = Symbol('subscriptions')\nconst _lastSubscriptionId = Symbol('lastSubscriptionId')\n\n/**\n * Class to enable implementation of publish/subscribe pattern\n * @class\n * @classdesc Enables publishing/subscribing\n */\nexport default class PubSub {\n constructor () {\n this[_subscriptions] = {}\n this[_lastSubscriptionId] = 0\n }\n\n /**\n * Adds a subscription callback to the provided event name\n * @param {string} eventName Event name that will trigger the callback\n * @param {Function} callback Function to be executed when event is published\n * @returns {void}\n */\n subscribe (eventName, callback) {\n if (eventName === undefined) {\n throw new Error('Trying to subscribe to an inexistent event')\n }\n\n if (typeof callback !== 'function') {\n throw new Error('The provided callback must be a function')\n }\n\n if (!this[_subscriptions].hasOwnProperty(eventName)) {\n this[_subscriptions][eventName] = {}\n }\n\n const subscriptionId = `sub${this[_lastSubscriptionId]++}`\n this[_subscriptions][eventName][subscriptionId] = callback\n }\n\n /**\n * Removes a subscription callback for the provided event name\n * @param {string} eventName Event name for the registerd callback\n * @param {Function} [callback] Function to have its subscription removed\n * @returns {void}\n */\n unsubscribe (eventName, callback) {\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n if (!callback) {\n delete callbacks[subscriptionId]\n } else if (callbacks[subscriptionId] === callback) {\n delete callbacks[subscriptionId]\n }\n }\n }\n\n /**\n * Trigger all registered subscription callbacks for a specific event name\n * @param {String} eventName Event name to trigger subscriptions from\n * @param {any} [payload] Payload that will be passed to the callback fuction\n * @returns {void}\n */\n publish (eventName, ...payload) {\n if (eventName === undefined) {\n throw new Error('Trying to publish an inexistent event')\n }\n\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n callbacks[subscriptionId](...payload)\n }\n }\n\n /**\n * Cleares all subscriptions for current instance\n * @returns {void}\n */\n unsubscribeFromAll () {\n for (const eventName in this[_subscriptions]) {\n const callbacks = this[_subscriptions][eventName]\n for (const subscriptionId in callbacks) {\n delete callbacks[subscriptionId]\n }\n }\n }\n}\n","const errorTypes = {\n AUTHENTICATION: 'Authentication',\n COMMUNICATION: 'Communication',\n ENCODINGANDDECODING: 'EncodingDecoding',\n VISUALIZATION: 'Visualization'\n}\n\nclass CustomError extends Error {\n constructor (type, message) {\n super()\n this.message = message\n this.stack = new Error().stack\n this.type = type\n }\n}\n\nexport { errorTypes, CustomError }\n","import PubSub from '../utils/PubSub'\nimport { notification } from 'antd'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nexport const NotificationMiddlewareEvents = {\n OnError: 'onError',\n OnWarning: 'onWarning'\n}\n\nexport const NotificationMiddlewareContext = {\n DICOMWEB: 'dicomweb-client',\n DMV: 'dicom-microscopy-viewer',\n DCMJS: 'dcmjs',\n SLIM: 'slim',\n AUTH: 'authentication'\n}\n\nconst NotificationType = {\n TOAST: 'toast',\n CONSOLE: 'console'\n}\n\n/* Sources of Error:\n 1. 'dicomweb-client': Error while requesting/fetching data, tagged as 'Communication'\n 2. 'slim' and 'dicom-microscopy-viewer' library: Error related to dicom data encoding/decoding,\n could directly/indirectly impact image-related visualization, tagged as 'Visualization' or\n 'Encoding/Decoding' accordingly\n 3. 'dcmjs' library: Data parsing error, tagged as 'DICOMError'\n 4. 'authentication': Error during user authentication, tagged as 'Authentication'\n */\nconst NotificationSourceDefinition = {\n sources: [\n {\n category: errorTypes.AUTHENTICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.COMMUNICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.VISUALIZATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.ENCODINGANDDECODING,\n notificationType: NotificationType.CONSOLE\n },\n {\n category: 'Warning',\n notificationType: NotificationType.TOAST\n }\n ]\n}\n\nclass NotificationMiddleware extends PubSub {\n constructor () {\n super()\n\n const outerContext = (args) => {\n this.publish(NotificationMiddlewareEvents.OnWarning, Array.from(args).join(' '))\n }\n\n (function () {\n const warn = console.warn\n console.warn = function () {\n if (!JSON.stringify(arguments).includes('request')) {\n outerContext(arguments)\n }\n warn.apply(this, Array.prototype.slice.call(arguments))\n }\n }())\n }\n\n /**\n * Error handling middleware function\n *\n * @param source - source of error - dicomweb-client, dmv, dcmjs or slim itself\n * @param error - error object\n */\n onError (source, error) {\n const errorCategory = error.type\n const sourceConfig = NotificationSourceDefinition.sources.find(\n s => s.category === errorCategory\n )\n\n const { notificationType } = sourceConfig\n\n this.publish(NotificationMiddlewareEvents.OnError, {\n source,\n error\n })\n\n let notificationMsg\n if (error instanceof CustomError) {\n notificationMsg = error.message\n } else {\n notificationMsg = String(error)\n }\n\n switch (notificationType) {\n case NotificationType.TOAST:\n console.error(`A ${errorCategory} error occurred: `, error)\n return notification.error({\n message: `${errorCategory} error`,\n description: notificationMsg,\n duration: 3\n })\n\n case NotificationType.CONSOLE:\n console.error(`A ${errorCategory} error occurred: `, error)\n break\n\n default:\n }\n }\n}\n\nexport default new NotificationMiddleware()\n","import React from 'react'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport Description from './Description'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\n\ninterface SlideItemProps {\n clients: { [key: string]: DicomWebManager }\n slide: Slide\n}\n\ninterface SlideItemState {\n isLoading: boolean\n}\n\n/**\n * React component representing a DICOM Series Information Entity that displays\n * common series-level attributes of contained DICOM Slide Microscopy images\n * as well as the OVERVIEW image (if available).\n * When selected a Slide Viewer instance is created for the display of the\n * contained images.\n */\nclass SlideItem extends React.Component {\n state = { isLoading: false }\n\n private readonly overviewViewportRef = React.createRef()\n\n private overviewViewer?: dmv.viewer.OverviewImageViewer\n\n constructor (props: SlideItemProps) {\n super(props)\n this.overviewViewer = undefined\n }\n\n componentDidMount (): void {\n this.setState({ isLoading: true })\n if (this.props.slide.overviewImages.length > 0) {\n const metadata = this.props.slide.overviewImages[0]\n if (this.overviewViewportRef.current !== null) {\n this.overviewViewportRef.current.innerHTML = ''\n console.info(\n 'instantiate viewer for OVERVIEW image of slide ' +\n `\"${metadata.ContainerIdentifier}\"`\n )\n this.overviewViewer = new dmv.viewer.OverviewImageViewer({\n client: this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ],\n metadata: metadata,\n resizeFactor: 1,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n this.overviewViewer.render({\n container: this.overviewViewportRef.current\n })\n }\n }\n\n this.setState({ isLoading: false })\n }\n\n render (): React.ReactNode {\n if (this.overviewViewer !== undefined) {\n this.overviewViewer.resize()\n }\n const attributes = []\n const description = this.props.slide.description\n if (description != null && description !== '') {\n attributes.push({\n name: 'Description',\n value: description\n })\n }\n if (this.state.isLoading) {\n return ()\n }\n\n /* Properties need to be propagated down to Menu.Item:\n * https://github.com/react-component/menu/issues/142\n */\n return (\n \n \n {(this.overviewViewportRef.current != null) &&
}\n \n \n )\n }\n}\n\nexport default SlideItem\n","import React from 'react'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport SlideItem from './SlideItem'\nimport { Slide } from '../data/slides'\n\ninterface SlideListProps {\n metadata: Slide[]\n clients: { [key: string]: DicomWebManager }\n selectedSeriesInstanceUID: string\n onSeriesSelection: (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ) => void\n}\n\ninterface SlideListState {\n selectedSeriesInstanceUID: string\n}\n\n/**\n * React component representing a list of DICOM Series Information Entities.\n */\nclass SlideList extends React.Component {\n state = {\n selectedSeriesInstanceUID: this.props.selectedSeriesInstanceUID\n }\n\n componentDidMount (): void {\n this.props.onSeriesSelection({\n seriesInstanceUID: this.state.selectedSeriesInstanceUID\n })\n }\n\n render (): React.ReactNode {\n const slideList = this.props.metadata\n const slideItemList = []\n for (let i = 0; i < slideList.length; ++i) {\n const slide = slideList[i]\n const slideItem = (\n \n )\n\n slideItemList.push(slideItem)\n }\n\n const handleMenuItemSelection = ({ key, keyPath, domEvent, selectedKeys }: {\n key: React.ReactText\n keyPath: React.ReactText[]\n domEvent: React.MouseEvent | React.KeyboardEvent\n selectedKeys?: React.ReactText[]\n }): void => {\n console.info(`select slide \"${key}\"`)\n this.setState({ selectedSeriesInstanceUID: key.toString() })\n this.props.onSeriesSelection({ seriesInstanceUID: key.toString() })\n }\n\n let selectedKeys\n if (this.state.selectedSeriesInstanceUID !== undefined &&\n this.state.selectedSeriesInstanceUID !== null) {\n selectedKeys = [this.state.selectedSeriesInstanceUID]\n }\n\n return (\n \n {slideItemList}\n \n )\n }\n}\n\nexport default SlideList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Menu, Space, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface AnnotationItemProps {\n roi: dmv.roi.ROI\n index: number\n isVisible: boolean\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n}\n\n/**\n * React component representing a Region of Interest (ROI) annotation.\n */\nclass AnnotationItem extends React.Component {\n constructor (props: AnnotationItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n roiUID: this.props.roi.uid,\n isVisible: checked\n })\n }\n\n render (): React.ReactNode {\n const identifier = `ROI ${this.props.index + 1}`\n const attributes: Array<{ name: string, value: string }> = []\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const { isVisible, onVisibilityChange, ...otherProps } = this.props\n this.props.roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n this.props.roi.measurements.forEach(item => {\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n const seq = item.MeasuredValueSequence[0]\n const value = seq.NumericValue.toPrecision(6)\n const unit = seq.MeasurementUnitsCodeSequence[0].CodeValue\n attributes.push({\n name: name,\n value: `${value} ${unit}`\n })\n })\n return (\n \n
\n }\n unCheckedChildren={}\n />\n
\n \n \n \n
\n )\n }\n}\n\nexport default AnnotationItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport AnnotationItem from './AnnotationItem'\n\ninterface AnnotationListProps {\n rois: dmv.roi.ROI[]\n selectedRoiUIDs: Set\n visibleRoiUIDs: Set\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n onSelection: ({ roiUID }: { roiUID: string }) => void\n}\n\n/**\n * React component representing a list of Region of Interest (ROI)\n * annotations.\n */\nclass AnnotationList extends React.Component {\n constructor (props: AnnotationListProps) {\n super(props)\n this.handleMenuItemSelection = this.handleMenuItemSelection.bind(this)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n if (checked) {\n this.props.rois.forEach(roi => {\n this.props.onVisibilityChange({ roiUID: roi.uid, isVisible: checked })\n })\n } else {\n this.props.visibleRoiUIDs.forEach(roiUID => {\n this.props.onVisibilityChange({ roiUID, isVisible: checked })\n })\n }\n }\n\n handleMenuItemSelection (object: any): void {\n this.props.onSelection({ roiUID: object.key })\n }\n\n render (): React.ReactNode {\n const items = this.props.rois.map((roi, index) => (\n \n ))\n\n return (\n <>\n
\n 0}\n checkedChildren={}\n unCheckedChildren={}\n />\n
\n \n {items}\n \n \n )\n }\n}\n\nexport default AnnotationList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Select,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Description from './Description'\n\ninterface AnnotationGroupItemProps {\n annotationGroup: dmv.annotation.AnnotationGroup\n isVisible: boolean\n metadata: dmv.metadata.MicroscopyBulkSimpleAnnotations\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\ninterface AnnotationGroupItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass AnnotationGroupItem extends React.Component {\n constructor (props: AnnotationGroupItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleMeasurementSelection = this.handleMeasurementSelection.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n annotationGroupUID: this.props.annotationGroup.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color,\n limitValues: this.state.currentStyle.limitValues\n }\n })\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { limitValues: values }\n })\n }\n\n handleMeasurementSelection (value?: string, option?: any): void {\n if (value != null && option.children != null) {\n const codeComponents = value.split('-')\n const measurement = new dcmjs.sr.coding.CodedConcept({\n value: codeComponents[1],\n schemeDesignator: codeComponents[0],\n meaning: option.children\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { measurement }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n measurement\n }\n }))\n } else {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n color: this.props.defaultStyle.color\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n color: this.props.defaultStyle.color,\n limitValues: undefined\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const index = this.props.metadata.AnnotationGroupSequence.findIndex(\n item => (item.AnnotationGroupUID === this.props.annotationGroup.uid)\n )\n const item = this.props.metadata.AnnotationGroupSequence[index]\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property type',\n value: this.props.annotationGroup.propertyType.CodeMeaning\n },\n {\n name: 'Property category',\n value: this.props.annotationGroup.propertyCategory.CodeMeaning\n },\n // {\n // name: 'Algorithm Name',\n // value: this.props.annotationGroup.algorithmName\n // },\n {\n name: 'Graphic type',\n value: item.GraphicType\n },\n {\n name: 'Annotation coordinate type',\n value: this.props.metadata.AnnotationCoordinateType\n }\n ]\n\n const measurementsSequence = item.MeasurementsSequence ?? []\n const measurementOptions = measurementsSequence.map((measurementItem, i) => {\n const name = measurementItem.ConceptNameCodeSequence[0]\n return (\n \n {name.CodeMeaning}\n \n )\n })\n measurementOptions.push(\n \n <>\n \n )\n\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n \n )\n }\n\n let windowSettings\n let explorationSettings\n if (measurementsSequence.length > 0) {\n if (this.state.currentStyle.limitValues != null) {\n // TODO: need to get default min/max values from viewer first\n const minValue = 0\n const maxValue = 1000\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n explorationSettings = (\n <>\n \n Exploration\n \n \n \n Measurement\n \n \n \n {measurementOptions}\n \n \n \n \n )\n }\n\n const settings = (\n
\n {colorSettings}\n {windowSettings}\n \n \n Opacity\n \n \n \n \n \n \n \n \n {explorationSettings}\n
\n )\n\n const color = this.getCurrentColor()\n const isBadgeVisible = (\n this.state.isVisible && this.state.currentStyle.measurement == null\n )\n const {\n annotationGroup,\n defaultStyle,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n \n \n
\n \n )\n }\n}\n\nexport default AnnotationGroupItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport AnnotationGroupItem from './AnnotationGroupItem'\n\ninterface AnnotationGroupListProps {\n annotationGroups: dmv.annotation.AnnotationGroup[]\n visibleAnnotationGroupUIDs: Set\n metadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n }\n defaultAnnotationGroupStyles: {\n [annotationGroupUID: string]: {\n opacity: number\n color: number[]\n }\n }\n onAnnotationGroupVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onAnnotationGroupStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\n/**\n * React component representing a list of Annotation Groups.\n */\nclass AnnotationGroupList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.annotationGroups.map((annotationGroup, index) => {\n const uid = annotationGroup.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default AnnotationGroupList\n","import React from 'react'\nimport { Button as Btn, Divider, Tooltip } from 'antd'\n\ninterface ButtonProps {\n icon: any\n tooltip?: string\n label?: string\n onClick?: (options: any) => void\n isSelected?: boolean\n}\n\n/**\n * React component for a button.\n */\nclass Button extends React.Component {\n constructor (props: ButtonProps) {\n super(props)\n this.handleClick = this.handleClick.bind(this)\n }\n\n handleClick (event: React.SyntheticEvent): void {\n if (this.props.onClick !== undefined) {\n this.props.onClick(event)\n }\n }\n\n render (): React.ReactNode {\n const Icon = this.props.icon\n if (Icon === undefined) {\n return null\n }\n\n let text\n if (this.props.label != null) {\n text = (\n <>\n \n {this.props.label}\n \n )\n }\n\n let button\n if (this.props.isSelected ?? false) {\n button = (\n }\n type='primary'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n } else {\n button = (\n }\n type='default'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n }\n\n if (this.props.tooltip !== undefined) {\n return (\n \n {button}\n \n )\n } else {\n return button\n }\n }\n}\n\nexport default Button\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface EquipmentProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n}\n\n/**\n * React component representing a list of DICOM Equipment Entities.\n */\nclass Equipment extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const attributes = [\n {\n name: 'Manufacturer',\n value: this.props.metadata.Manufacturer\n },\n {\n name: 'Model Name',\n value: this.props.metadata.ManufacturerModelName\n },\n {\n name: 'Device Serial Number',\n value: this.props.metadata.DeviceSerialNumber\n },\n {\n name: 'Software Versions',\n value: this.props.metadata.SoftwareVersions\n }\n ]\n if (this.props.metadata.InstitutionName != null) {\n attributes.push({\n name: 'Institution Name',\n value: this.props.metadata.InstitutionName\n })\n }\n return \n }\n}\n\nexport default Equipment\n","import * as dcmjs from 'dcmjs'\n\n/**\n * Check whether a DICOM SR content item has a given name.\n *\n * @param item - Content item\n * @param name - Coded name that should be compared\n * @returns Whether the content item has the given name\n */\nconst hasName = (\n item: dcmjs.sr.valueTypes.ContentItem,\n name: dcmjs.sr.coding.CodedConcept\n): boolean => {\n const concept = item.ConceptNameCodeSequence[0]\n return (\n concept.CodeValue === name.CodeValue &&\n concept.CodingSchemeDesignator === name.CodingSchemeDesignator\n )\n}\n\n/**\n * Check whether a DICOM SR content item has a given value type.\n *\n * @param item - Content item\n * @param valueType - Value Type\n * @returns Whether the content item has the given value type\n */\nconst hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: dcmjs.sr.valueTypes.ValueTypes\n): boolean => {\n console.log(item.ValueType, valueType)\n return item.ValueType === valueType\n}\n\n/**\n * Find content items in a DICOM SR document given their name.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param name - Coded name that should be compared\n * @returns Matched content items\n */\nexport const findContentItemsByName = (\n { content, name }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n name: dcmjs.sr.coding.CodedConcept\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasName(i, name)) {\n items.push(i)\n }\n })\n return items\n}\n\n/**\n * Find content items in a DICOM SR document given their value type.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param valueType - Value Type\n * @returns Matched content items\n */\nexport const findContentItemsByValueType = (\n { content, valueType }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n valueType: dcmjs.sr.valueTypes.ValueTypes\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, valueType)) {\n items.push(i)\n }\n })\n return items\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Divider } from 'antd'\nimport { v4 as generateUUID } from 'uuid'\n\nimport Description from './Description'\nimport Patient from './Patient'\nimport Study from './Study'\nimport { findContentItemsByName } from '../utils/sr'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nexport const hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: string\n): boolean => {\n return item.ValueType === valueType\n}\n\nconst findMeasurementItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.NumContentItem[] => {\n const items: dcmjs.sr.valueTypes.NumContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.NUM)) {\n const measurement = i as dcmjs.sr.valueTypes.NumContentItem\n items.push(measurement)\n }\n })\n return items\n}\n\nconst findEvaluationItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.CodeContentItem[] => {\n const items: dcmjs.sr.valueTypes.CodeContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.CODE)) {\n const evaluation = i as dcmjs.sr.valueTypes.CodeContentItem\n items.push(evaluation)\n }\n })\n return items\n}\n\nconst getROIs = (report: dmv.metadata.Comprehensive3DSR): dmv.roi.ROI[] => {\n // TID 1500 Measurement Report\n const matches = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (matches.length !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Imaging Measurements\" not found.' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\".'\n )\n )\n }\n const measurementsItem = matches[0] as dcmjs.sr.valueTypes.ContainerContentItem\n // TID 1410 Planar ROI Measurements and Qualitative Evaluations\n const measurementGroupItems = findContentItemsByName({\n content: measurementsItem.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n const rois: dmv.roi.ROI[] = []\n measurementGroupItems.forEach((item) => {\n const evaluations = []\n let observerType: string\n const group = item as dcmjs.sr.valueTypes.ContainerContentItem\n let items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '112040',\n schemeDesignator: 'DCM',\n meaning: 'Tracking Unique Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Tracking Unique Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const trackingUIDItem = items[0] as dcmjs.sr.valueTypes.UIDRefContentItem\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n schemeDesignator: 'DCM',\n meaning: 'Finding'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Finding\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111001',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Name'\n })\n })\n if (items.length !== 0) {\n const algorithmNameItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmNameItem)\n observerType = 'Device'\n } else {\n observerType = 'Person'\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111003',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Version'\n })\n })\n if (items.length !== 0) {\n const algorithmVersionItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmVersionItem)\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const regionItem = items[0] as dcmjs.sr.valueTypes.Scoord3DContentItem\n let scoord3d: any\n if (regionItem.GraphicType === 'POINT') {\n scoord3d = new dmv.scoord3d.Point({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: regionItem.GraphicData\n })\n } else {\n const coordinates: number[][] = []\n for (let i = 0; i < regionItem.GraphicData.length; i += 3) {\n coordinates.push(regionItem.GraphicData.slice(i, i + 3))\n }\n if (regionItem.GraphicType === 'POLYGON') {\n scoord3d = new dmv.scoord3d.Polygon({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'MULTIPOINT') {\n scoord3d = new dmv.scoord3d.MultiPoint({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'POLYLINE') {\n scoord3d = new dmv.scoord3d.Polyline({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSE') {\n scoord3d = new dmv.scoord3d.Ellipse({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSOID') {\n scoord3d = new dmv.scoord3d.Ellipsoid({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" has unknown graphic type ' +\n `\"${regionItem.GraphicType}\". ` +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n }\n\n evaluations.push(\n ...findEvaluationItems({ content: group.ContentSequence })\n )\n const measurements = findMeasurementItems({\n content: group.ContentSequence\n })\n\n const roi = new dmv.roi.ROI({\n scoord3d: scoord3d,\n uid: generateUUID(),\n properties: {\n trackingUID: trackingUIDItem.UID,\n observerType: observerType,\n evaluations: evaluations,\n measurements: measurements\n }\n })\n rois.push(roi)\n })\n return rois\n}\n\nclass MeasurementReport {\n public PersonObserverName?: string\n\n public PersonObserverLoginName?: string\n\n public DeviceObserverUID?: string\n\n public DeviceObserverName?: string\n\n public SpecimenUID: string\n\n public SpecimenIdentifier: string\n\n public ContainerIdentifier: string\n\n public ROIs: dmv.roi.ROI[] = []\n\n constructor (report: dmv.metadata.Comprehensive3DSR) {\n let items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121039',\n schemeDesignator: 'DCM',\n meaning: 'Specimen UID'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen UID\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.SpecimenUID = specimenUIDItem.UID\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.SpecimenIdentifier = specimenIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111700',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Container Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Container Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const containerIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.ContainerIdentifier = containerIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121008',\n schemeDesignator: 'DCM',\n meaning: 'Person Observer Name'\n })\n })\n if (items.length !== 0) {\n const personNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.PNameContentItem\n )\n this.PersonObserverName = personNameItem.PersonName\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '128774',\n schemeDesignator: 'DCM',\n meaning: \"Person Observer's Login Name\"\n })\n })\n if (items.length !== 0) {\n const personLoginNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.PersonObserverLoginName = personLoginNameItem.TextValue\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121012',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer UID'\n })\n })\n if (items.length > 0) {\n const deviceUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.DeviceObserverUID = deviceUIDItem.UID\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121013',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer Name'\n })\n })\n if (items.length !== 0) {\n const deviceNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.DeviceObserverName = deviceNameItem.TextValue\n }\n\n this.ROIs = getROIs(report)\n }\n}\n\ninterface ReportProps {\n dataset: dmv.metadata.Comprehensive3DSR\n}\n\n/**\n * React component representing a DICOM SR document that displays the\n * document content (a selected subset of content items).\n */\nclass Report extends React.Component {\n render (): React.ReactNode {\n const report = new MeasurementReport(this.props.dataset)\n const containerAttrs = [\n {\n name: 'ID',\n value: report.ContainerIdentifier\n }\n ]\n const specimenAttrs = [\n {\n name: 'ID',\n value: report.SpecimenIdentifier\n }\n ]\n const observerAttrs = [\n {\n name: 'Name',\n value: report.PersonObserverName\n }\n ]\n const annotations = report.ROIs.map(\n (roi, index): React.ReactNode => {\n const id = `Region ${index + 1}`\n const attrs: Array<{ name: string, value: string }> = []\n roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem\n )\n ) => {\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.ConceptCodeSequence[0].CodeMeaning\n })\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.TextValue\n })\n }\n })\n return \n }\n )\n\n return (\n
\n Patient\n \n Case\n \n Slide\n \n Specimen\n \n Observer\n \n Annotations\n {annotations}\n
\n )\n }\n}\n\nexport default Report\nexport { MeasurementReport }\n","import React from 'react'\nimport { List } from 'antd'\n\nimport Description, { Attribute, AttributeGroup } from './Description'\n\ninterface ItemProps {\n uid: string\n identifier: string\n attributes: Attribute[]\n groups?: AttributeGroup[]\n children?: React.ReactElement[]\n type?: string\n hasLongValues?: boolean\n}\n\n/**\n * React component for a list item that consists of a header element\n * containing an identifier and a body element containing a description list\n * of attributes rendered as name-value pairs.\n */\nclass Item extends React.Component {\n render (): React.ReactNode {\n let groups = null\n if (this.props.groups !== undefined) {\n groups = this.props.groups.map((item, index: number) => (\n \n ))\n }\n let title\n if (this.props.type !== undefined) {\n title = `${this.props.type}: ${this.props.identifier}`\n } else {\n title = this.props.identifier\n }\n return (\n \n \n {groups}\n
\n {this.props.children}\n \n )\n }\n}\n\nexport default Item\n","import * as dcmjs from 'dcmjs'\n\nexport const SpecimenPreparationTypes: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n COLLECTION: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING: new dcmjs.sr.coding.CodedConcept({\n value: '433465004',\n schemeDesignator: 'SCT',\n meaning: 'Sampling of tissue specimen'\n }),\n STAINING: new dcmjs.sr.coding.CodedConcept({\n value: '127790008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen staining'\n }),\n PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '9265001',\n schemeDesignator: 'SCT',\n meaning: 'Specimen processing'\n })\n}\n\nexport const SpecimenPreparationAdditives: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n FIXATIVE: new dcmjs.sr.coding.CodedConcept({\n value: '430864009',\n schemeDesignator: 'SCT',\n meaning: 'Tissue fixative'\n }),\n EMBEDDING_MEDIUM: new dcmjs.sr.coding.CodedConcept({\n value: '430863003',\n schemeDesignator: 'SCT',\n meaning: 'Embedding medium'\n })\n}\n\nexport const SpecimenPreparationStepItems: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen identifier'\n }),\n PARENT_SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '111705',\n schemeDesignator: 'DCM',\n meaning: 'Parent specimen identifier'\n }),\n PROCESSING_TYPE: new dcmjs.sr.coding.CodedConcept({\n value: '111701',\n schemeDesignator: 'DCM',\n meaning: 'Processing type'\n }),\n DATETIME_OF_PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '111702',\n schemeDesignator: 'DCM',\n meaning: 'Datetime of processing'\n }),\n PROCESSING_STEP_DESCRIPTION: new dcmjs.sr.coding.CodedConcept({\n value: '111703',\n schemeDesignator: 'DCM',\n meaning: 'Processing step description'\n }),\n COLLECTION_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '111704',\n schemeDesignator: 'DCM',\n meaning: 'Sampling method'\n }),\n STAIN: new dcmjs.sr.coding.CodedConcept({\n value: '424361007',\n schemeDesignator: 'SCT',\n meaning: 'Using substance'\n }),\n ...SpecimenPreparationAdditives\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Item from './Item'\nimport { Attribute } from './Description'\nimport { SpecimenPreparationStepItems } from '../data/specimens'\n\ninterface SpecimenItemProps {\n index: number\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a DICOM Specimen Information Entity and\n * displays specimen-related attributes of a DICOM Slide Microscopy image.\n */\nclass SpecimenItem extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const specimenDescription = this.props.metadata.SpecimenDescriptionSequence[\n this.props.index\n ]\n const attributes: Attribute[] = []\n if (specimenDescription.SpecimenShortDescription !== undefined) {\n attributes.push({\n name: 'Description',\n value: specimenDescription.SpecimenShortDescription\n })\n }\n if (specimenDescription.PrimaryAnatomicStructureSequence !== undefined) {\n if (specimenDescription.PrimaryAnatomicStructureSequence.length > 0) {\n const structures = specimenDescription.PrimaryAnatomicStructureSequence\n attributes.push({\n name: 'Anatomical structure',\n value: structures.map(item => item.CodeMeaning).join(', ')\n })\n }\n }\n\n // TID 8001 \"Specimen Preparation\"\n const preparationSteps: dmv.metadata.SpecimenPreparation[] = (\n specimenDescription.SpecimenPreparationSequence ?? []\n )\n preparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (\n name.equals(SpecimenPreparationStepItems.COLLECTION_METHOD)\n ) {\n attributes.push({\n name: 'Collection method',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.FIXATIVE)\n ) {\n attributes.push({\n name: 'Tissue fixative',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.EMBEDDING_MEDIUM)\n ) {\n attributes.push({\n name: 'Tissue embedding medium',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.PARENT_SPECIMEN_IDENTIFIER)\n ) {\n attributes.push({\n name: 'Parent specimen',\n value: item.TextValue\n })\n }\n }\n })\n }\n )\n const uid = specimenDescription.SpecimenUID\n const identifier = specimenDescription.SpecimenIdentifier\n return (\n \n )\n }\n}\n\nexport default SpecimenItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { List } from 'antd'\n\nimport SpecimenItem from './SpecimenItem'\n\ninterface SpecimenListProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a list of DICOM Specimen Information Entities.\n */\nclass SpecimenList extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n /*\n * Specimen Description Sequence is a type 1 attribute. However, it is\n * nevertheless missing in some data sets. This is a violation of the\n * standard, but it may be better to facilitate display of the data.\n */\n const descriptions = this.props.metadata.SpecimenDescriptionSequence ?? []\n const items = descriptions.map(\n (item: dmv.metadata.SpecimenDescription, index: number) => {\n return (\n \n )\n }\n )\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SpecimenList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch,\n Tooltip\n} from 'antd'\nimport {\n DeleteOutlined,\n EyeOutlined,\n EyeInvisibleOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport Description from './Description'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport { SpecimenPreparationStepItems } from '../data/specimens'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\ninterface OpticalPathItemProps {\n opticalPath: dmv.opticalPath.OpticalPath\n metadata: dmv.metadata.VLWholeSlideMicroscopyImage[]\n isVisible: boolean\n isRemovable: boolean\n defaultStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n onVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n }) => void\n onRemoval: (opticalPathIdentifier: string) => void\n}\n\ninterface OpticalPathItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n}\n\n/**\n * React component representing an optical path of a\n * multi-channel acquistion with control of visualization parameters.\n */\nclass OpticalPathItem extends React.Component {\n constructor (props: OpticalPathItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleLimitChange = this.handleLimitChange.bind(this)\n this.handleLowerLimitChange = this.handleLowerLimitChange.bind(this)\n this.handleUpperLimitChange = this.handleUpperLimitChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.handleRemoval = this.handleRemoval.bind(this)\n this.getCurrentColors = this.getCurrentColors.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color,\n paletteColorLookupTable: this.props.defaultStyle.paletteColorLookupTable,\n limitValues: this.props.defaultStyle.limitValues\n }\n }\n }\n\n componentDidUpdate (\n previousProps: OpticalPathItemProps,\n previousState: OpticalPathItemState\n ): void {\n if (this.props.defaultStyle !== previousProps.defaultStyle) {\n this.setState({\n currentStyle: this.props.defaultStyle\n })\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState({\n isVisible: checked\n })\n this.props.onVisibilityChange({\n opticalPathIdentifier: identifier,\n isVisible: checked\n })\n }\n\n handleOpacityChange (\n value: number | null\n ): void {\n if (value != null) {\n const identifier = this.props.opticalPath.identifier\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { opacity: value }\n })\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: value,\n limitValues: state.currentStyle.limitValues\n }\n }))\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColors (): string[] {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.props.defaultStyle.paletteColorLookupTable != null) {\n const colormap = this.props.defaultStyle.paletteColorLookupTable.data\n return colormap.map(values => rgb2hex(values))\n } else if (this.state.currentStyle.color != null) {\n return [\n '#000000',\n rgb2hex(this.state.currentStyle.color)\n ]\n } else {\n return ['white', 'white']\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { limitValues: values }\n })\n }\n\n handleRemoval (): void {\n const identifier = this.props.opticalPath.identifier\n this.props.onRemoval(identifier)\n }\n\n render (): React.ReactNode {\n const identifier = this.props.opticalPath.identifier\n const description = this.props.opticalPath.description\n const attributes: Array<{ name: string, value: string }> = []\n if (this.props.opticalPath.illuminationWaveLength !== undefined) {\n attributes.push(\n {\n name: 'Illumination wavelength',\n value: `${this.props.opticalPath.illuminationWaveLength} nm`\n }\n )\n }\n if (this.props.opticalPath.illuminationColor !== undefined) {\n attributes.push(\n {\n name: 'Illumination color',\n value: this.props.opticalPath.illuminationColor.CodeMeaning\n }\n )\n }\n\n // TID 8001 \"Specimen Preparation\"\n const specimenDescriptions: dmv.metadata.SpecimenDescription[] = (\n this.props.metadata[0].SpecimenDescriptionSequence ?? []\n )\n try {\n specimenDescriptions.forEach(description => {\n const specimenPreparationSteps: dmv.metadata.SpecimenPreparation[] =\n description.SpecimenPreparationSequence ?? []\n specimenPreparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n }\n }\n }\n })\n }\n )\n })\n } catch (error: any) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DCMJS,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n error.message\n )\n )\n }\n\n const maxValue = Math.pow(2, this.props.metadata[0].BitsAllocated) - 1\n\n const title = (\n description != null ? `${identifier}: ${description}` : identifier\n )\n let settings\n let item\n if (this.props.opticalPath.isMonochromatic) {\n // monochrome images that can be pseudo-colored\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n )\n } else {\n colorSettings = (\n <>\n \n Color\n \n Custom pseudo-coloring is disabled because pixels are colorized via\n a provided palette color lookup table.\n \n )\n }\n\n let windowSettings\n if (this.state.currentStyle.limitValues != null) {\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n settings = (\n
\n {windowSettings}\n {colorSettings}\n \n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n const colors = this.getCurrentColors()\n item = (\n \n \n \n )\n } else {\n // color images\n settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n item = (\n \n )\n }\n\n const buttons = []\n if (this.props.isRemovable) {\n buttons.push(\n \n }\n onClick={this.handleRemoval}\n />\n \n )\n }\n\n const {\n defaultStyle,\n isRemovable,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n onRemoval,\n opticalPath,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n {buttons}\n \n
\n {item}\n
\n \n )\n }\n}\n\nexport default OpticalPathItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Button as Btn, Menu, Select, Space, Tooltip } from 'antd'\nimport { AppstoreAddOutlined } from '@ant-design/icons'\n\nimport OpticalPathItem from './OpticalPathItem'\n\nconst { Option } = Select\n\ninterface OpticalPathListProps {\n opticalPaths: dmv.opticalPath.OpticalPath[]\n metadata: {\n [opticalPathIdentifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n }\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n defaultOpticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n }\n onOpticalPathVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onOpticalPathStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }) => void\n onOpticalPathActivityChange: ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }) => void\n selectedPresentationStateUID?: string\n}\n\ninterface OpticalPathListState {\n selectedOpticalPathIdentifier?: string\n}\n\n/**\n * React component representing a list of optical paths.\n */\nclass OpticalPathList extends React.Component {\n state = {\n selectedOpticalPathIdentifier: undefined\n }\n\n constructor (props: OpticalPathListProps) {\n super(props)\n this.handleItemAddition = this.handleItemAddition.bind(this)\n this.handleItemRemoval = this.handleItemRemoval.bind(this)\n this.handleItemSelectionChange = this.handleItemSelectionChange.bind(this)\n }\n\n /**\n * Handler that gets called when an optical path should be removed.\n */\n handleItemRemoval (opticalPathIdentifier: string): void {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier,\n isActive: false\n })\n }\n\n /**\n * Handler that gets called when the selection of an optical path should change.\n */\n handleItemSelectionChange (\n value: string\n ): void {\n this.setState({ selectedOpticalPathIdentifier: value })\n }\n\n /**\n * Handler that gets called when an optical path should be added.\n */\n handleItemAddition (): void {\n const identifier = this.state.selectedOpticalPathIdentifier\n if (identifier !== undefined) {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier: identifier,\n isActive: true\n })\n this.setState({ selectedOpticalPathIdentifier: undefined })\n }\n }\n\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n\n const isSelectable = this.props.opticalPaths.length > 1\n const opticalPathItems: React.ReactNode[] = []\n const optionItems: React.ReactNode[] = []\n this.props.opticalPaths.forEach(opticalPath => {\n const opticalPathIdentifier = opticalPath.identifier\n const images = this.props.metadata[opticalPathIdentifier]\n const seriesInstanceUID = images[0].SeriesInstanceUID\n images[0].OpticalPathSequence.forEach(opticalPathItem => {\n const id = opticalPathItem.OpticalPathIdentifier\n const description = opticalPathItem.OpticalPathDescription\n if (opticalPath.identifier === id) {\n if (this.props.activeOpticalPathIdentifiers.has(id)) {\n opticalPathItems.push(\n \n )\n } else {\n let title\n if (description !== '') {\n title = `${id} - ${description}`\n } else {\n title = `${id}`\n }\n optionItems.push(\n \n )\n }\n }\n })\n })\n\n let opticalPathSelector\n if (isSelectable) {\n opticalPathSelector = (\n \n \n {optionItems}\n \n \n }\n type='primary'\n onClick={this.handleItemAddition}\n />\n \n \n )\n }\n\n return (\n \n {opticalPathItems}\n {opticalPathSelector}\n \n )\n }\n}\n\nexport default OpticalPathList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface MappingItemProps {\n mapping: dmv.mapping.ParameterMapping\n metadata: dmv.metadata.ParametricMap[]\n isVisible: boolean\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\ninterface MappingItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Real World Value Mapping.\n */\nclass MappingItem extends React.Component {\n constructor (props: MappingItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n mappingUID: this.props.mapping.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n mappingUID: this.props.mapping.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: value\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Description',\n value: this.props.mapping.description\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n mapping,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n \n
\n \n
\n \n )\n }\n}\n\nexport default MappingItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport MappingItem from './MappingItem'\n\ninterface MappingListProps {\n mappings: dmv.mapping.ParameterMapping[]\n metadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n }\n visibleMappingUIDs: Set\n defaultMappingStyles: {\n [mappingUID: string]: { opacity: number }\n }\n onMappingVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onMappingStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Real World Value Mappings.\n */\nclass MappingList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.mappings.map((mapping, index) => {\n const uid = mapping.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default MappingList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface SegmentItemProps {\n segment: dmv.segment.Segment\n isVisible: boolean\n metadata: dmv.metadata.Segmentation[]\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\ninterface SegmentItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Segment.\n */\nclass SegmentItem extends React.Component {\n constructor (props: SegmentItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: { opacity: this.props.defaultStyle.opacity }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n segmentUID: this.props.segment.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n segmentUID: this.props.segment.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({ currentStyle: { opacity: value } })\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property Type',\n value: this.props.segment.propertyType.CodeMeaning\n },\n {\n name: 'Property Category',\n value: this.props.segment.propertyCategory.CodeMeaning\n },\n {\n name: 'Algorithm Name',\n value: this.props.segment.algorithmName\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n segment,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n
\n \n )\n }\n}\n\nexport default SegmentItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport SegmentItem from './SegmentItem'\n\ninterface SegmentListProps {\n segments: dmv.segment.Segment[]\n visibleSegmentUIDs: Set\n metadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n }\n defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n }\n onSegmentVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onSegmentStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Segments.\n */\nclass SegmentList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.segments.map((segment, index) => {\n const uid = segment.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SegmentList\n","import React from 'react'\nimport {\n NavigateFunction,\n Params,\n useLocation,\n useNavigate,\n useParams,\n Location\n} from 'react-router-dom'\n\nexport interface RouteComponentProps {\n location: Location\n navigate: NavigateFunction\n params: Params\n}\n\nexport function withRouter (Component: React.ComponentType): Function {\n function ComponentWithRouterProp (props: any): JSX.Element {\n const location = useLocation()\n const navigate = useNavigate()\n const params = useParams()\n return (\n \n )\n }\n return ComponentWithRouterProp\n}\n","import React from 'react'\nimport { Col, Divider, InputNumber, Row, Slider } from 'antd'\n\ninterface ColorSettingsMenuProps {\n annotationGroupsUIDs: string[]\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onStyleChange: Function\n}\n\ninterface ColorSettingsMenuState {\n currentStyle: {\n opacity: number\n color?: number[]\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass ColorSettingsMenu extends React.Component<\nColorSettingsMenuProps,\nColorSettingsMenuState\n> {\n constructor (props: ColorSettingsMenuProps) {\n super(props)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: this.state.currentStyle.color,\n opacity: value\n }\n })\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color\n }\n })\n }\n }\n\n handleColorRChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorGChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorBChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n render (): React.ReactNode {\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n Color\n \n Red\n \n \n \n \n \n \n \n\n \n Green\n \n \n \n \n \n \n \n\n \n Blue\n \n \n \n \n \n \n \n \n \n )\n }\n\n return (\n
\n {colorSettings}\n \n Opacity\n \n \n \n \n \n \n \n
\n )\n }\n}\n\nexport default ColorSettingsMenu\n","import React from 'react'\nimport { Menu, Space, Checkbox, Tooltip, Popover, Button } from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { Category, Type } from './AnnotationCategoryList'\nimport ColorSettingsMenu from './ColorSettingsMenu'\n\nconst AnnotationCategoryItem = ({\n category,\n onChange,\n checkedAnnotationUids,\n onStyleChange,\n defaultAnnotationStyles\n}: {\n category: Category\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const { types } = category\n\n const onCheckCategoryChange = (e: any): void => {\n const isVisible = e.target.checked\n types.forEach((type: Type) => {\n handleChangeCheckedType({ type, isVisible })\n })\n }\n\n const checkAll = types.every((type: Type) =>\n type.uids.every((uid: string) => checkedAnnotationUids.has(uid))\n )\n const indeterminate =\n !checkAll &&\n types.some((type: Type) =>\n type.uids.some((uid: string) => checkedAnnotationUids.has(uid))\n )\n\n const handleChangeCheckedType = ({\n type,\n isVisible\n }: {\n type: Type\n isVisible: boolean\n }): void => {\n type.uids.forEach((uid: string) => {\n onChange({ roiUID: uid, isVisible })\n })\n }\n\n return (\n \n \n
\n \n \n \n {category.CodeMeaning}\n \n (\n {\n return [...acc, ...type.uids]\n },\n []\n )}\n onStyleChange={onStyleChange}\n defaultStyle={\n defaultAnnotationStyles[types[0].uids[0]]\n }\n />\n )}\n >\n }\n />\n \n \n \n {types.map((type: Type) => {\n const { CodeMeaning, CodingSchemeDesignator, CodeValue, uids } =\n type\n const shortenedCodeMeaning = CodeMeaning.slice(0, 22)\n const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`\n const isChecked = uids.every((uid: string) =>\n checkedAnnotationUids.has(uid)\n )\n const indeterminateType =\n !isChecked &&\n uids.some((uid: string) => checkedAnnotationUids.has(uid))\n return (\n \n \n handleChangeCheckedType({\n type,\n isVisible: e.target.checked\n })}\n />\n
\n \n {displayCodeMeaning}\n \n (\n \n )}\n >\n }\n />\n \n
\n
\n )\n })}\n
\n \n \n )\n}\n\nexport default AnnotationCategoryItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport AnnotationCategoryItem from './AnnotationCategoryItem'\n\nexport interface AnnotationCategoryAndType {\n uid: string\n type: Omit\n category: Omit\n}\nexport interface Type {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n uids: string[]\n}\nexport interface Category {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n types: Type[]\n}\n\nconst getCategories = (annotations: any): Record => {\n const categories = annotations?.reduce(\n (\n categoriesAcc: Record }>,\n annotation: AnnotationCategoryAndType\n ) => {\n const { category, type, uid } = annotation\n const categoryKey = category.CodeMeaning\n const typeKey = type.CodeMeaning\n\n const oldCategory = categoriesAcc[categoryKey] ?? {\n ...category,\n types: {}\n }\n const oldType = oldCategory.types[typeKey] ?? {\n ...type,\n uids: []\n }\n\n return {\n ...categoriesAcc,\n [categoryKey]: {\n ...oldCategory,\n types: {\n ...oldCategory.types,\n [typeKey]: { ...oldType, uids: [...oldType.uids, uid] }\n }\n }\n }\n },\n {}\n )\n\n // Normalizing types so that it's an array instead of an object:\n Object.keys(categories).forEach((categoryKey: string) => {\n const category = categories[categoryKey]\n const { types } = category\n const typesArr = Object.keys(types).map(\n (typeKey: string) => types[typeKey]\n )\n categories[categoryKey].types = typesArr\n })\n\n return categories\n}\n\nconst AnnotationCategoryList = ({\n annotations,\n onChange,\n onStyleChange,\n defaultAnnotationStyles,\n checkedAnnotationUids\n}: {\n annotations: AnnotationCategoryAndType[]\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const categories: Record = getCategories(annotations)\n\n if (Object.keys(categories).length === 0) {\n return <>\n }\n\n const items = Object.keys(categories).map((categoryKey: any) => {\n const category = categories[categoryKey]\n return (\n \n )\n })\n\n return {items}\n}\nexport default AnnotationCategoryList\n","const HoveredRoiTooltip = ({\n xPosition,\n yPosition,\n attributes\n}: {\n xPosition: number\n yPosition: number\n attributes: Array<{ name: string, value: string }>\n}): JSX.Element => {\n return (\n \n {attributes.map((attr) => (\n
\n {attr.name}: {attr.value}\n
\n ))}\n \n )\n}\n\nexport default HoveredRoiTooltip\n","import * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { AnnotationCategoryAndType } from '../components/AnnotationCategoryList'\n\nexport const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndType => {\n const { uid, evaluations } = roi\n\n const result = {\n category: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n },\n type: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n }\n }\n\n evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = codeContentItem.ConceptCodeSequence[0]\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n result.category = { ...value }\n } else if (nameValue === '121071') {\n result.type = { ...value }\n }\n }\n })\n\n return {\n ...result,\n uid\n }\n}\n","import React from 'react'\nimport {\n FaCrosshairs,\n FaDrawPolygon,\n FaEye,\n FaEyeSlash,\n FaHandPaper,\n FaHandPointer,\n FaTrash,\n FaSave\n} from 'react-icons/fa'\nimport {\n Button as Btn,\n Checkbox,\n Descriptions,\n Divider,\n InputNumber,\n message,\n Menu,\n Modal,\n Layout,\n Row,\n Select,\n Space,\n Tooltip\n} from 'antd'\nimport { UndoOutlined, CheckOutlined, StopOutlined } from '@ant-design/icons'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport * as dwc from 'dicomweb-client'\n\nimport DicomWebManager from '../DicomWebManager'\nimport AnnotationList from './AnnotationList'\nimport AnnotationGroupList from './AnnotationGroupList'\nimport Button from './Button'\nimport Equipment from './Equipment'\nimport Report, { MeasurementReport } from './Report'\nimport SpecimenList from './SpecimenList'\nimport OpticalPathList from './OpticalPathList'\nimport MappingList from './MappingList'\nimport SegmentList from './SegmentList'\nimport { AnnotationSettings } from '../AppConfig'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { findContentItemsByName } from '../utils/sr'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport AnnotationCategoryList from './AnnotationCategoryList'\nimport HoveredRoiTooltip from './HoveredRoiTooltip'\nimport { adaptRoiToAnnotation } from '../services/RoiToAnnotationAdapter'\n\nconst DEFAULT_ROI_STROKE_COLOR: number[] = [255, 234, 0] // [0, 126, 163]\nconst DEFAULT_ROI_FILL_COLOR: number[] = [255, 234, 0, 0.2] // [0, 126, 163, 0.2]\nconst DEFAULT_ROI_STROKE_WIDTH: number = 2\nconst DEFAULT_ROI_RADIUS: number = 5\n\nconst DEFAULT_ANNOTATION_OPACITY = 0.4\nconst DEFAULT_ANNOTATION_STROKE_COLOR = [0, 0, 0]\nconst DEFAULT_ANNOTATION_COLOR_PALETTE = [\n [54, 162, 235],\n [181, 65, 98],\n [75, 192, 192],\n [255, 158, 64],\n [153, 102, 254],\n [255, 205, 86],\n [200, 203, 207]\n]\n\nconst _buildKey = (concept: {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n CodingSchemeVersion?: string\n}): string => {\n const codingScheme = concept.CodingSchemeDesignator\n const codeValue = concept.CodeValue\n return `${codingScheme}-${codeValue}`\n}\n\nconst _getRoiKey = (roi: dmv.roi.ROI): string | undefined => {\n const matches = findContentItemsByName({\n content: roi.evaluations,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n })\n })\n if (matches.length === 0) {\n console.warn(`no finding found for ROI ${roi.uid}`)\n return\n }\n const finding = matches[0] as dcmjs.sr.valueTypes.CodeContentItem\n const findingName = finding.ConceptCodeSequence[0]\n return _buildKey(findingName)\n}\n\nconst _areROIsEqual = (a: dmv.roi.ROI, b: dmv.roi.ROI): boolean => {\n if (a.scoord3d.graphicType !== b.scoord3d.graphicType) {\n return false\n }\n if (a.scoord3d.frameOfReferenceUID !== b.scoord3d.frameOfReferenceUID) {\n return false\n }\n if (a.scoord3d.graphicData.length !== b.scoord3d.graphicData.length) {\n return false\n }\n\n const decimals = 6\n for (let i = 0; i < a.scoord3d.graphicData.length; ++i) {\n if (a.scoord3d.graphicType === 'POINT') {\n const s1 = a.scoord3d as dmv.scoord3d.Point\n const s2 = b.scoord3d as dmv.scoord3d.Point\n const c1 = s1.graphicData[i].toPrecision(decimals)\n const c2 = s2.graphicData[i].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n } else {\n const s1 = a.scoord3d as dmv.scoord3d.Polygon\n const s2 = b.scoord3d as dmv.scoord3d.Polygon\n for (let j = 0; j < s1.graphicData[i].length; ++j) {\n const c1 = s1.graphicData[i][j].toPrecision(decimals)\n const c2 = s2.graphicData[i][j].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n }\n }\n }\n return true\n}\n\nconst _formatRoiStyle = (style: {\n stroke?: {\n color?: number[]\n width?: number\n }\n fill?: {\n color?: number[]\n }\n radius?: number\n}): dmv.viewer.ROIStyleOptions => {\n const stroke = {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n }\n if (style.stroke != null) {\n if (style.stroke.color != null) {\n stroke.color = style.stroke.color\n }\n if (style.stroke.width != null) {\n stroke.width = style.stroke.width\n }\n }\n const fill = {\n color: DEFAULT_ROI_FILL_COLOR\n }\n if (style.fill != null) {\n if (style.fill.color != null) {\n fill.color = style.fill.color\n }\n }\n return {\n stroke,\n fill,\n image: {\n circle: {\n radius: style.radius != null\n ? style.radius\n : Math.max(5 - stroke.width, 1),\n stroke,\n fill\n }\n }\n }\n}\n\nconst _constructViewers = ({ clients, slide, preload }: {\n clients: { [key: string]: dwc.api.DICOMwebClient }\n slide: Slide\n preload?: boolean\n}): {\n volumeViewer: dmv.viewer.VolumeImageViewer\n labelViewer?: dmv.viewer.LabelImageViewer\n} => {\n console.info(\n 'instantiate viewer for VOLUME images of slide ' +\n `\"${slide.volumeImages[0].ContainerIdentifier}\"`\n )\n try {\n const volumeViewer = new dmv.viewer.VolumeImageViewer({\n clientMapping: clients,\n metadata: slide.volumeImages,\n controls: ['overview', 'position'],\n preload: preload,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV, error\n )\n }\n })\n volumeViewer.activateSelectInteraction({})\n\n let labelViewer\n if (slide.labelImages.length > 0) {\n console.info(\n 'instantiate viewer for LABEL image of slide ' +\n `\"${slide.labelImages[0].ContainerIdentifier}\"`\n )\n labelViewer = new dmv.viewer.LabelImageViewer({\n client: clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],\n metadata: slide.labelImages[0],\n resizeFactor: 1,\n orientation: 'vertical',\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n }\n\n return { volumeViewer, labelViewer }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to instantiate viewer'\n )\n )\n throw error\n }\n}\n\n/*\n * Check whether the report is structured according to template\n * TID 1500 \"MeasurementReport\".\n */\nconst _implementsTID1500 = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const templateSeq = report.ContentTemplateSequence\n if (templateSeq.length > 0) {\n const tid = templateSeq[0].TemplateIdentifier\n if (tid === '1500') {\n return true\n }\n }\n return false\n}\n\n/*\n * Check whether the subject described in the report is a specimen as compared\n * to a patient, fetus, or device.\n */\nconst _describesSpecimenSubject = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121024',\n schemeDesignator: 'DCM',\n meaning: 'Subject Class'\n })\n })\n if (items.length === 0) {\n return false\n }\n const subjectClassItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n const subjectClassValue = subjectClassItem.ConceptCodeSequence[0]\n const retrievedConcept = new dcmjs.sr.coding.CodedConcept({\n value: subjectClassValue.CodeValue,\n meaning: subjectClassValue.CodeMeaning,\n schemeDesignator: subjectClassValue.CodingSchemeDesignator\n })\n const expectedConcept = new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n meaning: 'Specimen',\n schemeDesignator: 'DCM'\n })\n if (retrievedConcept.equals(expectedConcept)) {\n return true\n }\n return false\n}\n\n/*\n * Check whether the report contains appropriate graphic ROI annotations.\n */\nconst _containsROIAnnotations = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const measurements = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (measurements.length === 0) {\n return false\n }\n const container = measurements[0] as dcmjs.sr.valueTypes.ContainerContentItem\n const measurementGroups = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n let foundRegion = false\n measurementGroups.forEach((group) => {\n const container = group as dcmjs.sr.valueTypes.ContainerContentItem\n const regions = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (regions.length > 0) {\n if (regions[0].ValueType === dcmjs.sr.valueTypes.ValueTypes.SCOORD3D) {\n foundRegion = true\n }\n }\n })\n\n return foundRegion\n}\n\ninterface EvaluationOptions {\n name: dcmjs.sr.coding.CodedConcept\n values: dcmjs.sr.coding.CodedConcept[]\n}\n\ninterface Evaluation {\n name: dcmjs.sr.coding.CodedConcept\n value: dcmjs.sr.coding.CodedConcept\n}\n\ninterface Measurement {\n name: dcmjs.sr.coding.CodedConcept\n value?: number\n unit: dcmjs.sr.coding.CodedConcept\n}\n\ninterface SlideViewerProps extends RouteComponentProps {\n slide: Slide\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n seriesInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload?: boolean\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n user?: {\n name: string\n email: string\n }\n selectedPresentationStateUID?: string\n}\n\ninterface SlideViewerState {\n visibleRoiUIDs: Set\n visibleSegmentUIDs: Set\n visibleMappingUIDs: Set\n visibleAnnotationGroupUIDs: Set\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n presentationStates: dmv.metadata.AdvancedBlendingPresentationState[]\n selectedPresentationStateUID?: string\n selectedFinding?: dcmjs.sr.coding.CodedConcept\n selectedEvaluations: Evaluation[]\n selectedGeometryType?: string\n selectedMarkup?: string\n selectedRoi?: dmv.roi.ROI\n selectedRoiUIDs: Set\n generatedReport?: dmv.metadata.Comprehensive3DSR\n isLoading: boolean\n isAnnotationModalVisible: boolean\n isSelectedRoiModalVisible: boolean\n isHoveredRoiTooltipVisible: boolean\n hoveredRoi?: dmv.roi.ROI\n hoveredRoiAttributes: Array<{ name: string, value: string }>\n hoveredRoiTooltipX: number\n hoveredRoiTooltipY: number\n isReportModalVisible: boolean\n isRoiDrawingActive: boolean\n isRoiModificationActive: boolean\n isRoiTranslationActive: boolean\n isGoToModalVisible: boolean\n isSelectedMagnificationValid: boolean\n isSelectedXCoordinateValid: boolean\n isSelectedYCoordinateValid: boolean\n selectedXCoordinate?: number\n validXCoordinateRange: number[]\n selectedYCoordinate?: number\n validYCoordinateRange: number[]\n selectedMagnification?: number\n areRoisHidden: boolean\n pixelDataStatistics: {\n [opticalPathIdentifier: string]: {\n min: number\n max: number\n numFramesSampled: number\n }\n }\n loadingFrames: Set\n}\n\n/**\n * React component for interactive viewing of an individual digital slide,\n * which corresponds to one DICOM Series of DICOM Slide Microscopy images and\n * potentially one or more associated DICOM Series of DICOM SR documents.\n */\nclass SlideViewer extends React.Component {\n private readonly findingOptions: dcmjs.sr.coding.CodedConcept[] = []\n\n private readonly evaluationOptions: { [key: string]: EvaluationOptions[] } = {}\n\n private readonly measurements: Measurement[] = []\n\n private readonly geometryTypeOptions: { [key: string]: string[] } = {}\n\n private readonly volumeViewportRef: React.RefObject\n\n private readonly labelViewportRef: React.RefObject\n\n private volumeViewer: dmv.viewer.VolumeImageViewer\n\n private labelViewer?: dmv.viewer.LabelImageViewer\n\n private readonly defaultRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n },\n fill: {\n color: DEFAULT_ROI_FILL_COLOR\n },\n image: {\n circle: {\n fill: {\n color: DEFAULT_ROI_STROKE_COLOR\n },\n radius: DEFAULT_ROI_RADIUS\n }\n }\n }\n\n private roiStyles: {[key: string]: dmv.viewer.ROIStyleOptions} = {}\n\n private defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n\n private readonly selectionColor: number[] = [140, 184, 198]\n\n private readonly selectedRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: { color: [...this.selectionColor, 1], width: 3 },\n fill: { color: [...this.selectionColor, 0.2] },\n image: {\n circle: {\n radius: 5,\n fill: { color: [...this.selectionColor, 1] }\n }\n }\n }\n\n constructor (props: SlideViewerProps) {\n super(props)\n console.info(\n `view slide \"${this.props.slide.containerIdentifier}\": `,\n this.props.slide\n )\n const geometryTypeOptions = [\n 'point',\n 'circle',\n 'box',\n 'polygon',\n 'line',\n 'freehandpolygon',\n 'freehandline'\n ]\n props.annotations.forEach((annotation: AnnotationSettings) => {\n const finding = new dcmjs.sr.coding.CodedConcept(annotation.finding)\n this.findingOptions.push(finding)\n const key = _buildKey(finding)\n if (annotation.geometryTypes !== undefined) {\n this.geometryTypeOptions[key] = annotation.geometryTypes\n } else {\n this.geometryTypeOptions[key] = geometryTypeOptions\n }\n this.evaluationOptions[key] = []\n if (annotation.evaluations !== undefined) {\n annotation.evaluations.forEach(evaluation => {\n this.evaluationOptions[key].push({\n name: new dcmjs.sr.coding.CodedConcept(evaluation.name),\n values: evaluation.values.map(value => {\n return new dcmjs.sr.coding.CodedConcept(value)\n })\n })\n })\n }\n if (annotation.measurements !== undefined) {\n annotation.measurements.forEach(measurement => {\n this.measurements.push({\n name: new dcmjs.sr.coding.CodedConcept(measurement.name),\n value: undefined,\n unit: new dcmjs.sr.coding.CodedConcept(measurement.unit)\n })\n })\n }\n if (annotation.style != null) {\n this.roiStyles[key] = _formatRoiStyle(annotation.style)\n } else {\n this.roiStyles[key] = this.defaultRoiStyle\n }\n })\n\n this.componentSetup = this.componentSetup.bind(this)\n this.componentCleanup = this.componentCleanup.bind(this)\n\n this.onWindowResize = this.onWindowResize.bind(this)\n this.handleRoiDrawing = this.handleRoiDrawing.bind(this)\n this.handleRoiTranslation = this.handleRoiTranslation.bind(this)\n this.handleRoiModification = this.handleRoiModification.bind(this)\n this.handleRoiVisibilityChange = this.handleRoiVisibilityChange.bind(this)\n this.handleRoiRemoval = this.handleRoiRemoval.bind(this)\n this.handleRoiSelectionCancellation = this.handleRoiSelectionCancellation.bind(this)\n this.handleAnnotationConfigurationCancellation = this.handleAnnotationConfigurationCancellation.bind(this)\n this.handleAnnotationGeometryTypeSelection = this.handleAnnotationGeometryTypeSelection.bind(this)\n this.handleAnnotationMeasurementActivation = this.handleAnnotationMeasurementActivation.bind(this)\n this.handleAnnotationFindingSelection = this.handleAnnotationFindingSelection.bind(this)\n this.handleAnnotationEvaluationSelection = this.handleAnnotationEvaluationSelection.bind(this)\n this.handleAnnotationEvaluationClearance = this.handleAnnotationEvaluationClearance.bind(this)\n this.handleAnnotationConfigurationCompletion = this.handleAnnotationConfigurationCompletion.bind(this)\n this.handleAnnotationSelection = this.handleAnnotationSelection.bind(this)\n this.handleAnnotationVisibilityChange = this.handleAnnotationVisibilityChange.bind(this)\n this.handleAnnotationGroupVisibilityChange = this.handleAnnotationGroupVisibilityChange.bind(this)\n this.handleAnnotationGroupStyleChange = this.handleAnnotationGroupStyleChange.bind(this)\n this.handleRoiStyleChange = this.handleRoiStyleChange.bind(this)\n this.handleGoTo = this.handleGoTo.bind(this)\n this.handleXCoordinateSelection = this.handleXCoordinateSelection.bind(this)\n this.handleYCoordinateSelection = this.handleYCoordinateSelection.bind(this)\n this.handleMagnificationSelection = this.handleMagnificationSelection.bind(this)\n this.handleSlidePositionSelection = this.handleSlidePositionSelection.bind(this)\n this.handleSlidePositionSelectionCancellation = this.handleSlidePositionSelectionCancellation.bind(this)\n this.handleReportGeneration = this.handleReportGeneration.bind(this)\n this.handleReportVerification = this.handleReportVerification.bind(this)\n this.handleReportCancellation = this.handleReportCancellation.bind(this)\n this.handleSegmentVisibilityChange = this.handleSegmentVisibilityChange.bind(this)\n this.handleSegmentStyleChange = this.handleSegmentStyleChange.bind(this)\n this.handleMappingVisibilityChange = this.handleMappingVisibilityChange.bind(this)\n this.handleMappingStyleChange = this.handleMappingStyleChange.bind(this)\n this.handleOpticalPathVisibilityChange = this.handleOpticalPathVisibilityChange.bind(this)\n this.handleOpticalPathStyleChange = this.handleOpticalPathStyleChange.bind(this)\n this.handleOpticalPathActivityChange = this.handleOpticalPathActivityChange.bind(this)\n this.handlePresentationStateSelection = this.handlePresentationStateSelection.bind(this)\n this.handlePresentationStateReset = this.handlePresentationStateReset.bind(this)\n\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n this.volumeViewportRef = React.createRef()\n this.labelViewportRef = React.createRef()\n\n /**\n * Deactivate all optical paths. Visibility will be set later, potentially\n * using based on available presentation state instances.\n */\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n this.volumeViewer.deactivateOpticalPath(opticalPath.identifier)\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.state = {\n selectedRoiUIDs: new Set(),\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers: new Set(),\n activeOpticalPathIdentifiers: new Set(),\n presentationStates: [],\n selectedFinding: undefined,\n selectedEvaluations: [],\n generatedReport: undefined,\n isLoading: false,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isHoveredRoiTooltipVisible: false,\n hoveredRoiTooltipX: 0,\n hoveredRoiTooltipY: 0,\n hoveredRoiAttributes: [],\n isSelectedMagnificationValid: false,\n isReportModalVisible: false,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n selectedXCoordinate: undefined,\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n selectedYCoordinate: undefined,\n validYCoordinateRange: [offset[1], offset[1] + size[1]],\n selectedMagnification: undefined,\n areRoisHidden: false,\n pixelDataStatistics: {},\n selectedPresentationStateUID: this.props.selectedPresentationStateUID,\n loadingFrames: new Set()\n }\n }\n\n componentDidUpdate (\n previousProps: SlideViewerProps,\n previousState: SlideViewerState\n ): void {\n /** Fetch data and update the viewports if the route has changed (\n * i.e., if another series has been selected) or if the client has changed.\n */\n if (\n this.props.location.pathname !== previousProps.location.pathname ||\n this.props.studyInstanceUID !== previousProps.studyInstanceUID ||\n this.props.seriesInstanceUID !== previousProps.seriesInstanceUID ||\n this.props.slide !== previousProps.slide ||\n this.props.clients !== previousProps.clients\n ) {\n if (this.volumeViewportRef.current != null) {\n this.volumeViewportRef.current.innerHTML = ''\n }\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n if (this.labelViewportRef.current != null) {\n this.labelViewportRef.current.innerHTML = ''\n }\n this.labelViewer.cleanup()\n }\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n\n const activeOpticalPathIdentifiers: Set = new Set()\n const visibleOpticalPathIdentifiers: Set = new Set()\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n const identifier = opticalPath.identifier\n if (this.volumeViewer.isOpticalPathVisible(identifier)) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n if (this.volumeViewer.isOpticalPathActive(identifier)) {\n activeOpticalPathIdentifiers.add(identifier)\n }\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.setState({\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers,\n activeOpticalPathIdentifiers,\n presentationStates: [],\n loadingFrames: new Set(),\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n validYCoordinateRange: [offset[1], offset[1] + size[1]]\n })\n this.populateViewports()\n }\n }\n\n /**\n * Retrieve Presentation State instances that reference the any images of\n * the currently selected series.\n */\n loadPresentationStates = (): void => {\n console.info('search for Presentation State instances')\n const client = this.props.clients[\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE\n ]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'PR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach((rawInstance, index) => {\n const { dataset } = dmv.metadata.formatMetadata(rawInstance)\n const instance = dataset as dmv.metadata.Instance\n console.info(`retrieve PR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n if (this.props.slide.areVolumeImagesMonochrome) {\n const presentationState = (\n dataset as\n unknown as\n dmv.metadata.AdvancedBlendingPresentationState\n )\n let doesMatch = false\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n doesMatch = this.props.slide.seriesInstanceUIDs.includes(\n blendingItem.SeriesInstanceUID\n )\n }\n )\n if (doesMatch) {\n console.info(\n 'include Advanced Blending Presentation State instance ' +\n `\"${presentationState.SOPInstanceUID}\"`\n )\n if (\n index === 0 &&\n this.props.selectedPresentationStateUID == null\n ) {\n this.setPresentationState(presentationState)\n } else {\n if (\n presentationState.SOPInstanceUID ===\n this.props.selectedPresentationStateUID\n ) {\n this.setPresentationState(presentationState)\n }\n }\n this.setState(state => {\n const mapping: {\n [sopInstanceUID: string]:\n dmv.metadata.AdvancedBlendingPresentationState\n } = {}\n state.presentationStates.forEach(instance => {\n mapping[instance.SOPInstanceUID] = instance\n })\n mapping[presentationState.SOPInstanceUID] = presentationState\n return { presentationStates: Object.values(mapping) }\n })\n }\n } else {\n console.info(\n `ignore presentation state \"${instance.SOPInstanceUID}\", ` +\n 'application of presentation states for color images ' +\n 'has not (yet) been implemented'\n )\n }\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n console.error(\n 'failed to load presentation state ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n })\n }\n\n /**\n * Set presentation state as specified by a DICOM Presentation State instance.\n */\n setPresentationState = (\n presentationState: dmv.metadata.AdvancedBlendingPresentationState\n ): void => {\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n console.info(\n `apply Presentation State instance \"${presentationState.SOPInstanceUID}\"`\n )\n const opticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n } | null\n } = {}\n opticalPaths.forEach(opticalPath => {\n // First, deactivate and hide all optical paths and reset style\n const identifier = opticalPath.identifier\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n /**\n * Referenced Instance Sequence should be used instead of Referenced\n * Image Sequence, but that's easy to mix up and we have encountered\n * implementations that get it wrong.\n */\n let refInstanceItems = blendingItem.ReferencedInstanceSequence\n if (refInstanceItems === undefined) {\n refInstanceItems = blendingItem.ReferencedImageSequence\n }\n if (refInstanceItems === undefined) {\n return\n }\n refInstanceItems.forEach(imageItem => {\n const isReferenced = opticalPath.sopInstanceUIDs.includes(\n imageItem.ReferencedSOPInstanceUID\n ) as boolean\n if (isReferenced) {\n let paletteColorLUT\n if (blendingItem.PaletteColorLookupTableSequence != null) {\n const cpLUTItem = blendingItem.PaletteColorLookupTableSequence[0]\n paletteColorLUT = new dmv.color.PaletteColorLookupTable({\n uid: (\n cpLUTItem.PaletteColorLookupTableUID != null\n ? cpLUTItem.PaletteColorLookupTableUID\n : ''\n ),\n redDescriptor:\n cpLUTItem.RedPaletteColorLookupTableDescriptor,\n greenDescriptor:\n cpLUTItem.GreenPaletteColorLookupTableDescriptor,\n blueDescriptor:\n cpLUTItem.BluePaletteColorLookupTableDescriptor,\n redData: (\n (cpLUTItem.RedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.RedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenData: (\n (cpLUTItem.GreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.GreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueData: (\n (cpLUTItem.BluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.BluePaletteColorLookupTableData\n )\n : undefined\n ),\n redSegmentedData: (\n (cpLUTItem.SegmentedRedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedRedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenSegmentedData: (\n (cpLUTItem.SegmentedGreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedGreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueSegmentedData: (\n (cpLUTItem.SegmentedBluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedBluePaletteColorLookupTableData\n )\n : undefined\n )\n })\n }\n\n let limitValues\n if (blendingItem.SoftcopyVOILUTSequence != null) {\n const voiLUTItem = blendingItem.SoftcopyVOILUTSequence[0]\n const windowCenter = voiLUTItem.WindowCenter\n const windowWidth = voiLUTItem.WindowWidth\n limitValues = [\n windowCenter - windowWidth * 0.5,\n windowCenter + windowWidth * 0.5\n ]\n }\n\n opticalPathStyles[identifier] = {\n opacity: 1,\n paletteColorLookupTable: paletteColorLUT,\n limitValues: limitValues\n }\n }\n })\n })\n })\n\n const selectedOpticalPathIdentifiers: Set = new Set()\n Object.keys(opticalPathStyles).forEach(identifier => {\n const styleOptions = opticalPathStyles[identifier]\n if (styleOptions != null) {\n this.volumeViewer.setOpticalPathStyle(identifier, styleOptions)\n this.volumeViewer.activateOpticalPath(identifier)\n this.volumeViewer.showOpticalPath(identifier)\n selectedOpticalPathIdentifiers.add(identifier)\n } else {\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n }\n })\n const searchParams = new URLSearchParams(this.props.location.search)\n searchParams.set('state', presentationState.SOPInstanceUID)\n this.props.navigate(\n {\n pathname: this.props.location.pathname,\n search: searchParams.toString()\n },\n { replace: true }\n )\n this.setState(state => ({\n activeOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n visibleOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n selectedPresentationStateUID: presentationState.SOPInstanceUID\n }))\n }\n\n getRoiStyle = (key?: string): dmv.viewer.ROIStyleOptions => {\n if (key == null) {\n return this.defaultRoiStyle\n }\n if (this.roiStyles[key] !== undefined) {\n return this.roiStyles[key]\n }\n return this.defaultRoiStyle\n }\n\n /**\n * Retrieve Structured Report instances that contain regions of interests\n * with 3D spatial coordinates defined in the same frame of reference as the\n * currently selected series and add them to the VOLUME image viewer.\n */\n addAnnotations = (): void => {\n console.info('search for Comprehensive 3D SR instances')\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach(i => {\n const { dataset } = dmv.metadata.formatMetadata(i)\n const instance = dataset as dmv.metadata.Instance\n if (instance.SOPClassUID === StorageClasses.COMPREHENSIVE_3D_SR) {\n console.info(`retrieve SR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n const report = dataset as unknown as dmv.metadata.Comprehensive3DSR\n /*\n * Perform a couple of checks to ensure the document content of the\n * report fullfils the requirements of the application.\n */\n if (!_implementsTID1500(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it is not structured according to template ' +\n 'TID 1500 \"MeasurementReport\"'\n )\n return\n }\n if (!_describesSpecimenSubject(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not describe a specimen subject'\n )\n return\n }\n if (!_containsROIAnnotations(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not contain any suitable ROI annotations'\n )\n return\n }\n\n const content = new MeasurementReport(report)\n content.ROIs.forEach(roi => {\n console.info(`add ROI \"${roi.uid}\"`)\n const scoord3d = roi.scoord3d\n const image = this.props.slide.volumeImages[0]\n if (scoord3d.frameOfReferenceUID === image.FrameOfReferenceUID) {\n /*\n * ROIs may get assigned new UIDs upon re-rendering of the\n * page and we need to ensure that we don't add them twice.\n * The same ROI may be stored in multiple SR documents and\n * we don't want them to show up twice.\n * TODO: We should probably either \"merge\" measurements and\n * quantitative evaluations or pick the ROI from the \"best\"\n * available report (COMPLETE and VERIFIED).\n */\n const doesROIExist = this.volumeViewer.getAllROIs().some(\n (otherROI: dmv.roi.ROI): boolean => {\n return _areROIsEqual(otherROI, roi)\n }\n )\n if (!doesROIExist) {\n try {\n // Add ROI without style such that it won't be visible.\n this.volumeViewer.addROI(roi, {})\n } catch {\n console.error(`could not add ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(`skip already existing ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(\n `skip ROI \"${roi.uid}\" ` +\n `of SR document \"${report.SOPInstanceUID}\"` +\n 'because it is defined in another frame of reference'\n )\n }\n })\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n console.error(\n 'failed to load ROIs ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n /*\n * React is not aware of the fact that ROIs have been added via the\n * viewer (the viewport is a ref object) and won't show the\n * annotations in the user interface unless an update is forced.\n */\n this.forceUpdate()\n }\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n })\n }\n\n /**\n * Retrieve Microscopy Bulk Simple Annotations instances that contain\n * annotation groups defined in the same frame of reference as the currently\n * selected series and add them to the VOLUME image viewer.\n */\n addAnnotationGroups = (): void => {\n console.info('search for Microscopy Bulk Simple Annotations instances')\n const client = this.props.clients[\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION\n ]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'ANN'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const annotations: dmv.metadata.MicroscopyBulkSimpleAnnotations[] = retrievedMetadata.map(metadata => {\n return new dmv.metadata.MicroscopyBulkSimpleAnnotations({\n metadata\n })\n })\n // annotations = annotations.filter(ann => {\n // const refImage = this.props.slide.volumeImages[0]\n // return (\n // ann.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n // ann.ContainerIdentifier === refImage.ContainerIdentifier\n // )\n // })\n annotations.forEach(ann => {\n try {\n this.volumeViewer.addAnnotationGroups(ann)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Microscopy Bulk Simple Annotations cannot be displayed.'\n )\n )\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n console.error('failed to add annotation groups:', error)\n }\n ann.AnnotationGroupSequence.forEach(item => {\n const annotationGroupUID = item.AnnotationGroupUID\n const finding = item.AnnotationPropertyTypeCodeSequence[0]\n const key = _buildKey(finding)\n const style = this.roiStyles[key]\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (style != null && style.fill != null) {\n this.volumeViewer.setAnnotationGroupStyle(\n annotationGroupUID,\n { color: style.fill.color }\n )\n }\n })\n })\n /*\n * React is not aware of the fact that annotation groups have been\n * added via the viewer (the underlying HTML viewport element is a\n * ref object) and won't show the annotation groups in the user\n * interface unless an update is forced.\n */\n this.forceUpdate()\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Microscopy Bulk Simple Annotations ' +\n 'instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Microscopy Bulk Simple Annotations instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Segmentation instances that contain segments defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addSegmentations = (): void => {\n console.info('search for Segmentation instances')\n const client = this.props.clients[StorageClasses.SEGMENTATION]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SEG'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach((s, i) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const segmentations: dmv.metadata.Segmentation[] = []\n retrievedMetadata.forEach(metadata => {\n const seg = new dmv.metadata.Segmentation({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n seg.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n seg.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n segmentations.push(seg)\n }\n })\n if (segmentations.length > 0) {\n try {\n this.volumeViewer.addSegments(segmentations)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Segmentations cannot be displayed'\n )\n )\n console.error('failed to add segments: ', error)\n }\n /*\n * React is not aware of the fact that segments have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the segments in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Segmentation instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Segmentation instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Parametric Map instances that contain mappings defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addParametricMaps = (): void => {\n console.info('search for Parametric Map instances')\n const client = this.props.clients[StorageClasses.PARAMETRIC_MAP]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'OT'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const parametricMaps: dmv.metadata.ParametricMap[] = []\n retrievedMetadata.forEach(metadata => {\n const pm = new dmv.metadata.ParametricMap({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n pm.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n pm.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n parametricMaps.push(pm)\n } else {\n console.warn(\n `skip Parametric Map instance \"${pm.SOPInstanceUID}\"`\n )\n }\n })\n if (parametricMaps.length > 0) {\n try {\n this.volumeViewer.addParameterMappings(parametricMaps)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Parametric Map cannot be displayed'\n )\n )\n console.error('failed to add mappings: ', error)\n }\n /*\n * React is not aware of the fact that mappings have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the mappings in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Parametric Map instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Parametric Map instances failed.'\n )\n )\n })\n }\n\n /**\n * Populate viewports of the VOLUME and LABEL image viewers.\n */\n populateViewports = (): void => {\n console.info('populate viewports...')\n this.setState({\n isLoading: true,\n presentationStates: []\n })\n\n if (this.volumeViewportRef.current != null) {\n this.volumeViewer.render({ container: this.volumeViewportRef.current })\n }\n if (\n this.labelViewportRef.current != null &&\n this.labelViewer != null\n ) {\n this.labelViewer.render({ container: this.labelViewportRef.current })\n }\n\n // State update will also ensure that the component is re-rendered.\n this.setState({ isLoading: false })\n\n this.setDefaultPresentationState()\n this.loadPresentationStates()\n\n this.addAnnotations()\n this.addAnnotationGroups()\n this.addSegmentations()\n this.addParametricMaps()\n }\n\n onRoiModified = (event: CustomEventInit): void => {\n // Update state to trigger rendering\n this.setState(state => ({\n visibleRoiUIDs: new Set(state.visibleRoiUIDs)\n }))\n }\n\n onWindowResize = (event: Event): void => {\n console.info('resize viewports')\n this.volumeViewer.resize()\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }\n\n onRoiDrawn = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n const selectedFinding = this.state.selectedFinding\n const selectedEvaluations = this.state.selectedEvaluations\n if (roi !== undefined && selectedFinding !== undefined) {\n console.debug(`add ROI \"${roi.uid}\"`)\n const findingItem = new dcmjs.sr.valueTypes.CodeContentItem({\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n }),\n value: selectedFinding,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(findingItem)\n selectedEvaluations.forEach((evaluation: Evaluation) => {\n const item = new dcmjs.sr.valueTypes.CodeContentItem({\n name: evaluation.name,\n value: evaluation.value,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(item)\n })\n const key = _buildKey(selectedFinding)\n const style = this.getRoiStyle(key)\n this.volumeViewer.addROI(roi, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.debug(`could not add ROI \"${roi.uid}\"`)\n }\n }\n\n onRoiDoubleClicked = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n this.setState({\n isSelectedRoiModalVisible: true\n })\n } else {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n }\n\n setHoveredRoiAttributes = (hoveredRoi: dmv.roi.ROI): void => {\n const attributes: Array<{ name: string, value: string }> = []\n hoveredRoi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n\n this.setState({ hoveredRoiAttributes: attributes })\n }\n\n onPointerMove = (event: CustomEventInit): void => {\n const { feature: hoveredRoi, event: evt } = event.detail.payload\n if (hoveredRoi != null) {\n const originalEvent = evt.originalEvent\n this.setHoveredRoiAttributes(hoveredRoi)\n this.setState({\n isHoveredRoiTooltipVisible: true,\n hoveredRoi,\n hoveredRoiTooltipX: originalEvent.clientX,\n hoveredRoiTooltipY: originalEvent.clientY\n })\n } else {\n this.setState({\n isHoveredRoiTooltipVisible: false\n })\n }\n }\n\n onRoiSelected = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n console.debug(`selected ROI \"${selectedRoi.uid}\"`)\n this.volumeViewer.setROIStyle(selectedRoi.uid, this.selectedRoiStyle)\n const key = _getRoiKey(selectedRoi)\n this.volumeViewer.getAllROIs().forEach((roi) => {\n if (roi.uid !== selectedRoi.uid) {\n this.volumeViewer.setROIStyle(roi.uid, this.getRoiStyle(key))\n }\n })\n this.setState({\n selectedRoiUIDs: new Set([selectedRoi.uid]),\n selectedRoi: selectedRoi\n })\n } else {\n this.setState({\n selectedRoiUIDs: new Set(),\n selectedRoi: undefined\n })\n }\n }\n\n handleRoiSelectionCancellation (): void {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n\n onLoadingStarted = (event: CustomEventInit): void => {\n this.setState({ isLoading: true })\n }\n\n onLoadingEnded = (event: CustomEventInit): void => {\n this.setState({ isLoading: false })\n }\n\n onFrameLoadingStarted = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n } = event.detail.payload\n const key: string = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.add(key)\n return state\n })\n }\n\n onFrameLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load frame')\n }\n\n onLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load data')\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const message = (event.detail?.payload?.message === null ? 'Failed to load data' : event.detail?.payload?.message) as string\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n message\n ) as any\n )\n }\n\n onFrameLoadingEnded = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n pixelArray: Uint8Array|Uint16Array|Float32Array|null\n } = event.detail.payload\n const key = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.delete(key)\n let isLoading: boolean = false\n if (state.loadingFrames.size > 0) {\n isLoading = true\n }\n return {\n isLoading,\n loadingFrames: state.loadingFrames\n }\n })\n if (\n frameInfo.sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE &&\n this.props.slide.areVolumeImagesMonochrome\n ) {\n const opticalPathIdentifier = frameInfo.channelIdentifier\n if (\n !(opticalPathIdentifier in this.state.pixelDataStatistics) &&\n frameInfo.pixelArray != null\n ) {\n /*\n * There are limits on the number of arguments Math.min and Math.max\n * functions can accept. Therefore, we compute values in smaller chunks.\n */\n const size = 2 ** 16\n const chunks = Math.ceil(frameInfo.pixelArray.length / size)\n let offset = 0\n const minValues: number[] = []\n const maxValues: number[] = []\n for (let i = 0; i < chunks; i++) {\n offset = i * size\n const pixels = frameInfo.pixelArray.slice(offset, offset + size)\n minValues.push(Math.min(...pixels))\n maxValues.push(Math.max(...pixels))\n }\n const min = Math.min(...minValues)\n const max = Math.max(...maxValues)\n this.setState(state => {\n const stats = state.pixelDataStatistics\n if (stats[opticalPathIdentifier] != null) {\n stats[opticalPathIdentifier] = {\n min: Math.min(stats[opticalPathIdentifier].min, min),\n max: Math.max(stats[opticalPathIdentifier].max, max),\n numFramesSampled: stats[opticalPathIdentifier].numFramesSampled + 1\n }\n } else {\n stats[opticalPathIdentifier] = {\n min: min,\n max: max,\n numFramesSampled: 1\n }\n }\n if (state.selectedPresentationStateUID == null) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(opticalPathIdentifier)\n }\n style.limitValues = [\n stats[opticalPathIdentifier].min,\n stats[opticalPathIdentifier].max\n ]\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, style)\n }\n return state\n })\n }\n }\n }\n\n onRoiRemoved = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n console.debug(`removed ROI \"${roi.uid}\"`)\n }\n\n componentCleanup (): void {\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.removeEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.removeEventListener('resize', this.onWindowResize)\n\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n /*\n * FIXME: React appears to not clean the content of referenced\n * HTMLDivElement objects when the page is reloaded. As a consequence,\n * optical paths and other display items cannot be toggled or updated after\n * a manual page reload. I have tried using ref callbacks and passing the\n * ref objects from the parent component via the props. Both didn't work\n * either.\n */\n }\n\n onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiModificationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiTranslationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.activateSelectInteraction({})\n }\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else if (event.altKey) {\n if (event.code === 'KeyD') {\n this.handleRoiDrawing()\n } else if (event.code === 'KeyM') {\n this.handleRoiModification()\n } else if (event.code === 'KeyT') {\n this.handleRoiTranslation()\n } else if (event.code === 'KeyR') {\n this.handleRoiRemoval()\n } else if (event.code === 'KeyV') {\n this.handleRoiVisibilityChange()\n } else if (event.code === 'KeyS') {\n this.handleReportGeneration()\n } else if (event.code === 'KeyG') {\n this.handleGoTo()\n }\n }\n }\n\n componentWillUnmount (): void {\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n window.removeEventListener('beforeunload', this.componentCleanup)\n }\n\n componentSetup (): void {\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_error',\n this.onLoadingError\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_error',\n this.onFrameLoadingError\n )\n document.body.addEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.addEventListener('beforeunload', this.componentCleanup)\n window.addEventListener('resize', this.onWindowResize)\n }\n\n componentDidMount (): void {\n this.componentSetup()\n this.populateViewports()\n\n if (!this.props.slide.areVolumeImagesMonochrome) {\n let hasICCProfile = false\n const image = this.props.slide.volumeImages[0]\n const metadataItem = image.OpticalPathSequence[0]\n if (metadataItem.ICCProfile == null) {\n if ('OpticalPathSequence' in image.bulkdataReferences) {\n // @ts-expect-error\n const bulkdataItem = image.bulkdataReferences.OpticalPathSequence[0]\n if ('ICCProfile' in bulkdataItem) {\n hasICCProfile = true\n }\n }\n } else {\n hasICCProfile = true\n }\n if (!hasICCProfile) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No ICC Profile was found for color images')\n }\n }\n }\n\n /**\n * Handler that gets called when a finding has been selected for annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationFindingSelection (\n value: string,\n option: any\n ): void {\n this.findingOptions.forEach(finding => {\n if (finding.CodeValue === value) {\n console.info(`selected finding \"${finding.CodeMeaning}\"`)\n this.setState({\n selectedFinding: finding,\n selectedEvaluations: []\n })\n }\n })\n }\n\n /**\n * Handler that gets called when a geometry type has been selected for\n * annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationGeometryTypeSelection (value: string, option: any): void {\n this.setState({ selectedGeometryType: value })\n }\n\n /**\n * Handler that gets called when measurements have been selected for\n * annotation.\n */\n handleAnnotationMeasurementActivation (event: any): void {\n const active: boolean = event.target.checked\n if (active) {\n this.setState({ selectedMarkup: 'measurement' })\n } else {\n this.setState({ selectedMarkup: undefined })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been selected for an\n * annotation.\n *\n * @param value - Code value of the coded evaluation that got selected\n * @param option - Option that got selected\n */\n handleAnnotationEvaluationSelection (\n value: string,\n option: any\n ): void {\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n const name = option.label\n this.evaluationOptions[key].forEach(evaluation => {\n if (\n evaluation.name.CodeValue === name.CodeValue &&\n evaluation.name.CodingSchemeDesignator === name.CodingSchemeDesignator\n ) {\n evaluation.values.forEach(code => {\n if (code.CodeValue === value) {\n const filteredEvaluations = this.state.selectedEvaluations.filter(\n (item: Evaluation) => item.name !== evaluation.name\n )\n this.setState({\n selectedEvaluations: [\n ...filteredEvaluations,\n { name: name, value: code }\n ]\n })\n }\n })\n }\n })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been cleared for an\n * annotation.\n */\n handleAnnotationEvaluationClearance (): void {\n this.setState({\n selectedEvaluations: []\n })\n }\n\n handleXCoordinateSelection (value: any): void {\n if (value != null) {\n const x = Number(value)\n const start = this.state.validXCoordinateRange[0]\n const end = this.state.validXCoordinateRange[1]\n if (x >= start && x <= end) {\n this.setState({\n selectedXCoordinate: x,\n isSelectedXCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedXCoordinate: undefined,\n isSelectedXCoordinateValid: false\n })\n }\n\n handleYCoordinateSelection (value: any): void {\n if (value != null) {\n const y = Number(value)\n const start = this.state.validYCoordinateRange[0]\n const end = this.state.validYCoordinateRange[1]\n if (y >= start && y <= end) {\n this.setState({\n selectedYCoordinate: y,\n isSelectedYCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedYCoordinate: undefined,\n isSelectedYCoordinateValid: false\n })\n }\n\n handleMagnificationSelection (value: any): void {\n if (value != null) {\n if (value > 0 && value <= 40) {\n this.setState({\n selectedMagnification: Number(value),\n isSelectedMagnificationValid: true\n })\n return\n }\n }\n this.setState({\n selectedMagnification: undefined,\n isSelectedMagnificationValid: false\n })\n }\n\n /**\n * Handler that gets called when the selection of slide position was\n * completed.\n */\n handleSlidePositionSelection (): void {\n if (\n this.state.isSelectedXCoordinateValid &&\n this.state.isSelectedYCoordinateValid &&\n this.state.isSelectedMagnificationValid &&\n this.state.selectedXCoordinate != null &&\n this.state.selectedYCoordinate != null &&\n this.state.selectedMagnification != null\n ) {\n console.info(\n 'select slide position ' +\n `(${this.state.selectedXCoordinate}, ` +\n `${this.state.selectedYCoordinate}) ` +\n `at ${this.state.selectedMagnification}x magnification`\n )\n\n const factor = this.state.selectedMagnification\n /**\n * On an optical microscope an objective with 1x magnification\n * corresponds to approximately 10 micrometer pixel spacing\n * (due to the ocular).\n */\n const targetPixelSpacing = 0.01 / factor\n const diffs = []\n for (let i = 0; i < this.volumeViewer.numLevels; i++) {\n const actualPixelSpacing = this.volumeViewer.getPixelSpacing(i)[0]\n diffs.push(Math.abs(targetPixelSpacing - actualPixelSpacing))\n }\n const level = diffs.indexOf(Math.min(...diffs))\n this.volumeViewer.navigate({\n position: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate\n ],\n level: level\n })\n const point = new dmv.scoord3d.Point({\n coordinates: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate,\n 0\n ],\n frameOfReferenceUID: this.volumeViewer.frameOfReferenceUID\n })\n const roi = new dmv.roi.ROI({ scoord3d: point })\n this.volumeViewer.addROI(roi, this.defaultRoiStyle)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return {\n visibleRoiUIDs,\n isGoToModalVisible: false\n }\n })\n }\n }\n\n /**\n * Handler that gets called when the selection of a slide position was\n * canceled.\n */\n handleSlidePositionSelectionCancellation (): void {\n console.log('cancel slide position selection')\n this.setState({\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n isSelectedMagnificationValid: false,\n selectedXCoordinate: undefined,\n selectedYCoordinate: undefined,\n selectedMagnification: undefined\n })\n }\n\n /**\n * Handler that gets called when annotation configuration has been completed.\n */\n handleAnnotationConfigurationCompletion (): void {\n console.debug('complete annotation configuration')\n const finding = this.state.selectedFinding\n const geometryType = this.state.selectedGeometryType\n const markup = this.state.selectedMarkup\n if (geometryType !== undefined && finding !== undefined) {\n this.volumeViewer.activateDrawInteraction({ geometryType, markup })\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: true\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Could not complete annotation configuration'\n )\n )\n }\n }\n\n /**\n * Handler that gets called when annotation configuration has been cancelled.\n */\n handleAnnotationConfigurationCancellation (): void {\n console.debug('cancel annotation configuration')\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that gets called when a report should be generated for the current\n * set of annotations.\n */\n handleReportGeneration (): void {\n console.info('save ROIs')\n const rois = this.volumeViewer.getAllROIs()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n const metadata = this.volumeViewer.getOpticalPathMetadata(\n opticalPaths[0].identifier\n )\n // Metadata should be sorted such that the image with the highest\n // resolution is the last item in the array.\n const refImage = metadata[metadata.length - 1]\n // We assume that there is only one specimen (tissue section) per\n // ontainer (slide). Only the tissue section is tracked with a unique\n // identifier, even if the section may be composed of different biological\n // samples.\n if (refImage.SpecimenDescriptionSequence.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'More than one specimen has been described for the slide'\n )\n )\n }\n const refSpecimen = refImage.SpecimenDescriptionSequence[0]\n\n console.debug('create Observation Context')\n let observer\n if (this.props.user !== undefined) {\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: this.props.user.name,\n loginName: this.props.user.email\n })\n } else {\n console.warn('no user information available')\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: 'ANONYMOUS'\n })\n }\n const observationContext = new dcmjs.sr.templates.ObservationContext({\n observerPersonContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121006',\n schemeDesignator: 'DCM',\n meaning: 'Person'\n }),\n observerIdentifyingAttributes: observer\n }),\n observerDeviceContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121007',\n schemeDesignator: 'DCM',\n meaning: 'Device'\n }),\n observerIdentifyingAttributes:\n new dcmjs.sr.templates.DeviceObserverIdentifyingAttributes({\n uid: this.props.app.uid,\n manufacturerName: 'MGH Computational Pathology',\n modelName: this.props.app.name\n })\n }),\n subjectContext: new dcmjs.sr.templates.SubjectContext({\n subjectClass: new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n schemeDesignator: 'DCM',\n meaning: 'Specimen'\n }),\n subjectClassSpecificContext:\n new dcmjs.sr.templates.SubjectContextSpecimen({\n uid: refSpecimen.SpecimenUID,\n identifier: refSpecimen.SpecimenIdentifier,\n containerIdentifier: refImage.ContainerIdentifier\n })\n })\n })\n\n console.debug('encode Imaging Measurements')\n const imagingMeasurements: dcmjs.sr.valueTypes.ContainerContentItem[] = []\n for (let i = 0; i < rois.length; i++) {\n const roi = rois[i]\n if (!this.state.visibleRoiUIDs.has(roi.uid)) {\n continue\n }\n let findingType = roi.evaluations.find(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue === '121071'\n }\n )\n if (findingType === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `No finding type was specified for ROI \"${roi.uid}\"`\n )\n )\n }\n findingType = findingType as dcmjs.sr.valueTypes.CodeContentItem\n const group = new dcmjs.sr.templates.PlanarROIMeasurementsAndQualitativeEvaluations({\n trackingIdentifier: new dcmjs.sr.templates.TrackingIdentifier({\n uid: roi.properties.trackingUID ?? roi.uid,\n identifier: `ROI #${i + 1}`\n }),\n referencedRegion: new dcmjs.sr.contentItems.ImageRegion3D({\n graphicType: roi.scoord3d.graphicType,\n graphicData: roi.scoord3d.graphicData,\n frameOfReferenceUID: roi.scoord3d.frameOfReferenceUID\n }),\n findingType: new dcmjs.sr.coding.CodedConcept({\n value: findingType.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n findingType.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: findingType.ConceptCodeSequence[0].CodeMeaning\n }),\n qualitativeEvaluations: roi.evaluations.filter(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue !== '121071'\n }\n ),\n measurements: roi.measurements\n })\n const measurements = group as dcmjs.sr.valueTypes.ContainerContentItem[]\n measurements[0].ContentTemplateSequence = [{\n MappingResource: 'DCMR',\n TemplateIdentifier: '1410'\n }]\n imagingMeasurements.push(...measurements)\n }\n\n console.debug('create Measurement Report document content')\n const measurementReport = new dcmjs.sr.templates.MeasurementReport({\n languageOfContentItemAndDescendants: new dcmjs.sr.templates.LanguageOfContentItemAndDescendants({}),\n observationContext: observationContext,\n procedureReported: new dcmjs.sr.coding.CodedConcept({\n value: '112703',\n schemeDesignator: 'DCM',\n meaning: 'Whole Slide Imaging'\n }),\n imagingMeasurements: imagingMeasurements\n })\n\n console.info('create Comprehensive 3D SR document')\n const dataset = new dcmjs.sr.documents.Comprehensive3DSR({\n content: measurementReport[0],\n evidence: [refImage],\n seriesInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n seriesNumber: 1,\n seriesDescription: 'Annotation',\n sopInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n instanceNumber: 1,\n manufacturer: 'MGH Computational Pathology',\n previousVersions: undefined // TODO\n })\n\n this.setState({\n isReportModalVisible: true,\n generatedReport: dataset as dmv.metadata.Comprehensive3DSR\n })\n }\n\n /**\n * Handler that gets called when a report should be verified. The current\n * list of annotations will be presented to the user together with other\n * pertinent metadata about the patient, study, and specimen.\n */\n handleReportVerification (): void {\n console.info('verfied report')\n\n const report = this.state.generatedReport\n if (report !== undefined) {\n const dataset = report as unknown as dmv.metadata.Comprehensive3DSR\n console.debug('create File Meta Information')\n const fileMetaInformationVersionArray = new Uint8Array(2)\n fileMetaInformationVersionArray[1] = 1\n const fileMeta = {\n // FileMetaInformationVersion\n '00020001': {\n Value: [fileMetaInformationVersionArray.buffer],\n vr: 'OB'\n },\n // MediaStorageSOPClassUID\n '00020002': {\n Value: [dataset.SOPClassUID],\n vr: 'UI'\n },\n // MediaStorageSOPInstanceUID\n '00020003': {\n Value: [dataset.SOPInstanceUID],\n vr: 'UI'\n },\n // TransferSyntaxUID\n '00020010': {\n Value: ['1.2.840.10008.1.2.1'],\n vr: 'UI'\n },\n // ImplementationClassUID\n '00020012': {\n Value: [this.props.app.uid],\n vr: 'UI'\n }\n }\n\n console.info('store Comprehensive 3D SR document')\n const writer = new dcmjs.data.DicomDict(fileMeta)\n writer.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset)\n const buffer = writer.write()\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.storeInstances({ datasets: [buffer] }).then(\n (response: any) => message.info('Annotations were saved.')\n ).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Annotations could not be saved'\n )\n )\n })\n }\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when report generation has been cancelled.\n */\n handleReportCancellation (): void {\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when an annotation has been selected from the\n * current list of annotations.\n */\n handleAnnotationSelection ({ roiUID }: { roiUID: string }): void {\n console.log(`selected ROI ${roiUID}`)\n this.setState({ selectedRoiUIDs: new Set([roiUID]) })\n this.volumeViewer.getAllROIs().forEach((roi) => {\n let style = {}\n if (roi.uid === roiUID) {\n style = this.selectedRoiStyle\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n if (this.state.visibleRoiUIDs.has(roi.uid)) {\n const key = _getRoiKey(roi)\n style = this.getRoiStyle(key)\n }\n }\n this.volumeViewer.setROIStyle(roi.uid, style)\n })\n }\n\n /**\n * Handle toggling of annotation visibility, i.e., whether a given\n * annotation should be either displayed or hidden by the viewer.\n */\n handleAnnotationVisibilityChange ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }): void {\n if (isVisible) {\n console.info(`show ROI ${roiUID}`)\n const roi = this.volumeViewer.getROI(roiUID)\n const key = _getRoiKey(roi)\n const style = this.getRoiStyle(key)\n this.volumeViewer.setROIStyle(roi.uid, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.info(`hide ROI ${roiUID}`)\n this.setState(state => {\n const selectedRoiUIDs = state.selectedRoiUIDs\n selectedRoiUIDs.delete(roiUID)\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.delete(roiUID)\n return { visibleRoiUIDs, selectedRoiUIDs }\n })\n this.volumeViewer.setROIStyle(roiUID, {})\n }\n }\n\n /**\n * Handle toggling of annotation group visibility, i.e., whether a given\n * annotation group should be either displayed or hidden by the viewer.\n */\n handleAnnotationGroupVisibilityChange ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of annotation group ${annotationGroupUID}`)\n if (isVisible) {\n console.info(`show annotation group ${annotationGroupUID}`)\n try {\n this.volumeViewer.showAnnotationGroup(annotationGroupUID)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to show annotation group.'\n )\n )\n throw error\n }\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.add(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n } else {\n console.info(`hide annotation group ${annotationGroupUID}`)\n this.volumeViewer.hideAnnotationGroup(annotationGroupUID)\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.delete(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n }\n }\n\n /**\n * Handle change of annotation group style.\n */\n handleAnnotationGroupStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }): void {\n console.log(`change style of annotation group ${uid}`)\n try {\n this.volumeViewer.setAnnotationGroupStyle(\n uid,\n styleOptions\n )\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of annotation group.'\n )\n )\n throw error\n }\n }\n\n generateRoiStyle (\n styleOptions: {\n opacity?: number\n color?: number[]\n }): dmv.viewer.ROIStyleOptions {\n const opacity = styleOptions.opacity ?? DEFAULT_ANNOTATION_OPACITY\n const strokeColor = styleOptions.color ?? DEFAULT_ANNOTATION_STROKE_COLOR\n const fillColor = strokeColor.map((c) => Math.min(c + 25, 255))\n const style = _formatRoiStyle({\n fill: { color: [...fillColor, opacity] },\n stroke: { color: [...strokeColor, opacity] },\n radius: this.defaultRoiStyle.stroke?.width\n })\n return style\n }\n\n handleRoiStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity: number\n color: number[]\n }\n }): void {\n console.log(`change style of ROI ${uid}`)\n try {\n this.defaultAnnotationStyles[uid] = styleOptions\n const style = this.generateRoiStyle(styleOptions)\n\n const roi = this.volumeViewer.getROI(uid)\n const key = _getRoiKey(roi) as string\n this.roiStyles[key] = style\n this.volumeViewer.setROIStyle(uid, style)\n this.state.visibleRoiUIDs.add(uid)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of ROI.'\n )\n )\n throw error\n }\n }\n\n /**\n * Handle toggling of segment visibility, i.e., whether a given\n * segment should be either displayed or hidden by the viewer.\n */\n handleSegmentVisibilityChange ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of segment ${segmentUID}`)\n if (isVisible) {\n console.info(`show segment ${segmentUID}`)\n this.volumeViewer.showSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.add(segmentUID)\n return { visibleSegmentUIDs }\n })\n } else {\n console.info(`hide segment ${segmentUID}`)\n this.volumeViewer.hideSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.delete(segmentUID)\n return { visibleSegmentUIDs }\n })\n }\n }\n\n /**\n * Handle change of segment style.\n */\n handleSegmentStyleChange ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of segment ${segmentUID}`)\n this.volumeViewer.setSegmentStyle(segmentUID, styleOptions)\n }\n\n /**\n * Handle toggling of mapping visibility, i.e., whether a given\n * mapping should be either displayed or hidden by the viewer.\n */\n handleMappingVisibilityChange ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of mapping ${mappingUID}`)\n if (isVisible) {\n console.info(`show mapping ${mappingUID}`)\n this.volumeViewer.showParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.add(mappingUID)\n return { visibleMappingUIDs }\n })\n } else {\n console.info(`hide mapping ${mappingUID}`)\n this.volumeViewer.hideParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.delete(mappingUID)\n return { visibleMappingUIDs }\n })\n }\n }\n\n /**\n * Handle change of mapping style.\n */\n handleMappingStyleChange ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of mapping ${mappingUID}`)\n this.volumeViewer.setParameterMappingStyle(mappingUID, styleOptions)\n }\n\n /**\n * Handle toggling of optical path visibility, i.e., whether a given\n * optical path should be either displayed or hidden by the viewer.\n */\n handleOpticalPathVisibilityChange ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of optical path ${opticalPathIdentifier}`)\n if (isVisible) {\n console.info(`show optical path ${opticalPathIdentifier}`)\n this.volumeViewer.showOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n } else {\n console.info(`hide optical path ${opticalPathIdentifier}`)\n this.volumeViewer.hideOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Handle change of optical path style.\n */\n handleOpticalPathStyleChange ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }): void {\n console.log(`change style of optical path ${opticalPathIdentifier}`)\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, styleOptions)\n }\n\n /**\n * Handle toggling of optical path activity, i.e., whether a given\n * optical path should be either added or removed from the viewport.\n */\n handleOpticalPathActivityChange ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }): void {\n console.log(`change activity of optical path ${opticalPathIdentifier}`)\n if (isActive) {\n console.info(`activate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.activateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n } else {\n console.info(`deactivate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.deactivateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Set default presentation state that is either defined by metadata included\n * in the DICOM Slide Microscopy instance or by the viewer.\n */\n setDefaultPresentationState (): void {\n const visibleOpticalPathIdentifiers: Set = new Set()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n if (item.isMonochromatic) {\n /*\n * If the image metadata contains a palette color lookup table for the\n * optical path, then it will be displayed by default.\n */\n if (item.paletteColorLookupTableUID != null) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n } else {\n /* Color images will always be displayed by default. */\n visibleOpticalPathIdentifiers.add(identifier)\n }\n })\n\n /*\n * If no optical paths have been selected for visualization so far, select\n * first n optical paths and set a default value of interest (VOI) window\n * (using pre-computed pixel data statistics) and a default color.\n */\n if (visibleOpticalPathIdentifiers.size === 0) {\n const defaultColors = [\n [255, 255, 255]\n ]\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n if (item.isMonochromatic) {\n const numVisible = visibleOpticalPathIdentifiers.size\n if (numVisible < defaultColors.length) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n const index = numVisible\n style.color = defaultColors[index]\n const stats = this.state.pixelDataStatistics[item.identifier]\n if (stats != null) {\n style.limitValues = [stats.min, stats.max]\n }\n this.volumeViewer.setOpticalPathStyle(item.identifier, style)\n visibleOpticalPathIdentifiers.add(item.identifier)\n }\n }\n })\n }\n\n console.info(\n `selected n=${visibleOpticalPathIdentifiers.size} optical paths ` +\n 'for visualization'\n )\n visibleOpticalPathIdentifiers.forEach(identifier => {\n this.volumeViewer.showOpticalPath(identifier)\n })\n this.setState(state => ({\n activeOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers),\n visibleOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers)\n }))\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateReset (): void {\n this.setState({ selectedPresentationStateUID: undefined })\n const urlPath = this.props.location.pathname\n this.props.navigate(urlPath)\n this.setDefaultPresentationState()\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateSelection (\n value?: string,\n option?: any\n ): void {\n if (value != null) {\n console.info(`select Presentation State instance \"${value}\"`)\n let presentationState\n this.state.presentationStates.forEach(instance => {\n if (instance.SOPInstanceUID === value) {\n presentationState = instance\n }\n })\n if (presentationState != null) {\n let urlPath = this.props.location.pathname\n urlPath += `?state=${value}`\n this.props.navigate(urlPath)\n this.setPresentationState(presentationState)\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be found'\n )\n )\n console.log(\n 'failed to handle section of presentation state: ' +\n `could not find instance \"${value}\"`\n )\n }\n } else {\n this.handlePresentationStateReset()\n }\n this.setState({ selectedPresentationStateUID: value })\n }\n\n /**\n * Handler that will toggle the ROI drawing tool, i.e., either activate or\n * de-activate it, depending on its current state.\n */\n handleRoiDrawing (): void {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else {\n console.info('activate drawing of ROIs')\n this.setState({\n isAnnotationModalVisible: true,\n isSelectedRoiModalVisible: false,\n isRoiDrawingActive: true,\n isRoiModificationActive: false,\n isRoiTranslationActive: false,\n isGoToModalVisible: false\n })\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n }\n }\n\n /**\n * Handler that will toggle the ROI modification tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiModification (): void {\n console.info('toggle modification of ROIs')\n if (this.volumeViewer.isModifyInteractionActive) {\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiModificationActive: true,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false\n })\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateSnapInteraction({})\n this.volumeViewer.activateModifyInteraction({})\n }\n }\n\n /**\n * Handler that will toggle the ROI translation tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiTranslation (): void {\n console.info('toggle translation of ROIs')\n if (this.volumeViewer.isTranslateInteractionActive) {\n this.volumeViewer.deactivateTranslateInteraction()\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiTranslationActive: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateTranslateInteraction({})\n }\n }\n\n handleGoTo (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.setState({\n isGoToModalVisible: true,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isReportModalVisible: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that will toggle the ROI removal tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiRemoval (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n if (this.state.selectedRoiUIDs.size > 0) {\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No annotation was selected for removal')\n return\n }\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.info('Annotation was removed')\n })\n this.setState({\n selectedRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.state.visibleRoiUIDs.forEach(uid => {\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n })\n this.setState({\n visibleRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n }\n this.volumeViewer.activateSelectInteraction({})\n }\n\n /**\n * Handler that will toggle the ROI visibility tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiVisibilityChange (): void {\n console.info('toggle visibility of ROIs')\n if (this.volumeViewer.areROIsVisible) {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.hideROIs()\n this.setState({\n areRoisHidden: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isRoiTranslationActive: false\n })\n } else {\n this.volumeViewer.showROIs()\n this.volumeViewer.activateSelectInteraction({})\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid !== undefined) {\n this.volumeViewer.setROIStyle(uid, this.selectedRoiStyle)\n }\n })\n this.setState({ areRoisHidden: false })\n }\n }\n\n render (): React.ReactNode {\n const rois: dmv.roi.ROI[] = []\n const segments: dmv.segment.Segment[] = []\n const mappings: dmv.mapping.ParameterMapping[] = []\n const annotationGroups: dmv.annotation.AnnotationGroup[] = []\n rois.push(...this.volumeViewer.getAllROIs())\n segments.push(...this.volumeViewer.getAllSegments())\n mappings.push(...this.volumeViewer.getAllParameterMappings())\n const allAnnotationGroups = this.volumeViewer.getAllAnnotationGroups()\n const filteredAnnotationGroups = allAnnotationGroups?.filter((annotationGroup) =>\n annotationGroup.referencedSeriesInstanceUID === this.props.seriesInstanceUID\n )\n annotationGroups.push(...filteredAnnotationGroups)\n\n const annotations = rois.map(roi => adaptRoiToAnnotation(roi))\n\n const openSubMenuItems = [\n 'specimens', 'optical-paths', 'annotations', 'presentation-states'\n ]\n\n let report: React.ReactNode\n const dataset = this.state.generatedReport\n if (dataset !== undefined) {\n report = \n }\n\n let annotationMenuItems: React.ReactNode\n if (rois.length > 0) {\n annotationMenuItems = (\n \n )\n }\n\n const findingOptions = this.findingOptions.map(finding => {\n return (\n \n {finding.CodeMeaning}\n \n )\n })\n\n const geometryTypeOptionsMapping: { [key: string]: React.ReactNode } = {\n point: Point,\n circle: Circle,\n box: Box,\n polygon: Polygon,\n line: Line,\n freehandpolygon: (\n \n Polygon (freehand)\n \n ),\n freehandline: (\n \n Line (freehand)\n \n )\n }\n\n const annotationConfigurations: React.ReactNode[] = [\n (\n \n {findingOptions}\n \n )\n ]\n\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n this.evaluationOptions[key].forEach(evaluation => {\n const evaluationOptions = evaluation.values.map(code => {\n return (\n \n {code.CodeMeaning}\n \n )\n })\n annotationConfigurations.push(\n <>\n {evaluation.name.CodeMeaning}\n \n {evaluationOptions}\n \n \n )\n })\n const geometryTypeOptions = this.geometryTypeOptions[key].map(name => {\n return geometryTypeOptionsMapping[name]\n })\n annotationConfigurations.push(\n <>\n ROI geometry type\n \n {geometryTypeOptions}\n \n \n )\n annotationConfigurations.push(\n \n measure\n \n )\n }\n\n const specimenMenu = (\n \n \n \n )\n\n const equipmentMenu = (\n \n \n \n )\n\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n const opticalPathStyles: {\n [identifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n } = {}\n const opticalPathMetadata: {\n [identifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n } = {}\n opticalPaths.forEach(opticalPath => {\n const identifier = opticalPath.identifier\n const metadata = this.volumeViewer.getOpticalPathMetadata(identifier)\n opticalPathMetadata[identifier] = metadata\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n opticalPathStyles[identifier] = style\n })\n const opticalPathMenu = (\n \n \n \n )\n\n let presentationStateMenu\n if (this.state.presentationStates.length > 0) {\n const presentationStateOptions = []\n this.state.presentationStates.forEach(instance => {\n presentationStateOptions.push(\n \n {instance.ContentDescription}\n \n )\n })\n presentationStateOptions.push(\n \n <>\n \n )\n presentationStateMenu = (\n \n \n \n {presentationStateOptions}\n \n \n }\n type='primary'\n onClick={this.handlePresentationStateReset}\n />\n \n \n \n )\n }\n\n let segmentationMenu\n if (segments.length > 0) {\n const defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n } = {}\n const segmentMetadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n } = {}\n const segments = this.volumeViewer.getAllSegments()\n segments.forEach(segment => {\n defaultSegmentStyles[segment.uid] = this.volumeViewer.getSegmentStyle(\n segment.uid\n )\n segmentMetadata[segment.uid] = this.volumeViewer.getSegmentMetadata(\n segment.uid\n )\n })\n segmentationMenu = (\n \n \n \n )\n openSubMenuItems.push('segmentations')\n }\n\n let parametricMapMenu\n if (mappings.length > 0) {\n const defaultMappingStyles: {\n [mappingUID: string]: {\n opacity: number\n }\n } = {}\n const mappingMetadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n } = {}\n mappings.forEach(mapping => {\n defaultMappingStyles[mapping.uid] = this.volumeViewer.getParameterMappingStyle(\n mapping.uid\n )\n mappingMetadata[mapping.uid] = this.volumeViewer.getParameterMappingMetadata(\n mapping.uid\n )\n })\n parametricMapMenu = (\n \n \n \n )\n openSubMenuItems.push('parametric-maps')\n }\n\n let annotationGroupMenu\n\n if (annotations.length > 0) {\n annotations.forEach((annotation) => {\n const roi = this.volumeViewer.getROI(annotation.uid)\n const key = _getRoiKey(roi) as string\n const color = this.roiStyles[key] !== undefined\n ? this.roiStyles[key].stroke?.color.slice(0, 3)\n : DEFAULT_ANNOTATION_COLOR_PALETTE[\n Object.keys(this.roiStyles).length % DEFAULT_ANNOTATION_COLOR_PALETTE.length\n ]\n this.defaultAnnotationStyles[annotation.uid] = {\n color,\n opacity: DEFAULT_ANNOTATION_OPACITY\n } as any\n\n this.roiStyles[key] = this.generateRoiStyle(\n this.defaultAnnotationStyles[annotation.uid]\n )\n })\n }\n\n if (annotationGroups.length > 0) {\n const annotationGroupMetadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n } = {}\n const defaultAnnotationGroupStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n annotationGroups.forEach(annotationGroup => {\n defaultAnnotationGroupStyles[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupStyle(\n annotationGroup.uid\n )\n annotationGroupMetadata[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupMetadata(\n annotationGroup.uid\n )\n })\n annotationGroupMenu = (\n \n \n \n )\n openSubMenuItems.push('annotationGroups')\n }\n\n let toolbar\n let toolbarHeight = '0px'\n const annotationTools = [\n ,\n ,\n ,\n ,\n ,\n \n ]\n const controlTools = [\n \n ]\n if (this.props.enableAnnotationTools) {\n toolbar = (\n \n {annotationTools.map((item, i) => {\n return {item}\n })}\n {controlTools.map((item, i) => {\n return {item}\n })}\n \n )\n toolbarHeight = '50px'\n }\n\n let cursor = 'default'\n if (this.state.isLoading) {\n cursor = 'progress'\n }\n\n let selectedRoiInformation\n if (this.state.selectedRoi != null) {\n const roiAttributes: Array<{\n name: string\n value: string\n unit?: string\n }> = [\n {\n name: 'UID',\n value: this.state.selectedRoi.uid\n }\n ]\n const roiScoordAttributes: Array<{\n name: string\n value: string\n }> = [\n {\n name: 'Graphic type',\n value: this.state.selectedRoi.scoord3d.graphicType\n }\n ]\n const roiEvaluationAttributes: Array<{\n name: string\n value: string\n }> = []\n this.state.selectedRoi.evaluations.forEach(item => {\n if (item.ValueType === 'CODE') {\n const codeItem = item as dcmjs.sr.valueTypes.CodeContentItem\n roiEvaluationAttributes.push({\n name: codeItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: codeItem.ConceptCodeSequence[0].CodeMeaning\n })\n } else {\n const textItem = item as dcmjs.sr.valueTypes.TextContentItem\n roiEvaluationAttributes.push({\n name: textItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: textItem.TextValue\n })\n }\n })\n const roiMeasurmentAttributesPerOpticalPath: {\n [identifier: string]: Array<{\n name: string\n value: string\n unit?: string\n }>\n } = {}\n this.state.selectedRoi.measurements.forEach(item => {\n let identifier = 'default'\n if (item.ContentSequence != null) {\n const refItems = findContentItemsByName({\n content: item.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121112',\n meaning: 'Source of Measurement',\n schemeDesignator: 'DCM'\n })\n })\n if (refItems.length > 0) {\n identifier = (\n refItems[0]\n // @ts-expect-error\n .ReferencedSOPSequence[0]\n .ReferencedOpticalPathIdentifier\n )\n }\n }\n if (!(identifier in roiMeasurmentAttributesPerOpticalPath)) {\n roiMeasurmentAttributesPerOpticalPath[identifier] = []\n }\n const measuredValueItem = item.MeasuredValueSequence[0]\n roiMeasurmentAttributesPerOpticalPath[identifier].push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: measuredValueItem.NumericValue.toString(),\n unit: measuredValueItem.MeasurementUnitsCodeSequence[0].CodeMeaning\n })\n })\n const createRoiDescription = (\n attributes: Array<{ name: string, value: string, unit?: string }>\n ): React.ReactNode[] => {\n return attributes.map(item => {\n let value\n if (item.unit != null) {\n value = `${item.value} [${item.unit}]`\n } else {\n value = item.value\n }\n return (\n \n {value}\n \n )\n })\n }\n const roiDescriptions = createRoiDescription(roiAttributes)\n const roiScoordDescriptions = createRoiDescription(\n roiScoordAttributes\n )\n const roiEvaluationDescriptions = createRoiDescription(\n roiEvaluationAttributes\n )\n const roiMeasurementDescriptions = []\n for (const identifier in roiMeasurmentAttributesPerOpticalPath) {\n const descriptions = createRoiDescription(\n roiMeasurmentAttributesPerOpticalPath[identifier]\n )\n if (identifier === 'default') {\n roiMeasurementDescriptions.push(descriptions)\n } else {\n roiMeasurementDescriptions.push(\n <>\n \n {identifier}\n \n {descriptions}\n \n )\n }\n }\n selectedRoiInformation = (\n <>\n \n {roiDescriptions}\n \n \n Spatial coordinates\n \n \n {roiScoordDescriptions}\n \n \n Evaluations\n \n \n {roiEvaluationDescriptions}\n \n \n Measurements\n \n \n {roiMeasurementDescriptions}\n \n \n )\n }\n\n return (\n \n \n {toolbar}\n\n \n\n \n \n {annotationConfigurations}\n \n \n\n \n \n {selectedRoiInformation}\n \n \n\n \n \n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n \n\n \n {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(() => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }, 100)\n }}\n >\n {this.labelViewportRef.current != null && (\n \n \n \n \n \n )}\n {specimenMenu}\n {equipmentMenu}\n {opticalPathMenu}\n {presentationStateMenu}\n \n {annotationMenuItems}\n \n {annotationGroupMenu}\n {annotations.length === 0\n ? (\n <>\n )\n : (\n \n \n \n )}\n {segmentationMenu}\n {parametricMapMenu}\n \n \n {this.state.isHoveredRoiTooltipVisible &&\n this.state.hoveredRoiAttributes.length > 0\n ? (\n \n )\n : (\n <>\n )}\n \n )\n }\n}\n\nexport default withRouter(SlideViewer)\n","import * as dmv from 'dicom-microscopy-viewer'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nenum ImageFlavors {\n VOLUME = 'VOLUME',\n LABEL = 'LABEL',\n OVERVIEW = 'OVERVIEW',\n THUMBNAIL = 'THUMBNAIL'\n}\n\nconst hasImageFlavor = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n imageFlavor: ImageFlavors\n): boolean => {\n return image.ImageType[2] === imageFlavor\n}\n\nconst areSameAcquisition = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n refImage: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean => {\n if (image.AcquisitionUID != null) {\n return image.AcquisitionUID === refImage.AcquisitionUID\n }\n return false\n}\n\ninterface SlideImageCollection {\n acquisitionUID?: string\n frameOfReferenceUID: string\n containerIdentifier: string\n volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n}\n\ninterface SlideOptions {\n images: dmv.metadata.VLWholeSlideMicroscopyImage[]\n description?: string\n}\n\n/**\n * Slide - collection of images with the same Frame of Reference UID and\n * Container Identifier.\n */\nclass Slide {\n readonly description: string\n readonly acquisitionUID: string | null | undefined\n readonly frameOfReferenceUID: string\n readonly containerIdentifier: string\n readonly seriesInstanceUIDs: string[]\n readonly opticalPathIdentifiers: string[]\n readonly pyramidUIDs: string[] = []\n readonly areVolumeImagesMonochrome: boolean\n readonly volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n\n /**\n * @param options\n * @param options.images - Metadata of images associated with the slide\n * @param options.description - Description of the slide\n */\n constructor (\n options: SlideOptions\n ) {\n if (options.images.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Value of option \"images\" have been non-zero length.'\n )\n )\n }\n\n const seriesInstanceUIDs = new Set([] as string[])\n const acquisitionUIDs = new Set([] as string[])\n const opticalPathIdentifiers = new Set([] as string[])\n const containerIdentifiers = new Set([] as string[])\n const frameOfReferenceUIDs = {\n VOLUME: new Set([] as string[]),\n LABEL: new Set([] as string[]),\n OVERVIEW: new Set([] as string[])\n }\n const pyramidUIDs: {\n [key: string]: { [opticalPathIdentifier: string]: Set }\n } = {\n VOLUME: {}\n }\n const volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n options.images.forEach((image) => {\n containerIdentifiers.add(image.ContainerIdentifier)\n seriesInstanceUIDs.add(image.SeriesInstanceUID)\n image.OpticalPathSequence.forEach(item => {\n opticalPathIdentifiers.add(item.OpticalPathIdentifier)\n })\n if (image.AcquisitionUID != null) {\n acquisitionUIDs.add(image.AcquisitionUID)\n }\n if (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n ) {\n frameOfReferenceUIDs.VOLUME.add(image.FrameOfReferenceUID)\n if (image.PyramidUID != null) {\n for (const identifier in opticalPathIdentifiers) {\n pyramidUIDs.VOLUME[identifier].add(image.PyramidUID)\n }\n }\n volumeImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.LABEL)) {\n frameOfReferenceUIDs.LABEL.add(image.FrameOfReferenceUID)\n labelImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.OVERVIEW)) {\n frameOfReferenceUIDs.OVERVIEW.add(image.FrameOfReferenceUID)\n overviewImages.push(image)\n }\n })\n if (volumeImages.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'At least one VOLUME image must be provided for a slide.'\n )\n )\n } else {\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const samplesPerPixel = new Set([] as number[])\n volumeImages.forEach((image) => {\n samplesPerPixel.add(image.SamplesPerPixel)\n })\n if (samplesPerPixel.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const isNotResampled = volumeImages.filter(image => {\n return image.ImageType[3] !== 'RESAMPLED'\n })\n if (isNotResampled.length > opticalPathIdentifiers.size) {\n console.warn(\n 'the set of VOLUME images of a slide must contain only a single ' +\n 'image that has not been resampled per optical path'\n )\n }\n }\n this.volumeImages = volumeImages\n this.labelImages = labelImages\n this.overviewImages = overviewImages\n\n this.seriesInstanceUIDs = [...seriesInstanceUIDs]\n this.opticalPathIdentifiers = [...opticalPathIdentifiers]\n\n if (containerIdentifiers.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All images of a slide must have the same Container Identifier.'\n )\n )\n }\n this.containerIdentifier = [...containerIdentifiers][0]\n\n if (frameOfReferenceUIDs.VOLUME.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have ' +\n 'the same Frame of Reference UID.'\n )\n )\n }\n this.frameOfReferenceUID = [...frameOfReferenceUIDs.VOLUME][0]\n\n let requirePyramidUID = false\n if (Object.keys(pyramidUIDs.VOLUME).length > 0) {\n requirePyramidUID = true\n }\n this.opticalPathIdentifiers.forEach(identifier => {\n if (pyramidUIDs.VOLUME[identifier] != null) {\n if (pyramidUIDs.VOLUME[identifier].size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `All VOLUME images for optical path \"${identifier}\"` +\n 'must be part of the same multi-resolution pyramid.'\n )\n )\n } else if (pyramidUIDs.VOLUME[identifier].size === 1) {\n this.pyramidUIDs.push([...pyramidUIDs.VOLUME[identifier]][0])\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n } else {\n if (requirePyramidUID) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n }\n })\n\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must be part of the same ' +\n 'acquisition and have the same Acquisition UID.'\n )\n )\n } else if (acquisitionUIDs.size === 1) {\n this.acquisitionUID = [...acquisitionUIDs][0]\n } else {\n this.acquisitionUID = null\n }\n\n this.areVolumeImagesMonochrome = (\n this.volumeImages[0].SamplesPerPixel === 1 &&\n this.volumeImages[0].PhotometricInterpretation === 'MONOCHROME2'\n )\n\n this.description = (\n options.description !== undefined ? options.description : ''\n )\n }\n}\n\n/**\n * Create slides.\n *\n * @param imagesPerSeries - Image instances grouped per series\n * @param referenceSeriesInstanceUID - Unique identifier of the series that serves as a reference for the slide\n * @returns Slides\n */\nconst createSlides = (\n images: dmv.metadata.VLWholeSlideMicroscopyImage[][]\n): Slide[] => {\n const slideMetadata: SlideImageCollection[] = []\n images.forEach((series) => {\n if (series.length > 0) {\n const volumeImages = series.filter((image) => {\n return (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n )\n })\n if (volumeImages.length > 0) {\n const refImage = volumeImages[0]\n const filteredVolumeImages = volumeImages.filter((image) => {\n return refImage.SamplesPerPixel === image.SamplesPerPixel\n })\n const slideMetadataIndex = slideMetadata.findIndex((slide) => {\n return _doesImageBelongToSlide(slide, refImage)\n })\n\n const labelImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.LABEL)\n })\n let filteredLabelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (labelImages.length > 1) {\n filteredLabelImages = labelImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredLabelImages = labelImages\n }\n const overviewImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.OVERVIEW)\n })\n let filteredOverviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (overviewImages.length > 1) {\n filteredOverviewImages = overviewImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredOverviewImages = overviewImages\n }\n\n if (slideMetadataIndex === -1) {\n const slideMetadataItem: SlideImageCollection = {\n acquisitionUID: refImage.AcquisitionUID,\n frameOfReferenceUID: refImage.FrameOfReferenceUID,\n containerIdentifier: refImage.ContainerIdentifier,\n volumeImages: filteredVolumeImages,\n labelImages: filteredLabelImages,\n overviewImages: filteredOverviewImages\n }\n slideMetadata.push(slideMetadataItem)\n } else {\n const slideMetadataItem = slideMetadata[slideMetadataIndex]\n slideMetadataItem.volumeImages.push(...filteredVolumeImages)\n slideMetadataItem.labelImages.push(...filteredLabelImages)\n slideMetadataItem.overviewImages.push(...filteredOverviewImages)\n }\n }\n }\n })\n\n let slides: Slide[] = slideMetadata.map((item) => {\n return new Slide({\n images: [\n ...item.volumeImages,\n ...item.labelImages,\n ...item.overviewImages\n ]\n })\n })\n slides = slides.sort((a, b) => {\n const imgA = a.volumeImages[0]\n const imgB = b.volumeImages[0]\n if (imgA.ContainerIdentifier != null && imgB.ContainerIdentifier != null) {\n return Number(imgA.ContainerIdentifier) - Number(imgB.ContainerIdentifier)\n } else {\n return 0\n }\n })\n\n return slides\n}\n\n/**\n * Check if instance belongs to the slide.\n *\n * Compares values of Frame of Reference UID and Container Identifier attributes.\n *\n * @param slide - Slide metadata object\n * @param image - Metadata of VOLUME, LABEL or OVERVIEW image instance\n */\nfunction _doesImageBelongToSlide (\n slide: SlideImageCollection,\n image: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean {\n if (\n slide.frameOfReferenceUID === image.FrameOfReferenceUID &&\n slide.containerIdentifier === image.ContainerIdentifier &&\n slide.acquisitionUID === image.AcquisitionUID\n ) {\n return true\n }\n return false\n}\n\nexport { Slide, createSlides }\n","import * as dmv from 'dicom-microscopy-viewer'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { StorageClasses } from '../data/uids'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './NotificationMiddleware'\nimport { createSlides, Slide } from '../data/slides'\n\ninterface FetchImageMetadataParams {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n onSuccess: (slides: Slide[]) => void\n onError: (error: Error) => void\n}\n\nexport const fetchImageMetadata = async ({\n clients,\n studyInstanceUID,\n onSuccess,\n onError\n}: FetchImageMetadataParams): Promise => {\n try {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n\n const client = clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(\n matchedSeries.map(async (s) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const loadingSeries = dataset as dmv.metadata.Series\n console.info(\n `retrieve metadata of series \"${loadingSeries.SeriesInstanceUID}\"`\n )\n const retrievedMetadata = await client.retrieveSeriesMetadata({\n studyInstanceUID: studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item) => {\n if (\n item['00080016']?.Value?.[0] ===\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n })\n )\n const newSlides = createSlides(images)\n onSuccess(newSlides)\n } catch (err) {\n console.error(err)\n const customError = new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.'\n )\n onError(customError)\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n customError\n )\n }\n}\n","import { useState, useEffect } from 'react'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { Slide } from '../data/slides'\nimport { fetchImageMetadata } from '../services/fetchImageMetadata'\n\ninterface UseSlidesProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\ninterface UseSlidesReturn {\n slides: Slide[]\n isLoading: boolean\n error: Error | null\n}\n\nconst slidesCache = new Map()\nconst pendingRequests = new Map>()\n\n/**\n * Hook to fetch and manage whole slide microscopy images for a given study.\n * Values are cached so they can be reused if props are not provided.\n *\n * @param props - Hook configuration props\n * @param props.clients - Map of DICOM web clients keyed by storage class\n */\nexport const useSlides = ({ clients, studyInstanceUID }: UseSlidesProps): UseSlidesReturn => {\n const [slides, setSlides] = useState([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState(null)\n\n useEffect(() => {\n if (studyInstanceUID === undefined) {\n setSlides([])\n setIsLoading(false)\n return\n }\n\n const cachedData = slidesCache.get(studyInstanceUID)\n if (cachedData !== undefined) {\n setSlides(cachedData)\n setIsLoading(false)\n return\n }\n\n setIsLoading(true)\n\n const fetchSlides = async (): Promise => {\n // Check if there's already a pending request for this study\n let pendingRequest = pendingRequests.get(studyInstanceUID)\n\n if (pendingRequest === undefined) {\n // Create a new promise for this request\n pendingRequest = new Promise((resolve, reject): void => {\n fetchImageMetadata({\n clients,\n studyInstanceUID,\n onSuccess: (newSlides) => {\n slidesCache.set(studyInstanceUID, newSlides)\n resolve(newSlides)\n },\n onError: (err) => {\n reject(err)\n }\n }).catch((err) => {\n reject(err)\n })\n })\n pendingRequests.set(studyInstanceUID, pendingRequest)\n }\n\n try {\n const newSlides = await pendingRequest\n setSlides(newSlides)\n setError(null)\n } catch (err) {\n setError(err as Error)\n setSlides([])\n } finally {\n pendingRequests.delete(studyInstanceUID)\n setIsLoading(false)\n }\n }\n\n void fetchSlides()\n }, [clients, studyInstanceUID])\n\n return { slides, isLoading, error }\n}\n","import { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport { AnnotationSettings } from '../AppConfig'\nimport ClinicalTrial from './ClinicalTrial'\nimport DicomWebManager from '../DicomWebManager'\nimport Patient from './Patient'\nimport Study from './Study'\nimport SlideList from './SlideList'\nimport SlideViewer from './SlideViewer'\n\nimport { User } from '../auth'\nimport { Slide } from '../data/slides'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { useSlides } from '../hooks/useSlides'\n\nfunction ParametrizedSlideViewer ({\n clients,\n slides,\n user,\n app,\n preload,\n enableAnnotationTools,\n annotations\n}: {\n clients: { [key: string]: DicomWebManager }\n slides: Slide[]\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload: boolean\n enableAnnotationTools: boolean\n annotations: AnnotationSettings[]\n}): JSX.Element | null {\n const { studyInstanceUID, seriesInstanceUID } = useParams()\n const location = useLocation()\n\n const selectedSlide = slides.find((slide: Slide) => {\n return slide.seriesInstanceUIDs.find((uid: string) => {\n return uid === seriesInstanceUID\n })\n })\n const searchParams = new URLSearchParams(location.search)\n let presentationStateUID: string | null | undefined\n if (!searchParams.has('access_token')) {\n presentationStateUID = searchParams.get('state')\n if (presentationStateUID === null) {\n presentationStateUID = undefined\n }\n }\n let viewer = null\n if (selectedSlide != null) {\n viewer = (\n \n )\n }\n return viewer\n}\n\ninterface ViewerProps extends RouteComponentProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n preload: boolean\n user?: {\n name: string\n email: string\n }\n}\n\nfunction Viewer (props: ViewerProps): JSX.Element | null {\n const { clients, studyInstanceUID, location, navigate } = props\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n\n const handleSeriesSelection = ({ seriesInstanceUID }: { seriesInstanceUID: string }): void => {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (location.pathname.includes('/projects/')) {\n urlPath = location.pathname\n if (!location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n location.pathname.includes('/series/') &&\n location.search != null\n ) {\n urlPath += location.search\n }\n\n navigate(urlPath, { replace: true })\n }\n\n if (isLoading) {\n return null\n }\n\n if (slides.length === 0) {\n return null\n }\n\n const firstSlide = slides[0]\n const volumeInstances = firstSlide.volumeImages\n if (volumeInstances.length === 0) {\n return null\n }\n const refImage = volumeInstances[0]\n\n /* If a series is encoded in the path, route the viewer to this series.\n * Otherwise select the first series correspondent to\n * the first slide contained in the study.\n */\n let selectedSeriesInstanceUID: string\n if (location.pathname.includes('series/')) {\n const seriesFragment = location.pathname.split('series/')[1]\n selectedSeriesInstanceUID = seriesFragment.includes('/') ? seriesFragment.split('/')[0] : seriesFragment\n } else {\n selectedSeriesInstanceUID = volumeInstances[0].SeriesInstanceUID\n }\n\n let clinicalTrialMenu\n if (refImage.ClinicalTrialSponsorName != null) {\n clinicalTrialMenu = (\n \n \n \n )\n }\n\n return (\n \n \n \n \n \n \n \n \n \n {clinicalTrialMenu}\n \n \n \n \n \n\n \n \n }\n />\n \n \n )\n}\n\nexport default withRouter(Viewer)\n","import dcmjs from 'dcmjs'\n\nconst { DicomMetaDictionary } = dcmjs.data\n\ninterface TagInfo {\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TagInfo[]\n level: number\n}\n\nexport interface DicomTag {\n name: string\n vr: string\n Value?: any[]\n [key: string]: any\n}\n\nconst formatValue = (val: any): string => {\n if (typeof val === 'object' && val !== null) {\n return JSON.stringify(val)\n }\n return String(val)\n}\n\nexport const formatTagValue = (tag: DicomTag): string => {\n if (tag.Value == null) return ''\n\n if (Array.isArray(tag.Value)) {\n return tag.Value.map(formatValue).join(', ')\n }\n\n return formatValue(tag.Value)\n}\n\n/**\n * Processes DICOM metadata and returns a flattened array of tag information\n * @param metadata - The DICOM metadata object to process\n * @param depth - The current depth level for nested sequences (default: 0)\n * @returns Array of processed tag information\n */\nexport function getRows (metadata: Record, depth = 0): TagInfo[] {\n if (metadata === undefined || metadata === null) return []\n const keywords = Object.keys(metadata).filter(key => key !== '_vrMap')\n\n return keywords.flatMap(keyword => {\n // @ts-expect-error\n const tagInfo = DicomMetaDictionary.nameMap[keyword] as TagInfo | undefined\n let value = metadata[keyword]\n\n // Handle private or unknown tags\n if (tagInfo === undefined) {\n const regex = /[0-9A-Fa-f]{6}/g\n if (keyword.match(regex) == null) return []\n\n return [{\n tag: `(${keyword.substring(0, 4)},${keyword.substring(4, 8)})`,\n vr: '',\n keyword: 'Private Tag',\n value: value?.toString() ?? '',\n level: depth\n }]\n }\n\n // Handle sequence values (SQ VR)\n if (tagInfo.vr === 'SQ' && value !== undefined) {\n const sequenceItems = Array.isArray(value) ? value : [value]\n\n // Create a parent sequence node\n const sequenceNode: TagInfo = {\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword,\n value: `Sequence with ${sequenceItems.length} item(s)`,\n level: depth,\n children: []\n }\n\n // Create individual nodes for each sequence item\n sequenceNode.children = sequenceItems.map((item, index) => {\n const itemNode: TagInfo = {\n tag: `${tagInfo.tag}.${index + 1}`,\n vr: 'Item',\n keyword: `Item ${index + 1}`,\n value: `Sequence Item ${index + 1}`,\n level: depth + 1,\n children: getRows(item, depth + 2)\n }\n return itemNode\n })\n\n return [sequenceNode]\n }\n\n // Handle array values\n if (Array.isArray(value)) {\n value = value.map(formatValue).join('\\\\')\n } else if (typeof value === 'object' && value !== null) {\n value = formatValue(value)\n }\n\n return [{\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword: keyword.replace('RETIRED_', ''),\n value: value?.toString() ?? '',\n level: depth\n }]\n })\n}\n\n/**\n * Sorts DICOM tags alphabetically by tag value\n * @param metadata - The DICOM metadata object to process\n * @returns Sorted array of tag information\n */\nexport function getSortedTags (metadata: Record): TagInfo[] {\n const tagList = getRows(metadata)\n return tagList.sort((a, b) => a.tag.localeCompare(b.tag))\n}\n","/**\n * Formats a DICOM datetime string (YYYYMMDD:HHmmss) into a human-readable format\n *\n * @param dateStr - DICOM datetime string in format \"YYYYMMDD:HHmmss\"\n * @returns Formatted date string (e.g., \"Mon, Jan 1 2024\")\n * @example\n * formatDicomDate(\"20240101:120000\") // Returns \"Mon, Jan 1 2024\"\n * formatDicomDate(\"invalid\") // Returns \"invalid\"\n */\nexport const formatDicomDate = (dateStr: string): string => {\n // Parse YYYYMMDD:HHmmss format\n const match = dateStr.match(/^(\\d{4})(\\d{2})(\\d{2}):(\\d{2})(\\d{2})(\\d{2})/)\n if (match == null) return dateStr\n\n const [, year, month, day, hour, minute, second] = match\n\n // Validate month and day\n const monthNum = parseInt(month)\n const dayNum = parseInt(day)\n if (monthNum < 1 || monthNum > 12 || dayNum < 1 || dayNum > 31) {\n return dateStr\n }\n\n const date = new Date(\n parseInt(year),\n monthNum - 1, // months are 0-based\n dayNum,\n parseInt(hour),\n parseInt(minute),\n parseInt(second)\n )\n\n // Check if the date is invalid or if the month/day combination is invalid\n // This catches cases like February 31st where the date rolls over to March\n if (\n date.getMonth() !== monthNum - 1 || // month rolled over\n date.getDate() !== dayNum // day rolled over\n ) {\n return dateStr\n }\n\n // Format parts separately to avoid the extra comma\n const weekday = date.toLocaleDateString('en-US', { weekday: 'short' })\n const monthName = date.toLocaleDateString('en-US', { month: 'short' })\n const dayFormatted = date.getDate()\n const yearNum = date.getFullYear()\n\n return `${weekday}, ${monthName} ${dayFormatted} ${yearNum}`\n}\n","import { v4 as generateUUID } from 'uuid'\n\n/**\n * Consumer must implement:\n * this.listeners = {}\n * this.EVENTS = { \"EVENT_KEY\": \"EVENT_VALUE\" }\n */\nconst pubSubInterface = {\n subscribe,\n _broadcastEvent,\n _unsubscribe,\n _isValidEvent\n}\n\nexport default pubSubInterface\n\n/**\n * Subscribe to updates.\n *\n * @param {string} eventName The name of the event\n * @param {Function} callback Events callback\n * @return {Object} Observable object with actions\n */\nfunction subscribe (this: PubSubService, eventName: string, callback: Function): { unsubscribe: () => any } {\n if (this._isValidEvent(eventName)) {\n const listenerId = generateUUID()\n const subscription = { id: listenerId, callback }\n\n // console.info(`Subscribing to '${eventName}'.`);\n if (Array.isArray(this.listeners[eventName])) {\n this.listeners[eventName].push(subscription)\n } else {\n this.listeners[eventName] = [subscription]\n }\n\n return {\n unsubscribe: () => this._unsubscribe(eventName, listenerId)\n }\n } else {\n throw new Error(`Event ${eventName} not supported.`)\n }\n}\n\n/**\n * Unsubscribe to measurement updates.\n *\n * @param {string} eventName The name of the event\n * @param {string} listenerId The listeners id\n * @return void\n */\nfunction _unsubscribe (this: PubSubService, eventName: string, listenerId: string): void {\n if (this.listeners[eventName] === undefined) {\n return\n }\n\n const listeners = this.listeners[eventName]\n if (Array.isArray(listeners)) {\n this.listeners[eventName] = listeners.filter(({ id }) => id !== listenerId)\n } else {\n this.listeners[eventName] = []\n }\n}\n\n/**\n * Check if a given event is valid.\n *\n * @param {string} eventName The name of the event\n * @return {boolean} Event name validation\n */\nfunction _isValidEvent (this: PubSubService, eventName: string): boolean {\n return Object.values(this.EVENTS).includes(eventName)\n}\n\n/**\n * Broadcasts changes.\n *\n * @param {string} eventName - The event name\n * @param {func} callbackProps - Properties to pass callback\n * @return void\n */\nfunction _broadcastEvent (this: PubSubService, eventName: string, callbackProps: any): void {\n const hasListeners = Object.keys(this.listeners).length > 0\n const hasCallbacks = Array.isArray(this.listeners[eventName])\n\n if (hasListeners && hasCallbacks) {\n this.listeners[eventName].forEach((listener: { id: string, callback: Function }) => {\n listener.callback(callbackProps)\n })\n }\n}\n\n/** Export a PubSubService class to be used instead of the individual items */\nexport class PubSubService {\n EVENTS: any\n subscribe: (\n eventName: string,\n callback: Function\n ) => { unsubscribe: () => any }\n\n _broadcastEvent: (eventName: string, callbackProps: any) => void\n _unsubscribe: (eventName: string, listenerId: string) => void\n _isValidEvent: (eventName: string) => boolean\n listeners: { [key: string]: Array<{ id: string, callback: Function }> }\n unsubscriptions: any[]\n constructor (EVENTS: Record) {\n this.EVENTS = EVENTS\n this.subscribe = subscribe\n this._broadcastEvent = _broadcastEvent\n this._unsubscribe = _unsubscribe\n this._isValidEvent = _isValidEvent\n this.listeners = {}\n this.unsubscriptions = []\n }\n\n reset (): void {\n this.unsubscriptions.forEach((unsub) => unsub())\n this.unsubscriptions = []\n }\n\n /**\n * Creates an event that records whether or not someone\n * has consumed it. Call eventData.consume() to consume the event.\n * Check eventData.isConsumed to see if it is consumed or not.\n * @param props - to include in the event\n */\n protected createConsumableEvent (props: Record): Record {\n return {\n ...props,\n isConsumed: false,\n consume: function Consume () {\n this.isConsumed = true\n }\n }\n }\n}\n","import { Instance, Series } from '../services/DICOMMetadataStore'\n\nfunction createSeriesMetadata (SeriesInstanceUID: string, defaultInstances?: Instance[]): Series {\n const instances: Instance[] = []\n const instancesMap = new Map()\n\n return {\n SeriesInstanceUID,\n Modality: '',\n SeriesNumber: 0,\n SeriesDescription: '',\n SeriesDate: '',\n SeriesTime: '',\n ...defaultInstances?.[0],\n instances,\n addInstance: function (newInstance: Instance) {\n this.addInstances([newInstance])\n },\n addInstances: function (newInstances: Instance[]) {\n for (let i = 0, len = newInstances.length; i < len; i++) {\n const instance = newInstances[i]\n\n if (!instancesMap.has(instance.SOPInstanceUID)) {\n instancesMap.set(instance.SOPInstanceUID, instance)\n instances.push(instance)\n }\n }\n },\n getInstance: function (SOPInstanceUID: string) {\n return instancesMap.get(SOPInstanceUID)\n }\n }\n}\n\nexport default createSeriesMetadata\n","import createSeriesMetadata from './createSeriesMetadata'\n\nimport { Study, Series, Instance } from '../services/DICOMMetadataStore'\n\nfunction createStudyMetadata (StudyInstanceUID: string): Study {\n return {\n StudyInstanceUID,\n StudyDescription: '',\n PatientID: '',\n PatientName: '',\n StudyDate: '',\n AccessionNumber: '',\n NumInstances: 0,\n ModalitiesInStudy: [],\n isLoaded: false,\n series: [] as Series[],\n /**\n * @param {object} instance\n */\n addInstanceToSeries: function (instance: Instance) {\n this.addInstancesToSeries([instance])\n },\n /**\n * @param {object[]} instances\n * @param {string} instances[].SeriesInstanceUID\n * @param {string} instances[].StudyDescription\n */\n addInstancesToSeries: function (instances: Instance[]) {\n const { SeriesInstanceUID } = instances[0]\n\n if (this.StudyDescription !== '' && this.StudyDescription !== undefined) {\n this.StudyDescription = instances[0].StudyDescription\n }\n\n let series = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n series = createSeriesMetadata(SeriesInstanceUID, instances)\n this.series.push(series)\n }\n\n series.addInstances(instances)\n },\n\n setSeriesMetadata: function (\n SeriesInstanceUID: string,\n seriesMetadata: any\n ) {\n let existingSeries = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (existingSeries != null) {\n existingSeries = Object.assign(existingSeries, seriesMetadata)\n } else {\n const series = createSeriesMetadata(SeriesInstanceUID)\n this.series.push(Object.assign(series, seriesMetadata))\n }\n }\n }\n}\n\nexport default createStudyMetadata\n","import dcmjs from 'dcmjs'\n\nimport pubSubServiceInterface from '../utils/pubSubServiceInterface'\nimport createStudyMetadata from '../utils/createStudyMetadata'\n\nexport const EVENTS = {\n STUDY_ADDED: 'event::dicomMetadataStore:studyAdded',\n INSTANCES_ADDED: 'event::dicomMetadataStore:instancesAdded',\n SERIES_ADDED: 'event::dicomMetadataStore:seriesAdded',\n SERIES_UPDATED: 'event::dicomMetadataStore:seriesUpdated'\n}\n\nexport interface Instance {\n SOPInstanceUID: string\n SOPClassUID: string\n Rows: number\n Columns: number\n PatientSex: string\n Modality: string\n InstanceNumber: string\n imageId?: string\n [key: string]: any // For dynamic metadata properties\n}\n\nexport interface Series {\n Modality: string\n SeriesInstanceUID: string\n SeriesNumber: number\n SeriesDate: string\n SeriesTime: string\n SeriesDescription: string\n instances: Instance[]\n addInstance: (newInstance: Instance) => void\n addInstances: (newInstances: Instance[]) => void\n getInstance: (SOPInstanceUID: string) => Instance | undefined\n}\n\nexport interface Study {\n StudyInstanceUID: string\n StudyDescription: string\n PatientID: string\n PatientName: string\n StudyDate: string\n AccessionNumber: string\n NumInstances: number\n ModalitiesInStudy: any[]\n NumberOfStudyRelatedSeries?: number\n isLoaded: boolean\n series: Series[]\n addInstanceToSeries: (instance: Instance) => void\n addInstancesToSeries: (instances: Instance[]) => void\n setSeriesMetadata: (SeriesInstanceUID: string, metadata: any) => void\n}\n\ninterface Model {\n studies: Study[]\n}\n\nconst _model: Model = {\n studies: []\n}\n\nfunction _getStudyInstanceUIDs (): string[] {\n return _model.studies.map((aStudy) => aStudy.StudyInstanceUID)\n}\n\nfunction _getStudy (StudyInstanceUID: string): Study | undefined {\n return _model.studies.find(\n (aStudy) => aStudy.StudyInstanceUID === StudyInstanceUID\n )\n}\n\nfunction _getSeries (StudyInstanceUID: string, SeriesInstanceUID: string): Series | undefined {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n return study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n}\n\nfunction _getInstance (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n SOPInstanceUID: string\n): Instance | undefined {\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n\n if (series == null) {\n return\n }\n\n return series.getInstance(SOPInstanceUID)\n}\n\nfunction _getInstanceByImageId (imageId: string): Instance | undefined {\n for (const study of _model.studies) {\n for (const series of study.series) {\n for (const instance of series.instances) {\n if (instance.imageId === imageId) {\n return instance\n }\n }\n }\n }\n}\n\n/**\n * Update the metadata of a specific series\n * @param {*} StudyInstanceUID\n * @param {*} SeriesInstanceUID\n * @param {*} metadata metadata inform of key value pairs\n * @returns\n */\nfunction _updateMetadataForSeries (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n metadata: Record\n): void {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n const series = study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n return\n }\n\n const { instances } = series\n instances.forEach((instance) => {\n Object.keys(metadata).forEach((key) => {\n if (typeof metadata[key] === 'object') {\n instance[key] = { ...instance[key], ...metadata[key] }\n } else {\n instance[key] = metadata[key]\n }\n })\n })\n}\n\ninterface BaseImplementationType {\n EVENTS: typeof EVENTS\n listeners: Record\n addInstance: (dicomJSONDatasetOrP10ArrayBuffer: ArrayBuffer | Record) => void\n addInstances: (instances: Instance[], madeInClient?: boolean) => void\n updateSeriesMetadata: (seriesMetadata: Record) => void\n addSeriesMetadata: (seriesSummaryMetadata: Array>, madeInClient?: boolean) => void\n addStudy: (study: Record) => void\n getStudyInstanceUIDs: typeof _getStudyInstanceUIDs\n getStudy: typeof _getStudy\n getSeries: typeof _getSeries\n getInstance: typeof _getInstance\n getInstanceByImageId: typeof _getInstanceByImageId\n updateMetadataForSeries: typeof _updateMetadataForSeries\n _broadcastEvent: (eventName: string, data: any) => void\n}\n\nconst BaseImplementation: BaseImplementationType = {\n EVENTS,\n listeners: {},\n addInstance (dicomJSONDatasetOrP10ArrayBuffer) {\n let dicomJSONDataset\n\n // If Arraybuffer, parse to DICOMJSON before naturalizing.\n if (dicomJSONDatasetOrP10ArrayBuffer instanceof ArrayBuffer) {\n const dicomData = dcmjs.data.DicomMessage.readFile(\n dicomJSONDatasetOrP10ArrayBuffer\n )\n\n dicomJSONDataset = dicomData.dict\n } else {\n dicomJSONDataset = dicomJSONDatasetOrP10ArrayBuffer\n }\n\n let naturalizedDataset: Instance\n\n if (!('SeriesInstanceUID' in dicomJSONDataset)) {\n naturalizedDataset =\n dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomJSONDataset) as Instance\n } else {\n naturalizedDataset = dicomJSONDataset as unknown as Instance\n }\n\n const { StudyInstanceUID } = naturalizedDataset\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstanceToSeries(naturalizedDataset)\n },\n addInstances (instances, madeInClient = false) {\n const { StudyInstanceUID, SeriesInstanceUID } = instances[0]\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstancesToSeries(instances)\n\n // Broadcast an event even if we used cached data.\n // This is because the mode needs to listen to instances that are added to build up its active displaySets.\n // It will see there are cached displaySets and end early if this Series has already been fired in this\n // Mode session for some reason.\n this._broadcastEvent(EVENTS.INSTANCES_ADDED, {\n StudyInstanceUID,\n SeriesInstanceUID,\n madeInClient\n })\n },\n updateSeriesMetadata (seriesMetadata) {\n const { StudyInstanceUID, SeriesInstanceUID } = seriesMetadata\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n if (series == null) {\n return\n }\n\n const study = _getStudy(StudyInstanceUID)\n if (study != null) {\n study.setSeriesMetadata(SeriesInstanceUID, seriesMetadata)\n }\n },\n addSeriesMetadata (seriesSummaryMetadata, madeInClient = false) {\n if (\n seriesSummaryMetadata === undefined ||\n seriesSummaryMetadata.length === 0 ||\n seriesSummaryMetadata[0] === undefined\n ) {\n return\n }\n\n const { StudyInstanceUID } = seriesSummaryMetadata[0]\n let study = _getStudy(StudyInstanceUID)\n if (study == null) {\n study = createStudyMetadata(StudyInstanceUID)\n // Will typically be undefined with a compliant DICOMweb server, reset later\n study.StudyDescription = seriesSummaryMetadata[0].StudyDescription\n seriesSummaryMetadata?.forEach((item) => {\n if (study !== undefined && !study.ModalitiesInStudy?.includes(item.Modality)) {\n study.ModalitiesInStudy?.push(item.Modality)\n }\n })\n study.NumberOfStudyRelatedSeries = seriesSummaryMetadata.length\n _model.studies.push(study)\n }\n\n seriesSummaryMetadata.forEach((series) => {\n const { SeriesInstanceUID } = series\n study?.setSeriesMetadata(SeriesInstanceUID, series)\n })\n\n this._broadcastEvent(EVENTS.SERIES_ADDED, {\n StudyInstanceUID,\n seriesSummaryMetadata,\n madeInClient\n })\n },\n addStudy (study) {\n const { StudyInstanceUID } = study\n\n const existingStudy = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (existingStudy == null) {\n const newStudy = createStudyMetadata(StudyInstanceUID)\n\n newStudy.PatientID = study.PatientID\n newStudy.PatientName = study.PatientName\n newStudy.StudyDate = study.StudyDate\n newStudy.ModalitiesInStudy = study.ModalitiesInStudy\n newStudy.StudyDescription = study.StudyDescription\n newStudy.AccessionNumber = study.AccessionNumber\n newStudy.NumInstances = study.NumInstances // todo: Correct naming?\n\n _model.studies.push(newStudy)\n }\n },\n getStudyInstanceUIDs: _getStudyInstanceUIDs,\n getStudy: _getStudy,\n getSeries: _getSeries,\n getInstance: _getInstance,\n getInstanceByImageId: _getInstanceByImageId,\n updateMetadataForSeries: _updateMetadataForSeries,\n _broadcastEvent (eventName: string, data: any): void {\n }\n}\n\ninterface DicomMetadataStoreType extends BaseImplementationType {\n subscribe: (event: string, callback: (data: any) => void) => { unsubscribe: () => any }\n unsubscribe: (event: string, callback: (data: any) => void) => void\n}\n\nconst DicomMetadataStore = Object.assign(\n {},\n BaseImplementation,\n pubSubServiceInterface\n) as unknown as DicomMetadataStoreType\n\nexport { DicomMetadataStore }\nexport default DicomMetadataStore\n","import { useState, useEffect } from 'react'\n\n/**\n * A hook that delays updating a value for the specified time\n * @param value The value to debounce\n * @param delay The delay time in milliseconds\n * @returns The debounced value\n * @example\n * const debouncedSearchTerm = useDebounce(searchTerm, 300)\n */\nexport const useDebounce = (value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n","import { useState, useMemo, useEffect } from 'react'\nimport { Select, Input, Slider, Typography, Table } from 'antd'\nimport { SearchOutlined } from '@ant-design/icons'\n\nimport DicomWebManager from '../../DicomWebManager'\nimport './DicomTagBrowser.css'\nimport { useSlides } from '../../hooks/useSlides'\nimport { getSortedTags } from './dicomTagUtils'\nimport { formatDicomDate } from '../../utils/formatDicomDate'\nimport DicomMetadataStore, { Series, Study } from '../../services/DICOMMetadataStore'\nimport { useDebounce } from '../../hooks/useDebounce'\n\nconst { Option } = Select\n\ninterface DisplaySet {\n displaySetInstanceUID: number\n SeriesDate?: string\n SeriesTime?: string\n SeriesNumber: string\n SeriesDescription?: string\n Modality: string\n images: any[]\n}\n\ninterface TableDataItem {\n key: string\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TableDataItem[]\n}\n\ninterface DicomTagBrowserProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\nconst DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): JSX.Element => {\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n const [study, setStudy] = useState(undefined)\n\n const [displaySets, setDisplaySets] = useState([])\n const [selectedDisplaySetInstanceUID, setSelectedDisplaySetInstanceUID] = useState(0)\n const [instanceNumber, setInstanceNumber] = useState(1)\n const [filterValue, setFilterValue] = useState('')\n const [expandedKeys, setExpandedKeys] = useState([])\n const [searchInput, setSearchInput] = useState('')\n\n const debouncedSearchValue = useDebounce(searchInput, 300)\n\n useEffect(() => {\n if (debouncedSearchValue === '') {\n setFilterValue('')\n setExpandedKeys([])\n } else {\n setFilterValue(debouncedSearchValue)\n }\n }, [debouncedSearchValue])\n\n useEffect(() => {\n const handler = (event: any): void => {\n const study: Study | undefined = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n }\n const seriesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.SERIES_ADDED, handler)\n const instancesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.INSTANCES_ADDED, handler)\n\n const study = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n\n return () => {\n seriesAddedSubscription.unsubscribe()\n instancesAddedSubscription.unsubscribe()\n }\n }, [studyInstanceUID])\n\n useEffect(() => {\n let displaySets: DisplaySet[] = []\n let derivedDisplaySets: DisplaySet[] = []\n const processedSeries: string[] = []\n let index = 0\n\n if (slides.length > 0) {\n displaySets = slides\n .map((slide): DisplaySet | null => {\n const { volumeImages } = slide\n if (volumeImages?.[0] === undefined) return null\n\n const {\n SeriesDate,\n SeriesTime,\n SeriesNumber,\n SeriesInstanceUID,\n SeriesDescription,\n Modality\n } = volumeImages[0]\n\n processedSeries.push(SeriesInstanceUID)\n\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate,\n SeriesTime,\n SeriesInstanceUID,\n // @ts-expect-error\n SeriesNumber,\n SeriesDescription,\n Modality,\n images: volumeImages\n }\n index++\n return ds\n })\n .filter((set): set is DisplaySet => set !== null)\n }\n\n if (study !== undefined && study.series?.length > 0) {\n derivedDisplaySets = study.series.filter(s => !processedSeries.includes(s.SeriesInstanceUID))\n .map((series: Series): DisplaySet => {\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate: series.SeriesDate,\n SeriesTime: series.SeriesTime,\n // @ts-expect-error\n SeriesNumber: series.SeriesNumber,\n SeriesDescription: series.SeriesDescription,\n SeriesInstanceUID: series.SeriesInstanceUID,\n Modality: series.Modality,\n images: series?.instances?.length > 0 ? series.instances : [series]\n }\n index++\n return ds\n })\n }\n\n setDisplaySets([...displaySets, ...derivedDisplaySets])\n }, [slides, study])\n\n const displaySetList = useMemo(() => {\n displaySets.sort((a, b) => Number(a.SeriesNumber) - Number(b.SeriesNumber))\n return displaySets.map((displaySet, index) => {\n const {\n SeriesDate = '',\n SeriesTime = '',\n SeriesNumber = '',\n SeriesDescription = '',\n Modality = ''\n } = displaySet\n\n const dateStr = `${SeriesDate}:${SeriesTime}`.split('.')[0]\n const displayDate = formatDicomDate(dateStr)\n\n return {\n value: index,\n label: `${SeriesNumber} (${Modality}): ${SeriesDescription}`,\n description: displayDate\n }\n })\n }, [displaySets])\n\n const showInstanceList =\n displaySets[selectedDisplaySetInstanceUID]?.images.length > 1\n\n console.debug('displaySets:', displaySets)\n\n const instanceSliderMarks = useMemo(() => {\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return {}\n const totalInstances = displaySets[selectedDisplaySetInstanceUID].images.length\n\n // Create marks for first, middle, and last instances\n const marks: Record = {\n 1: '1', // First\n [Math.ceil(totalInstances / 2)]: String(Math.ceil(totalInstances / 2)), // Middle\n [totalInstances]: String(totalInstances) // Last\n }\n\n return marks\n }, [selectedDisplaySetInstanceUID, displaySets])\n\n const columns = [\n {\n title: 'Tag',\n dataIndex: 'tag',\n key: 'tag',\n width: '30%'\n },\n {\n title: 'VR',\n dataIndex: 'vr',\n key: 'vr',\n width: '5%'\n },\n {\n title: 'Keyword',\n dataIndex: 'keyword',\n key: 'keyword',\n width: '30%'\n },\n {\n title: 'Value',\n dataIndex: 'value',\n key: 'value',\n width: '40%'\n }\n ]\n\n const tableData = useMemo(() => {\n const transformTagsToTableData = (tags: any[], parentKey = ''): TableDataItem[] => {\n return tags.map((tag, index) => {\n // Create a unique key using tag value if available, otherwise use index\n const keyBase: string = tag.tag !== '' ? tag.tag.replace(/[(),]/g, '') : index.toString()\n const currentKey: string = parentKey !== '' ? `${parentKey}-${keyBase}` : keyBase\n\n const item: TableDataItem = {\n key: currentKey,\n tag: tag.tag,\n vr: tag.vr,\n keyword: tag.keyword,\n value: tag.value\n }\n\n if (tag.children !== undefined && tag.children.length > 0) {\n item.children = transformTagsToTableData(tag.children, currentKey)\n }\n\n return item\n })\n }\n\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return []\n const metadata = displaySets[selectedDisplaySetInstanceUID]?.images[instanceNumber - 1]\n const tags = getSortedTags(metadata)\n return transformTagsToTableData(tags)\n }, [instanceNumber, selectedDisplaySetInstanceUID, displaySets])\n\n const filteredData = useMemo(() => {\n if (filterValue === undefined || filterValue === '') return tableData\n\n const searchLower = filterValue.toLowerCase()\n const matchedKeys = new Set()\n\n const nodeMatches = (node: TableDataItem): boolean => {\n return (\n (node.tag?.toLowerCase() ?? '').includes(searchLower) ||\n (node.vr?.toLowerCase() ?? '').includes(searchLower) ||\n (node.keyword?.toLowerCase() ?? '').includes(searchLower) ||\n (node.value?.toString().toLowerCase() ?? '').includes(searchLower)\n )\n }\n\n // First pass: find all matching nodes and their parent paths\n const findMatchingPaths = (\n node: TableDataItem,\n parentPath: TableDataItem[] = []\n ): TableDataItem[][] => {\n const currentPath = [...parentPath, node]\n let matchingPaths: TableDataItem[][] = []\n\n if (nodeMatches(node)) {\n matchingPaths.push(currentPath)\n }\n\n if (node.children != null) {\n node.children.forEach(child => {\n const childPaths = findMatchingPaths(child, currentPath)\n matchingPaths = [...matchingPaths, ...childPaths]\n })\n }\n\n return matchingPaths\n }\n\n // Find all paths that contain matches\n const matchingPaths = tableData.flatMap(node => findMatchingPaths(node))\n\n // Second pass: reconstruct the tree with matching paths\n const reconstructTree = (\n paths: TableDataItem[][],\n level = 0\n ): TableDataItem[] => {\n if (paths.length === 0 || level >= paths[0].length) return []\n\n const nodesAtLevel = new Map()\n\n paths.forEach(path => {\n if (level < path.length) {\n const node = path[level]\n if (!nodesAtLevel.has(node.key)) {\n nodesAtLevel.set(node.key, {\n node: { ...node },\n childPaths: []\n })\n }\n if (level + 1 < path.length) {\n nodesAtLevel.get(node.key)?.childPaths.push(path)\n }\n }\n })\n\n return Array.from(nodesAtLevel.values()).map(({ node, childPaths }) => {\n matchedKeys.add(node.key)\n const children = reconstructTree(childPaths, level + 1)\n return children.length > 0 ? { ...node, children } : node\n })\n }\n\n const filtered = reconstructTree(matchingPaths)\n setExpandedKeys(Array.from(matchedKeys))\n\n return filtered\n }, [tableData, filterValue])\n\n if (isLoading) {\n return
Loading...
\n }\n\n return (\n
\n \n
\n
\n Slides\n {\n setSelectedDisplaySetInstanceUID(value)\n setInstanceNumber(1)\n }}\n optionLabelProp='label'\n optionFilterProp='label'\n >\n {displaySetList.map((item) => (\n
\n \n ))}\n \n
\n\n {showInstanceList && (\n
\n \n Instance Number: {instanceNumber}\n \n setInstanceNumber(value)}\n marks={instanceSliderMarks}\n tooltip={{\n formatter: (value: number | undefined) => value !== undefined ? `Instance ${value}` : ''\n }}\n />\n
\n )}\n
\n\n }\n onChange={(e) => setSearchInput(e.target.value)}\n value={searchInput}\n />\n\n setExpandedKeys(keys as string[])\n }}\n size='small'\n scroll={{ y: 500 }}\n />\n \n \n )\n}\n\nexport default DicomTagBrowser\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\n FileSearchOutlined,\n UnorderedListOutlined,\n UserOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport { detect } from 'detect-browser'\n\nimport Button from './Button'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport NotificationMiddleware, { NotificationMiddlewareEvents } from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\nimport { v4 as uuidv4 } from 'uuid'\nimport DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser'\nimport DicomWebManager from '../DicomWebManager'\n\ninterface HeaderProps extends RouteComponentProps {\n app: {\n name: string\n version: string\n homepage: string\n uid: string\n organization?: string\n }\n user?: {\n name: string\n email: string\n }\n clients: { [key: string]: DicomWebManager }\n showWorklistButton: boolean\n onServerSelection: ({ url }: { url: string }) => void\n onUserLogout?: () => void\n showServerSelectionButton: boolean\n}\n\ninterface ExtendedCustomError extends CustomError {\n source: string\n}\n\ninterface HeaderState {\n selectedServerUrl?: string\n isServerSelectionModalVisible: boolean\n isServerSelectionDisabled: boolean\n errorObj: ExtendedCustomError[]\n errorCategory: string[]\n warnings: string[]\n}\n\n/**\n * React component for the application header.\n */\nclass Header extends React.Component {\n constructor (props: HeaderProps) {\n super(props)\n this.state = {\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n }\n\n const onErrorHandler = ({ source, error }: {\n source: string\n error: CustomError\n }): void => {\n this.setState(state => ({\n ...state,\n errorObj: [...state.errorObj, { ...error, source }],\n errorCategory: [...state.errorCategory, error.type]\n }))\n }\n\n const onWarningHandler = (warning: string): void => {\n this.setState(state => ({\n ...state,\n warnings: [...state.warnings, warning]\n }))\n }\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnError,\n onErrorHandler\n )\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnWarning,\n onWarningHandler\n )\n }\n\n componentDidUpdate (prevProps: Readonly, prevState: Readonly): void {\n if (((prevState.warnings.length > 0) || (prevState.errorObj.length > 0)) && this.props.location.pathname !== prevProps.location.pathname) {\n this.setState({\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n })\n }\n }\n\n handleInfoButtonClick = (): void => {\n const browser = detect()\n const environment: {\n browser: {\n name?: string\n version?: string\n }\n os: {\n name?: string\n }\n } = {\n browser: {},\n os: {}\n }\n if (browser != null) {\n environment.browser = {\n name: browser.name != null ? browser.name : undefined,\n version: browser.version != null ? browser.version : undefined\n }\n environment.os = {\n name: browser.os != null ? browser.os : undefined\n }\n }\n\n Modal.info({\n title: 'About',\n width: 600,\n content: (\n <>\n \n \n {this.props.app.name}\n \n \n {this.props.app.version}\n \n \n {this.props.app.homepage}\n \n \n \n \n {environment.browser.name}\n \n \n {environment.browser.version}\n \n \n \n \n {environment.os.name}\n \n \n \n ),\n onOk (): void {}\n })\n }\n\n handleDicomTagBrowserButtonClick = (): void => {\n const width = window.innerWidth - 200\n Modal.info({\n title: 'DICOM Tag Browser',\n width,\n content: ,\n onOk (): void {}\n })\n }\n\n handleDebugButtonClick = (): void => {\n const errorMsgs: {\n Authentication: string[]\n Communication: string[]\n EncodingDecoding: string[]\n Visualization: string[]\n } = {\n Authentication: [],\n Communication: [],\n EncodingDecoding: [],\n Visualization: []\n }\n\n type ObjectKey = keyof typeof errorMsgs\n const errorNum = this.state.errorObj.length\n\n if (errorNum > 0) {\n for (let i = 0; i < errorNum; i++) {\n const category = this.state.errorCategory[i] as ObjectKey\n errorMsgs[category].push(`${this.state.errorObj[i].message as string} (Source: ${this.state.errorObj[i].source})`)\n }\n }\n\n const { Panel } = Collapse\n\n const showErrorCount = (errcount: number): JSX.Element => (\n \n )\n\n const showWarningCount = (warncount: number): JSX.Element => (\n \n )\n\n Modal.info({\n title: 'Debug Information\\n (Check console for more information)',\n width: 800,\n content: (\n \n \n
    \n {errorMsgs.Communication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.EncodingDecoding.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Visualization.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Authentication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {this.state.warnings.map(warning => (\n
  1. {warning}
  2. \n ))}\n
\n \n
\n ),\n onOk (): void {}\n })\n }\n\n handleServerSelectionButtonClick = (): void => {\n this.setState({ isServerSelectionModalVisible: true })\n }\n\n render (): React.ReactNode {\n let user = null\n if (this.props.user !== undefined) {\n const userMenuItems = []\n if (this.props.onUserLogout !== undefined) {\n userMenuItems.push(\n {\n label: 'Logout',\n key: 'user-logout',\n onClick: () => {\n if (this.props.onUserLogout !== undefined) {\n this.props.onUserLogout()\n }\n }\n }\n )\n }\n const userMenu = { items: userMenuItems }\n user = (\n \n e.preventDefault()}\n label={`${this.props.user.name} (${this.props.user.email})`}\n />\n \n )\n }\n\n let worklistButton\n if (this.props.showWorklistButton) {\n worklistButton = (\n \n \n this.handleReset(clearFilters)}\n size='small'\n style={{ width: 90 }}\n >\n Reset\n \n \n \n ),\n filterIcon: (filtered: boolean) => (\n \n )\n })\n}\n\nexport default withRouter(Worklist)\n","/**\n * Join a URI with a path to form a full URL.\n *\n * @param path - Path component\n * @param uri - Base URI to which the path component should be added\n */\nexport const joinUrl = (path: string, uri: string): string => {\n let baseUri = uri\n if (!baseUri.endsWith('/')) {\n baseUri += '/'\n }\n const url = new URL(path, baseUri)\n return url.toString()\n}\n\n/**\n * Check whether a URL contains an OAuth 2.0 authorization code.\n *\n * @param location - URL components (JavaScript location object)\n * @returns Whether the URL contains a code\n */\nexport const isAuthorizationCodeInUrl = (location: {\n search: string\n hash: string\n}): boolean => {\n const searchParams = new URLSearchParams(location.search)\n const hashParams = new URLSearchParams(location.hash.replace('#', '?'))\n\n return Boolean(\n searchParams.get('code') ??\n searchParams.get('id_token') ??\n searchParams.get('session_state') ??\n hashParams.get('code') ??\n hashParams.get('id_token') ??\n hashParams.get('session_state')\n )\n}\n","import { UserManager, User as UserData } from 'oidc-client'\n\nimport { OidcSettings } from '../AppConfig'\nimport { isAuthorizationCodeInUrl } from '../utils/url'\nimport { User, AuthManager, SignInCallback } from './'\nimport NotificationMiddleware,\n{ NotificationMiddlewareContext } from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nconst createUser = (userData: UserData | null): User => {\n let profile\n if (userData !== null) {\n profile = userData.profile\n }\n\n if (profile !== undefined) {\n if (profile.name === undefined || profile.email === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user \"name\" and \"email\".'\n )\n )\n } else {\n return {\n name: profile.name,\n email: profile.email\n }\n }\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n return {\n name: undefined,\n email: undefined\n }\n}\n\nexport default class OidcManager implements AuthManager {\n private _oidc: UserManager\n\n constructor (baseUri: string, settings: OidcSettings) {\n let responseType = 'code'\n if (settings.grantType !== undefined) {\n if (settings.grantType === 'implicit') {\n responseType = 'id_token token'\n }\n }\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`\n })\n if (settings.endSessionEndpoint != null) {\n /*\n * Unfortunately, the end session endpoint alone cannot be provided to\n * the construction of UserManager and the other metadata parameters\n * would need to be provided as well. However, configuring all of them\n * individually would not be desirable and they will be automatically\n * determined anyways. Therefore, we first construct an object, get the\n * metadata, update the metadata, and then reconstruct an object with the\n * updated metadata.\n */\n this._oidc.metadataService.getMetadata().then(metadata => {\n if (settings.endSessionEndpoint != null) {\n metadata.end_session_endpoint = settings.endSessionEndpoint\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`,\n metadata\n })\n }\n }).catch((error) => {\n console.error(\n 'failed to get metadata from authorization server: ',\n error\n )\n })\n }\n }\n\n /**\n * Sign-in to authenticate the user and obtain authorization.\n */\n signIn = async ({ onSignIn }: {\n onSignIn?: SignInCallback\n }): Promise => {\n const handleSignIn = (userData: UserData): void => {\n const user = createUser(userData)\n const authorization = `${userData.token_type} ${userData.access_token}`\n if (onSignIn != null) {\n console.info('handling sign-in using provided callback function')\n onSignIn({ user: user, authorization: authorization })\n } else {\n console.warn('no callback function was provided to handle sign-in')\n }\n }\n\n if (isAuthorizationCodeInUrl(window.location)) {\n /* Handle the callback from the authorization server: extract the code\n * from the callback URL, obtain user information and the access token\n * for the DICOMweb server.\n */\n console.info('obtaining authorization')\n const userData = await this._oidc.signinCallback()\n if (userData != null) {\n console.info('obtained user data: ', userData)\n handleSignIn(userData)\n }\n } else {\n /* Redirect to the authorization server to authenticate the user\n * and authorize the application to obtain user information and access\n * the DICOMweb server.\n */\n const userData = await this._oidc.getUser()\n if (userData === null || userData.expired) {\n console.info('authenticating user')\n await this._oidc.signinRedirect()\n } else {\n console.info('user has already been authenticated')\n handleSignIn(userData)\n }\n }\n }\n\n /**\n * Sign-out to revoke authorization.\n */\n signOut = async (): Promise => {\n console.log('signing out user and revoking authorization')\n return await this._oidc.signoutRedirect()\n }\n\n /**\n * Get authorization. Requires prior sign-in.\n */\n getAuthorization = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData !== null) {\n return userData.access_token\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n })\n }\n\n /**\n * Get user information. Requires prior sign-in.\n */\n getUser = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData === null) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user information.'\n )\n )\n }\n return createUser(userData)\n })\n }\n}\n","import retry from 'retry'\n\nimport {\n RetryRequestSettings,\n DICOMwebClientRequestHookMetadata\n} from '../AppConfig'\n\ntype RequestHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n) => XMLHttpRequest\n\n/**\n * Returns a configured retry request hook function\n * that can be used to add retry functionality to XHR request.\n *\n * Default options:\n * retries: 5\n * factor: 3\n * minTimeout: 1 * 1000\n * maxTimeout: 60 * 1000\n * randomize: true\n *\n * @param options\n * @param options.retires - Number of retries\n * @param options.factor - Factor\n * @param options.minTimeout - Min number of seconds to wait before next retry\n * @param options.maxTimeout - Max number of seconds to wait before next retry\n * @param options.randomize - Whether randomization should be applied\n * @param options.retryableStatusCodes HTTP status codes that can trigger a retry\n * @returns Configured retry request function\n */\nexport const getXHRRetryHook = (options: RetryRequestSettings = {\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n retryableStatusCodes: [429, 500]\n}): RequestHook => {\n const retryOptions = options\n\n if (options.retries != null) {\n retryOptions.retries = options.retries\n }\n\n if (options.factor != null) {\n retryOptions.factor = options.factor\n }\n\n if (options.minTimeout != null) {\n retryOptions.minTimeout = options.minTimeout\n }\n\n if (options.maxTimeout != null) {\n retryOptions.maxTimeout = options.maxTimeout\n }\n\n if (options.randomize != null) {\n retryOptions.randomize = options.randomize\n }\n\n if (options.retryableStatusCodes != null) {\n retryOptions.retryableStatusCodes = options.retryableStatusCodes\n }\n\n /**\n * Request hook used to add retry functionality to XHR requests.\n *\n * @param request - XHR request instance\n * @param metadata - Metadata about the request\n * @param metadata.url - URL\n * @param metadata.method - HTTP method\n * @returns - XHR request instance (potentially modified)\n */\n const xhrRetryHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n ): XMLHttpRequest => {\n const { url, method } = metadata\n\n function faultTolerantRequestSend (...args: any): void {\n const operation = retry.operation(retryOptions)\n\n operation.attempt(function operationAttempt (currentAttempt) {\n const originalOnReadyStateChange = request.onreadystatechange\n\n /** Overriding/extending XHR function */\n request.onreadystatechange = function onReadyStateChange (...args: any): void {\n if (originalOnReadyStateChange != null) {\n originalOnReadyStateChange.apply(request, args)\n }\n\n if (retryOptions.retryableStatusCodes.includes(request.status)) {\n const errorMessage = `Attempt to request ${url} failed.`\n const attemptFailedError = new Error(errorMessage)\n operation.retry(attemptFailedError)\n }\n }\n\n /** Call open only on retry (after headers and other things were set in the xhr instance) */\n if (currentAttempt > 1) {\n console.warn(`Requesting ${url}... (attempt: ${currentAttempt})`)\n request.open(method, url, true)\n }\n })\n\n originalRequestSend.apply(request, args)\n }\n\n /** Overriding/extending XHR function */\n const originalRequestSend = request.send\n request.send = faultTolerantRequestSend\n\n return request\n }\n\n return xhrRetryHook\n}\n\nexport default getXHRRetryHook\n","import * as dwc from 'dicomweb-client'\nimport * as dcmjs from 'dcmjs'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport { ServerSettings, DicomWebManagerErrorHandler } from './AppConfig'\nimport { joinUrl } from './utils/url'\nimport getXHRRetryHook from './utils/xhrRetryHook'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\nimport DicomMetadataStore, { Instance } from './services/DICOMMetadataStore'\n\nconst { naturalizeDataset } = dcmjs.data.DicomMetaDictionary\n\ninterface Store {\n id: string\n read: boolean\n write: boolean\n client: dwc.api.DICOMwebClient\n}\n\nexport default class DicomWebManager implements dwc.api.DICOMwebClient {\n private readonly stores: Store[] = []\n\n private readonly handleError: DicomWebManagerErrorHandler\n\n constructor ({ baseUri, settings, onError }: {\n baseUri: string\n settings: ServerSettings[]\n onError?: DicomWebManagerErrorHandler\n }) {\n if (onError != null) {\n this.handleError = onError\n } else {\n this.handleError = (error, serverSettings) => {\n console.error(error, serverSettings)\n }\n }\n\n settings.forEach(serverSettings => {\n if (serverSettings === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'At least one server needs to be configured.'\n )\n )\n }\n\n let serviceUrl\n if (serverSettings.url !== undefined) {\n serviceUrl = serverSettings.url\n } else if (serverSettings.path !== undefined) {\n serviceUrl = joinUrl(serverSettings.path, baseUri)\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Either path or full URL needs to be configured for server.'\n )\n )\n }\n\n const hasHttpsUrl = (url?: string): boolean => url?.startsWith('https') ?? false\n\n const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\n }\n\n const shouldUpgradeInsecure = serverSettings.upgradeInsecureRequests === true && [\n serviceUrl,\n serverSettings.qidoPathPrefix,\n serverSettings.wadoPathPrefix,\n serverSettings.stowPathPrefix\n ].some(hasHttpsUrl)\n\n if (serverSettings.qidoPathPrefix !== undefined) {\n clientSettings.qidoURLPrefix = serverSettings.qidoPathPrefix\n }\n if (serverSettings.wadoPathPrefix !== undefined) {\n clientSettings.wadoURLPrefix = serverSettings.wadoPathPrefix\n }\n if (serverSettings.stowPathPrefix !== undefined) {\n clientSettings.stowURLPrefix = serverSettings.stowPathPrefix\n }\n\n if (shouldUpgradeInsecure) {\n clientSettings.headers = {\n ...clientSettings.headers,\n 'Content-Security-Policy': 'upgrade-insecure-requests'\n }\n }\n\n if (serverSettings.retry !== undefined) {\n clientSettings.requestHooks = [getXHRRetryHook(serverSettings.retry)]\n }\n\n clientSettings.errorInterceptor = (error: dwc.api.DICOMwebClientError) => {\n this.handleError(error, serverSettings)\n }\n\n this.stores.push({\n id: serverSettings.id,\n write: serverSettings.write ?? false,\n read: serverSettings.read ?? true,\n client: new dwc.api.DICOMwebClient(clientSettings)\n })\n })\n\n if (this.stores.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one store is supported for now.'\n )\n )\n }\n }\n\n get baseURL (): string {\n return this.stores[0].client.baseURL\n }\n\n updateHeaders = (fields: { [name: string]: string }): void => {\n for (const f in fields) {\n this.stores[0].client.headers[f] = fields[f]\n }\n }\n\n get headers (): { [name: string]: string } {\n return this.stores[0].client.headers\n }\n\n storeInstances = async (\n options: dwc.api.StoreInstancesOptions\n ): Promise => {\n if (this.stores[0].write) {\n return await this.stores[0].client.storeInstances(options)\n } else {\n return await Promise.reject(\n new Error('Store is not writable.')\n )\n }\n }\n\n searchForStudies = async (\n options: dwc.api.SearchForStudiesOptions\n ): Promise => {\n return await this.stores[0].client.searchForStudies(options)\n }\n\n searchForSeries = async (\n options: dwc.api.SearchForSeriesOptions\n ): Promise => {\n return await this.stores[0].client.searchForSeries(options)\n }\n\n searchForInstances = async (\n options: dwc.api.SearchForInstancesOptions\n ): Promise => {\n return await this.stores[0].client.searchForInstances(options)\n }\n\n retrieveStudyMetadata = async (\n options: dwc.api.RetrieveStudyMetadataOptions\n ): Promise => {\n const studySummaryMetadata = await this.stores[0].client.retrieveStudyMetadata(options)\n const naturalized = naturalizeDataset(studySummaryMetadata)\n DicomMetadataStore.addStudy(naturalized)\n return studySummaryMetadata\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n const seriesSummaryMetadata = await this.stores[0].client.retrieveSeriesMetadata(options)\n console.debug('seriesSummaryMetadata:', seriesSummaryMetadata)\n const naturalized = seriesSummaryMetadata.map(naturalizeDataset)\n console.debug('naturalized:', naturalized)\n DicomMetadataStore.addSeriesMetadata(naturalized, true)\n return seriesSummaryMetadata\n }\n\n retrieveInstanceMetadata = async (\n options: dwc.api.RetrieveInstanceMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceMetadata(options)\n }\n\n retrieveInstance = async (\n options: dwc.api.RetrieveInstanceOptions\n ): Promise => {\n const instance = await this.stores[0].client.retrieveInstance(options)\n const data = dcmjs.data.DicomMessage.readFile(instance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n DicomMetadataStore.addInstances([dataset as Instance])\n return instance\n }\n\n retrieveInstanceFrames = async (\n options: dwc.api.RetrieveInstanceFramesOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFrames(options)\n }\n\n retrieveInstanceRendered = async (\n options: dwc.api.RetrieveInstanceRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceRendered(options)\n }\n\n retrieveInstanceFramesRendered = async (\n options: dwc.api.RetrieveInstanceFramesRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFramesRendered(options)\n }\n\n retrieveBulkData = async (\n options: dwc.api.RetrieveBulkDataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveBulkData(options)\n }\n}\n","import React from 'react'\nimport {\n BrowserRouter,\n Navigate,\n Route,\n Routes,\n useParams\n} from 'react-router-dom'\nimport { Layout, message } from 'antd'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dwc from 'dicomweb-client'\n\nimport AppConfig, { ServerSettings, ErrorMessageSettings } from './AppConfig'\nimport CaseViewer from './components/CaseViewer'\nimport Header from './components/Header'\nimport InfoPage from './components/InfoPage'\nimport Worklist from './components/Worklist'\n\nimport { User, AuthManager } from './auth'\nimport OidcManager from './auth/OidcManager'\nimport { StorageClasses } from './data/uids'\nimport DicomWebManager from './DicomWebManager'\nimport { joinUrl } from './utils/url'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\n\nfunction ParametrizedCaseViewer ({ clients, user, app, config }: {\n clients: { [key: string]: DicomWebManager }\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n config: AppConfig\n}): JSX.Element {\n const { studyInstanceUID } = useParams()\n\n const enableAnnotationTools = !(config.disableAnnotationTools ?? false)\n const preload = config.preload ?? false\n return (\n \n )\n}\n\nfunction _createClientMapping ({ baseUri, gcpBaseUrl, settings, onError }: {\n baseUri: string\n gcpBaseUrl: string\n settings: ServerSettings[]\n onError: (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ) => void\n}): { [sopClassUID: string]: DicomWebManager } {\n const storageClassMapping: { [key: string]: number } = { default: 0 }\n const clientMapping: { [sopClassUID: string]: DicomWebManager } = {}\n\n settings.forEach(serverSettings => {\n if (serverSettings.storageClasses != null) {\n serverSettings.storageClasses.forEach(sopClassUID => {\n if (Object.values(StorageClasses).includes(sopClassUID)) {\n if (sopClassUID in storageClassMapping) {\n storageClassMapping[sopClassUID] += 1\n } else {\n storageClassMapping[sopClassUID] = 1\n }\n } else {\n console.warn(\n `unknown storage class \"${sopClassUID}\" specified ` +\n `for configured server \"${serverSettings.id}\"`\n )\n }\n })\n } else {\n if (window.location.pathname.includes('/projects/')) {\n const pathname = window.location.pathname.split('/study/')[0]\n const pathUrl = `${gcpBaseUrl}${pathname}/dicomWeb`\n serverSettings.url = pathUrl\n }\n\n storageClassMapping.default += 1\n clientMapping.default = new DicomWebManager({\n baseUri,\n settings: [serverSettings],\n onError\n })\n }\n })\n\n if (storageClassMapping.default > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one default server can be configured without specification ' +\n 'of storage classes.'\n )\n )\n }\n\n for (const key in storageClassMapping) {\n if (key === 'default') {\n continue\n }\n if (storageClassMapping[key] > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one configured server can specify a given storage class. ' +\n `Storage class \"${key}\" is specified by more than one ` +\n 'of the configured servers.'\n )\n )\n }\n }\n\n if (Object.keys(storageClassMapping).length > 1) {\n settings.forEach(server => {\n const client = new DicomWebManager({\n baseUri,\n settings: [server],\n onError\n })\n if (server.storageClasses != null) {\n server.storageClasses.forEach(sopClassUID => {\n clientMapping[sopClassUID] = client\n })\n }\n })\n }\n\n Object.values(StorageClasses).forEach(sopClassUID => {\n if (!(sopClassUID in clientMapping)) {\n clientMapping[sopClassUID] = clientMapping.default\n }\n })\n return clientMapping\n}\n\ninterface AppProps {\n name: string\n homepage: string\n version: string\n config: AppConfig\n}\n\ninterface AppState {\n clients: { [sopClassUID: string]: DicomWebManager }\n user?: User\n isLoading: boolean\n redirectTo?: string\n wasAuthSuccessful: boolean\n error?: ErrorMessageSettings\n}\n\nclass App extends React.Component {\n private readonly auth?: AuthManager\n\n private readonly handleDICOMwebError = (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ): void => {\n if (error.status === 401) {\n this.signIn()\n } else if (error.status === 403) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'User is not authorized to access DICOMweb resources.')\n )\n }\n\n const logServerError = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'An unexpected server error occured.'\n )\n )\n }\n\n if (serverSettings.errorMessages !== undefined) {\n serverSettings.errorMessages.forEach((setting: ErrorMessageSettings) => {\n if (error.status === setting.status) {\n this.setState({\n error: {\n status: error.status,\n message: setting.message\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n }\n\n constructor (props: AppProps) {\n super(props)\n\n console.info('instatiate app')\n console.info(`app is located at \"${props.config.path}\"`)\n const { protocol, host } = window.location\n const baseUri = `${protocol}//${host}`\n const appUri = joinUrl(props.config.path, baseUri)\n\n const oidcSettings = props.config.oidc\n if (oidcSettings !== undefined) {\n console.info(\n 'app uses the following OIDC configuration: ',\n props.config.oidc\n )\n this.auth = new OidcManager(appUri, oidcSettings)\n }\n\n if (props.config.servers.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'One server needs to be configured.')\n )\n }\n console.info(\n 'app uses the following DICOMweb server configuration: ',\n props.config.servers\n )\n\n this.handleServerSelection = this.handleServerSelection.bind(this)\n\n message.config({ duration: 5 })\n this.addGcpSecondaryAnnotationServer(props.config)\n\n this.state = {\n clients: _createClientMapping({\n baseUri,\n gcpBaseUrl: props.config.gcpBaseUrl ?? 'https://healthcare.googleapis.com/v1',\n settings: props.config.servers,\n onError: this.handleDICOMwebError\n }),\n isLoading: true,\n wasAuthSuccessful: false\n }\n }\n\n addGcpSecondaryAnnotationServer (config: AppProps['config']): void {\n const serverId = 'gcp_secondary_annotation_server'\n const urlParams = new URLSearchParams(window.location.search)\n const url = urlParams.get('gcp')\n const gcpSecondaryAnnotationServer = config.servers.find(\n (server) => server.id === serverId\n )\n if (gcpSecondaryAnnotationServer === undefined && typeof url === 'string') {\n config.servers.push({\n id: serverId,\n write: true,\n url,\n storageClasses: [\n StorageClasses.COMPREHENSIVE_SR,\n StorageClasses.COMPREHENSIVE_3D_SR,\n StorageClasses.SEGMENTATION,\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION,\n StorageClasses.PARAMETRIC_MAP,\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE,\n StorageClasses.COLOR_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE\n ]\n })\n }\n }\n\n handleServerSelection ({ url }: { url: string }): void {\n console.info('select DICOMweb server: ', url)\n const tmpClient = new DicomWebManager({\n baseUri: '',\n settings: [{\n id: 'tmp',\n url,\n read: true,\n write: false\n }],\n onError: this.handleDICOMwebError\n })\n tmpClient.updateHeaders(this.state.clients.default.headers)\n /**\n * Use the newly created client for all storage classes. We may want to\n * make this more sophisticated in the future to allow users to override\n * the entire server configuration.\n */\n this.setState(state => {\n const clients: { [key: string]: DicomWebManager } = {}\n for (const key in state.clients) {\n clients[key] = tmpClient\n }\n return { clients }\n })\n }\n\n /**\n * Handle successful authentication event.\n *\n * Authorizes the DICOMweb client to access the DICOMweb server and directs\n * the user back to the App.\n *\n * @param user - Information about the user\n * @param authorization - Value of the \"Authorization\" HTTP header field\n */\n handleSignIn = ({ user, authorization }: {\n user: User\n authorization: string\n }): void => {\n for (const key in this.state.clients) {\n const client = this.state.clients[key]\n client.updateHeaders({ Authorization: authorization })\n }\n const storedPath = window.localStorage.getItem('slim_path')\n const storedSearch = window.localStorage.getItem('slim_search')\n if (storedPath != null) {\n const currentPath = window.location.pathname\n if (storedPath !== currentPath) {\n let path = storedPath\n if (storedSearch != null) {\n path += storedSearch\n }\n window.location.href = path\n }\n }\n window.localStorage.removeItem('slim_path')\n window.localStorage.removeItem('slim_search')\n this.setState({ user: user })\n }\n\n signIn (): void {\n if (this.auth !== undefined) {\n console.info('try to sign in user')\n this.auth.signIn({ onSignIn: this.handleSignIn }).then(() => {\n console.info('sign-in was successful')\n this.setState({\n isLoading: false,\n wasAuthSuccessful: true\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Could not sign-in user.')\n )\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: false\n })\n })\n } else {\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: true\n })\n }\n }\n\n componentDidMount (): void {\n const path = window.localStorage.getItem('slim_path')\n if (path == null) {\n window.localStorage.setItem('slim_path', window.location.pathname)\n window.localStorage.setItem('slim_search', window.location.search)\n }\n this.signIn()\n }\n\n render (): React.ReactNode {\n const appInfo = {\n name: this.props.name,\n version: this.props.version,\n homepage: this.props.homepage,\n uid: '1.2.826.0.1.3680043.9.7433.1.5',\n organization: this.props.config.organization\n }\n\n const enableWorklist = !(\n this.props.config.disableWorklist ?? false\n )\n const enableServerSelection = (\n this.props.config.enableServerSelection ?? false\n )\n\n let worklist\n if (enableWorklist) {\n worklist = \n } else {\n worklist =
Worklist has been disabled.
\n }\n\n let isLogoutPossible = false\n let onLogout: () => void\n if (\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n this.props.config.oidc != null &&\n this.props.config.oidc.endSessionEndpoint != null\n ) {\n onLogout = (): void => {\n if (this.auth != null) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.auth.signOut()\n }\n }\n isLogoutPossible = true\n } else {\n onLogout = () => {}\n isLogoutPossible = false\n }\n\n const layoutStyle = { height: '100vh' }\n const layoutContentStyle = { height: '100%' }\n\n if (this.state.redirectTo !== undefined) {\n return (\n \n \n \n )\n } else if (this.state.isLoading) {\n return (\n \n \n \n \n \n \n \n \n )\n } else if (!this.state.wasAuthSuccessful) {\n return (\n \n )\n } else if (this.state.error != null) {\n return (\n \n )\n } else {\n return (\n \n \n \n \n \n {worklist}\n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n Logged out\n \n }\n />\n \n \n )\n }\n }\n}\n\nexport default App\n"],"names":["Description","layout","labelLineHeight","undefined","this","props","hasLongValues","items","attributes","map","item","index","uid","generateUUID","label","name","labelStyle","lineHeight","contentStyle","fontWeight","whiteSpace","span","value","icon","title","header","extra","size","hoverable","selectable","bordered","actions","methods","column","children","React","metadata","ClinicalTrialSponsorName","push","ClinicalTrialProtocolID","ClinicalTrialProtocolName","ClinicalTrialSiteName","ClinicalTrialTimePointID","parseName","Alphabetic","split","join","parseDate","year","substring","month","day","parseTime","hours","minutes","seconds","parseSex","F","M","O","PatientID","PatientName","PatientSex","PatientBirthDate","AccessionNumber","StudyID","StudyDate","StudyTime","StorageClasses","_subscriptions","Symbol","_lastSubscriptionId","PubSub","eventName","callback","Error","hasOwnProperty","subscriptionId","callbacks","payload","errorTypes","CustomError","type","message","stack","NotificationMiddlewareEvents","NotificationMiddlewareContext","NotificationType","NotificationSourceDefinition","sources","category","notificationType","outerContext","args","publish","Array","from","warn","console","JSON","stringify","arguments","includes","apply","prototype","slice","call","source","error","notificationMsg","errorCategory","find","s","String","notification","description","duration","state","isLoading","overviewViewportRef","overviewViewer","setState","slide","overviewImages","length","current","innerHTML","info","ContainerIdentifier","dmv","client","clients","VL_WHOLE_SLIDE_MICROSCOPY_IMAGE","resizeFactor","errorInterceptor","NotificationMiddleware","render","container","resize","style","height","containerIdentifier","ref","seriesInstanceUIDs","selectedSeriesInstanceUID","onSeriesSelection","seriesInstanceUID","slideList","slideItemList","i","slideItem","selectedKeys","width","onSelect","key","keyPath","domEvent","toString","mode","inlineIndent","handleVisibilityChange","bind","checked","event","onVisibilityChange","roiUID","roi","isVisible","identifier","otherProps","evaluations","forEach","nameValue","ConceptNameCodeSequence","CodeValue","nameMeaning","CodeMeaning","ValueType","dcmjs","valueMeaning","ConceptCodeSequence","textContentItem","TextValue","measurements","seq","MeasuredValueSequence","NumericValue","toPrecision","unit","MeasurementUnitsCodeSequence","align","paddingLeft","onChange","checkedChildren","unCheckedChildren","handleMenuItemSelection","rois","visibleRoiUIDs","object","onSelection","has","paddingTop","paddingBottom","selectedRoiUIDs","values","onClick","handleMeasurementSelection","handleOpacityChange","handleColorRChange","handleColorGChange","handleColorBChange","getCurrentColor","currentStyle","opacity","defaultStyle","color","annotationGroupUID","annotationGroup","onStyleChange","styleOptions","limitValues","isArray","option","codeComponents","measurement","schemeDesignator","meaning","colorSettings","windowSettings","explorationSettings","AnnotationGroupSequence","findIndex","AnnotationGroupUID","propertyType","propertyCategory","GraphicType","AnnotationCoordinateType","measurementsSequence","MeasurementsSequence","measurementOptions","measurementItem","CodingSchemeDesignator","dropdownMatchSelectWidth","disabled","plain","justify","gutter","range","min","max","step","handleLowerLimitChange","handleLimitChange","handleUpperLimitChange","minWidth","defaultValue","settings","isBadgeVisible","direction","placement","content","overlayStyle","shape","SettingOutlined","offset","count","borderStyle","borderWidth","borderColor","visibility","backgroundImage","annotationGroups","visibleAnnotationGroupUIDs","defaultAnnotationGroupStyles","onAnnotationGroupVisibilityChange","onAnnotationGroupStyleChange","handleClick","text","button","Icon","isSelected","tooltip","Manufacturer","ManufacturerModelName","DeviceSerialNumber","SoftwareVersions","InstitutionName","findContentItemsByName","concept","hasName","hasValueType","valueType","getROIs","report","matches","ContentSequence","measurementsItem","measurementGroupItems","observerType","group","trackingUIDItem","algorithmNameItem","algorithmVersionItem","scoord3d","regionItem","frameOfReferenceUID","ReferencedFrameOfReferenceUID","coordinates","GraphicData","evaluation","findEvaluationItems","findMeasurementItems","properties","trackingUID","UID","MeasurementReport","PersonObserverName","PersonObserverLoginName","DeviceObserverUID","DeviceObserverName","SpecimenUID","SpecimenIdentifier","ROIs","specimenUIDItem","specimenIdItem","containerIdItem","personNameItem","PersonName","personLoginNameItem","deviceUIDItem","deviceNameItem","dataset","containerAttrs","specimenAttrs","observerAttrs","annotations","id","attrs","orientation","groups","SpecimenPreparationAdditives","FIXATIVE","EMBEDDING_MEDIUM","SpecimenPreparationStepItems","SPECIMEN_IDENTIFIER","PARENT_SPECIMEN_IDENTIFIER","PROCESSING_TYPE","DATETIME_OF_PROCESSING","PROCESSING_STEP_DESCRIPTION","COLLECTION_METHOD","SAMPLING_METHOD","STAIN","specimenDescription","SpecimenDescriptionSequence","SpecimenShortDescription","PrimaryAnatomicStructureSequence","structures","SpecimenPreparationSequence","SpecimenPreparationStepContentItemSequence","equals","showstain","overflowY","handleRemoval","getCurrentColors","paletteColorLookupTable","previousProps","previousState","opticalPath","opticalPathIdentifier","rgb2hex","data","onRemoval","illuminationWaveLength","illuminationColor","specimenDescriptions","maxValue","Math","pow","BitsAllocated","isMonochromatic","colors","buttons","isRemovable","DeleteOutlined","EyeOutlined","EyeInvisibleOutlined","Option","Select","selectedOpticalPathIdentifier","handleItemAddition","handleItemRemoval","handleItemSelectionChange","onOpticalPathActivityChange","isActive","opticalPathSelector","isSelectable","opticalPaths","opticalPathItems","optionItems","images","SeriesInstanceUID","OpticalPathSequence","opticalPathItem","OpticalPathIdentifier","OpticalPathDescription","activeOpticalPathIdentifiers","visibleOpticalPathIdentifiers","defaultOpticalPathStyles","onOpticalPathVisibilityChange","onOpticalPathStyleChange","padding","allowClear","AppstoreAddOutlined","mappingUID","mapping","mappings","visibleMappingUIDs","defaultMappingStyles","onMappingVisibilityChange","onMappingStyleChange","segmentUID","segment","algorithmName","segments","visibleSegmentUIDs","defaultSegmentStyles","onSegmentVisibilityChange","onSegmentStyleChange","withRouter","Component","location","useLocation","navigate","useNavigate","params","useParams","annotationGroupsUIDs","checkedAnnotationUids","defaultAnnotationStyles","types","checkAll","every","uids","indeterminate","some","handleChangeCheckedType","e","target","mouseEnterDelay","reduce","acc","marginLeft","shortenedCodeMeaning","displayCodeMeaning","isChecked","indeterminateType","display","flexDirection","categories","categoriesAcc","annotation","categoryKey","typeKey","oldCategory","oldType","Object","keys","typesArr","getCategories","xPosition","yPosition","position","top","left","backgroundColor","minHeight","pointerEvents","attr","DEFAULT_ROI_STROKE_COLOR","DEFAULT_ROI_FILL_COLOR","DEFAULT_ANNOTATION_STROKE_COLOR","DEFAULT_ANNOTATION_COLOR_PALETTE","_buildKey","codingScheme","codeValue","_getRoiKey","findingName","_formatRoiStyle","stroke","fill","image","circle","radius","_constructViewers","preload","volumeImages","labelViewer","volumeViewer","clientMapping","controls","activateSelectInteraction","labelImages","SlideViewer","findingOptions","evaluationOptions","geometryTypeOptions","volumeViewportRef","labelViewportRef","defaultRoiStyle","roiStyles","selectionColor","selectedRoiStyle","loadPresentationStates","ADVANCED_BLENDING_PRESENTATION_STATE","searchForInstances","studyInstanceUID","queryParams","Modality","then","matchedInstances","rawInstance","instance","SOPInstanceUID","retrieveInstance","sopInstanceUID","retrievedInstance","dict","areVolumeImagesMonochrome","presentationState","doesMatch","AdvancedBlendingSequence","blendingItem","selectedPresentationStateUID","setPresentationState","presentationStates","catch","getAllOpticalPaths","opticalPathStyles","hideOpticalPath","deactivateOpticalPath","getOpticalPathDefaultStyle","setOpticalPathStyle","refInstanceItems","ReferencedInstanceSequence","ReferencedImageSequence","imageItem","sopInstanceUIDs","ReferencedSOPInstanceUID","paletteColorLUT","PaletteColorLookupTableSequence","cpLUTItem","PaletteColorLookupTableUID","redDescriptor","RedPaletteColorLookupTableDescriptor","greenDescriptor","GreenPaletteColorLookupTableDescriptor","blueDescriptor","BluePaletteColorLookupTableDescriptor","redData","RedPaletteColorLookupTableData","Uint16Array","greenData","GreenPaletteColorLookupTableData","blueData","BluePaletteColorLookupTableData","redSegmentedData","SegmentedRedPaletteColorLookupTableData","greenSegmentedData","SegmentedGreenPaletteColorLookupTableData","blueSegmentedData","SegmentedBluePaletteColorLookupTableData","SoftcopyVOILUTSequence","voiLUTItem","windowCenter","WindowCenter","windowWidth","WindowWidth","selectedOpticalPathIdentifiers","Set","activateOpticalPath","showOpticalPath","add","searchParams","URLSearchParams","search","set","pathname","replace","getRoiStyle","addAnnotations","COMPREHENSIVE_3D_SR","SOPClassUID","templateSeq","ContentTemplateSequence","TemplateIdentifier","_implementsTID1500","subjectClassValue","retrievedConcept","expectedConcept","_describesSpecimenSubject","debug","measurementGroups","foundRegion","regions","_containsROIAnnotations","FrameOfReferenceUID","doesROIExist","getAllROIs","otherROI","a","b","graphicType","graphicData","s1","s2","j","_areROIsEqual","addROI","forceUpdate","addAnnotationGroups","MICROSCOPY_BULK_SIMPLE_ANNOTATION","searchForSeries","matchedSeries","series","retrieveSeriesMetadata","retrievedMetadata","ann","finding","AnnotationPropertyTypeCodeSequence","setAnnotationGroupStyle","addSegmentations","SEGMENTATION","segmentations","seg","refImage","addSegments","addParametricMaps","PARAMETRIC_MAP","parametricMaps","pm","addParameterMappings","populateViewports","setDefaultPresentationState","onRoiModified","onWindowResize","onRoiDrawn","detail","selectedFinding","selectedEvaluations","findingItem","relationshipType","addEvaluation","onRoiDoubleClicked","isSelectedRoiModalVisible","setHoveredRoiAttributes","hoveredRoi","hoveredRoiAttributes","onPointerMove","feature","evt","originalEvent","isHoveredRoiTooltipVisible","hoveredRoiTooltipX","clientX","hoveredRoiTooltipY","clientY","onRoiSelected","selectedRoi","setROIStyle","onLoadingStarted","onLoadingEnded","onFrameLoadingStarted","frameInfo","frameNumber","loadingFrames","onFrameLoadingError","onLoadingError","onFrameLoadingEnded","delete","sopClassUID","channelIdentifier","pixelDataStatistics","pixelArray","chunks","ceil","minValues","maxValues","pixels","stats","numFramesSampled","getOpticalPathStyle","onRoiRemoved","onKeyUp","isRoiDrawingActive","deactivateDrawInteraction","isRoiModificationActive","deactivateModifyInteraction","isRoiTranslationActive","deactivateTranslateInteraction","isAnnotationModalVisible","isGoToModalVisible","altKey","code","handleRoiDrawing","handleRoiModification","handleRoiTranslation","handleRoiRemoval","handleRoiVisibilityChange","handleReportGeneration","handleGoTo","geometryTypes","componentSetup","componentCleanup","handleRoiSelectionCancellation","handleAnnotationConfigurationCancellation","handleAnnotationGeometryTypeSelection","handleAnnotationMeasurementActivation","handleAnnotationFindingSelection","handleAnnotationEvaluationSelection","handleAnnotationEvaluationClearance","handleAnnotationConfigurationCompletion","handleAnnotationSelection","handleAnnotationVisibilityChange","handleAnnotationGroupVisibilityChange","handleAnnotationGroupStyleChange","handleRoiStyleChange","handleXCoordinateSelection","handleYCoordinateSelection","handleMagnificationSelection","handleSlidePositionSelection","handleSlidePositionSelectionCancellation","handleReportVerification","handleReportCancellation","handleSegmentVisibilityChange","handleSegmentStyleChange","handleMappingVisibilityChange","handleMappingStyleChange","handleOpticalPathVisibilityChange","handleOpticalPathStyleChange","handleOpticalPathActivityChange","handlePresentationStateSelection","handlePresentationStateReset","boundingBox","generatedReport","isSelectedMagnificationValid","isReportModalVisible","isSelectedXCoordinateValid","isSelectedYCoordinateValid","selectedXCoordinate","validXCoordinateRange","selectedYCoordinate","validYCoordinateRange","selectedMagnification","areRoisHidden","cleanup","isOpticalPathVisible","isOpticalPathActive","document","body","removeEventListener","window","addEventListener","hasICCProfile","ICCProfile","bulkdataReferences","selectedGeometryType","selectedMarkup","filteredEvaluations","filter","x","Number","start","end","y","targetPixelSpacing","diffs","numLevels","actualPixelSpacing","getPixelSpacing","abs","level","indexOf","point","log","geometryType","markup","activateDrawInteraction","getOpticalPathMetadata","observer","refSpecimen","user","loginName","email","observationContext","observerPersonContext","observerIdentifyingAttributes","observerDeviceContext","app","manufacturerName","modelName","subjectContext","subjectClass","subjectClassSpecificContext","imagingMeasurements","findingType","trackingIdentifier","referencedRegion","qualitativeEvaluations","MappingResource","measurementReport","languageOfContentItemAndDescendants","procedureReported","evidence","seriesNumber","seriesDescription","instanceNumber","manufacturer","previousVersions","fileMetaInformationVersionArray","Uint8Array","fileMeta","Value","buffer","vr","writer","write","storeInstances","datasets","response","getROI","showAnnotationGroup","hideAnnotationGroup","strokeColor","fillColor","c","generateRoiStyle","showSegment","hideSegment","setSegmentStyle","showParameterMapping","hideParameterMapping","setParameterMappingStyle","sort","localeCompare","paletteColorLookupTableUID","defaultColors","numVisible","urlPath","deactivateSelectInteraction","deactivateSnapInteraction","isModifyInteractionActive","activateSnapInteraction","activateModifyInteraction","isTranslateInteractionActive","activateTranslateInteraction","removeROI","areROIsVisible","hideROIs","showROIs","getAllSegments","getAllParameterMappings","allAnnotationGroups","getAllAnnotationGroups","filteredAnnotationGroups","referencedSeriesInstanceUID","annotationMenuItems","result","adaptRoiToAnnotation","openSubMenuItems","geometryTypeOptionsMapping","box","polygon","line","freehandpolygon","freehandline","annotationConfigurations","defaultActiveFirstOption","onClear","specimenMenu","equipmentMenu","opticalPathMetadata","presentationStateMenu","segmentationMenu","parametricMapMenu","annotationGroupMenu","toolbar","opticalPathMenu","presentationStateOptions","ContentDescription","maxWidth","UndoOutlined","segmentMetadata","getSegmentStyle","getSegmentMetadata","mappingMetadata","getParameterMappingStyle","getParameterMappingMetadata","annotationGroupMetadata","getAnnotationGroupStyle","getAnnotationGroupMetadata","toolbarHeight","annotationTools","FaDrawPolygon","FaHandPointer","FaHandPaper","FaTrash","FaEye","FaEyeSlash","FaSave","controlTools","FaCrosshairs","enableAnnotationTools","selectedRoiInformation","cursor","roiAttributes","roiScoordAttributes","roiEvaluationAttributes","codeItem","textItem","roiMeasurmentAttributesPerOpticalPath","refItems","ReferencedSOPSequence","ReferencedOpticalPathIdentifier","measuredValueItem","createRoiDescription","roiDescriptions","roiScoordDescriptions","roiEvaluationDescriptions","roiMeasurementDescriptions","descriptions","orientationMargin","dashed","hasSider","overflow","open","onOk","onCancel","okText","maskClosable","footer","placeholder","prefix","onPressEnter","addonAfter","CheckOutlined","StopOutlined","reverseArrow","borderLeft","borderLeftWidth","background","defaultOpenKeys","forceSubMenuRender","onOpenChange","setTimeout","ImageFlavors","hasImageFlavor","imageFlavor","ImageType","areSameAcquisition","AcquisitionUID","Slide","options","acquisitionUID","opticalPathIdentifiers","pyramidUIDs","acquisitionUIDs","containerIdentifiers","frameOfReferenceUIDs","VOLUME","LABEL","OVERVIEW","THUMBNAIL","PyramidUID","samplesPerPixel","SamplesPerPixel","requirePyramidUID","PhotometricInterpretation","createSlides","slideMetadata","filteredLabelImages","filteredVolumeImages","slideMetadataIndex","_doesImageBelongToSlide","filteredOverviewImages","slideMetadataItem","slides","imgA","imgB","fetchImageMetadata","onSuccess","onError","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","newSlides","customError","slidesCache","Map","pendingRequests","useSlides","useState","setSlides","setIsLoading","setError","useEffect","cachedData","get","fetchSlides","pendingRequest","resolve","reject","err","ParametrizedSlideViewer","presentationStateUID","selectedSlide","viewer","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","DicomMetaDictionary","formatValue","val","getRows","depth","keywords","flatMap","keyword","tagInfo","nameMap","match","tag","sequenceItems","sequenceNode","getSortedTags","subscribe","_broadcastEvent","_unsubscribe","_isValidEvent","listenerId","subscription","listeners","unsubscribe","EVENTS","callbackProps","hasListeners","hasCallbacks","listener","defaultInstances","instances","instancesMap","SeriesNumber","SeriesDescription","SeriesDate","SeriesTime","addInstance","newInstance","addInstances","newInstances","len","getInstance","StudyDescription","NumInstances","ModalitiesInStudy","isLoaded","addInstanceToSeries","addInstancesToSeries","createSeriesMetadata","setSeriesMetadata","seriesMetadata","existingSeries","assign","STUDY_ADDED","INSTANCES_ADDED","SERIES_ADDED","SERIES_UPDATED","_model","studies","_getStudy","aStudy","_getSeries","study","aSeries","BaseImplementation","dicomJSONDatasetOrP10ArrayBuffer","dicomJSONDataset","naturalizedDataset","ArrayBuffer","createStudyMetadata","madeInClient","updateSeriesMetadata","addSeriesMetadata","seriesSummaryMetadata","NumberOfStudyRelatedSeries","addStudy","existingStudy","newStudy","getStudyInstanceUIDs","getStudy","getSeries","getInstanceByImageId","imageId","updateMetadataForSeries","pubSubServiceInterface","setStudy","displaySets","setDisplaySets","selectedDisplaySetInstanceUID","setSelectedDisplaySetInstanceUID","setInstanceNumber","filterValue","setFilterValue","expandedKeys","setExpandedKeys","searchInput","setSearchInput","debouncedSearchValue","delay","debouncedValue","setDebouncedValue","timer","clearTimeout","useDebounce","handler","DicomMetadataStore","seriesAddedSubscription","instancesAddedSubscription","derivedDisplaySets","processedSeries","ds","displaySetInstanceUID","displaySetList","useMemo","displaySet","displayDate","dateStr","hour","minute","second","monthNum","parseInt","dayNum","date","Date","getMonth","getDate","weekday","toLocaleDateString","monthName","dayFormatted","yearNum","getFullYear","formatDicomDate","showInstanceList","instanceSliderMarks","totalInstances","tableData","transformTagsToTableData","tags","parentKey","keyBase","currentKey","filteredData","searchLower","toLowerCase","matchedKeys","nodeMatches","node","findMatchingPaths","parentPath","currentPath","matchingPaths","child","childPaths","filtered","reconstructTree","paths","nodesAtLevel","className","gap","marginBottom","flex","strong","optionLabelProp","optionFilterProp","fontSize","marks","formatter","SearchOutlined","columns","dataIndex","dataSource","pagination","expandable","expandedRowKeys","onExpandedRowsChange","scroll","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","handleDicomTagBrowserButtonClick","innerWidth","handleDebugButtonClick","errorMsgs","Authentication","Communication","EncodingDecoding","Visualization","errorNum","errorObj","warncount","Panel","Collapse","showErrorCount","errcount","uuidv4","warnings","warning","handleServerSelectionButtonClick","isServerSelectionModalVisible","isServerSelectionDisabled","prevProps","prevState","worklistButton","userMenuItems","onUserLogout","userMenu","menu","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","dicomTagBrowserButton","FileSearchOutlined","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","filterIcon","fetchData","handleChange","numStudies","pageSize","searchOptions","searchForStudies","limit","searchCriteria","fuzzymatching","filters","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","onRow","loading","joinUrl","uri","baseUri","endsWith","isAuthorizationCodeInUrl","hashParams","hash","Boolean","createUser","userData","profile","OidcManager","_oidc","signIn","onSignIn","handleSignIn","authorization","token_type","access_token","signinCallback","getUser","expired","signinRedirect","signOut","signoutRedirect","getAuthorization","responseType","grantType","UserManager","authority","client_id","clientId","redirect_uri","scope","response_type","loadUserInfo","automaticSilentRenew","revokeAccessTokenOnSignout","post_logout_redirect_uri","endSessionEndpoint","metadataService","getMetadata","end_session_endpoint","retries","factor","minTimeout","maxTimeout","randomize","retryableStatusCodes","retryOptions","xhrRetryHook","request","method","originalRequestSend","send","operation","retry","attempt","currentAttempt","originalOnReadyStateChange","onreadystatechange","status","errorMessage","attemptFailedError","naturalizeDataset","DicomWebManager","stores","handleError","updateHeaders","fields","f","headers","retrieveStudyMetadata","studySummaryMetadata","naturalized","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","shouldUpgradeInsecure","upgradeInsecureRequests","qidoPathPrefix","wadoPathPrefix","stowPathPrefix","qidoURLPrefix","wadoURLPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","handleDICOMwebError","logServerError","errorMessages","setting","Authorization","storedPath","localStorage","getItem","storedSearch","href","removeItem","host","appUri","oidcSettings","oidc","servers","addGcpSecondaryAnnotationServer","wasAuthSuccessful","serverId","COMPREHENSIVE_SR","COLOR_SOFTCOPY_PRESENTATION_STATE","GRAYSCALE_SOFTCOPY_PRESENTATION_STATE","PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE","tmpClient","redirectTo","setItem","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/687.cd0a08b4.chunk.js b/static/js/687.cd0a08b4.chunk.js new file mode 100644 index 00000000..6836eae7 --- /dev/null +++ b/static/js/687.cd0a08b4.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkslim=self.webpackChunkslim||[]).push([[687],{4687:(e,t,n)=>{n.d(t,{Z:()=>Dn});var i=n(5671),a=n(3144),o=n(7326),r=n(136),s=n(7277),l=n(2791),c=n(7689),u=n(1087),d=n(3695),h=n(586),p=n(9135),v=n(6014),m=n(4261),f=n(394),g=n(4970),y=n(184),S=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e="horizontal",t="14px";void 0!==this.props.hasLongValues&&this.props.hasLongValues&&(e="vertical",t="20px");var n=this.props.attributes.map((function(e,n){var i=(0,m.Z)();return(0,y.jsx)(f.Z.Item,{label:e.name,labelStyle:{lineHeight:t},contentStyle:{fontWeight:600,whiteSpace:"pre-line",lineHeight:"14px"},span:1,children:e.value},i)})),i=null;return void 0!==this.props.icon&&(i=(0,y.jsx)(this.props.icon,{})),(0,y.jsxs)(g.Z,{title:this.props.header,extra:i,size:"small",hoverable:this.props.selectable,bordered:void 0!==this.props.header,actions:this.props.methods,children:[(0,y.jsx)(f.Z,{column:1,size:"small",layout:e,bordered:!1,children:n}),this.props.children]})}}]),n}(l.Component);const C=S;const I=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[];return null!=this.props.metadata.ClinicalTrialSponsorName&&e.push.apply(e,[{name:"Sponsor Name",value:this.props.metadata.ClinicalTrialSponsorName},{name:"Protocol ID",value:this.props.metadata.ClinicalTrialProtocolID},{name:"Protocol Name",value:this.props.metadata.ClinicalTrialProtocolName},{name:"Site Name",value:this.props.metadata.ClinicalTrialSiteName}]),null!=this.props.metadata.ClinicalTrialTimePointID&&e.push({name:"Time Point ID",value:this.props.metadata.ClinicalTrialTimePointID}),(0,y.jsx)(C,{attributes:e})}}]),n}(l.Component);function b(e){return"object"===typeof e&&null!==e&&void 0!==e&&void 0!==e.Alphabetic?e.Alphabetic.split("^").join(" "):""}function w(e){if(null!==e&&void 0!==e){var t=e.substring(0,4),n=e.substring(4,6),i=e.substring(6,8);return"".concat(t,"-").concat(n,"-").concat(i)}return""}function x(e){if(null!==e&&void 0!==e){var t=e.substring(0,2),n=e.substring(2,4),i=e.substring(4,6);return"".concat(t,":").concat(n,":").concat(i)}return""}function D(e){return null!==e&&void 0!==e?{F:"Female",M:"Male",O:"Other"}[e]:""}const Z=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[{name:"ID",value:this.props.metadata.PatientID},{name:"Name",value:b(this.props.metadata.PatientName)},{name:"Gender",value:D(this.props.metadata.PatientSex)},{name:"Birthdate",value:w(this.props.metadata.PatientBirthDate)}];return(0,y.jsx)(C,{attributes:e})}}]),n}(l.Component);const V=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=[{name:"Accession #",value:this.props.metadata.AccessionNumber},{name:"ID",value:this.props.metadata.StudyID},{name:"Date",value:w(this.props.metadata.StudyDate)},{name:"Time",value:x(this.props.metadata.StudyTime)}];return(0,y.jsx)(C,{attributes:e})}}]),n}(l.Component);var O,R=n(1413),j=n(6658);!function(e){e.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE="1.2.840.10008.5.1.4.1.1.77.1.6",e.COMPREHENSIVE_SR="1.2.840.10008.5.1.4.1.1.88.33",e.COMPREHENSIVE_3D_SR="1.2.840.10008.5.1.4.1.1.88.34",e.SEGMENTATION="1.2.840.10008.5.1.4.1.1.66.4",e.MICROSCOPY_BULK_SIMPLE_ANNOTATION="1.2.840.10008.5.1.4.1.1.91.1",e.PARAMETRIC_MAP="1.2.840.10008.5.1.4.1.1.30",e.ADVANCED_BLENDING_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.8",e.COLOR_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.2",e.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.1",e.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE="1.2.840.10008.5.1.4.1.1.11.3"}(O||(O={}));var M=Symbol("subscriptions"),P=Symbol("lastSubscriptionId"),E=function(){function e(){(0,i.Z)(this,e),this[M]={},this[P]=0}return(0,a.Z)(e,[{key:"subscribe",value:function(e,t){if(void 0===e)throw new Error("Trying to subscribe to an inexistent event");if("function"!==typeof t)throw new Error("The provided callback must be a function");this[M].hasOwnProperty(e)||(this[M][e]={});var n="sub".concat(this[P]++);this[M][e][n]=t}},{key:"unsubscribe",value:function(e,t){var n=this[M][e]||{};for(var i in n)t?n[i]===t&&delete n[i]:delete n[i]}},{key:"publish",value:function(e){if(void 0===e)throw new Error("Trying to publish an inexistent event");for(var t=this[M][e]||{},n=arguments.length,i=new Array(n>1?n-1:0),a=1;a0){var e=this.props.slide.overviewImages[0];null!==this.overviewViewportRef.current&&(this.overviewViewportRef.current.innerHTML="",console.info("instantiate viewer for OVERVIEW image of slide "+'"'.concat(e.ContainerIdentifier,'"')),this.overviewViewer=new j.viewer.OverviewImageViewer({client:this.props.clients[O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:e,resizeFactor:1,errorInterceptor:function(e){Q.onError(z,e)}}),this.overviewViewer.render({container:this.overviewViewportRef.current}))}this.setState({isLoading:!1})}},{key:"render",value:function(){void 0!==this.overviewViewer&&this.overviewViewer.resize();var e=[],t=this.props.slide.description;return null!=t&&""!==t&&e.push({name:"Description",value:t}),this.state.isLoading?(0,y.jsx)(p.fCD,{}):(0,y.jsx)(v.Z.Item,(0,R.Z)((0,R.Z)({style:{height:"100%"}},this.props),{},{children:(0,y.jsx)(C,{header:this.props.slide.containerIdentifier,attributes:e,selectable:!0,children:null!=this.overviewViewportRef.current&&(0,y.jsx)("div",{style:{height:"100px"},ref:this.overviewViewportRef})})}),this.props.slide.seriesInstanceUIDs[0])}}]),n}(l.Component);const $=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,o=new Array(a),r=0;r0,checkedChildren:(0,y.jsx)(p.dSq,{}),unCheckedChildren:(0,y.jsx)(p.tgn,{})})}),(0,y.jsx)(v.Z,{selectedKeys:(0,te.Z)(this.props.selectedRoiUIDs.values()),onSelect:this.handleMenuItemSelection,onClick:this.handleMenuItemSelection,children:t})]})}}]),n}(l.Component);var Ce=n(914),Ie=n(6272),be=n(3020),we=n(5594),xe=n(2414),De=["annotationGroup","defaultStyle","isVisible","metadata","onVisibilityChange","onStyleChange"];const Ze=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleMeasurementSelection=a.handleMeasurementSelection.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.getCurrentColor=a.getCurrentColor.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({annotationGroupUID:this.props.annotationGroup.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{opacity:e}}),this.setState({currentStyle:{opacity:e,color:this.state.currentStyle.color,limitValues:this.state.currentStyle.limitValues}}))}},{key:"handleColorRChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"handleColorGChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"handleColorBChange",value:function(e){if(null!=e&&void 0!==this.state.currentStyle.color){var t=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.setState((function(e){return{currentStyle:{color:t,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:t}})}}},{key:"getCurrentColor",value:function(){var e;return null!=this.state.currentStyle.color?"#"+(16777216+((e=this.state.currentStyle.color)[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):"white"}},{key:"handleLowerLimitChange",value:function(e){null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:[e,t.currentStyle.limitValues[1]]}}:{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:[e,this.state.currentStyle.limitValues[1]]}}))}},{key:"handleUpperLimitChange",value:function(e){null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:[t.currentStyle.limitValues[0],e]}}:{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:[this.state.currentStyle.limitValues[0],e]}}))}},{key:"handleLimitChange",value:function(e){this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,opacity:t.currentStyle.opacity,limitValues:e}}})),this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{limitValues:e}})}},{key:"handleMeasurementSelection",value:function(e,t){var n=this;if(null!=e&&null!=t.children){var i=e.split("-"),a=new ve.sr.coding.CodedConcept({value:i[1],schemeDesignator:i[0],meaning:t.children});this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{measurement:a}}),this.setState((function(e){return{currentStyle:{opacity:e.currentStyle.opacity,measurement:a}}}))}else this.props.onStyleChange({uid:this.props.annotationGroup.uid,styleOptions:{color:this.props.defaultStyle.color}}),this.setState((function(e){return{currentStyle:{opacity:e.currentStyle.opacity,color:n.props.defaultStyle.color,limitValues:void 0}}}))}},{key:"render",value:function(){var e,t,n,i,a=this,o=this.props.metadata.AnnotationGroupSequence.findIndex((function(e){return e.AnnotationGroupUID===a.props.annotationGroup.uid})),r=this.props.metadata.AnnotationGroupSequence[o],s=[{name:"Property type",value:this.props.annotationGroup.propertyType.CodeMeaning},{name:"Property category",value:this.props.annotationGroup.propertyCategory.CodeMeaning},{name:"Graphic type",value:r.GraphicType},{name:"Annotation coordinate type",value:this.props.metadata.AnnotationCoordinateType}],l=null!==(e=r.MeasurementsSequence)&&void 0!==e?e:[],c=l.map((function(e,t){var n=e.ConceptNameCodeSequence[0];return(0,y.jsx)(ne.Z.Option,{value:"".concat(n.CodingSchemeDesignator,"-").concat(n.CodeValue),dropdownMatchSelectWidth:!1,size:"small",disabled:!a.props.isVisible,children:n.CodeMeaning},t)}));if(c.push((0,y.jsx)(ne.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",disabled:!this.props.isVisible,children:(0,y.jsx)(y.Fragment,{})},"-")),null!=this.state.currentStyle.color&&(t=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Color"}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Red"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Green"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,y.jsx)(le.Z,{plain:!0})]})),l.length>0){if(null!=this.state.currentStyle.limitValues){n=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Values of interest"}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!0,min:0,max:1e3,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:this.state.currentStyle.limitValues[0],max:1e3,size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[1],onChange:this.handleUpperLimitChange})})]})]})}i=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Exploration"}),(0,y.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:8,children:"Measurement"}),(0,y.jsx)(Ce.Z,{span:16,children:(0,y.jsx)(ne.Z,{style:{minWidth:"65px",width:"90%"},onSelect:this.handleMeasurementSelection,defaultValue:void 0,children:c},"annotation-group-measurements")})]})]})}var u=(0,y.jsxs)("div",{children:[t,n,(0,y.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]}),i]}),d=this.getCurrentColor(),h=this.state.isVisible&&null==this.state.currentStyle.measurement,m=this.props,f=(m.annotationGroup,m.defaultStyle,m.isVisible,m.metadata,m.onVisibilityChange,m.onStyleChange,(0,fe.Z)(m,De));return(0,y.jsx)(v.Z.Item,(0,R.Z)((0,R.Z)({style:{height:"100%",paddingLeft:"3px"}},f),{},{children:(0,y.jsxs)(ae.Z,{align:"start",children:[(0,y.jsx)("div",{style:{paddingLeft:"14px"},children:(0,y.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,y.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,y.jsx)(p.dSq,{}),unCheckedChildren:(0,y.jsx)(p.tgn,{})}),(0,y.jsx)(be.Z,{placement:"left",content:u,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,y.jsx)(xe.Z,{})})})]})}),(0,y.jsx)(we.Z,{offset:[-20,20],count:" ",style:{borderStyle:"solid",borderWidth:"1px",borderColor:"gray",visibility:h?"visible":"hidden",backgroundImage:"linear-gradient(to bottom, ".concat(d,", ").concat(d)},children:(0,y.jsx)(C,{header:this.props.annotationGroup.label,attributes:s,selectable:!0,hasLongValues:!0})})]})}),this.props.annotationGroup.uid)}}]),n}(l.Component);const Ve=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.annotationGroups.map((function(t,n){var i=t.uid;return(0,y.jsx)(Ze,{annotationGroup:t,metadata:e.props.metadata[i],isVisible:e.props.visibleAnnotationGroupUIDs.has(i),defaultStyle:e.props.defaultAnnotationGroupStyles[i],onVisibilityChange:e.props.onAnnotationGroupVisibilityChange,onStyleChange:e.props.onAnnotationGroupStyleChange},t.uid)}));return(0,y.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);const Oe=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleClick=a.handleClick.bind((0,o.Z)(a)),a}return(0,a.Z)(n,[{key:"handleClick",value:function(e){void 0!==this.props.onClick&&this.props.onClick(e)}},{key:"render",value:function(){var e,t,n,i=this.props.icon;return void 0===i?null:(null!=this.props.label&&(t=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{type:"vertical"}),this.props.label]})),n=null!==(e=this.props.isSelected)&&void 0!==e&&e?(0,y.jsx)(re.Z,{onClick:this.handleClick,icon:(0,y.jsx)(i,{}),type:"primary",style:{lineHeight:"1.0"},children:t}):(0,y.jsx)(re.Z,{onClick:this.handleClick,icon:(0,y.jsx)(i,{}),type:"default",style:{lineHeight:"1.0"},children:t}),void 0!==this.props.tooltip?(0,y.jsx)(oe.Z,{title:this.props.tooltip,children:n}):n)}}]),n}(l.Component);const Re=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){if(void 0===this.props.metadata)return null;var e=[{name:"Manufacturer",value:this.props.metadata.Manufacturer},{name:"Model Name",value:this.props.metadata.ManufacturerModelName},{name:"Device Serial Number",value:this.props.metadata.DeviceSerialNumber},{name:"Software Versions",value:this.props.metadata.SoftwareVersions}];return null!=this.props.metadata.InstitutionName&&e.push({name:"Institution Name",value:this.props.metadata.InstitutionName}),(0,y.jsx)(C,{attributes:e,hasLongValues:!0})}}]),n}(l.Component);var je=function(e){var t=e.content,n=e.name,i=[];return t.forEach((function(e){(function(e,t){var n=e.ConceptNameCodeSequence[0];return n.CodeValue===t.CodeValue&&n.CodingSchemeDesignator===t.CodingSchemeDesignator})(e,n)&&i.push(e)})),i},Me=function(e,t){return e.ValueType===t},Pe=function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});1!==t.length&&Q.onError(W,new N(L,'Content item "Imaging Measurements" not found.Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report".'));var n=t[0],i=je({content:n.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=[];return i.forEach((function(e){var t,n=[],i=e,o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"112040",schemeDesignator:"DCM",meaning:"Tracking Unique Identifier"})});0===o.length&&Q.onError(W,new N(L,'Content item "Tracking Unique Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'));var r=o[0];if(0===(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121071",schemeDesignator:"DCM",meaning:"Finding"})})).length&&Q.onError(W,new N(L,'Content item "Finding" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".')),0!==(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111001",schemeDesignator:"DCM",meaning:"Algorithm Name"})})).length){var s=o[0];n.push(s),t="Device"}else t="Person";if(0!==(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111003",schemeDesignator:"DCM",meaning:"Algorithm Version"})})).length){var l=o[0];n.push(l)}0===(o=je({content:i.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})})).length&&Q.onError(W,new N(L,'Content item "Image Region" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'));var c,u=o[0];if("POINT"===u.GraphicType)c=new j.scoord3d.Point({frameOfReferenceUID:u.ReferencedFrameOfReferenceUID,coordinates:u.GraphicData});else{for(var d=[],h=0;h TID 1410 "Planar ROI Measurements and Qualitative Evaluations".'))}n.push.apply(n,(0,te.Z)(function(e){var t=e.content,n=[];return t.forEach((function(e){if(Me(e,ve.sr.valueTypes.ValueTypes.CODE)){var t=e;n.push(t)}})),n}({content:i.ContentSequence})));var p=function(e){var t=e.content,n=[];return t.forEach((function(e){if(Me(e,ve.sr.valueTypes.ValueTypes.NUM)){var t=e;n.push(t)}})),n}({content:i.ContentSequence}),v=new j.roi.ROI({scoord3d:c,uid:(0,m.Z)(),properties:{trackingUID:r.UID,observerType:t,evaluations:n,measurements:p}});a.push(v)})),a},Ee=(0,a.Z)((function e(t){(0,i.Z)(this,e),this.PersonObserverName=void 0,this.PersonObserverLoginName=void 0,this.DeviceObserverUID=void 0,this.DeviceObserverName=void 0,this.SpecimenUID=void 0,this.SpecimenIdentifier=void 0,this.ContainerIdentifier=void 0,this.ROIs=[];var n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121039",schemeDesignator:"DCM",meaning:"Specimen UID"})});0===n.length&&Q.onError(W,new N(L,'Content item "Specimen UID" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var a=n[0];this.SpecimenUID=a.UID,0===(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen Identifier"})})).length&&Q.onError(W,new N(L,'Content item "Specimen Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var o=n[0];this.SpecimenIdentifier=o.TextValue,0===(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111700",schemeDesignator:"DCM",meaning:"Specimen Container Identifier"})})).length&&Q.onError(W,new N(L,'Content item "Specimen Container Identifier" not found. Content of Comprehensive 3D SR document is not structured based on TID 1500 "Measurement Report" -> TID 1001 "Observation Context" -> TID 1006 "Subject Context" -> TID 1009 "Subject Context, Specimen".'));var r=n[0];if(this.ContainerIdentifier=r.TextValue,0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121008",schemeDesignator:"DCM",meaning:"Person Observer Name"})})).length){var s=n[0];this.PersonObserverName=s.PersonName}if(0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"128774",schemeDesignator:"DCM",meaning:"Person Observer's Login Name"})})).length){var l=n[0];this.PersonObserverLoginName=l.TextValue}if((n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121012",schemeDesignator:"DCM",meaning:"Device Observer UID"})})).length>0){var c=n[0];this.DeviceObserverUID=c.UID}if(0!==(n=je({content:t.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121013",schemeDesignator:"DCM",meaning:"Device Observer Name"})})).length){var u=n[0];this.DeviceObserverName=u.TextValue}this.ROIs=Pe(t)}));const Ue=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=new Ee(this.props.dataset),t=[{name:"ID",value:e.ContainerIdentifier}],n=[{name:"ID",value:e.SpecimenIdentifier}],i=[{name:"Name",value:e.PersonObserverName}],a=e.ROIs.map((function(e,t){var n="Region ".concat(t+1),i=[];return e.evaluations.forEach((function(e){e.ValueType===ve.sr.valueTypes.ValueTypes.CODE?i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.ConceptCodeSequence[0].CodeMeaning}):e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.TextValue})})),(0,y.jsx)(C,{header:n,attributes:i},e.uid)}));return(0,y.jsxs)("div",{children:[(0,y.jsx)(le.Z,{orientation:"left",children:"Patient"}),(0,y.jsx)(Z,{metadata:this.props.dataset}),(0,y.jsx)(le.Z,{orientation:"left",children:"Case"}),(0,y.jsx)(V,{metadata:this.props.dataset}),(0,y.jsx)(le.Z,{orientation:"left",children:"Slide"}),(0,y.jsx)(C,{attributes:t}),(0,y.jsx)(le.Z,{orientation:"left",children:"Specimen"}),(0,y.jsx)(C,{attributes:n}),(0,y.jsx)(le.Z,{orientation:"left",children:"Observer"}),(0,y.jsx)(C,{attributes:i}),(0,y.jsx)(le.Z,{orientation:"left",children:"Annotations"}),a]})}}]),n}(l.Component);var Ae=n(2126);const Te=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=null;return void 0!==this.props.groups&&(t=this.props.groups.map((function(e,t){return(0,y.jsx)(C,{header:e.name,attributes:e.attributes},t)}))),e=void 0!==this.props.type?"".concat(this.props.type,": ").concat(this.props.identifier):this.props.identifier,(0,y.jsxs)(Ae.ZP.Item,{children:[(0,y.jsx)(C,{header:e,attributes:this.props.attributes,hasLongValues:this.props.hasLongValues,children:t}),this.props.children]},this.props.uid)}}]),n}(l.Component);new ve.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),new ve.sr.coding.CodedConcept({value:"433465004",schemeDesignator:"SCT",meaning:"Sampling of tissue specimen"}),new ve.sr.coding.CodedConcept({value:"127790008",schemeDesignator:"SCT",meaning:"Specimen staining"}),new ve.sr.coding.CodedConcept({value:"9265001",schemeDesignator:"SCT",meaning:"Specimen processing"});var ke={FIXATIVE:new ve.sr.coding.CodedConcept({value:"430864009",schemeDesignator:"SCT",meaning:"Tissue fixative"}),EMBEDDING_MEDIUM:new ve.sr.coding.CodedConcept({value:"430863003",schemeDesignator:"SCT",meaning:"Embedding medium"})},Le=(0,R.Z)({SPECIMEN_IDENTIFIER:new ve.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen identifier"}),PARENT_SPECIMEN_IDENTIFIER:new ve.sr.coding.CodedConcept({value:"111705",schemeDesignator:"DCM",meaning:"Parent specimen identifier"}),PROCESSING_TYPE:new ve.sr.coding.CodedConcept({value:"111701",schemeDesignator:"DCM",meaning:"Processing type"}),DATETIME_OF_PROCESSING:new ve.sr.coding.CodedConcept({value:"111702",schemeDesignator:"DCM",meaning:"Datetime of processing"}),PROCESSING_STEP_DESCRIPTION:new ve.sr.coding.CodedConcept({value:"111703",schemeDesignator:"DCM",meaning:"Processing step description"}),COLLECTION_METHOD:new ve.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),SAMPLING_METHOD:new ve.sr.coding.CodedConcept({value:"111704",schemeDesignator:"DCM",meaning:"Sampling method"}),STAIN:new ve.sr.coding.CodedConcept({value:"424361007",schemeDesignator:"SCT",meaning:"Using substance"})},ke);const _e=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=this;if(void 0===this.props.metadata)return null;var n=this.props.metadata.SpecimenDescriptionSequence[this.props.index],i=[];if(void 0!==n.SpecimenShortDescription&&i.push({name:"Description",value:n.SpecimenShortDescription}),void 0!==n.PrimaryAnatomicStructureSequence&&n.PrimaryAnatomicStructureSequence.length>0){var a=n.PrimaryAnatomicStructureSequence;i.push({name:"Anatomical structure",value:a.map((function(e){return e.CodeMeaning})).join(", ")})}(null!==(e=n.SpecimenPreparationSequence)&&void 0!==e?e:[]).forEach((function(e,n){e.SpecimenPreparationStepContentItemSequence.forEach((function(e,n){var a=new ve.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var o=new ve.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});a.equals(Le.PROCESSING_TYPE)||(a.equals(Le.COLLECTION_METHOD)?i.push({name:"Collection method",value:o.CodeMeaning}):a.equals(Le.FIXATIVE)?i.push({name:"Tissue fixative",value:o.CodeMeaning}):a.equals(Le.EMBEDDING_MEDIUM)?i.push({name:"Tissue embedding medium",value:o.CodeMeaning}):a.equals(Le.STAIN)&&t.props.showstain&&i.push({name:"Tissue stain",value:o.CodeMeaning}))}else e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&(a.equals(Le.STAIN)&&t.props.showstain?i.push({name:"Tissue stain",value:e.TextValue}):a.equals(Le.PARENT_SPECIMEN_IDENTIFIER)&&i.push({name:"Parent specimen",value:e.TextValue}))}))}));var o=n.SpecimenUID,r=n.SpecimenIdentifier;return(0,y.jsx)(Te,{uid:o,identifier:r,attributes:i,hasLongValues:!0},o)}}]),n}(l.Component);const Ne=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e,t=this;if(void 0===this.props.metadata)return null;var n=(null!==(e=this.props.metadata.SpecimenDescriptionSequence)&&void 0!==e?e:[]).map((function(e,n){return(0,y.jsx)(_e,{index:n,metadata:t.props.metadata,showstain:t.props.showstain},e.SpecimenUID)}));return(0,y.jsx)(Ae.ZP,{style:{overflowY:"auto"},children:n})}}]),n}(l.Component);var Ge=n(681),qe=n(2622),Fe=n(4215),ze=n(8272),Be=["defaultStyle","isRemovable","isVisible","metadata","onVisibilityChange","onStyleChange","onRemoval","opticalPath"];const We=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleLimitChange=a.handleLimitChange.bind((0,o.Z)(a)),a.handleLowerLimitChange=a.handleLowerLimitChange.bind((0,o.Z)(a)),a.handleUpperLimitChange=a.handleUpperLimitChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.handleRemoval=a.handleRemoval.bind((0,o.Z)(a)),a.getCurrentColors=a.getCurrentColors.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color,paletteColorLookupTable:a.props.defaultStyle.paletteColorLookupTable,limitValues:a.props.defaultStyle.limitValues}},a}return(0,a.Z)(n,[{key:"componentDidUpdate",value:function(e,t){this.props.defaultStyle!==e.defaultStyle&&this.setState({currentStyle:this.props.defaultStyle})}},{key:"handleVisibilityChange",value:function(e,t){var n=this.props.opticalPath.identifier;this.setState({isVisible:e}),this.props.onVisibilityChange({opticalPathIdentifier:n,isVisible:e})}},{key:"handleOpacityChange",value:function(e){if(null!=e){var t=this.props.opticalPath.identifier;this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{opacity:e}}),this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:e,limitValues:t.currentStyle.limitValues}}}))}}},{key:"handleColorRChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"handleColorGChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"handleColorBChange",value:function(e){var t=this.props.opticalPath.identifier;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.setState((function(e){return{currentStyle:{color:n,paletteColorLookupTable:e.currentStyle.paletteColorLookupTable,opacity:e.currentStyle.opacity,limitValues:e.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{color:n}})}}},{key:"getCurrentColors",value:function(){var e=function(e){return"#"+(16777216+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1)};return null!=this.props.defaultStyle.paletteColorLookupTable?this.props.defaultStyle.paletteColorLookupTable.data.map((function(t){return e(t)})):null!=this.state.currentStyle.color?["#000000",e(this.state.currentStyle.color)]:["white","white"]}},{key:"handleLowerLimitChange",value:function(e){var t=this.props.opticalPath.identifier;null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:[e,t.currentStyle.limitValues[1]]}}:{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:[e,this.state.currentStyle.limitValues[1]]}}))}},{key:"handleUpperLimitChange",value:function(e){var t=this.props.opticalPath.identifier;null!=e&&void 0!==this.state.currentStyle.limitValues&&(this.setState((function(t){return void 0!==t.currentStyle.limitValues?{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:[t.currentStyle.limitValues[0],e]}}:{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:t.currentStyle.limitValues}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:[this.state.currentStyle.limitValues[0],e]}}))}},{key:"handleLimitChange",value:function(e){var t=this.props.opticalPath.identifier;this.setState((function(t){return{currentStyle:{color:t.currentStyle.color,paletteColorLookupTable:t.currentStyle.paletteColorLookupTable,opacity:t.currentStyle.opacity,limitValues:e}}})),this.props.onStyleChange({opticalPathIdentifier:t,styleOptions:{limitValues:e}})}},{key:"handleRemoval",value:function(){var e=this.props.opticalPath.identifier;this.props.onRemoval(e)}},{key:"render",value:function(){var e,t=this.props.opticalPath.identifier,n=this.props.opticalPath.description,i=[];void 0!==this.props.opticalPath.illuminationWaveLength&&i.push({name:"Illumination wavelength",value:"".concat(this.props.opticalPath.illuminationWaveLength," nm")}),void 0!==this.props.opticalPath.illuminationColor&&i.push({name:"Illumination color",value:this.props.opticalPath.illuminationColor.CodeMeaning});var a=null!==(e=this.props.metadata[0].SpecimenDescriptionSequence)&&void 0!==e?e:[];try{a.forEach((function(e){var t;(null!==(t=e.SpecimenPreparationSequence)&&void 0!==t?t:[]).forEach((function(e,t){e.SpecimenPreparationStepContentItemSequence.forEach((function(e,t){var n=new ve.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var a=new ve.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});n.equals(Le.PROCESSING_TYPE)||n.equals(Le.STAIN)&&i.push({name:"Tissue stain",value:a.CodeMeaning})}else e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT&&(n.equals(Le.PROCESSING_TYPE)||n.equals(Le.STAIN)&&i.push({name:"Tissue stain",value:e.TextValue}))}))}))}))}catch(f){Q.onError(B,new N(L,f.message))}var o,r,s=Math.pow(2,this.props.metadata[0].BitsAllocated)-1,l=null!=n?"".concat(t,": ").concat(n):t;if(this.props.opticalPath.isMonochromatic){var c,u;c=null!=this.state.currentStyle.color?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Color"}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Red"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Green"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Color"}),"Custom pseudo-coloring is disabled because pixels are colorized via a provided palette color lookup table."]}),null!=this.state.currentStyle.limitValues&&(u=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Values of interest"}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!0,min:0,max:s,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:this.state.currentStyle.limitValues[0],max:s,size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[1],onChange:this.handleUpperLimitChange})})]})]})),o=(0,y.jsxs)("div",{children:[u,c,(0,y.jsx)(le.Z,{plain:!0}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})]});var d=this.getCurrentColors();r=(0,y.jsx)(we.Z,{offset:[-20,20],count:" ",style:{borderStyle:"solid",borderWidth:"1px",borderColor:"gray",visibility:this.state.isVisible?"visible":"hidden",backgroundImage:"linear-gradient(to right, ".concat(d.toString(),")")},children:(0,y.jsx)(C,{header:l,attributes:i,selectable:!0,hasLongValues:!0})})}else o=(0,y.jsx)("div",{children:(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"60px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),r=(0,y.jsx)(C,{header:l,attributes:i,selectable:!0,hasLongValues:!0});var h=[];this.props.isRemovable&&h.push((0,y.jsx)(oe.Z,{title:"Remove Optical Path",children:(0,y.jsx)(re.Z,{type:"default",shape:"circle",icon:(0,y.jsx)(qe.Z,{}),onClick:this.handleRemoval})}));var p=this.props,m=(p.defaultStyle,p.isRemovable,p.isVisible,p.metadata,p.onVisibilityChange,p.onStyleChange,p.onRemoval,p.opticalPath,(0,fe.Z)(p,Be));return(0,y.jsx)(v.Z.Item,(0,R.Z)((0,R.Z)({style:{height:"100%",paddingLeft:"3px"}},m),{},{children:(0,y.jsxs)(ae.Z,{align:"start",children:[(0,y.jsx)("div",{style:{paddingLeft:"14px"},children:(0,y.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,y.jsx)(me.Z,{size:"small",checked:this.state.isVisible,onChange:this.handleVisibilityChange,checkedChildren:(0,y.jsx)(Fe.Z,{}),unCheckedChildren:(0,y.jsx)(ze.Z,{})}),(0,y.jsx)(be.Z,{placement:"left",content:o,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,y.jsx)(xe.Z,{})})}),h]})}),r]})}),this.props.opticalPath.identifier)}}]),n}(l.Component);var Ye=ne.Z.Option;const He=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).state={selectedOpticalPathIdentifier:void 0},a.handleItemAddition=a.handleItemAddition.bind((0,o.Z)(a)),a.handleItemRemoval=a.handleItemRemoval.bind((0,o.Z)(a)),a.handleItemSelectionChange=a.handleItemSelectionChange.bind((0,o.Z)(a)),a}return(0,a.Z)(n,[{key:"handleItemRemoval",value:function(e){this.props.onOpticalPathActivityChange({opticalPathIdentifier:e,isActive:!1})}},{key:"handleItemSelectionChange",value:function(e){this.setState({selectedOpticalPathIdentifier:e})}},{key:"handleItemAddition",value:function(){var e=this.state.selectedOpticalPathIdentifier;void 0!==e&&(this.props.onOpticalPathActivityChange({opticalPathIdentifier:e,isActive:!0}),this.setState({selectedOpticalPathIdentifier:void 0}))}},{key:"render",value:function(){var e=this;if(void 0===this.props.metadata)return null;var t,n=this.props.opticalPaths.length>1,i=[],a=[];return this.props.opticalPaths.forEach((function(t){var o=t.identifier,r=e.props.metadata[o],s=r[0].SeriesInstanceUID;r[0].OpticalPathSequence.forEach((function(o){var l,c=o.OpticalPathIdentifier,u=o.OpticalPathDescription;t.identifier===c&&(e.props.activeOpticalPathIdentifiers.has(c)?i.push((0,y.jsx)(We,{opticalPath:t,metadata:r,isVisible:e.props.visibleOpticalPathIdentifiers.has(c),defaultStyle:e.props.defaultOpticalPathStyles[c],onVisibilityChange:e.props.onOpticalPathVisibilityChange,onStyleChange:e.props.onOpticalPathStyleChange,onRemoval:e.handleItemRemoval,isRemovable:n},"".concat(s,"-").concat(c))):(l=""!==u?"".concat(c," - ").concat(u):"".concat(c),a.push((0,y.jsx)(Ye,{value:c,children:l},c))))}))})),n&&(t=(0,y.jsxs)(ae.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,y.jsx)(ne.Z,{defaultValue:"",style:{width:200},onChange:this.handleItemSelectionChange,value:this.state.selectedOpticalPathIdentifier,allowClear:!0,children:a}),(0,y.jsx)(oe.Z,{title:"Add",children:(0,y.jsx)(re.Z,{icon:(0,y.jsx)(Ge.Z,{}),type:"primary",onClick:this.handleItemAddition})})]})),(0,y.jsxs)(v.Z,{selectable:!1,children:[i,t]})}}]),n}(l.Component);var Xe=["defaultStyle","isVisible","mapping","metadata","onVisibilityChange","onStyleChange"];const Ke=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({mappingUID:this.props.mapping.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({mappingUID:this.props.mapping.uid,styleOptions:{opacity:e}}),this.setState((function(t){return{currentStyle:{opacity:e}}})))}},{key:"render",value:function(){var e=[{name:"Description",value:this.props.mapping.description}],t=(0,y.jsx)("div",{children:(0,y.jsxs)(se.Z,{justify:"center",align:"middle",children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),n=this.props,i=(n.defaultStyle,n.isVisible,n.mapping,n.metadata,n.onVisibilityChange,n.onStyleChange,(0,fe.Z)(n,Xe));return(0,y.jsx)(v.Z.Item,(0,R.Z)((0,R.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,y.jsxs)(ae.Z,{align:"start",children:[(0,y.jsx)("div",{style:{paddingLeft:"14px"},children:(0,y.jsx)(ae.Z,{direction:"vertical",align:"end",size:100,children:(0,y.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,y.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,y.jsx)(p.dSq,{}),unCheckedChildren:(0,y.jsx)(p.tgn,{})}),(0,y.jsx)(be.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,y.jsx)(xe.Z,{})})})]})})}),(0,y.jsx)(C,{header:this.props.mapping.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.mapping.uid)}}]),n}(l.Component);const Qe=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.mappings.map((function(t,n){var i=t.uid;return(0,y.jsx)(Ke,{mapping:t,metadata:e.props.metadata[i],isVisible:e.props.visibleMappingUIDs.has(i),defaultStyle:e.props.defaultMappingStyles[i],onVisibilityChange:e.props.onMappingVisibilityChange,onStyleChange:e.props.onMappingStyleChange},t.uid)}));return(0,y.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);var Je=["defaultStyle","isVisible","segment","metadata","onVisibilityChange","onStyleChange"];const $e=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleVisibilityChange=a.handleVisibilityChange.bind((0,o.Z)(a)),a.handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.state={isVisible:a.props.isVisible,currentStyle:{opacity:a.props.defaultStyle.opacity}},a}return(0,a.Z)(n,[{key:"handleVisibilityChange",value:function(e,t){this.props.onVisibilityChange({segmentUID:this.props.segment.uid,isVisible:e}),this.setState({isVisible:e})}},{key:"handleOpacityChange",value:function(e){null!=e&&(this.props.onStyleChange({segmentUID:this.props.segment.uid,styleOptions:{opacity:e}}),this.setState({currentStyle:{opacity:e}}))}},{key:"render",value:function(){var e=[{name:"Property Type",value:this.props.segment.propertyType.CodeMeaning},{name:"Property Category",value:this.props.segment.propertyCategory.CodeMeaning},{name:"Algorithm Name",value:this.props.segment.algorithmName}],t=(0,y.jsx)("div",{children:(0,y.jsxs)(se.Z,{justify:"center",align:"middle",children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),n=this.props,i=(n.defaultStyle,n.isVisible,n.segment,n.metadata,n.onVisibilityChange,n.onStyleChange,(0,fe.Z)(n,Je));return(0,y.jsx)(v.Z.Item,(0,R.Z)((0,R.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,y.jsxs)(ae.Z,{align:"start",children:[(0,y.jsx)("div",{style:{paddingLeft:"14px"},children:(0,y.jsxs)(ae.Z,{direction:"vertical",align:"end",children:[(0,y.jsx)(me.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,y.jsx)(p.dSq,{}),unCheckedChildren:(0,y.jsx)(p.tgn,{})}),(0,y.jsx)(be.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",icon:(0,y.jsx)(xe.Z,{})})})]})}),(0,y.jsx)(C,{header:this.props.segment.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.segment.uid)}}]),n}(l.Component);const et=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(){return(0,i.Z)(this,n),t.apply(this,arguments)}return(0,a.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.segments.map((function(t,n){var i=t.uid;return(0,y.jsx)($e,{segment:t,metadata:e.props.metadata[i],isVisible:e.props.visibleSegmentUIDs.has(i),defaultStyle:e.props.defaultSegmentStyles[i],onVisibilityChange:e.props.onSegmentVisibilityChange,onStyleChange:e.props.onSegmentStyleChange},t.uid)}));return(0,y.jsx)(v.Z,{selectable:!1,children:t})}}]),n}(l.Component);function tt(e){return function(t){var n=(0,c.TH)(),i=(0,c.s0)(),a=(0,c.UO)();return(0,y.jsx)(e,(0,R.Z)((0,R.Z)({},t),{},{location:n,navigate:i,params:a}))}}var nt=n(4942);const it=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).handleOpacityChange=a.handleOpacityChange.bind((0,o.Z)(a)),a.handleColorRChange=a.handleColorRChange.bind((0,o.Z)(a)),a.handleColorGChange=a.handleColorGChange.bind((0,o.Z)(a)),a.handleColorBChange=a.handleColorBChange.bind((0,o.Z)(a)),a.getCurrentColor=a.getCurrentColor.bind((0,o.Z)(a)),a.state={currentStyle:{opacity:a.props.defaultStyle.opacity,color:a.props.defaultStyle.color,contourOnly:a.props.defaultStyle.contourOnly}},a}return(0,a.Z)(n,[{key:"handleOpacityChange",value:function(e){var t=this;null!=e&&(this.props.annotationGroupsUIDs.forEach((function(n){t.props.onStyleChange({uid:n,styleOptions:{color:t.state.currentStyle.color,opacity:e,contourOnly:t.state.currentStyle.contourOnly}})})),this.updateCurrentStyle({opacity:e}))}},{key:"handleColorRChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[Array.isArray(e)?e[0]:e,this.state.currentStyle.color[1],this.state.currentStyle.color[2]];this.updateCurrentStyle({color:n}),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity,contourOnly:t.state.currentStyle.contourOnly}})}))}}},{key:"handleColorGChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],Array.isArray(e)?e[0]:e,this.state.currentStyle.color[2]];this.updateCurrentStyle({color:n}),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity,contourOnly:t.state.currentStyle.contourOnly}})}))}}},{key:"handleColorBChange",value:function(e){var t=this;if(null!=e&&void 0!==this.state.currentStyle.color){var n=[this.state.currentStyle.color[0],this.state.currentStyle.color[1],Array.isArray(e)?e[0]:e];this.updateCurrentStyle({color:n}),this.props.annotationGroupsUIDs.forEach((function(e){t.props.onStyleChange({uid:e,styleOptions:{color:n,opacity:t.state.currentStyle.opacity,contourOnly:t.state.currentStyle.contourOnly}})}))}}},{key:"handleShowOutlineOnly",value:function(e){var t=this;this.updateCurrentStyle({contourOnly:e}),this.props.annotationGroupsUIDs.forEach((function(n){t.props.onStyleChange({uid:n,styleOptions:{color:t.state.currentStyle.color,opacity:t.state.currentStyle.opacity,contourOnly:e}})}))}},{key:"getCurrentColor",value:function(){var e;return null!=this.state.currentStyle.color?"#"+(16777216+((e=this.state.currentStyle.color)[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):"white"}},{key:"updateCurrentStyle",value:function(e){var t=e.color,n=e.opacity,i=e.contourOnly;this.setState((function(e){return{currentStyle:{opacity:null!==n&&void 0!==n?n:e.currentStyle.opacity,color:null!==t&&void 0!==t?t:e.currentStyle.color,contourOnly:null!==i&&void 0!==i?i:e.currentStyle.contourOnly}}}))}},{key:"render",value:function(){var e,t=this;return null!=this.state.currentStyle.color&&(e=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{plain:!0,children:"Color"}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Red"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Green"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,y.jsxs)(se.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:5,children:"Blue"}),(0,y.jsx)(Ce.Z,{span:14,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,y.jsx)(Ce.Z,{span:5,children:(0,y.jsx)(ue.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,y.jsx)(le.Z,{plain:!0})]})),(0,y.jsxs)("div",{children:[e,(0,y.jsxs)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,y.jsx)(Ce.Z,{span:6,children:"Opacity"}),(0,y.jsx)(Ce.Z,{span:12,children:(0,y.jsx)(Ie.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,y.jsx)(Ce.Z,{span:6,children:(0,y.jsx)(ue.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]}),(0,y.jsx)(se.Z,{justify:"start",align:"middle",gutter:[8,8],children:(0,y.jsx)(ie.Z,{value:this.state.currentStyle.contourOnly,onChange:function(e){return t.handleShowOutlineOnly(e.target.checked)},children:"Show outline only"})})]})}}]),n}(l.Component);const at=function(e){var t=e.category,n=e.onChange,i=e.checkedAnnotationUids,a=e.onStyleChange,o=e.defaultAnnotationStyles,r=t.types,s=r.every((function(e){return e.uids.every((function(e){return i.has(e)}))})),l=!s&&r.some((function(e){return e.uids.some((function(e){return i.has(e)}))})),c=function(e){var t=e.type,i=e.isVisible;t.uids.forEach((function(e){n({roiUID:e,isVisible:i})}))};return(0,y.jsx)(v.Z.Item,{style:{height:"100%",paddingLeft:"3px"},children:(0,y.jsx)(ae.Z,{align:"start",children:(0,y.jsxs)("div",{style:{paddingLeft:"14px",color:"black"},children:[(0,y.jsx)(ae.Z,{direction:"vertical",align:"end",children:(0,y.jsxs)(ie.Z,{indeterminate:l,checked:s,onChange:function(e){var t=e.target.checked;r.forEach((function(e){c({type:e,isVisible:t})}))},children:[(0,y.jsx)(oe.Z,{title:"".concat(t.CodeValue,":").concat(t.CodingSchemeDesignator),mouseEnterDelay:1,children:t.CodeMeaning}),(0,y.jsx)(be.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,y.jsx)(it,{annotationGroupsUIDs:r.reduce((function(e,t){return[].concat((0,te.Z)(e),(0,te.Z)(t.uids))}),[]),onStyleChange:a,defaultStyle:o[r[0].uids[0]]})},children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,y.jsx)(xe.Z,{})})})]})}),r.map((function(e){var t=e.CodeMeaning,n=e.CodingSchemeDesignator,r=e.CodeValue,s=e.uids,l=t.slice(0,22),u=l===t?t:"".concat(l,"..."),d=s.every((function(e){return i.has(e)})),h=!d&&s.some((function(e){return i.has(e)}));return(0,y.jsxs)("div",{style:{paddingLeft:"25px",width:"100%",display:"flex",flexDirection:"row"},children:[(0,y.jsx)(ie.Z,{indeterminate:h,checked:d,onChange:function(t){return c({type:e,isVisible:t.target.checked})}}),(0,y.jsxs)("div",{style:{paddingLeft:"5px"},children:[(0,y.jsx)(oe.Z,{title:"".concat(r,":").concat(n),mouseEnterDelay:1,children:u}),(0,y.jsx)(be.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,y.jsx)(it,{annotationGroupsUIDs:e.uids,onStyleChange:a,defaultStyle:o[e.uids[0]]})},children:(0,y.jsx)(re.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,y.jsx)(xe.Z,{})})})]})]},"".concat(e.CodingSchemeDesignator,":").concat(e.CodeMeaning))}))]})})},t.CodeMeaning)};const ot=function(e){var t=e.annotations,n=e.onChange,i=e.onStyleChange,a=e.defaultAnnotationStyles,o=e.checkedAnnotationUids,r=function(e){var t=null===e||void 0===e?void 0:e.reduce((function(e,t){var n,i,a=t.category,o=t.type,r=t.uid,s=a.CodeMeaning,l=o.CodeMeaning,c=null!==(n=e[s])&&void 0!==n?n:(0,R.Z)((0,R.Z)({},a),{},{types:{}}),u=null!==(i=c.types[l])&&void 0!==i?i:(0,R.Z)((0,R.Z)({},o),{},{uids:[]});return(0,R.Z)((0,R.Z)({},e),{},(0,nt.Z)({},s,(0,R.Z)((0,R.Z)({},c),{},{types:(0,R.Z)((0,R.Z)({},c.types),{},(0,nt.Z)({},l,(0,R.Z)((0,R.Z)({},u),{},{uids:[].concat((0,te.Z)(u.uids),[r])})))})))}),{});return Object.keys(t).forEach((function(e){var n=t[e].types,i=Object.keys(n).map((function(e){return n[e]}));t[e].types=i})),t}(t);if(0===Object.keys(r).length)return(0,y.jsx)(y.Fragment,{});var s=Object.keys(r).map((function(e){var t=r[e];return(0,y.jsx)(at,{category:t,onChange:n,onStyleChange:i,defaultAnnotationStyles:a,checkedAnnotationUids:o},t.CodeMeaning)}));return(0,y.jsx)(v.Z,{selectable:!1,children:s})};const rt=function(e){var t=e.xPosition,n=e.yPosition,i=e.rois;return(0,y.jsx)("div",{style:{position:"fixed",top:"".concat(n,"px"),left:"".concat(t,"px"),backgroundColor:"rgba(230, 230, 230, 0.65)",minWidth:"150px",minHeight:"60px",padding:"20px",fontWeight:"bold",pointerEvents:"none"},children:i.map((function(e,t){var n=e.attributes;return(0,y.jsxs)("div",{children:[(0,y.jsxs)("span",{children:["ROI ",e.index]}),n.map((function(t){return(0,y.jsxs)("div",{children:[t.name,": ",(0,y.jsx)("span",{style:{fontWeight:500},children:t.value})]},t.name+e.roiUid)}))]},e.roiUid)}))})};var st=[255,234,0],lt=[255,234,0,.2],ct=[0,0,0],ut=[[255,0,0],[0,255,0],[0,0,255],[255,255,0],[0,255,255],[0,0,0]],dt=function(e){var t=e.CodingSchemeDesignator,n=e.CodeValue;return"".concat(t,"-").concat(n)},ht=function(e){var t=je({content:e.evaluations,name:new ve.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"})});if(0!==t.length){var n=t[0].ConceptCodeSequence[0];return dt(n)}console.warn("no finding found for ROI ".concat(e.uid))},pt=function(e){var t={color:st,width:2};null!=e.stroke&&(null!=e.stroke.color&&(t.color=e.stroke.color),null!=e.stroke.width&&(t.width=e.stroke.width));var n={color:lt};return null!=e.fill&&null!=e.fill.color&&(n.color=e.fill.color),{stroke:t,fill:n,image:{circle:{radius:null!=e.radius?e.radius:Math.max(5-t.width,1),stroke:t,fill:n}}}},vt=function(e){var t=e.clients,n=e.slide,i=e.preload;console.info("instantiate viewer for VOLUME images of slide "+'"'.concat(n.volumeImages[0].ContainerIdentifier,'"'));try{var a,o=new j.viewer.VolumeImageViewer({clientMapping:t,metadata:n.volumeImages,controls:["overview","position"],preload:i,errorInterceptor:function(e){Q.onError(z,e)}});return o.activateSelectInteraction({}),n.labelImages.length>0&&(console.info("instantiate viewer for LABEL image of slide "+'"'.concat(n.labelImages[0].ContainerIdentifier,'"')),a=new j.viewer.LabelImageViewer({client:t[O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:n.labelImages[0],resizeFactor:1,orientation:"vertical",errorInterceptor:function(e){Q.onError(z,e)}})),{volumeViewer:o,labelViewer:a}}catch(r){throw Q.onError(W,new N(_,"Failed to instantiate viewer")),r}},mt=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;(0,i.Z)(this,n),(a=t.call(this,e)).findingOptions=[],a.evaluationOptions={},a.measurements=[],a.geometryTypeOptions={},a.volumeViewportRef=void 0,a.labelViewportRef=void 0,a.volumeViewer=void 0,a.labelViewer=void 0,a.hoveredRois=[],a.lastPixel=[0,0],a.defaultRoiStyle={stroke:{color:st,width:2},fill:{color:lt},image:{circle:{fill:{color:st},radius:5}}},a.roiStyles={},a.defaultAnnotationStyles={},a.selectionColor=[140,184,198],a.selectedRoiStyle={stroke:{color:[].concat((0,te.Z)(a.selectionColor),[1]),width:3},fill:{color:[].concat((0,te.Z)(a.selectionColor),[.2])},image:{circle:{radius:5,fill:{color:[].concat((0,te.Z)(a.selectionColor),[1])}}}},a.loadPresentationStates=function(){console.info("search for Presentation State instances");var e=a.props.clients[O.ADVANCED_BLENDING_PRESENTATION_STATE];e.searchForInstances({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"PR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t,n){var i=j.metadata.formatMetadata(t).dataset;console.info('retrieve PR instance "'.concat(i.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:i.SeriesInstanceUID,sopInstanceUID:i.SOPInstanceUID}).then((function(e){var t=ve.aT.DicomMessage.readFile(e),o=j.metadata.formatMetadata(t.dict).dataset;if(a.props.slide.areVolumeImagesMonochrome){var r=o,s=!1;r.AdvancedBlendingSequence.forEach((function(e){s=a.props.slide.seriesInstanceUIDs.includes(e.SeriesInstanceUID)})),s&&(console.info("include Advanced Blending Presentation State instance "+'"'.concat(r.SOPInstanceUID,'"')),(0===n&&null==a.props.selectedPresentationStateUID||r.SOPInstanceUID===a.props.selectedPresentationStateUID)&&a.setPresentationState(r),a.setState((function(e){var t={};return e.presentationStates.forEach((function(e){t[e.SOPInstanceUID]=e})),t[r.SOPInstanceUID]=r,{presentationStates:Object.values(t)}})))}else console.info('ignore presentation state "'.concat(i.SOPInstanceUID,'", ')+"application of presentation states for color images has not (yet) been implemented")})).catch((function(e){Q.onError(W,new N(_,"Presentation State could not be loaded")),console.error("failed to load presentation state "+'of SOP instance "'.concat(i.SOPInstanceUID,'" ')+'of series "'.concat(i.SeriesInstanceUID,'" ')+'of study "'.concat(a.props.studyInstanceUID,'": '),e)}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Presentation State could not be loaded"))}))},a.setPresentationState=function(e){var t=a.volumeViewer.getAllOpticalPaths();console.info('apply Presentation State instance "'.concat(e.SOPInstanceUID,'"'));var n={};t.forEach((function(t){var i=t.identifier;a.volumeViewer.hideOpticalPath(i),a.volumeViewer.deactivateOpticalPath(i);var o=a.volumeViewer.getOpticalPathDefaultStyle(i);a.volumeViewer.setOpticalPathStyle(i,o),e.AdvancedBlendingSequence.forEach((function(e){var a=e.ReferencedInstanceSequence;void 0===a&&(a=e.ReferencedImageSequence),void 0!==a&&a.forEach((function(a){if(t.sopInstanceUIDs.includes(a.ReferencedSOPInstanceUID)){var o,r;if(null!=e.PaletteColorLookupTableSequence){var s=e.PaletteColorLookupTableSequence[0];o=new j.color.PaletteColorLookupTable({uid:null!=s.PaletteColorLookupTableUID?s.PaletteColorLookupTableUID:"",redDescriptor:s.RedPaletteColorLookupTableDescriptor,greenDescriptor:s.GreenPaletteColorLookupTableDescriptor,blueDescriptor:s.BluePaletteColorLookupTableDescriptor,redData:null!=s.RedPaletteColorLookupTableData?new Uint16Array(s.RedPaletteColorLookupTableData):void 0,greenData:null!=s.GreenPaletteColorLookupTableData?new Uint16Array(s.GreenPaletteColorLookupTableData):void 0,blueData:null!=s.BluePaletteColorLookupTableData?new Uint16Array(s.BluePaletteColorLookupTableData):void 0,redSegmentedData:null!=s.SegmentedRedPaletteColorLookupTableData?new Uint16Array(s.SegmentedRedPaletteColorLookupTableData):void 0,greenSegmentedData:null!=s.SegmentedGreenPaletteColorLookupTableData?new Uint16Array(s.SegmentedGreenPaletteColorLookupTableData):void 0,blueSegmentedData:null!=s.SegmentedBluePaletteColorLookupTableData?new Uint16Array(s.SegmentedBluePaletteColorLookupTableData):void 0})}if(null!=e.SoftcopyVOILUTSequence){var l=e.SoftcopyVOILUTSequence[0],c=l.WindowCenter,u=l.WindowWidth;r=[c-.5*u,c+.5*u]}n[i]={opacity:1,paletteColorLookupTable:o,limitValues:r}}}))}))}));var i=new Set;Object.keys(n).forEach((function(e){var t=n[e];null!=t?(a.volumeViewer.setOpticalPathStyle(e,t),a.volumeViewer.activateOpticalPath(e),a.volumeViewer.showOpticalPath(e),i.add(e)):(a.volumeViewer.hideOpticalPath(e),a.volumeViewer.deactivateOpticalPath(e))}));var o=new URLSearchParams(a.props.location.search);o.set("state",e.SOPInstanceUID),a.props.navigate({pathname:a.props.location.pathname,search:o.toString()},{replace:!0}),a.setState((function(t){return{activeOpticalPathIdentifiers:i,visibleOpticalPathIdentifiers:i,selectedPresentationStateUID:e.SOPInstanceUID}}))},a.getRoiStyle=function(e){return null==e?a.defaultRoiStyle:void 0!==a.roiStyles[e]?a.roiStyles[e]:a.defaultRoiStyle},a.addAnnotations=function(){console.info("search for Comprehensive 3D SR instances");var e=a.props.clients[O.COMPREHENSIVE_3D_SR];e.searchForInstances({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"SR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=j.metadata.formatMetadata(t).dataset;n.SOPClassUID===O.COMPREHENSIVE_3D_SR&&(console.info('retrieve SR instance "'.concat(n.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID,sopInstanceUID:n.SOPInstanceUID}).then((function(e){var t=ve.aT.DicomMessage.readFile(e),n=j.metadata.formatMetadata(t.dict).dataset;(function(e){var t=e.ContentTemplateSequence;return t.length>0&&"1500"===t[0].TemplateIdentifier})(n)?!function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121024",schemeDesignator:"DCM",meaning:"Subject Class"})});if(0===t.length)return!1;var n=t[0].ConceptCodeSequence[0],i=new ve.sr.coding.CodedConcept({value:n.CodeValue,meaning:n.CodeMeaning,schemeDesignator:n.CodingSchemeDesignator}),a=new ve.sr.coding.CodedConcept({value:"121027",meaning:"Specimen",schemeDesignator:"DCM"});return!!i.equals(a)}(n)?console.debug('ignore SR document "'.concat(n.SOPInstanceUID,'" ')+"because it does not describe a specimen subject"):!function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});if(0===t.length)return!1;var n=t[0],i=je({content:n.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=!1;return i.forEach((function(e){var t=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})});t.length>0&&t[0].ValueType===ve.sr.valueTypes.ValueTypes.SCOORD3D&&(a=!0)})),a}(n)?console.debug('ignore SR document "'.concat(n.SOPInstanceUID,'" ')+"because it does not contain any suitable ROI annotations"):new Ee(n).ROIs.forEach((function(e){console.info('add ROI "'.concat(e.uid,'"'));var t=e.scoord3d,i=a.props.slide.volumeImages[0];if(t.frameOfReferenceUID===i.FrameOfReferenceUID){var o=a.volumeViewer.getAllROIs().some((function(t){return function(e,t){if(e.scoord3d.graphicType!==t.scoord3d.graphicType)return!1;if(e.scoord3d.frameOfReferenceUID!==t.scoord3d.frameOfReferenceUID)return!1;if(e.scoord3d.graphicData.length!==t.scoord3d.graphicData.length)return!1;for(var n=0;n0){try{a.volumeViewer.addSegments(t)}catch(n){Q.onError(W,new N(_,"Segmentations cannot be displayed")),console.error("failed to add segments: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Retrieval of metadata of Segmentation instances failed."))}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Search for Segmentation instances failed."))}))},a.addParametricMaps=function(){console.info("search for Parametric Map instances");var e=a.props.clients[O.PARAMETRIC_MAP];e.searchForSeries({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"OT"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=j.metadata.formatMetadata(t).dataset;e.retrieveSeriesMetadata({studyInstanceUID:a.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID}).then((function(e){var t=[];if(e.forEach((function(e){var n=new j.metadata.ParametricMap({metadata:e}),i=a.props.slide.volumeImages[0];n.FrameOfReferenceUID===i.FrameOfReferenceUID&&n.ContainerIdentifier===i.ContainerIdentifier?t.push(n):console.warn('skip Parametric Map instance "'.concat(n.SOPInstanceUID,'"'))})),t.length>0){try{a.volumeViewer.addParameterMappings(t)}catch(n){Q.onError(W,new N(_,"Parametric Map cannot be displayed")),console.error("failed to add mappings: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Retrieval of metadata of Parametric Map instances failed."))}))}))})).catch((function(e){console.error(e),Q.onError(W,new N(_,"Search for Parametric Map instances failed."))}))},a.populateViewports=function(){console.info("populate viewports..."),a.setState({isLoading:!0,presentationStates:[]}),null!=a.volumeViewportRef.current&&a.volumeViewer.render({container:a.volumeViewportRef.current}),null!=a.labelViewportRef.current&&null!=a.labelViewer&&a.labelViewer.render({container:a.labelViewportRef.current}),a.setState({isLoading:!1}),a.setDefaultPresentationState(),a.loadPresentationStates(),a.addAnnotations(),a.addAnnotationGroups(),a.addSegmentations(),a.addParametricMaps()},a.onRoiModified=function(e){a.setState((function(e){return{visibleRoiUIDs:new Set(e.visibleRoiUIDs)}}))},a.onWindowResize=function(e){console.info("resize viewports"),a.volumeViewer.resize(),null!=a.labelViewer&&a.labelViewer.resize()},a.onRoiDrawn=function(e){var t=e.detail.payload,n=a.state.selectedFinding,i=a.state.selectedEvaluations;if(void 0!==t&&void 0!==n){console.debug('add ROI "'.concat(t.uid,'"'));var o=new ve.sr.valueTypes.CodeContentItem({name:new ve.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"}),value:n,relationshipType:"CONTAINS"});t.addEvaluation(o),i.forEach((function(e){var n=new ve.sr.valueTypes.CodeContentItem({name:e.name,value:e.value,relationshipType:"CONTAINS"});t.addEvaluation(n)}));var r=dt(n),s=a.getRoiStyle(r);a.volumeViewer.addROI(t,s),a.setState((function(e){var n=e.visibleRoiUIDs;return n.add(t.uid),{visibleRoiUIDs:n}}))}else console.debug('could not add ROI "'.concat(t.uid,'"'))},a.onRoiDoubleClicked=function(e){null!=e.detail.payload?a.setState({isSelectedRoiModalVisible:!0}):a.setState({isSelectedRoiModalVisible:!1})},a.setHoveredRoiAttributes=function(e){var t=a.volumeViewer.getAllROIs(),n=e.map((function(e){var n,i=[];return e.evaluations.forEach((function(e){var t=e.ConceptNameCodeSequence[0].CodeValue,n=e.ConceptNameCodeSequence[0].CodeMeaning,a="".concat(n);if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var o=e.ConceptCodeSequence[0].CodeMeaning;"276214006"===t?i.push({name:"Property category",value:"".concat(o)}):"121071"===t?i.push({name:"Property type",value:"".concat(o)}):"111001"===t?i.push({name:"Algorithm Name",value:"".concat(o)}):i.push({name:a,value:"".concat(o)})}else if(e.ValueType===ve.sr.valueTypes.ValueTypes.TEXT){var r=e;i.push({name:a,value:r.TextValue})}})),{index:(null!==(n=t.findIndex((function(t){return t.uid===e.uid})))&&void 0!==n?n:0)+1,roiUid:e.uid,attributes:i}}),[]);a.setState({hoveredRoiAttributes:n})},a.clearHoveredRois=function(){a.hoveredRois=[]},a.getUniqueHoveredRois=function(e){if(null==e)return[];var t=[].concat((0,te.Z)(a.hoveredRois),[e]);return Array.from(new Set(t.map((function(e){return e.uid})))).map((function(e){return t.find((function(t){return t.uid===e}))})).filter((function(e){return void 0!==e}))},a.isSamePixelAsLast=function(e){return e.clientX===a.lastPixel[0]&&e.clientY===a.lastPixel[1]},a.onPointerMove=function(e){var t=e.detail.payload,n=t.feature,i=t.event.originalEvent;a.isSamePixelAsLast(i)||(a.lastPixel=[i.clientX,i.clientY],a.clearHoveredRois()),a.hoveredRois=a.getUniqueHoveredRois(n),a.hoveredRois.length>0?(a.setHoveredRoiAttributes(a.hoveredRois),a.setState({isHoveredRoiTooltipVisible:!0,hoveredRoiTooltipX:i.clientX,hoveredRoiTooltipY:i.clientY})):a.setState({isHoveredRoiTooltipVisible:!1})},a.onRoiSelected=function(e){var t=e.detail.payload;if(null!=t){console.debug('selected ROI "'.concat(t.uid,'"'));var n=Array.from(a.state.selectedRoiUIDs);a.setState({selectedRoiUIDs:new Set([].concat(n,[t.uid])),selectedRoi:t})}else a.setState({selectedRoiUIDs:new Set,selectedRoi:void 0})},a.onLoadingStarted=function(e){a.setState({isLoading:!0})},a.onLoadingEnded=function(e){a.setState({isLoading:!1})},a.onFrameLoadingStarted=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);a.setState((function(e){return e.loadingFrames.add(n),e}))},a.onFrameLoadingError=function(e){console.error("Failed to load frame")},a.onLoadingError=function(e){var t,n,i,a;console.error("Failed to load data");var o=null===(null===(t=e.detail)||void 0===t||null===(n=t.payload)||void 0===n?void 0:n.message)?"Failed to load data":null===(i=e.detail)||void 0===i||null===(a=i.payload)||void 0===a?void 0:a.message;Q.onError(W,new N(_,o))},a.onFrameLoadingEnded=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);if(a.setState((function(e){e.loadingFrames.delete(n);var t=!1;return e.loadingFrames.size>0&&(t=!0),{isLoading:t,loadingFrames:e.loadingFrames}})),t.sopClassUID===O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE&&a.props.slide.areVolumeImagesMonochrome){var i=t.channelIdentifier;if(!(i in a.state.pixelDataStatistics)&&null!=t.pixelArray){for(var o=Math.pow(2,16),r=Math.ceil(t.pixelArray.length/o),s=0,l=[],c=[],u=0;u=n&&t<=i)return void this.setState({selectedXCoordinate:t,isSelectedXCoordinateValid:!0})}this.setState({selectedXCoordinate:void 0,isSelectedXCoordinateValid:!1})}},{key:"handleYCoordinateSelection",value:function(e){if(null!=e){var t=Number(e),n=this.state.validYCoordinateRange[0],i=this.state.validYCoordinateRange[1];if(t>=n&&t<=i)return void this.setState({selectedYCoordinate:t,isSelectedYCoordinateValid:!0})}this.setState({selectedYCoordinate:void 0,isSelectedYCoordinateValid:!1})}},{key:"handleMagnificationSelection",value:function(e){null!=e&&e>0&&e<=40?this.setState({selectedMagnification:Number(e),isSelectedMagnificationValid:!0}):this.setState({selectedMagnification:void 0,isSelectedMagnificationValid:!1})}},{key:"handleSlidePositionSelection",value:function(){if(this.state.isSelectedXCoordinateValid&&this.state.isSelectedYCoordinateValid&&this.state.isSelectedMagnificationValid&&null!=this.state.selectedXCoordinate&&null!=this.state.selectedYCoordinate&&null!=this.state.selectedMagnification){console.info("select slide position "+"(".concat(this.state.selectedXCoordinate,", ")+"".concat(this.state.selectedYCoordinate,") ")+"at ".concat(this.state.selectedMagnification,"x magnification"));for(var e=.01/this.state.selectedMagnification,t=[],n=0;n1&&Q.onError(W,new N(_,"More than one specimen has been described for the slide"));var a,o=i.SpecimenDescriptionSequence[0];console.debug("create Observation Context"),void 0!==this.props.user?a=new ve.sr.templates.PersonObserverIdentifyingAttributes({name:this.props.user.name,loginName:this.props.user.email}):(console.warn("no user information available"),a=new ve.sr.templates.PersonObserverIdentifyingAttributes({name:"ANONYMOUS"}));var r=new ve.sr.templates.ObservationContext({observerPersonContext:new ve.sr.templates.ObserverContext({observerType:new ve.sr.coding.CodedConcept({value:"121006",schemeDesignator:"DCM",meaning:"Person"}),observerIdentifyingAttributes:a}),observerDeviceContext:new ve.sr.templates.ObserverContext({observerType:new ve.sr.coding.CodedConcept({value:"121007",schemeDesignator:"DCM",meaning:"Device"}),observerIdentifyingAttributes:new ve.sr.templates.DeviceObserverIdentifyingAttributes({uid:this.props.app.uid,manufacturerName:"MGH Computational Pathology",modelName:this.props.app.name})}),subjectContext:new ve.sr.templates.SubjectContext({subjectClass:new ve.sr.coding.CodedConcept({value:"121027",schemeDesignator:"DCM",meaning:"Specimen"}),subjectClassSpecificContext:new ve.sr.templates.SubjectContextSpecimen({uid:o.SpecimenUID,identifier:o.SpecimenIdentifier,containerIdentifier:i.ContainerIdentifier})})});console.debug("encode Imaging Measurements");for(var s=[],l=0;l0?(this.state.selectedRoiUIDs.forEach((function(t){void 0!==t?(console.info('remove ROI "'.concat(t,'"')),e.volumeViewer.removeROI(t),d.ZP.info("Annotation was removed")):d.ZP.warning("No annotation was selected for removal")})),this.setState({selectedRoiUIDs:new Set,isRoiTranslationActive:!1,isRoiDrawingActive:!1,isRoiModificationActive:!1})):(this.state.visibleRoiUIDs.forEach((function(t){console.info('remove ROI "'.concat(t,'"')),e.volumeViewer.removeROI(t)})),this.setState({visibleRoiUIDs:new Set,isRoiTranslationActive:!1,isRoiDrawingActive:!1,isRoiModificationActive:!1})),this.volumeViewer.activateSelectInteraction({})}},{key:"handleRoiVisibilityChange",value:function(){var e=this;console.info("toggle visibility of ROIs"),this.volumeViewer.areROIsVisible?(this.volumeViewer.deactivateDrawInteraction(),this.volumeViewer.deactivateSnapInteraction(),this.volumeViewer.deactivateTranslateInteraction(),this.volumeViewer.deactivateSelectInteraction(),this.volumeViewer.deactivateModifyInteraction(),this.volumeViewer.hideROIs(),this.setState({areRoisHidden:!0,isRoiDrawingActive:!1,isRoiModificationActive:!1,isRoiTranslationActive:!1})):(this.volumeViewer.showROIs(),this.volumeViewer.activateSelectInteraction({}),this.state.selectedRoiUIDs.forEach((function(t){void 0!==t&&e.volumeViewer.setROIStyle(t,e.selectedRoiStyle)})),this.setState({areRoisHidden:!1}))}},{key:"render",value:function(){var e=this,t=[],n=[],i=[],a=[];t.push.apply(t,(0,te.Z)(this.volumeViewer.getAllROIs())),n.push.apply(n,(0,te.Z)(this.volumeViewer.getAllSegments())),i.push.apply(i,(0,te.Z)(this.volumeViewer.getAllParameterMappings()));var o=this.volumeViewer.getAllAnnotationGroups(),r=null===o||void 0===o?void 0:o.filter((function(t){return t.referencedSeriesInstanceUID===e.props.seriesInstanceUID}));a.push.apply(a,(0,te.Z)(r));var s,c,u=t.map((function(e){return function(e){var t=e.uid,n=e.evaluations,i={category:{CodeValue:"undefined",CodeMeaning:"undefined",CodingSchemeDesignator:"undefined"},type:{CodeValue:"undefined",CodeMeaning:"undefined",CodingSchemeDesignator:"undefined"}};return n.forEach((function(e){var t=e.ConceptNameCodeSequence[0].CodeValue;if(e.ValueType===ve.sr.valueTypes.ValueTypes.CODE){var n=e.ConceptCodeSequence[0];"276214006"===t?i.category=(0,R.Z)({},n):"121071"===t&&(i.type=(0,R.Z)({},n))}})),(0,R.Z)((0,R.Z)({},i),{},{uid:t})}(e)})),d=["specimens","optical-paths","annotations","presentation-states"],m=this.state.generatedReport;void 0!==m&&(s=(0,y.jsx)(Ue,{dataset:m})),t.length>0&&(c=(0,y.jsx)(Se,{rois:t,selectedRoiUIDs:this.state.selectedRoiUIDs,visibleRoiUIDs:this.state.visibleRoiUIDs,onSelection:this.handleAnnotationSelection,onVisibilityChange:this.handleAnnotationVisibilityChange}));var g=this.findingOptions.map((function(e){return(0,y.jsx)(ne.Z.Option,{value:e.CodeValue,children:e.CodeMeaning},e.CodeValue)})),S={point:(0,y.jsx)(ne.Z.Option,{value:"point",children:"Point"},"point"),circle:(0,y.jsx)(ne.Z.Option,{value:"circle",children:"Circle"},"circle"),box:(0,y.jsx)(ne.Z.Option,{value:"box",children:"Box"},"box"),polygon:(0,y.jsx)(ne.Z.Option,{value:"polygon",children:"Polygon"},"polygon"),line:(0,y.jsx)(ne.Z.Option,{value:"line",children:"Line"},"line"),freehandpolygon:(0,y.jsx)(ne.Z.Option,{value:"freehandpolygon",children:"Polygon (freehand)"},"freehandpolygon"),freehandline:(0,y.jsx)(ne.Z.Option,{value:"freehandline",children:"Line (freehand)"},"freehandline")},C=[(0,y.jsx)(ne.Z,{style:{minWidth:130},onSelect:this.handleAnnotationFindingSelection,defaultActiveFirstOption:!0,children:g},"annotation-finding")],I=this.state.selectedFinding;if(void 0!==I){var b=dt(I);this.evaluationOptions[b].forEach((function(t){var n=t.values.map((function(e){return(0,y.jsx)(ne.Z.Option,{value:e.CodeValue,label:t.name,children:e.CodeMeaning},e.CodeValue)}));C.push((0,y.jsxs)(y.Fragment,{children:[t.name.CodeMeaning,(0,y.jsx)(ne.Z,{style:{minWidth:130},onSelect:e.handleAnnotationEvaluationSelection,allowClear:!0,onClear:e.handleAnnotationEvaluationClearance,defaultActiveFirstOption:!1,children:n})]}))}));var w=this.geometryTypeOptions[b].map((function(e){return S[e]}));C.push((0,y.jsxs)(y.Fragment,{children:["ROI geometry type",(0,y.jsx)(ne.Z,{style:{minWidth:130},onSelect:this.handleAnnotationGeometryTypeSelection,children:w},"annotation-geometry-type")]})),C.push((0,y.jsx)(ie.Z,{onChange:this.handleAnnotationMeasurementActivation,children:"measure"},"annotation-measurement"))}var x=(0,y.jsx)(v.Z.SubMenu,{title:"Specimens",children:(0,y.jsx)(Ne,{metadata:this.props.slide.volumeImages[0],showstain:!1})},"specimens"),D=(0,y.jsx)(v.Z.SubMenu,{title:"Equipment",children:(0,y.jsx)(Re,{metadata:this.props.slide.volumeImages[0]})},"equipment"),Z=this.volumeViewer.getAllOpticalPaths();Z.sort((function(e,t){return 1===e.identifier.localeCompare(t.identifier)?1:1===t.identifier.localeCompare(e.identifier)?-1:0}));var V={},O={};Z.forEach((function(t){var n=t.identifier,i=e.volumeViewer.getOpticalPathMetadata(n);O[n]=i;var a=(0,R.Z)({},e.volumeViewer.getOpticalPathStyle(n));V[n]=a}));var j,M,P,E,U,A=(0,y.jsx)(v.Z.SubMenu,{title:"Optical Paths",children:(0,y.jsx)(He,{metadata:O,opticalPaths:Z,defaultOpticalPathStyles:V,visibleOpticalPathIdentifiers:this.state.visibleOpticalPathIdentifiers,activeOpticalPathIdentifiers:this.state.activeOpticalPathIdentifiers,onOpticalPathVisibilityChange:this.handleOpticalPathVisibilityChange,onOpticalPathStyleChange:this.handleOpticalPathStyleChange,onOpticalPathActivityChange:this.handleOpticalPathActivityChange,selectedPresentationStateUID:this.state.selectedPresentationStateUID})},"optical-paths");if(this.state.presentationStates.length>0){var T=[];this.state.presentationStates.forEach((function(e){T.push((0,y.jsx)(ne.Z.Option,{value:e.SOPInstanceUID,dropdownMatchSelectWidth:!1,size:"small",children:e.ContentDescription},e.SOPInstanceUID))})),T.push((0,y.jsx)(ne.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",children:(0,y.jsx)(y.Fragment,{})},"default-presentation-state")),j=(0,y.jsx)(v.Z.SubMenu,{title:"Presentation States",children:(0,y.jsxs)(ae.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,y.jsx)(ne.Z,{style:{minWidth:200,maxWidth:200},onSelect:this.handlePresentationStateSelection,value:this.state.selectedPresentationStateUID,children:T},"presentation-states"),(0,y.jsx)(oe.Z,{title:"Reset",children:(0,y.jsx)(re.Z,{icon:(0,y.jsx)(de.Z,{}),type:"primary",onClick:this.handlePresentationStateReset})})]})},"presentation-states")}if(n.length>0){var k={},L={},_=this.volumeViewer.getAllSegments();_.forEach((function(t){k[t.uid]=e.volumeViewer.getSegmentStyle(t.uid),L[t.uid]=e.volumeViewer.getSegmentMetadata(t.uid)})),M=(0,y.jsx)(v.Z.SubMenu,{title:"Segmentations",children:(0,y.jsx)(et,{segments:_,metadata:L,defaultSegmentStyles:k,visibleSegmentUIDs:this.state.visibleSegmentUIDs,onSegmentVisibilityChange:this.handleSegmentVisibilityChange,onSegmentStyleChange:this.handleSegmentStyleChange})},"segmentations"),d.push("segmentations")}if(i.length>0){var N={},G={};i.forEach((function(t){N[t.uid]=e.volumeViewer.getParameterMappingStyle(t.uid),G[t.uid]=e.volumeViewer.getParameterMappingMetadata(t.uid)})),P=(0,y.jsx)(v.Z.SubMenu,{title:"Parametric Maps",children:(0,y.jsx)(Qe,{mappings:i,metadata:G,defaultMappingStyles:N,visibleMappingUIDs:this.state.visibleMappingUIDs,onMappingVisibilityChange:this.handleMappingVisibilityChange,onMappingStyleChange:this.handleMappingStyleChange})},"parmetric-maps"),d.push("parametric-maps")}if(u.length>0&&u.forEach((function(t){var n,i=e.volumeViewer.getROI(t.uid),a=ht(i),o=void 0!==e.roiStyles[a]?null===(n=e.roiStyles[a].stroke)||void 0===n?void 0:n.color.slice(0,3):ut[Object.keys(e.roiStyles).length%ut.length];e.defaultAnnotationStyles[t.uid]={color:o,opacity:.4,contourOnly:!1},e.roiStyles[a]=e.generateRoiStyle(e.defaultAnnotationStyles[t.uid])})),a.length>0){var q={},F={};a.forEach((function(t){F[t.uid]=e.volumeViewer.getAnnotationGroupStyle(t.uid),q[t.uid]=e.volumeViewer.getAnnotationGroupMetadata(t.uid)})),E=(0,y.jsx)(v.Z.SubMenu,{title:"Annotation Groups",children:(0,y.jsx)(Ve,{annotationGroups:a,metadata:q,defaultAnnotationGroupStyles:F,visibleAnnotationGroupUIDs:this.state.visibleAnnotationGroupUIDs,onAnnotationGroupVisibilityChange:this.handleAnnotationGroupVisibilityChange,onAnnotationGroupStyleChange:this.handleAnnotationGroupStyleChange})},"annotation-groups"),d.push("annotationGroups")}var z="0px",B=[(0,y.jsx)(Oe,{tooltip:"Draw ROI [Alt+D]",icon:p.vuA,onClick:this.handleRoiDrawing,isSelected:this.state.isRoiDrawingActive},"draw-roi-button"),(0,y.jsx)(Oe,{tooltip:"Modify ROIs [Alt+M]",icon:p.eAi,onClick:this.handleRoiModification,isSelected:this.state.isRoiModificationActive},"modify-roi-button"),(0,y.jsx)(Oe,{tooltip:"Translate ROIs [Alt+T]",icon:p.Jd7,onClick:this.handleRoiTranslation,isSelected:this.state.isRoiTranslationActive},"translate-roi-button"),(0,y.jsx)(Oe,{tooltip:"Remove selected ROI [Alt+R]",onClick:this.handleRoiRemoval,icon:p.Xm5},"remove-roi-button"),(0,y.jsx)(Oe,{tooltip:"Show/Hide ROIs [Alt+V]",icon:this.state.areRoisHidden?p.dSq:p.tgn,onClick:this.handleRoiVisibilityChange,isSelected:this.state.areRoisHidden},"toggle-roi-visibility-button"),(0,y.jsx)(Oe,{tooltip:"Save ROIs [Alt+S]",icon:p.TvB,onClick:this.handleReportGeneration},"generate-report-button")],W=[(0,y.jsx)(Oe,{tooltip:"Go to [Alt+G]",icon:p.Xe,onClick:this.handleGoTo},"go-to-slide-position-button")];this.props.enableAnnotationTools&&(U=(0,y.jsxs)(se.Z,{justify:"start",children:[B.map((function(e,t){return(0,y.jsx)(l.Fragment,{children:e},t)})),W.map((function(e,t){return(0,y.jsx)(l.Fragment,{children:e},t)}))]}),z="50px");var Y,H="default";if(this.state.isLoading&&(H="progress"),null!=this.state.selectedRoi){var X=[{name:"UID",value:this.state.selectedRoi.uid}],K=[{name:"Graphic type",value:this.state.selectedRoi.scoord3d.graphicType}],Q=[];this.state.selectedRoi.evaluations.forEach((function(e){if("CODE"===e.ValueType){var t=e;Q.push({name:t.ConceptNameCodeSequence[0].CodeMeaning,value:t.ConceptCodeSequence[0].CodeMeaning})}else{var n=e;Q.push({name:n.ConceptNameCodeSequence[0].CodeMeaning,value:n.TextValue})}}));var J={};this.state.selectedRoi.measurements.forEach((function(e){var t="default";if(null!=e.ContentSequence){var n=je({content:e.ContentSequence,name:new ve.sr.coding.CodedConcept({value:"121112",meaning:"Source of Measurement",schemeDesignator:"DCM"})});n.length>0&&(t=n[0].ReferencedSOPSequence[0].ReferencedOpticalPathIdentifier)}t in J||(J[t]=[]);var i=e.MeasuredValueSequence[0];J[t].push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:i.NumericValue.toString(),unit:i.MeasurementUnitsCodeSequence[0].CodeMeaning})}));var $=function(e){return e.map((function(e){var t;return t=null!=e.unit?"".concat(e.value," [").concat(e.unit,"]"):e.value,(0,y.jsx)(f.Z.Item,{label:e.name,children:t},e.name)}))},ee=$(X),me=$(K),fe=$(Q),ge=[];for(var ye in J){var Ce=$(J[ye]);"default"===ye?ge.push(Ce):ge.push((0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(le.Z,{orientation:"left",orientationMargin:0,dashed:!0,plain:!0,children:ye}),Ce]}))}Y=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.Z,{layout:"horizontal",column:1,children:ee}),(0,y.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Spatial coordinates"}),(0,y.jsx)(f.Z,{layout:"horizontal",column:1,children:me}),(0,y.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Evaluations"}),(0,y.jsx)(f.Z,{layout:"horizontal",column:1,children:fe}),(0,y.jsx)(le.Z,{orientation:"left",orientationMargin:0,children:"Measurements"}),(0,y.jsx)(f.Z,{layout:"horizontal",column:1,children:ge})]})}return(0,y.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,y.jsxs)(h.Z.Content,{style:{height:"100%"},children:[U,(0,y.jsx)("div",{style:{height:"calc(100% - ".concat(z,")"),overflow:"hidden",cursor:H},ref:this.volumeViewportRef}),(0,y.jsx)(ce.Z,{open:this.state.isAnnotationModalVisible,title:"Configure annotations",onOk:this.handleAnnotationConfigurationCompletion,onCancel:this.handleAnnotationConfigurationCancellation,okText:"Select",children:(0,y.jsx)(ae.Z,{align:"start",direction:"vertical",children:C})}),(0,y.jsx)(ce.Z,{open:this.state.isSelectedRoiModalVisible,title:"Selected ROI",onCancel:this.handleRoiSelectionCancellation,maskClosable:!0,footer:null,children:(0,y.jsx)(ae.Z,{align:"start",direction:"vertical",children:Y})}),(0,y.jsx)(ce.Z,{open:this.state.isGoToModalVisible,title:"Go to slide position",onOk:this.handleSlidePositionSelection,onCancel:this.handleSlidePositionSelectionCancellation,okText:"Select",children:(0,y.jsxs)(ae.Z,{align:"start",direction:"vertical",children:[(0,y.jsx)(ue.Z,{placeholder:"["+"".concat(this.state.validXCoordinateRange[0])+", "+"".concat(this.state.validXCoordinateRange[1])+"]",prefix:"X Coordinate [mm]",onChange:this.handleXCoordinateSelection,onPressEnter:this.handleXCoordinateSelection,controls:!1,addonAfter:this.state.isSelectedXCoordinateValid?(0,y.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,y.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,y.jsx)(ue.Z,{placeholder:"["+"".concat(this.state.validYCoordinateRange[0])+", "+"".concat(this.state.validYCoordinateRange[1])+"]",prefix:"Y Coordinate [mm]",onChange:this.handleYCoordinateSelection,onPressEnter:this.handleYCoordinateSelection,controls:!1,addonAfter:this.state.isSelectedYCoordinateValid?(0,y.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,y.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,y.jsx)(ue.Z,{placeholder:"[0 - 40]",prefix:"Magnification",onChange:this.handleMagnificationSelection,onPressEnter:this.handleMagnificationSelection,controls:!1,addonAfter:this.state.isSelectedMagnificationValid?(0,y.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,y.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}})})]})}),(0,y.jsx)(ce.Z,{open:this.state.isReportModalVisible,title:"Verify and save report",onOk:this.handleReportVerification,onCancel:this.handleReportCancellation,okText:"Save",children:s})]}),(0,y.jsx)(h.Z.Sider,{width:300,reverseArrow:!0,style:{borderLeft:"solid",borderLeftWidth:.25,overflow:"hidden",background:"none"},children:(0,y.jsxs)(v.Z,{mode:"inline",defaultOpenKeys:d,style:{height:"100%"},inlineIndent:14,forceSubMenuRender:!0,onOpenChange:function(){setTimeout((function(){null!=e.labelViewer&&e.labelViewer.resize()}),100)},children:[null!=this.labelViewportRef.current&&(0,y.jsx)(v.Z.SubMenu,{title:"Slide label",children:(0,y.jsx)(v.Z.Item,{style:{height:"100%"},children:(0,y.jsx)("div",{style:{height:"220px"},ref:this.labelViewportRef})},"image")},"label"),x,D,A,j,(0,y.jsx)(v.Z.SubMenu,{title:"Annotations",children:c},"annotations"),E,0===u.length?(0,y.jsx)(y.Fragment,{}):(0,y.jsx)(v.Z.SubMenu,{title:"Annotation Categories",children:(0,y.jsx)(ot,{annotations:u,onChange:this.handleAnnotationVisibilityChange,checkedAnnotationUids:this.state.visibleRoiUIDs,onStyleChange:this.handleRoiStyleChange,defaultAnnotationStyles:this.defaultAnnotationStyles})},"annotation-category"),M,P]})}),this.state.isHoveredRoiTooltipVisible&&this.state.hoveredRoiAttributes.length>0?(0,y.jsx)(rt,{xPosition:this.state.hoveredRoiTooltipX,yPosition:this.state.hoveredRoiTooltipY,rois:this.state.hoveredRoiAttributes}):(0,y.jsx)(y.Fragment,{})]})}}]),n}(l.Component);const ft=tt(mt);var gt,yt=n(4165),St=n(5861);!function(e){e.VOLUME="VOLUME",e.LABEL="LABEL",e.OVERVIEW="OVERVIEW",e.THUMBNAIL="THUMBNAIL"}(gt||(gt={}));var Ct=function(e,t){return e.ImageType[2]===t},It=function(e,t){return null!=e.AcquisitionUID&&e.AcquisitionUID===t.AcquisitionUID},bt=(0,a.Z)((function e(t){var n=this;(0,i.Z)(this,e),this.description=void 0,this.acquisitionUID=void 0,this.frameOfReferenceUID=void 0,this.containerIdentifier=void 0,this.seriesInstanceUIDs=void 0,this.opticalPathIdentifiers=void 0,this.pyramidUIDs=[],this.areVolumeImagesMonochrome=void 0,this.volumeImages=void 0,this.labelImages=void 0,this.overviewImages=void 0,0===t.images.length&&Q.onError(W,new N(L,'Value of option "images" have been non-zero length.'));var a=new Set([]),o=new Set([]),r=new Set([]),s=new Set([]),l={VOLUME:new Set([]),LABEL:new Set([]),OVERVIEW:new Set([])},c={VOLUME:{}},u=[],d=[],h=[];if(t.images.forEach((function(e){if(s.add(e.ContainerIdentifier),a.add(e.SeriesInstanceUID),e.OpticalPathSequence.forEach((function(e){r.add(e.OpticalPathIdentifier)})),null!=e.AcquisitionUID&&o.add(e.AcquisitionUID),Ct(e,gt.VOLUME)||Ct(e,gt.THUMBNAIL)){if(l.VOLUME.add(e.FrameOfReferenceUID),null!=e.PyramidUID)for(var t in r)c.VOLUME[t].add(e.PyramidUID);u.push(e)}else Ct(e,gt.LABEL)?(l.LABEL.add(e.FrameOfReferenceUID),d.push(e)):Ct(e,gt.OVERVIEW)&&(l.OVERVIEW.add(e.FrameOfReferenceUID),h.push(e))})),0===u.length)Q.onError(W,new N(L,"At least one VOLUME image must be provided for a slide."));else{o.size>1&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same number of Samples per Pixel."));var p=new Set([]);u.forEach((function(e){p.add(e.SamplesPerPixel)})),p.size>1&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same number of Samples per Pixel.")),u.filter((function(e){return"RESAMPLED"!==e.ImageType[3]})).length>r.size&&console.warn("the set of VOLUME images of a slide must contain only a single image that has not been resampled per optical path")}this.volumeImages=u,this.labelImages=d,this.overviewImages=h,this.seriesInstanceUIDs=(0,te.Z)(a),this.opticalPathIdentifiers=(0,te.Z)(r),1!==s.size&&Q.onError(W,new N(L,"All images of a slide must have the same Container Identifier.")),this.containerIdentifier=(0,te.Z)(s)[0],1!==l.VOLUME.size&&Q.onError(W,new N(L,"All VOLUME images of a slide must have the same Frame of Reference UID.")),this.frameOfReferenceUID=(0,te.Z)(l.VOLUME)[0];var v=!1;Object.keys(c.VOLUME).length>0&&(v=!0),this.opticalPathIdentifiers.forEach((function(e){null!=c.VOLUME[e]?c.VOLUME[e].size>1?Q.onError(W,new N(L,'All VOLUME images for optical path "'.concat(e,'"')+"must be part of the same multi-resolution pyramid.")):1===c.VOLUME[e].size?n.pyramidUIDs.push((0,te.Z)(c.VOLUME[e])[0]):Q.onError(W,new N(L,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it.")):v&&Q.onError(W,new N(L,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it."))})),o.size>1?Q.onError(W,new N(L,"All VOLUME images of a slide must be part of the same acquisition and have the same Acquisition UID.")):1===o.size?this.acquisitionUID=(0,te.Z)(o)[0]:this.acquisitionUID=null,this.areVolumeImagesMonochrome=1===this.volumeImages[0].SamplesPerPixel&&"MONOCHROME2"===this.volumeImages[0].PhotometricInterpretation,this.description=void 0!==t.description?t.description:""})),wt=function(e){var t=[];e.forEach((function(e){if(e.length>0){var n=e.filter((function(e){return Ct(e,gt.VOLUME)||Ct(e,gt.THUMBNAIL)}));if(n.length>0){var i,a=n[0],o=n.filter((function(e){return a.SamplesPerPixel===e.SamplesPerPixel})),r=t.findIndex((function(e){return function(e,t){if(e.frameOfReferenceUID===t.FrameOfReferenceUID&&e.containerIdentifier===t.ContainerIdentifier&&e.acquisitionUID===t.AcquisitionUID)return!0;return!1}(e,a)})),s=e.filter((function(e){return Ct(e,gt.LABEL)}));i=s.length>1?s.filter((function(e){return It(e,a)})):s;var l,c=e.filter((function(e){return Ct(e,gt.OVERVIEW)}));if(l=c.length>1?c.filter((function(e){return It(e,a)})):c,-1===r){var u={acquisitionUID:a.AcquisitionUID,frameOfReferenceUID:a.FrameOfReferenceUID,containerIdentifier:a.ContainerIdentifier,volumeImages:o,labelImages:i,overviewImages:l};t.push(u)}else{var d,h,p,v=t[r];(d=v.volumeImages).push.apply(d,(0,te.Z)(o)),(h=v.labelImages).push.apply(h,(0,te.Z)(i)),(p=v.overviewImages).push.apply(p,(0,te.Z)(l))}}}}));var n=t.map((function(e){return new bt({images:[].concat((0,te.Z)(e.volumeImages),(0,te.Z)(e.labelImages),(0,te.Z)(e.overviewImages))})}));return n=n.sort((function(e,t){var n=e.volumeImages[0],i=t.volumeImages[0];return null!=n.ContainerIdentifier&&null!=i.ContainerIdentifier?Number(n.ContainerIdentifier)-Number(i.ContainerIdentifier):0}))};var xt=function(){var e=(0,St.Z)((0,yt.Z)().mark((function e(t){var n,i,a,o,r,s,l,c,u;return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.clients,i=t.studyInstanceUID,a=t.onSuccess,o=t.onError,e.prev=1,r=[],console.info('search for series of study "'.concat(i,'"...')),s=n[O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],e.next=7,s.searchForSeries({queryParams:{Modality:"SM",StudyInstanceUID:i}});case 7:return l=e.sent,e.next=10,Promise.all(l.map(function(){var e=(0,St.Z)((0,yt.Z)().mark((function e(t){var n,a,o,l,c;return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=j.metadata.formatMetadata(t),a=n.dataset,o=a,console.info('retrieve metadata of series "'.concat(o.SeriesInstanceUID,'"')),e.next=5,s.retrieveSeriesMetadata({studyInstanceUID:i,seriesInstanceUID:o.SeriesInstanceUID});case 5:l=e.sent,c=[],l.forEach((function(e){var t,n;if((null===(t=e["00080016"])||void 0===t||null===(n=t.Value)||void 0===n?void 0:n[0])===O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE){var i=new j.metadata.VLWholeSlideMicroscopyImage({metadata:e});c.push(i)}})),c.length>0&&r.push(c);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 10:c=wt(r),a(c),e.next=20;break;case 14:e.prev=14,e.t0=e.catch(1),console.error(e.t0),u=new N(L,"Image metadata could not be retrieved or decoded."),o(u),Q.onError(W,u);case 20:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),Dt=new Map,Zt=new Map,Vt=function(e){var t=e.clients,n=e.studyInstanceUID,i=(0,l.useState)([]),a=(0,ee.Z)(i,2),o=a[0],r=a[1],s=(0,l.useState)(!1),c=(0,ee.Z)(s,2),u=c[0],d=c[1],h=(0,l.useState)(null),p=(0,ee.Z)(h,2),v=p[0],m=p[1];return(0,l.useEffect)((function(){if(void 0===n)return r([]),void d(!1);var e=Dt.get(n);if(void 0!==e)return r(e),void d(!1);d(!0);var i=function(){var e=(0,St.Z)((0,yt.Z)().mark((function e(){var i,a;return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===(i=Zt.get(n))&&(i=new Promise((function(e,i){xt({clients:t,studyInstanceUID:n,onSuccess:function(t){Dt.set(n,t),e(t)},onError:function(e){i(e)}}).catch((function(e){i(e)}))})),Zt.set(n,i)),e.prev=2,e.next=5,i;case 5:a=e.sent,r(a),m(null),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),m(e.t0),r([]);case 14:return e.prev=14,Zt.delete(n),d(!1),e.finish(14);case 18:case"end":return e.stop()}}),e,null,[[2,10,14,18]])})));return function(){return e.apply(this,arguments)}}();i()}),[t,n]),{slides:o,isLoading:u,error:v}};function Ot(e){var t,n=e.clients,i=e.slides,a=e.user,o=e.app,r=e.preload,s=e.enableAnnotationTools,l=e.annotations,u=(0,c.UO)(),d=u.studyInstanceUID,h=u.seriesInstanceUID,p=(0,c.TH)(),v=i.find((function(e){return e.seriesInstanceUIDs.find((function(e){return e===h}))})),m=new URLSearchParams(p.search);m.has("access_token")||null===(t=m.get("state"))&&(t=void 0);var f=null;return null!=v&&(f=(0,y.jsx)(ft,{clients:n,studyInstanceUID:d,seriesInstanceUID:h,selectedPresentationStateUID:t,slide:v,preload:r,annotations:l,enableAnnotationTools:s,app:o,user:a})),f}const Rt=tt((function(e){var t=e.clients,n=e.studyInstanceUID,i=e.location,a=e.navigate,o=Vt({clients:t,studyInstanceUID:n}),r=o.slides;if(o.isLoading)return null;if(0===r.length)return null;var s=r[0].volumeImages;if(0===s.length)return null;var l,u,d=s[0];if(i.pathname.includes("series/")){var p=i.pathname.split("series/")[1];l=p.includes("/")?p.split("/")[0]:p}else l=s[0].SeriesInstanceUID;return null!=d.ClinicalTrialSponsorName&&(u=(0,y.jsx)(v.Z.SubMenu,{title:"Clinical Trial",children:(0,y.jsx)(I,{metadata:d})},"clinical-trial")),(0,y.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,y.jsx)(h.Z.Sider,{width:300,style:{height:"100%",borderRight:"solid",borderRightWidth:.25,overflow:"hidden",background:"none"},children:(0,y.jsxs)(v.Z,{mode:"inline",defaultOpenKeys:["patient","study","clinical-trial","slides"],style:{height:"100%"},inlineIndent:14,children:[(0,y.jsx)(v.Z.SubMenu,{title:"Patient",children:(0,y.jsx)(Z,{metadata:d})},"patient"),(0,y.jsx)(v.Z.SubMenu,{title:"Study",children:(0,y.jsx)(V,{metadata:d})},"study"),u,(0,y.jsx)(v.Z.SubMenu,{title:"Slides",children:(0,y.jsx)($,{clients:e.clients,metadata:r,selectedSeriesInstanceUID:l,onSeriesSelection:function(e){var t=e.seriesInstanceUID;console.info('switch to series "'.concat(t,'"'));var o="/studies/".concat(n)+"/series/".concat(t);i.pathname.includes("/projects/")&&(o=i.pathname,i.pathname.includes("/series/")?o=o.replace(/\/series\/[^/]+/,"/series/".concat(t)):o+="/series/".concat(t)),i.pathname.includes("/series/")&&null!=i.search&&(o+=i.search),a(o,{replace:!0})}})},"slides")]})}),(0,y.jsx)(c.Z5,{children:(0,y.jsx)(c.AW,{path:"/series/:seriesInstanceUID",element:(0,y.jsx)(Ot,{clients:e.clients,slides:r,preload:e.preload,annotations:e.annotations,enableAnnotationTools:e.enableAnnotationTools,app:e.app,user:e.user})})})]})}));var jt=n(63),Mt=n(7382),Pt=n(6005),Et=n(9529),Ut=n(127),At=n(4541),Tt=n(8527),kt=n(161),Lt=n(9761),_t=n(5485),Nt=n(7706),Gt=n(1730),qt=ve.ZP.data.DicomMetaDictionary,Ft=function(e){return"object"===typeof e&&null!==e?JSON.stringify(e):String(e)};function zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(void 0===e||null===e)return[];var n=Object.keys(e).filter((function(e){return"_vrMap"!==e}));return n.flatMap((function(n){var i,a,o=qt.nameMap[n],r=e[n];if(void 0===o){var s,l;return null==n.match(/[0-9A-Fa-f]{6}/g)?[]:[{tag:"(".concat(n.substring(0,4),",").concat(n.substring(4,8),")"),vr:"",keyword:"Private Tag",value:null!==(s=null===(l=r)||void 0===l?void 0:l.toString())&&void 0!==s?s:"",level:t}]}if("SQ"===o.vr&&void 0!==r){var c=Array.isArray(r)?r:[r],u={tag:o.tag,vr:o.vr,keyword:n,value:"Sequence with ".concat(c.length," item(s)"),level:t,children:[]};return u.children=c.map((function(e,n){return{tag:"".concat(o.tag,".").concat(n+1),vr:"Item",keyword:"Item ".concat(n+1),value:"Sequence Item ".concat(n+1),level:t+1,children:zt(e,t+2)}})),[u]}return Array.isArray(r)?r=r.map(Ft).join("\\"):"object"===typeof r&&null!==r&&(r=Ft(r)),[{tag:o.tag,vr:o.vr,keyword:n.replace("RETIRED_",""),value:null!==(i=null===(a=r)||void 0===a?void 0:a.toString())&&void 0!==i?i:"",level:t}]}))}function Bt(e){return zt(e).sort((function(e,t){return e.tag.localeCompare(t.tag)}))}var Wt=n(7762);const Yt={subscribe:Ht,_broadcastEvent:Qt,_unsubscribe:Xt,_isValidEvent:Kt};function Ht(e,t){var n=this;if(this._isValidEvent(e)){var i=(0,m.Z)(),a={id:i,callback:t};return Array.isArray(this.listeners[e])?this.listeners[e].push(a):this.listeners[e]=[a],{unsubscribe:function(){return n._unsubscribe(e,i)}}}throw new Error("Event ".concat(e," not supported."))}function Xt(e,t){if(void 0!==this.listeners[e]){var n=this.listeners[e];Array.isArray(n)?this.listeners[e]=n.filter((function(e){return e.id!==t})):this.listeners[e]=[]}}function Kt(e){return Object.values(this.EVENTS).includes(e)}function Qt(e,t){var n=Object.keys(this.listeners).length>0,i=Array.isArray(this.listeners[e]);n&&i&&this.listeners[e].forEach((function(e){e.callback(t)}))}const Jt=function(e,t){var n=[],i=new Map;return(0,R.Z)((0,R.Z)({SeriesInstanceUID:e,Modality:"",SeriesNumber:0,SeriesDescription:"",SeriesDate:"",SeriesTime:""},null===t||void 0===t?void 0:t[0]),{},{instances:n,addInstance:function(e){this.addInstances([e])},addInstances:function(e){for(var t=0,a=e.length;t1&&void 0!==arguments[1]&&arguments[1],n=e[0],i=n.StudyInstanceUID,a=n.SeriesInstanceUID,o=tn.studies.find((function(e){return e.StudyInstanceUID===i}));null==o&&(tn.studies.push($t(i)),o=tn.studies[tn.studies.length-1]),o.addInstancesToSeries(e),this._broadcastEvent(en.INSTANCES_ADDED,{StudyInstanceUID:i,SeriesInstanceUID:a,madeInClient:t})},updateSeriesMetadata:function(e){var t=e.StudyInstanceUID,n=e.SeriesInstanceUID;if(null!=an(t,n)){var i=nn(t);null!=i&&i.setSeriesMetadata(n,e)}},addSeriesMetadata:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0!==e&&0!==e.length&&void 0!==e[0]){var n=e[0].StudyInstanceUID,i=nn(n);null==i&&((i=$t(n)).StudyDescription=e[0].StudyDescription,null===e||void 0===e||e.forEach((function(e){var t,n;void 0===i||null!==(t=i.ModalitiesInStudy)&&void 0!==t&&t.includes(e.Modality)||(null===(n=i.ModalitiesInStudy)||void 0===n||n.push(e.Modality))})),i.NumberOfStudyRelatedSeries=e.length,tn.studies.push(i)),e.forEach((function(e){var t,n=e.SeriesInstanceUID;null===(t=i)||void 0===t||t.setSeriesMetadata(n,e)})),this._broadcastEvent(en.SERIES_ADDED,{StudyInstanceUID:n,seriesSummaryMetadata:e,madeInClient:t})}},addStudy:function(e){var t=e.StudyInstanceUID,n=tn.studies.find((function(e){return e.StudyInstanceUID===t}));if(null==n){var i=$t(t);i.PatientID=e.PatientID,i.PatientName=e.PatientName,i.StudyDate=e.StudyDate,i.ModalitiesInStudy=e.ModalitiesInStudy,i.StudyDescription=e.StudyDescription,i.AccessionNumber=e.AccessionNumber,i.NumInstances=e.NumInstances,tn.studies.push(i)}},getStudyInstanceUIDs:function(){return tn.studies.map((function(e){return e.StudyInstanceUID}))},getStudy:nn,getSeries:an,getInstance:function(e,t,n){var i=an(e,t);if(null!=i)return i.getInstance(n)},getInstanceByImageId:function(e){var t,n=(0,Wt.Z)(tn.studies);try{for(n.s();!(t=n.n()).done;){var i,a=t.value,o=(0,Wt.Z)(a.series);try{for(o.s();!(i=o.n()).done;){var r,s=i.value,l=(0,Wt.Z)(s.instances);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.imageId===e)return c}}catch(u){l.e(u)}finally{l.f()}}}catch(u){o.e(u)}finally{o.f()}}}catch(u){n.e(u)}finally{n.f()}},updateMetadataForSeries:function(e,t,n){var i=nn(e);if(null!=i){var a=i.series.find((function(e){return e.SeriesInstanceUID===t}));if(null!=a)a.instances.forEach((function(e){Object.keys(n).forEach((function(t){"object"===typeof n[t]?e[t]=(0,R.Z)((0,R.Z)({},e[t]),n[t]):e[t]=n[t]}))}))}},_broadcastEvent:function(e,t){}};const rn=Object.assign({},on,Yt);var sn=ne.Z.Option;const ln=function(e){var t,n,i=e.clients,a=e.studyInstanceUID,o=Vt({clients:i,studyInstanceUID:a}),r=o.slides,s=o.isLoading,c=(0,l.useState)(void 0),u=(0,ee.Z)(c,2),d=u[0],h=u[1],p=(0,l.useState)([]),v=(0,ee.Z)(p,2),m=v[0],f=v[1],g=(0,l.useState)(0),S=(0,ee.Z)(g,2),C=S[0],I=S[1],b=(0,l.useState)(1),w=(0,ee.Z)(b,2),x=w[0],D=w[1],Z=(0,l.useState)(""),V=(0,ee.Z)(Z,2),O=V[0],j=V[1],M=(0,l.useState)([]),P=(0,ee.Z)(M,2),E=P[0],U=P[1],A=(0,l.useState)(""),T=(0,ee.Z)(A,2),k=T[0],L=T[1],_=function(e,t){var n=(0,l.useState)(e),i=(0,ee.Z)(n,2),a=i[0],o=i[1];return(0,l.useEffect)((function(){var n=setTimeout((function(){o(e)}),t);return function(){clearTimeout(n)}}),[e,t]),a}(k,300);(0,l.useEffect)((function(){""===_?(j(""),U([])):j(_)}),[_]),(0,l.useEffect)((function(){var e=function(e){var t=Object.assign({},rn.getStudy(a));h(t)},t=rn.subscribe(rn.EVENTS.SERIES_ADDED,e),n=rn.subscribe(rn.EVENTS.INSTANCES_ADDED,e),i=Object.assign({},rn.getStudy(a));return h(i),function(){t.unsubscribe(),n.unsubscribe()}}),[a]),(0,l.useEffect)((function(){var e,t=[],n=[],i=[],a=0;r.length>0&&(t=r.map((function(e){var t=e.volumeImages;if(void 0===(null===t||void 0===t?void 0:t[0]))return null;var n=t[0],o=n.SeriesDate,r=n.SeriesTime,s=n.SeriesNumber,l=n.SeriesInstanceUID,c=n.SeriesDescription,u=n.Modality;i.push(l);var d={displaySetInstanceUID:a,SeriesDate:o,SeriesTime:r,SeriesInstanceUID:l,SeriesNumber:s,SeriesDescription:c,Modality:u,images:t};return a++,d})).filter((function(e){return null!==e}))),void 0!==d&&(null===(e=d.series)||void 0===e?void 0:e.length)>0&&(n=d.series.filter((function(e){return!i.includes(e.SeriesInstanceUID)})).map((function(e){var t,n={displaySetInstanceUID:a,SeriesDate:e.SeriesDate,SeriesTime:e.SeriesTime,SeriesNumber:e.SeriesNumber,SeriesDescription:e.SeriesDescription,SeriesInstanceUID:e.SeriesInstanceUID,Modality:e.Modality,images:(null===e||void 0===e||null===(t=e.instances)||void 0===t?void 0:t.length)>0?e.instances:[e]};return a++,n}))),f([].concat((0,te.Z)(t),(0,te.Z)(n)))}),[r,d]);var N=(0,l.useMemo)((function(){return m.sort((function(e,t){return Number(e.SeriesNumber)-Number(t.SeriesNumber)})),m.map((function(e,t){var n=e.SeriesDate,i=void 0===n?"":n,a=e.SeriesTime,o=void 0===a?"":a,r=e.SeriesNumber,s=void 0===r?"":r,l=e.SeriesDescription,c=void 0===l?"":l,u=e.Modality,d=void 0===u?"":u,h=function(e){var t=e.match(/^(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})(\d{2})/);if(null==t)return e;var n=(0,ee.Z)(t,7),i=n[1],a=n[2],o=n[3],r=n[4],s=n[5],l=n[6],c=parseInt(a),u=parseInt(o);if(c<1||c>12||u<1||u>31)return e;var d=new Date(parseInt(i),c-1,u,parseInt(r),parseInt(s),parseInt(l));if(d.getMonth()!==c-1||d.getDate()!==u)return e;var h=d.toLocaleDateString("en-US",{weekday:"short"}),p=d.toLocaleDateString("en-US",{month:"short"}),v=d.getDate(),m=d.getFullYear();return"".concat(h,", ").concat(p," ").concat(v," ").concat(m)}("".concat(i,":").concat(o).split(".")[0]);return{value:t,label:"".concat(s," (").concat(d,"): ").concat(c),description:h}}))}),[m]),G=(null===(t=m[C])||void 0===t?void 0:t.images.length)>1;console.debug("displaySets:",m);var q=(0,l.useMemo)((function(){var e;if(void 0===m[C])return{};var t=m[C].images.length;return e={1:"1"},(0,nt.Z)(e,Math.ceil(t/2),String(Math.ceil(t/2))),(0,nt.Z)(e,t,String(t)),e}),[C,m]),F=(0,l.useMemo)((function(){var e;return void 0===m[C]?[]:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.map((function(t,i){var a=""!==t.tag?t.tag.replace(/[(),]/g,""):i.toString(),o=""!==n?"".concat(n,"-").concat(a):a,r={key:o,tag:t.tag,vr:t.vr,keyword:t.keyword,value:t.value};return void 0!==t.children&&t.children.length>0&&(r.children=e(t.children,o)),r}))}(Bt(null===(e=m[C])||void 0===e?void 0:e.images[x-1]))}),[x,C,m]),z=(0,l.useMemo)((function(){if(void 0===O||""===O)return F;var e=O.toLowerCase(),t=new Set,n=function(t){var n,i,a,o,r,s,l,c;return(null!==(n=null===(i=t.tag)||void 0===i?void 0:i.toLowerCase())&&void 0!==n?n:"").includes(e)||(null!==(a=null===(o=t.vr)||void 0===o?void 0:o.toLowerCase())&&void 0!==a?a:"").includes(e)||(null!==(r=null===(s=t.keyword)||void 0===s?void 0:s.toLowerCase())&&void 0!==r?r:"").includes(e)||(null!==(l=null===(c=t.value)||void 0===c?void 0:c.toString().toLowerCase())&&void 0!==l?l:"").includes(e)},i=function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[].concat((0,te.Z)(i),[t]),o=[];return n(t)&&o.push(a),null!=t.children&&t.children.forEach((function(t){var n=e(t,a);o=[].concat((0,te.Z)(o),(0,te.Z)(n))})),o},a=function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0===n.length||i>=n[0].length)return[];var a=new Map;return n.forEach((function(e){if(i0?(0,R.Z)((0,R.Z)({},a),{},{children:r}):a}))}(F.flatMap((function(e){return i(e)})));return U(Array.from(t)),a}),[F,O]);return s?(0,y.jsx)("div",{children:"Loading..."}):(0,y.jsx)("div",{className:"dicom-tag-browser",children:(0,y.jsxs)("div",{style:{width:"100%",padding:"16px 20px 20px"},children:[(0,y.jsxs)("div",{style:{display:"flex",gap:"24px",marginBottom:"32px"},children:[(0,y.jsxs)("div",{style:{flex:1},children:[(0,y.jsx)(_t.Z.Text,{strong:!0,style:{display:"block",marginBottom:"8px"},children:"Slides"}),(0,y.jsx)(ne.Z,{style:{width:"100%"},value:C,onChange:function(e){I(e),D(1)},optionLabelProp:"label",optionFilterProp:"label",children:N.map((function(e){return(0,y.jsx)(sn,{value:e.value,label:e.label,children:(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{children:e.label}),(0,y.jsx)("div",{style:{fontSize:"12px",color:"rgba(0, 0, 0, 0.45)"},children:e.description})]})},e.value)}))})]}),G&&(0,y.jsxs)("div",{style:{flex:1},children:[(0,y.jsxs)(_t.Z.Text,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Instance Number: ",x]}),(0,y.jsx)(Ie.Z,{min:1,max:null===(n=m[C])||void 0===n?void 0:n.images.length,value:x,onChange:function(e){return D(e)},marks:q,tooltip:{formatter:function(e){return void 0!==e?"Instance ".concat(e):""}}})]})]}),(0,y.jsx)(Pt.Z,{style:{marginBottom:"20px"},placeholder:"Search DICOM tags...",prefix:(0,y.jsx)(Gt.Z,{}),onChange:function(e){return L(e.target.value)},value:k}),(0,y.jsx)(Nt.Z,{columns:[{title:"Tag",dataIndex:"tag",key:"tag",width:"30%"},{title:"VR",dataIndex:"vr",key:"vr",width:"5%"},{title:"Keyword",dataIndex:"keyword",key:"keyword",width:"30%"},{title:"Value",dataIndex:"value",key:"value",width:"40%"}],dataSource:z,pagination:!1,expandable:{expandedRowKeys:E,onExpandedRowsChange:function(e){return U(e)}},size:"small",scroll:{y:500}})]})})};const cn=tt(function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;(0,i.Z)(this,n),(a=t.call(this,e)).handleInfoButtonClick=function(){var e=(0,Lt.qY)(),t={browser:{},os:{}};null!=e&&(t.browser={name:null!=e.name?e.name:void 0,version:null!=e.version?e.version:void 0},t.os={name:null!=e.os?e.os:void 0}),ce.Z.info({title:"About",width:600,content:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(f.Z,{title:"Application",column:1,children:[(0,y.jsx)(f.Z.Item,{label:"Name",children:a.props.app.name}),(0,y.jsx)(f.Z.Item,{label:"Version",children:a.props.app.version}),(0,y.jsx)(f.Z.Item,{label:"Homepage",children:a.props.app.homepage})]}),(0,y.jsxs)(f.Z,{title:"Browser",column:1,children:[(0,y.jsx)(f.Z.Item,{label:"Name",children:t.browser.name}),(0,y.jsx)(f.Z.Item,{label:"Version",children:t.browser.version})]}),(0,y.jsx)(f.Z,{title:"Operating System",column:1,children:(0,y.jsx)(f.Z.Item,{label:"Name",children:t.os.name})})]}),onOk:function(){}})},a.handleDicomTagBrowserButtonClick=function(){var e,t=window.innerWidth-200;ce.Z.info({title:"DICOM Tag Browser",width:t,content:(0,y.jsx)(ln,{clients:a.props.clients,studyInstanceUID:null!==(e=a.props.params.studyInstanceUID)&&void 0!==e?e:""}),onOk:function(){}})},a.handleDebugButtonClick=function(){var e={Authentication:[],Communication:[],EncodingDecoding:[],Visualization:[]},t=a.state.errorObj.length;if(t>0)for(var n=0;n0||t.errorObj.length>0)&&this.props.location.pathname!==e.location.pathname&&this.setState({isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0,errorObj:[],errorCategory:[],warnings:[]})}},{key:"render",value:function(){var e,t=this,n=null;if(void 0!==this.props.user){var i=[];void 0!==this.props.onUserLogout&&i.push({label:"Logout",key:"user-logout",onClick:function(){void 0!==t.props.onUserLogout&&t.props.onUserLogout()}});var a={items:i};n=(0,y.jsx)(Mt.Z,{menu:a,trigger:["click"],children:(0,y.jsx)(Oe,{icon:Et.Z,onClick:function(e){return e.preventDefault()},label:"".concat(this.props.user.name," (").concat(this.props.user.email,")")})})}this.props.showWorklistButton&&(e=(0,y.jsx)(u.OL,{to:"/",children:(0,y.jsx)(Oe,{icon:Ut.Z,tooltip:"Go to worklist"})}));var o,r=(0,y.jsx)(Oe,{icon:At.Z,tooltip:"Get app info",onClick:this.handleInfoButtonClick}),s=(0,y.jsx)(we.Z,{count:this.state.errorObj.length,children:(0,y.jsx)(we.Z,{color:"green",count:this.state.warnings.length,children:(0,y.jsx)(Oe,{icon:xe.Z,tooltip:"Debug info",onClick:this.handleDebugButtonClick})})}),l=this.props.location.pathname.includes("/studies/")?(0,y.jsx)(Oe,{icon:Tt.Z,tooltip:"Dicom Tag Browser",onClick:this.handleDicomTagBrowserButtonClick}):null;this.props.showServerSelectionButton&&(o=(0,y.jsx)(Oe,{icon:kt.Z,tooltip:"Select server",onClick:this.handleServerSelectionButtonClick}));var c=function(){var e=t.state.selectedServerUrl,n=!1;null!=e&&""!==e&&(e.startsWith("http://")||e.startsWith("https://"))&&(t.props.onServerSelection({url:e}),n=!0),t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!n,isServerSelectionDisabled:!0})};return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.Z.Header,{style:{width:"100%",padding:"0 14px"},children:(0,y.jsxs)(se.Z,{children:[(0,y.jsx)(Ce.Z,{children:(0,y.jsx)(ae.Z,{align:"center",direction:"horizontal",children:(0,y.jsx)("img",{src:"https://imagingdatacommons.github.io/slim/logo.svg",alt:"",style:{height:"64px",margin:"-14px"}})})}),(0,y.jsx)(Ce.Z,{flex:"auto"}),(0,y.jsx)(Ce.Z,{children:(0,y.jsxs)(ae.Z,{direction:"horizontal",children:[e,r,s,l,o,n]})})]})}),(0,y.jsx)(ce.Z,{open:this.state.isServerSelectionModalVisible,title:"Select DICOMweb server",onOk:c,onCancel:function(){t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0})},children:(0,y.jsx)(Pt.Z,{placeholder:"Enter base URL of DICOMweb Study Service",onChange:function(e){var n=e.currentTarget.value,i=!0;if(null!=n)try{var a=new URL(n);a.protocol.startsWith("http")&&a.pathname.length>0&&(i=!1)}catch(o){}t.setState({selectedServerUrl:n,isServerSelectionDisabled:i})},onPressEnter:c,addonAfter:this.state.isServerSelectionDisabled?(0,y.jsx)(pe.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,y.jsx)(he.Z,{style:{color:"rgba(0,0,0,.45)"}})})})]})}}]),n}(l.Component));var un=n(7063);const dn=function(e){var t=e.title,n=e.message;return(0,y.jsx)("div",{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.jsx)(un.ZP,{title:t,subTitle:n})})};const hn=tt(function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a;return(0,i.Z)(this,n),(a=t.call(this,e)).defaultPageSize=20,a.handleSearch=function(e,t,n){t()},a.handleReset=function(e){e()},a.getColumnSearchProps=function(e){return{filterDropdown:function(t){var n=t.setSelectedKeys,i=t.selectedKeys,o=t.confirm,r=t.clearFilters;return(0,y.jsxs)("div",{style:{padding:8},children:[(0,y.jsx)(Pt.Z,{placeholder:"Search",value:i[0],onChange:function(e){return n(void 0!==e.target.value?[e.target.value]:[])},onPressEnter:function(){return a.handleSearch(i,o,e)},style:{width:188,marginBottom:8,display:"block"}}),(0,y.jsxs)(ae.Z,{children:[(0,y.jsx)(re.Z,{type:"primary",onClick:function(){return a.handleSearch(i,o,e)},icon:(0,y.jsx)(Gt.Z,{}),size:"small",style:{width:90},children:"Search"}),(0,y.jsx)(re.Z,{onClick:function(){return a.handleReset(r)},size:"small",style:{width:90},children:"Reset"})]})]})},filterIcon:function(e){return(0,y.jsx)(Gt.Z,{style:{color:e?"#1890ff":void 0}})}}},a.fetchData=a.fetchData.bind((0,o.Z)(a)),a.handleClick=a.handleClick.bind((0,o.Z)(a)),a.handleChange=a.handleChange.bind((0,o.Z)(a)),a.state={studies:[],isLoading:!1,numStudies:0,pageSize:a.defaultPageSize},a}return(0,a.Z)(n,[{key:"searchForStudies",value:function(){var e=this,t={queryParams:{ModalitiesInStudy:"SM"}};this.props.clients[O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(t).then((function(t){e.setState({numStudies:t.length,studies:t.slice(0,e.state.pageSize).map((function(e){return j.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),Q.onError(F,new N(k,"An error occured. Search for studies failed."))}))}},{key:"componentDidMount",value:function(){this.searchForStudies()}},{key:"componentDidUpdate",value:function(e){this.props.clients!==e.clients&&this.searchForStudies()}},{key:"handleClick",value:function(e,t){this.props.navigate("/studies/".concat(t.StudyInstanceUID))}},{key:"fetchData",value:function(e){var t=this,n=e.offset,i=e.limit,a=e.searchCriteria,o={ModalitiesInStudy:"SM",offset:n,limit:i};if(void 0!==a){for(var r in a){var s=a[r];o[r]="PersonName"===r?"*".concat(s,"*"):s}o.fuzzymatching="true"}var l={queryParams:o};this.props.clients[O.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(l).then((function(e){t.setState({studies:e.map((function(e){return j.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),Q.onError(F,new N(k,"Request to search for studies failed."))}))}},{key:"handleChange",value:function(e,t){this.setState({isLoading:!0});var n=e.current;void 0===n&&(n=1);var i=e.pageSize;void 0===i&&(i=this.state.pageSize);var a=i*(n-1),o=i;console.debug("search for studies of page #".concat(n,"..."));var r={};for(var s in t)null!==t[s]&&(r[s]=t[s][0].toString());this.fetchData({offset:a,limit:o,searchCriteria:r}),this.setState({isLoading:!1,pageSize:i})}},{key:"render",value:function(){var e=this,t=[(0,R.Z)({title:"Accession Number",dataIndex:"AccessionNumber"},this.getColumnSearchProps("AccessionNumber")),(0,R.Z)({title:"Study ID",dataIndex:"StudyID"},this.getColumnSearchProps("StudyID")),{title:"Study Date",dataIndex:"StudyDate",render:function(e){return w(e)}},{title:"Study Time",dataIndex:"StudyTime",render:function(e){return x(e)}},(0,R.Z)({title:"Patient ID",dataIndex:"PatientID"},this.getColumnSearchProps("PatientID")),(0,R.Z)({title:"Patient's Name",dataIndex:"PatientName",render:function(e){return b(e)}},this.getColumnSearchProps("PatientName")),{title:"Patient's Sex",dataIndex:"PatientSex",render:function(e){return D(e)}},{title:"Patient's Birthdate",dataIndex:"PatientBirthDate",render:function(e){return w(e)}},{title:"Referring Physician's Name",dataIndex:"ReferringPhysicianName",render:function(e){return b(e)}},{title:"Modalities in Study",dataIndex:"ModalitiesInStudy",render:function(e){return void 0===e?"":String(e)}}],n={defaultPageSize:this.defaultPageSize,pageSize:this.state.pageSize,hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,showTotal:function(e,t){return"".concat(t[0],"-").concat(t[1]," of ").concat(e," studies")},total:this.state.numStudies};return(0,y.jsx)(Nt.Z,{style:{cursor:"pointer"},columns:t,rowKey:function(e){return e.StudyInstanceUID},dataSource:this.state.studies,pagination:n,onRow:function(t){return{onClick:function(n){return e.handleClick(n,t)}}},onChange:this.handleChange,size:"small",loading:this.state.isLoading})}}]),n}(l.Component));var pn=n(5685),vn=function(e,t){var n=t;return n.endsWith("/")||(n+="/"),new URL(e,n).toString()},mn=function(e){var t,n,i,a,o,r=new URLSearchParams(e.search),s=new URLSearchParams(e.hash.replace("#","?"));return Boolean(null!==(t=null!==(n=null!==(i=null!==(a=null!==(o=r.get("code"))&&void 0!==o?o:r.get("id_token"))&&void 0!==a?a:r.get("session_state"))&&void 0!==i?i:s.get("code"))&&void 0!==n?n:s.get("id_token"))&&void 0!==t?t:s.get("session_state"))},fn=function(e){var t;if(null!==e&&(t=e.profile),void 0!==t){if(void 0!==t.name&&void 0!==t.email)return{name:t.name,email:t.email};Q.onError(Y,new N(T,'Failed to obtain user "name" and "email".'))}else Q.onError(Y,new N(T,"Failed to obtain user profile."));return{name:void 0,email:void 0}},gn=(0,a.Z)((function e(t,n){var a=this;(0,i.Z)(this,e),this._oidc=void 0,this.signIn=function(){var e=(0,St.Z)((0,yt.Z)().mark((function e(t){var n,i,o,r;return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.onSignIn,i=function(e){var t=fn(e),i="".concat(e.token_type," ").concat(e.access_token);null!=n?(console.info("handling sign-in using provided callback function"),n({user:t,authorization:i})):console.warn("no callback function was provided to handle sign-in")},!mn(window.location)){e.next=10;break}return console.info("obtaining authorization"),e.next=6,a._oidc.signinCallback();case 6:null!=(o=e.sent)&&(console.info("obtained user data: ",o),i(o)),e.next=21;break;case 10:return e.next=12,a._oidc.getUser();case 12:if(null!==(r=e.sent)&&!r.expired){e.next=19;break}return console.info("authenticating user"),e.next=17,a._oidc.signinRedirect();case 17:e.next=21;break;case 19:console.info("user has already been authenticated"),i(r);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.signOut=(0,St.Z)((0,yt.Z)().mark((function e(){return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("signing out user and revoking authorization"),e.next=3,a._oidc.signoutRedirect();case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),this.getAuthorization=(0,St.Z)((0,yt.Z)().mark((function e(){return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._oidc.getUser().then((function(e){if(null!==e)return e.access_token;Q.onError(Y,new N(T,"Failed to obtain user profile."))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.getUser=(0,St.Z)((0,yt.Z)().mark((function e(){return(0,yt.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._oidc.getUser().then((function(e){return null===e&&Q.onError(Y,new N(T,"Failed to obtain user information.")),fn(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));var o="code";void 0!==n.grantType&&"implicit"===n.grantType&&(o="id_token token"),this._oidc=new pn.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:o,loadUserInfo:!0,automaticSilentRenew:!0,revokeAccessTokenOnSignout:!0,post_logout_redirect_uri:"".concat(t,"/logout")}),null!=n.endSessionEndpoint&&this._oidc.metadataService.getMetadata().then((function(e){null!=n.endSessionEndpoint&&(e.end_session_endpoint=n.endSessionEndpoint,a._oidc=new pn.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:o,loadUserInfo:!0,automaticSilentRenew:!0,revokeAccessTokenOnSignout:!0,post_logout_redirect_uri:"".concat(t,"/logout"),metadata:e}))})).catch((function(e){console.error("failed to get metadata from authorization server: ",e)}))})),yn=n(7659),Sn=n(9158);const Cn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{retries:5,factor:3,minTimeout:1e3,maxTimeout:6e4,randomize:!0,retryableStatusCodes:[429,500]},t=e;null!=e.retries&&(t.retries=e.retries),null!=e.factor&&(t.factor=e.factor),null!=e.minTimeout&&(t.minTimeout=e.minTimeout),null!=e.maxTimeout&&(t.maxTimeout=e.maxTimeout),null!=e.randomize&&(t.randomize=e.randomize),null!=e.retryableStatusCodes&&(t.retryableStatusCodes=e.retryableStatusCodes);var n=function(e,n){var i=n.url,a=n.method;var o=e.send;return e.send=function(){var n=Sn.operation(t);n.attempt((function(o){var r=e.onreadystatechange;e.onreadystatechange=function(){if(null!=r){for(var a=arguments.length,o=new Array(a),s=0;s1&&(console.warn("Requesting ".concat(i,"... (attempt: ").concat(o,")")),e.open(a,i,!0))}));for(var r=arguments.length,s=new Array(r),l=0;l1&&Q.onError(W,new N(k,"Only one store is supported for now."))}return(0,a.Z)(e,[{key:"baseURL",get:function(){return this.stores[0].client.baseURL}},{key:"headers",get:function(){return this.stores[0].client.headers}}]),e}();function wn(e){var t,n,i=e.clients,a=e.user,o=e.app,r=e.config,s=(0,c.UO)().studyInstanceUID,l=!(null!==(t=r.disableAnnotationTools)&&void 0!==t&&t),u=null!==(n=r.preload)&&void 0!==n&&n;return(0,y.jsx)(Rt,{clients:i,user:a,annotations:r.annotations,preload:u,app:o,enableAnnotationTools:l,studyInstanceUID:s})}function xn(e){var t=e.baseUri,n=e.gcpBaseUrl,i=e.settings,a=e.onError,o={default:0},r={};for(var s in i.forEach((function(e){if(null!=e.storageClasses)e.storageClasses.forEach((function(t){Object.values(O).includes(t)?t in o?o[t]+=1:o[t]=1:console.warn('unknown storage class "'.concat(t,'" specified ')+'for configured server "'.concat(e.id,'"'))}));else{if(window.location.pathname.includes("/projects/")){var i=window.location.pathname.split("/study/")[0],s="".concat(n).concat(i,"/dicomWeb");e.url=s}o.default+=1,r.default=new bn({baseUri:t,settings:[e],onError:a})}})),o.default>1&&Q.onError(W,new N(k,"Only one default server can be configured without specification of storage classes.")),o)"default"!==s&&o[s]>1&&Q.onError(W,new N(k,"Only one configured server can specify a given storage class. "+'Storage class "'.concat(s,'" is specified by more than one ')+"of the configured servers."));return Object.keys(o).length>1&&i.forEach((function(e){var n=new bn({baseUri:t,settings:[e],onError:a});null!=e.storageClasses&&e.storageClasses.forEach((function(e){r[e]=n}))})),Object.values(O).forEach((function(e){e in r||(r[e]=r.default)})),r}const Dn=function(e){(0,r.Z)(n,e);var t=(0,s.Z)(n);function n(e){var a,r;(0,i.Z)(this,n),(r=t.call(this,e)).auth=void 0,r.handleDICOMwebError=function(e,t){401===e.status?r.signIn():403===e.status&&Q.onError(F,new N(k,"User is not authorized to access DICOMweb resources."));var n=function(){Q.onError(F,new N(k,"An unexpected server error occured."))};void 0!==t.errorMessages?t.errorMessages.forEach((function(t){e.status===t.status?r.setState({error:{status:e.status,message:t.message}}):500===e.status&&n()})):500===e.status&&n()},r.handleSignIn=function(e){var t=e.user,n=e.authorization;for(var i in r.state.clients){r.state.clients[i].updateHeaders({Authorization:n})}var a=window.localStorage.getItem("slim_path"),o=window.localStorage.getItem("slim_search");if(null!=a&&a!==window.location.pathname){var s=a;null!=o&&(s+=o),window.location.href=s}window.localStorage.removeItem("slim_path"),window.localStorage.removeItem("slim_search"),r.setState({user:t})},console.info("instatiate app"),console.info('app is located at "'.concat(e.config.path,'"'));var s=window.location,l=s.protocol,c=s.host,u="".concat(l,"//").concat(c),h=vn(e.config.path,u),p=e.config.oidc;return void 0!==p&&(console.info("app uses the following OIDC configuration: ",e.config.oidc),r.auth=new gn(h,p)),0===e.config.servers.length&&Q.onError(W,new N(k,"One server needs to be configured.")),console.info("app uses the following DICOMweb server configuration: ",e.config.servers),r.handleServerSelection=r.handleServerSelection.bind((0,o.Z)(r)),d.ZP.config({duration:5}),r.addGcpSecondaryAnnotationServer(e.config),r.state={clients:xn({baseUri:u,gcpBaseUrl:null!==(a=e.config.gcpBaseUrl)&&void 0!==a?a:"https://healthcare.googleapis.com/v1",settings:e.config.servers,onError:r.handleDICOMwebError}),isLoading:!0,wasAuthSuccessful:!1},r}return(0,a.Z)(n,[{key:"addGcpSecondaryAnnotationServer",value:function(e){var t="gcp_secondary_annotation_server",n=new URLSearchParams(window.location.search).get("gcp");void 0===e.servers.find((function(e){return e.id===t}))&&"string"===typeof n&&e.servers.push({id:t,write:!0,url:n,storageClasses:[O.COMPREHENSIVE_SR,O.COMPREHENSIVE_3D_SR,O.SEGMENTATION,O.MICROSCOPY_BULK_SIMPLE_ANNOTATION,O.PARAMETRIC_MAP,O.ADVANCED_BLENDING_PRESENTATION_STATE,O.COLOR_SOFTCOPY_PRESENTATION_STATE,O.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,O.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE]})}},{key:"handleServerSelection",value:function(e){var t=e.url;console.info("select DICOMweb server: ",t);var n=new bn({baseUri:"",settings:[{id:"tmp",url:t,read:!0,write:!1}],onError:this.handleDICOMwebError});n.updateHeaders(this.state.clients.default.headers),this.setState((function(e){var t={};for(var i in e.clients)t[i]=n;return{clients:t}}))}},{key:"signIn",value:function(){var e=this;void 0!==this.auth?(console.info("try to sign in user"),this.auth.signIn({onSignIn:this.handleSignIn}).then((function(){console.info("sign-in was successful"),e.setState({isLoading:!1,wasAuthSuccessful:!0})})).catch((function(t){console.error(t),Q.onError(Y,new N(T,"Could not sign-in user.")),e.setState({isLoading:!1,redirectTo:void 0,wasAuthSuccessful:!1})}))):this.setState({isLoading:!1,redirectTo:void 0,wasAuthSuccessful:!0})}},{key:"componentDidMount",value:function(){null==window.localStorage.getItem("slim_path")&&(window.localStorage.setItem("slim_path",window.location.pathname),window.localStorage.setItem("slim_search",window.location.search)),this.signIn()}},{key:"render",value:function(){var e,t,n,i=this,a={name:this.props.name,version:this.props.version,homepage:this.props.homepage,uid:"1.2.826.0.1.3680043.9.7433.1.5",organization:this.props.config.organization},o=!(null!==(e=this.props.config.disableWorklist)&&void 0!==e&&e),r=null!==(t=this.props.config.enableServerSelection)&&void 0!==t&&t;n=o?(0,y.jsx)(hn,{clients:this.state.clients}):(0,y.jsx)("div",{children:"Worklist has been disabled."});var s,l=!1;null!=this.props.config.oidc&&null!=this.props.config.oidc.endSessionEndpoint?(s=function(){null!=i.auth&&i.auth.signOut()},l=!0):(s=function(){},l=!1);var d={height:"100vh"},v={height:"100%"};return void 0!==this.state.redirectTo?(0,y.jsx)(u.VK,{basename:this.props.config.path,children:(0,y.jsx)(c.Fg,{to:this.state.redirectTo,replace:!0})}):this.state.isLoading?(0,y.jsx)(u.VK,{basename:this.props.config.path,children:(0,y.jsxs)(h.Z,{style:d,children:[(0,y.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,showServerSelectionButton:!1,clients:this.state.clients}),(0,y.jsx)(h.Z.Content,{style:v,children:(0,y.jsx)(p.fCD,{})})]})}):this.state.wasAuthSuccessful?null!=this.state.error?(0,y.jsx)(dn,{type:"error",message:this.state.error.message}):(0,y.jsx)(u.VK,{basename:this.props.config.path,children:(0,y.jsxs)(c.Z5,{children:[(0,y.jsx)(c.AW,{path:"/",element:(0,y.jsxs)(h.Z,{style:d,children:[(0,y.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,y.jsx)(h.Z.Content,{style:v,children:n})]})}),(0,y.jsx)(c.AW,{path:"/studies/:studyInstanceUID/*",element:(0,y.jsxs)(h.Z,{style:d,children:[(0,y.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,y.jsx)(h.Z.Content,{style:v,children:(0,y.jsx)(wn,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,y.jsx)(c.AW,{path:"/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:studyInstanceUID/*",element:(0,y.jsxs)(h.Z,{style:d,children:[(0,y.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,y.jsx)(h.Z.Content,{style:v,children:(0,y.jsx)(wn,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,y.jsx)(c.AW,{path:"/logout",element:(0,y.jsxs)(h.Z,{style:d,children:[(0,y.jsx)(cn,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),"Logged out"]})})]})}):(0,y.jsx)(dn,{type:"error",message:"Sign-in failed."})}}]),n}(l.Component)}}]); +//# sourceMappingURL=687.cd0a08b4.chunk.js.map \ No newline at end of file diff --git a/static/js/687.cd0a08b4.chunk.js.map b/static/js/687.cd0a08b4.chunk.js.map new file mode 100644 index 00000000..06120590 --- /dev/null +++ b/static/js/687.cd0a08b4.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/687.cd0a08b4.chunk.js","mappings":"6QA4BMA,EAAW,qGAqDd,OArDc,8BACf,WACE,IAAIC,EAAoC,aACpCC,EAAkB,YAEWC,IAA7BC,KAAKC,MAAMC,eAA+BF,KAAKC,MAAMC,gBACvDL,EAAS,WACTC,EAAkB,QAEpB,IAAMK,EAAQH,KAAKC,MAAMG,WA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CACrB3vC,QAAS/H,KAAKiH,MAAMc,QACpB+pB,KAAM9xB,KAAKiH,MAAM6qB,KACjB6lB,OAAQ33C,KAAKC,MAAM03C,OACnBtlB,IAAK4nB,YAMf,SAAC,KAAK,CACJ1Z,KAAK,UACLC,SACE,UAAC,IAAM,CAACj4B,MAAOiyC,EAAY,WACzB,SAAC,GAAM,CACLnoB,IAAK4nB,EACLnoB,KAAM9xB,KAAKiH,MAAM6qB,KACjBmc,oBAAoB,EACpBgB,kBAAmBjvC,KAAK4uC,sBACxBjB,aAAc4M,EAAmBD,OAAWv6C,EAC5C2uC,0BAA2B2L,IAC3B,wBArFZ,SAAC,GAAQ,CAACv1C,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EAvYM,CAAShD,EAAAA,U","sources":["components/Description.tsx","components/ClinicalTrial.tsx","utils/values.ts","components/Patient.tsx","components/Study.tsx","data/uids.tsx","utils/PubSub.js","utils/CustomError.js","services/NotificationMiddleware.js","components/SlideItem.tsx","components/SlideList.tsx","components/AnnotationItem.tsx","components/AnnotationList.tsx","components/AnnotationGroupItem.tsx","components/AnnotationGroupList.tsx","components/Button.tsx","components/Equipment.tsx","utils/sr.tsx","components/Report.tsx","components/Item.tsx","data/specimens.tsx","components/SpecimenItem.tsx","components/SpecimenList.tsx","components/OpticalPathItem.tsx","components/OpticalPathList.tsx","components/MappingItem.tsx","components/MappingList.tsx","components/SegmentItem.tsx","components/SegmentList.tsx","utils/router.tsx","components/ColorSettingsMenu.tsx","components/AnnotationCategoryItem.tsx","components/AnnotationCategoryList.tsx","components/HoveredRoiTooltip.tsx","services/RoiToAnnotationAdapter.ts","components/SlideViewer.tsx","data/slides.tsx","services/fetchImageMetadata.ts","hooks/useSlides.ts","components/CaseViewer.tsx","components/DicomTagBrowser/dicomTagUtils.ts","utils/formatDicomDate.ts","utils/pubSubServiceInterface.ts","utils/createSeriesMetadata.ts","utils/createStudyMetadata.ts","services/DICOMMetadataStore.ts","hooks/useDebounce.ts","components/DicomTagBrowser/DicomTagBrowser.tsx","components/Header.tsx","components/InfoPage.tsx","components/Worklist.tsx","utils/url.tsx","auth/OidcManager.tsx","utils/xhrRetryHook.ts","DicomWebManager.ts","App.tsx"],"sourcesContent":["import React from 'react'\nimport { v4 as generateUUID } from 'uuid'\nimport { Card, Descriptions } from 'antd'\n\nexport interface Attribute {\n name: string\n value: any\n}\n\nexport interface AttributeGroup {\n name: string\n attributes: Attribute[]\n}\n\ninterface DescriptionProps {\n header?: string\n icon?: any\n attributes: Attribute[]\n selectable?: boolean\n hasLongValues?: boolean\n methods?: React.ReactNode[]\n children?: React.ReactNode\n}\n\n/**\n * React component for a description consisting of a header containing a\n * header and a body containing a list of name-value pairs.\n */\nclass Description extends React.Component {\n render (): React.ReactNode {\n let layout: 'horizontal' | 'vertical' = 'horizontal'\n let labelLineHeight = '14px'\n const contentLineHeight = '14px'\n if (this.props.hasLongValues !== undefined && this.props.hasLongValues) {\n layout = 'vertical'\n labelLineHeight = '20px'\n }\n const items = this.props.attributes.map((item: Attribute, index: number) => {\n const uid = generateUUID()\n return (\n \n {item.value}\n \n )\n })\n let icon = null\n if (this.props.icon !== undefined) {\n icon = \n }\n return (\n \n \n {items}\n \n {this.props.children}\n \n )\n }\n}\n\nexport default Description\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface ClinicalTrialProps {\n metadata: dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM ClinicalTrial Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass ClinicalTrial extends React.Component {\n render (): React.ReactNode {\n const attributes = []\n if (this.props.metadata.ClinicalTrialSponsorName != null) {\n // Attributes of Clinical Trial Subject module\n attributes.push(\n ...[\n {\n name: 'Sponsor Name',\n value: this.props.metadata.ClinicalTrialSponsorName\n },\n {\n name: 'Protocol ID',\n value: this.props.metadata.ClinicalTrialProtocolID\n },\n {\n name: 'Protocol Name',\n value: this.props.metadata.ClinicalTrialProtocolName\n },\n {\n name: 'Site Name',\n value: this.props.metadata.ClinicalTrialSiteName\n }\n ]\n )\n }\n if (this.props.metadata.ClinicalTrialTimePointID != null) {\n // Attributes of Clinical Trial Study module\n attributes.push(\n {\n name: 'Time Point ID',\n value: this.props.metadata.ClinicalTrialTimePointID\n }\n )\n }\n // Attributes of Clinical Trial Subject module\n return \n }\n}\n\nexport default ClinicalTrial\n","import * as dmv from 'dicom-microscopy-viewer'\n\nfunction parseName (value: dmv.metadata.PersonName|null|undefined): string {\n if (typeof value === 'object' && value !== null && value !== undefined) {\n if (value.Alphabetic !== undefined) {\n return value.Alphabetic.split('^').join(' ')\n }\n return ''\n }\n return ''\n}\n\nfunction parseDate (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n return `${year}-${month}-${day}`\n }\n return ''\n}\n\nfunction parseTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const hours = value.substring(0, 2)\n const minutes = value.substring(2, 4)\n const seconds = value.substring(4, 6)\n return `${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseDateTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n const hours = value.substring(8, 10)\n const minutes = value.substring(10, 12)\n const seconds = value.substring(12, 14)\n return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseSex (value: string|null|undefined): string {\n const lut: { [key: string]: string } = {\n F: 'Female',\n M: 'Male',\n O: 'Other'\n }\n if (value !== null && value !== undefined) {\n return lut[value]\n }\n return ''\n}\n\nexport { parseDate, parseDateTime, parseName, parseSex, parseTime }\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseName, parseSex, parseDate } from '../utils/values'\n\ninterface PatientProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Patient Information Entity that\n * displays common study-level, patient-related attributes of contained\n * DICOM Slide Microscopy images.\n */\nclass Patient extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'ID',\n value: this.props.metadata.PatientID\n },\n {\n name: 'Name',\n value: parseName(this.props.metadata.PatientName)\n },\n {\n name: 'Gender',\n value: parseSex(this.props.metadata.PatientSex)\n },\n {\n name: 'Birthdate',\n value: parseDate(this.props.metadata.PatientBirthDate)\n }\n ]\n return (\n \n )\n }\n}\n\nexport default Patient\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseDate, parseTime } from '../utils/values'\n\ninterface StudyProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Study Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass Study extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'Accession #',\n value: this.props.metadata.AccessionNumber\n },\n {\n name: 'ID',\n value: this.props.metadata.StudyID\n },\n {\n name: 'Date',\n value: parseDate(this.props.metadata.StudyDate)\n },\n {\n name: 'Time',\n value: parseTime(this.props.metadata.StudyTime)\n }\n ]\n return \n }\n}\n\nexport default Study\n","export enum StorageClasses {\n VL_WHOLE_SLIDE_MICROSCOPY_IMAGE = '1.2.840.10008.5.1.4.1.1.77.1.6',\n COMPREHENSIVE_SR = '1.2.840.10008.5.1.4.1.1.88.33',\n COMPREHENSIVE_3D_SR = '1.2.840.10008.5.1.4.1.1.88.34',\n SEGMENTATION = '1.2.840.10008.5.1.4.1.1.66.4',\n MICROSCOPY_BULK_SIMPLE_ANNOTATION = '1.2.840.10008.5.1.4.1.1.91.1',\n PARAMETRIC_MAP = '1.2.840.10008.5.1.4.1.1.30',\n ADVANCED_BLENDING_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.8',\n COLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.2',\n GRAYSCALE_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.1',\n PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.3'\n}\n","// Use symbols to prevent exposing private attributes\nconst _subscriptions = Symbol('subscriptions')\nconst _lastSubscriptionId = Symbol('lastSubscriptionId')\n\n/**\n * Class to enable implementation of publish/subscribe pattern\n * @class\n * @classdesc Enables publishing/subscribing\n */\nexport default class PubSub {\n constructor () {\n this[_subscriptions] = {}\n this[_lastSubscriptionId] = 0\n }\n\n /**\n * Adds a subscription callback to the provided event name\n * @param {string} eventName Event name that will trigger the callback\n * @param {Function} callback Function to be executed when event is published\n * @returns {void}\n */\n subscribe (eventName, callback) {\n if (eventName === undefined) {\n throw new Error('Trying to subscribe to an inexistent event')\n }\n\n if (typeof callback !== 'function') {\n throw new Error('The provided callback must be a function')\n }\n\n if (!this[_subscriptions].hasOwnProperty(eventName)) {\n this[_subscriptions][eventName] = {}\n }\n\n const subscriptionId = `sub${this[_lastSubscriptionId]++}`\n this[_subscriptions][eventName][subscriptionId] = callback\n }\n\n /**\n * Removes a subscription callback for the provided event name\n * @param {string} eventName Event name for the registerd callback\n * @param {Function} [callback] Function to have its subscription removed\n * @returns {void}\n */\n unsubscribe (eventName, callback) {\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n if (!callback) {\n delete callbacks[subscriptionId]\n } else if (callbacks[subscriptionId] === callback) {\n delete callbacks[subscriptionId]\n }\n }\n }\n\n /**\n * Trigger all registered subscription callbacks for a specific event name\n * @param {String} eventName Event name to trigger subscriptions from\n * @param {any} [payload] Payload that will be passed to the callback fuction\n * @returns {void}\n */\n publish (eventName, ...payload) {\n if (eventName === undefined) {\n throw new Error('Trying to publish an inexistent event')\n }\n\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n callbacks[subscriptionId](...payload)\n }\n }\n\n /**\n * Cleares all subscriptions for current instance\n * @returns {void}\n */\n unsubscribeFromAll () {\n for (const eventName in this[_subscriptions]) {\n const callbacks = this[_subscriptions][eventName]\n for (const subscriptionId in callbacks) {\n delete callbacks[subscriptionId]\n }\n }\n }\n}\n","const errorTypes = {\n AUTHENTICATION: 'Authentication',\n COMMUNICATION: 'Communication',\n ENCODINGANDDECODING: 'EncodingDecoding',\n VISUALIZATION: 'Visualization'\n}\n\nclass CustomError extends Error {\n constructor (type, message) {\n super()\n this.message = message\n this.stack = new Error().stack\n this.type = type\n }\n}\n\nexport { errorTypes, CustomError }\n","import PubSub from '../utils/PubSub'\nimport { notification } from 'antd'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nexport const NotificationMiddlewareEvents = {\n OnError: 'onError',\n OnWarning: 'onWarning'\n}\n\nexport const NotificationMiddlewareContext = {\n DICOMWEB: 'dicomweb-client',\n DMV: 'dicom-microscopy-viewer',\n DCMJS: 'dcmjs',\n SLIM: 'slim',\n AUTH: 'authentication'\n}\n\nconst NotificationType = {\n TOAST: 'toast',\n CONSOLE: 'console'\n}\n\n/* Sources of Error:\n 1. 'dicomweb-client': Error while requesting/fetching data, tagged as 'Communication'\n 2. 'slim' and 'dicom-microscopy-viewer' library: Error related to dicom data encoding/decoding,\n could directly/indirectly impact image-related visualization, tagged as 'Visualization' or\n 'Encoding/Decoding' accordingly\n 3. 'dcmjs' library: Data parsing error, tagged as 'DICOMError'\n 4. 'authentication': Error during user authentication, tagged as 'Authentication'\n */\nconst NotificationSourceDefinition = {\n sources: [\n {\n category: errorTypes.AUTHENTICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.COMMUNICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.VISUALIZATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.ENCODINGANDDECODING,\n notificationType: NotificationType.CONSOLE\n },\n {\n category: 'Warning',\n notificationType: NotificationType.TOAST\n }\n ]\n}\n\nclass NotificationMiddleware extends PubSub {\n constructor () {\n super()\n\n const outerContext = (args) => {\n this.publish(NotificationMiddlewareEvents.OnWarning, Array.from(args).join(' '))\n }\n\n (function () {\n const warn = console.warn\n console.warn = function () {\n if (!JSON.stringify(arguments).includes('request')) {\n outerContext(arguments)\n }\n warn.apply(this, Array.prototype.slice.call(arguments))\n }\n }())\n }\n\n /**\n * Error handling middleware function\n *\n * @param source - source of error - dicomweb-client, dmv, dcmjs or slim itself\n * @param error - error object\n */\n onError (source, error) {\n const errorCategory = error.type\n const sourceConfig = NotificationSourceDefinition.sources.find(\n s => s.category === errorCategory\n )\n\n const { notificationType } = sourceConfig\n\n this.publish(NotificationMiddlewareEvents.OnError, {\n source,\n error\n })\n\n let notificationMsg\n if (error instanceof CustomError) {\n notificationMsg = error.message\n } else {\n notificationMsg = String(error)\n }\n\n switch (notificationType) {\n case NotificationType.TOAST:\n console.error(`A ${errorCategory} error occurred: `, error)\n return notification.error({\n message: `${errorCategory} error`,\n description: notificationMsg,\n duration: 3\n })\n\n case NotificationType.CONSOLE:\n console.error(`A ${errorCategory} error occurred: `, error)\n break\n\n default:\n }\n }\n}\n\nexport default new NotificationMiddleware()\n","import React from 'react'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport Description from './Description'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\n\ninterface SlideItemProps {\n clients: { [key: string]: DicomWebManager }\n slide: Slide\n}\n\ninterface SlideItemState {\n isLoading: boolean\n}\n\n/**\n * React component representing a DICOM Series Information Entity that displays\n * common series-level attributes of contained DICOM Slide Microscopy images\n * as well as the OVERVIEW image (if available).\n * When selected a Slide Viewer instance is created for the display of the\n * contained images.\n */\nclass SlideItem extends React.Component {\n state = { isLoading: false }\n\n private readonly overviewViewportRef = React.createRef()\n\n private overviewViewer?: dmv.viewer.OverviewImageViewer\n\n constructor (props: SlideItemProps) {\n super(props)\n this.overviewViewer = undefined\n }\n\n componentDidMount (): void {\n this.setState({ isLoading: true })\n if (this.props.slide.overviewImages.length > 0) {\n const metadata = this.props.slide.overviewImages[0]\n if (this.overviewViewportRef.current !== null) {\n this.overviewViewportRef.current.innerHTML = ''\n console.info(\n 'instantiate viewer for OVERVIEW image of slide ' +\n `\"${metadata.ContainerIdentifier}\"`\n )\n this.overviewViewer = new dmv.viewer.OverviewImageViewer({\n client: this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ],\n metadata: metadata,\n resizeFactor: 1,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n this.overviewViewer.render({\n container: this.overviewViewportRef.current\n })\n }\n }\n\n this.setState({ isLoading: false })\n }\n\n render (): React.ReactNode {\n if (this.overviewViewer !== undefined) {\n this.overviewViewer.resize()\n }\n const attributes = []\n const description = this.props.slide.description\n if (description != null && description !== '') {\n attributes.push({\n name: 'Description',\n value: description\n })\n }\n if (this.state.isLoading) {\n return ()\n }\n\n /* Properties need to be propagated down to Menu.Item:\n * https://github.com/react-component/menu/issues/142\n */\n return (\n \n \n {(this.overviewViewportRef.current != null) &&
}\n \n \n )\n }\n}\n\nexport default SlideItem\n","import React from 'react'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport SlideItem from './SlideItem'\nimport { Slide } from '../data/slides'\n\ninterface SlideListProps {\n metadata: Slide[]\n clients: { [key: string]: DicomWebManager }\n selectedSeriesInstanceUID: string\n onSeriesSelection: (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ) => void\n}\n\ninterface SlideListState {\n selectedSeriesInstanceUID: string\n}\n\n/**\n * React component representing a list of DICOM Series Information Entities.\n */\nclass SlideList extends React.Component {\n state = {\n selectedSeriesInstanceUID: this.props.selectedSeriesInstanceUID\n }\n\n componentDidMount (): void {\n this.props.onSeriesSelection({\n seriesInstanceUID: this.state.selectedSeriesInstanceUID\n })\n }\n\n render (): React.ReactNode {\n const slideList = this.props.metadata\n const slideItemList = []\n for (let i = 0; i < slideList.length; ++i) {\n const slide = slideList[i]\n const slideItem = (\n \n )\n\n slideItemList.push(slideItem)\n }\n\n const handleMenuItemSelection = ({ key, keyPath, domEvent, selectedKeys }: {\n key: React.ReactText\n keyPath: React.ReactText[]\n domEvent: React.MouseEvent | React.KeyboardEvent\n selectedKeys?: React.ReactText[]\n }): void => {\n console.info(`select slide \"${key}\"`)\n this.setState({ selectedSeriesInstanceUID: key.toString() })\n this.props.onSeriesSelection({ seriesInstanceUID: key.toString() })\n }\n\n let selectedKeys\n if (this.state.selectedSeriesInstanceUID !== undefined &&\n this.state.selectedSeriesInstanceUID !== null) {\n selectedKeys = [this.state.selectedSeriesInstanceUID]\n }\n\n return (\n \n {slideItemList}\n \n )\n }\n}\n\nexport default SlideList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Menu, Space, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface AnnotationItemProps {\n roi: dmv.roi.ROI\n index: number\n isVisible: boolean\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n}\n\n/**\n * React component representing a Region of Interest (ROI) annotation.\n */\nclass AnnotationItem extends React.Component {\n constructor (props: AnnotationItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n roiUID: this.props.roi.uid,\n isVisible: checked\n })\n }\n\n render (): React.ReactNode {\n const identifier = `ROI ${this.props.index + 1}`\n const attributes: Array<{ name: string, value: string }> = []\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const { isVisible, onVisibilityChange, ...otherProps } = this.props\n this.props.roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n this.props.roi.measurements.forEach(item => {\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n const seq = item.MeasuredValueSequence[0]\n const value = seq.NumericValue.toPrecision(6)\n const unit = seq.MeasurementUnitsCodeSequence[0].CodeValue\n attributes.push({\n name: name,\n value: `${value} ${unit}`\n })\n })\n return (\n \n
\n }\n unCheckedChildren={}\n />\n
\n \n \n \n
\n )\n }\n}\n\nexport default AnnotationItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport AnnotationItem from './AnnotationItem'\n\ninterface AnnotationListProps {\n rois: dmv.roi.ROI[]\n selectedRoiUIDs: Set\n visibleRoiUIDs: Set\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n onSelection: ({ roiUID }: { roiUID: string }) => void\n}\n\n/**\n * React component representing a list of Region of Interest (ROI)\n * annotations.\n */\nclass AnnotationList extends React.Component {\n constructor (props: AnnotationListProps) {\n super(props)\n this.handleMenuItemSelection = this.handleMenuItemSelection.bind(this)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n if (checked) {\n this.props.rois.forEach(roi => {\n this.props.onVisibilityChange({ roiUID: roi.uid, isVisible: checked })\n })\n } else {\n this.props.visibleRoiUIDs.forEach(roiUID => {\n this.props.onVisibilityChange({ roiUID, isVisible: checked })\n })\n }\n }\n\n handleMenuItemSelection (object: any): void {\n this.props.onSelection({ roiUID: object.key })\n }\n\n render (): React.ReactNode {\n const items = this.props.rois.map((roi, index) => (\n \n ))\n\n return (\n <>\n
\n 0}\n checkedChildren={}\n unCheckedChildren={}\n />\n
\n \n {items}\n \n \n )\n }\n}\n\nexport default AnnotationList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Select,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Description from './Description'\n\ninterface AnnotationGroupItemProps {\n annotationGroup: dmv.annotation.AnnotationGroup\n isVisible: boolean\n metadata: dmv.metadata.MicroscopyBulkSimpleAnnotations\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\ninterface AnnotationGroupItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass AnnotationGroupItem extends React.Component {\n constructor (props: AnnotationGroupItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleMeasurementSelection = this.handleMeasurementSelection.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n annotationGroupUID: this.props.annotationGroup.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color,\n limitValues: this.state.currentStyle.limitValues\n }\n })\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { limitValues: values }\n })\n }\n\n handleMeasurementSelection (value?: string, option?: any): void {\n if (value != null && option.children != null) {\n const codeComponents = value.split('-')\n const measurement = new dcmjs.sr.coding.CodedConcept({\n value: codeComponents[1],\n schemeDesignator: codeComponents[0],\n meaning: option.children\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { measurement }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n measurement\n }\n }))\n } else {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n color: this.props.defaultStyle.color\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n color: this.props.defaultStyle.color,\n limitValues: undefined\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const index = this.props.metadata.AnnotationGroupSequence.findIndex(\n item => (item.AnnotationGroupUID === this.props.annotationGroup.uid)\n )\n const item = this.props.metadata.AnnotationGroupSequence[index]\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property type',\n value: this.props.annotationGroup.propertyType.CodeMeaning\n },\n {\n name: 'Property category',\n value: this.props.annotationGroup.propertyCategory.CodeMeaning\n },\n // {\n // name: 'Algorithm Name',\n // value: this.props.annotationGroup.algorithmName\n // },\n {\n name: 'Graphic type',\n value: item.GraphicType\n },\n {\n name: 'Annotation coordinate type',\n value: this.props.metadata.AnnotationCoordinateType\n }\n ]\n\n const measurementsSequence = item.MeasurementsSequence ?? []\n const measurementOptions = measurementsSequence.map((measurementItem, i) => {\n const name = measurementItem.ConceptNameCodeSequence[0]\n return (\n \n {name.CodeMeaning}\n \n )\n })\n measurementOptions.push(\n \n <>\n \n )\n\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n \n )\n }\n\n let windowSettings\n let explorationSettings\n if (measurementsSequence.length > 0) {\n if (this.state.currentStyle.limitValues != null) {\n // TODO: need to get default min/max values from viewer first\n const minValue = 0\n const maxValue = 1000\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n explorationSettings = (\n <>\n \n Exploration\n \n \n \n Measurement\n \n \n \n {measurementOptions}\n \n \n \n \n )\n }\n\n const settings = (\n
\n {colorSettings}\n {windowSettings}\n \n \n Opacity\n \n \n \n \n \n \n \n \n {explorationSettings}\n
\n )\n\n const color = this.getCurrentColor()\n const isBadgeVisible = (\n this.state.isVisible && this.state.currentStyle.measurement == null\n )\n const {\n annotationGroup,\n defaultStyle,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n \n \n
\n \n )\n }\n}\n\nexport default AnnotationGroupItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport AnnotationGroupItem from './AnnotationGroupItem'\n\ninterface AnnotationGroupListProps {\n annotationGroups: dmv.annotation.AnnotationGroup[]\n visibleAnnotationGroupUIDs: Set\n metadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n }\n defaultAnnotationGroupStyles: {\n [annotationGroupUID: string]: {\n opacity: number\n color: number[]\n }\n }\n onAnnotationGroupVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onAnnotationGroupStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\n/**\n * React component representing a list of Annotation Groups.\n */\nclass AnnotationGroupList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.annotationGroups.map((annotationGroup, index) => {\n const uid = annotationGroup.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default AnnotationGroupList\n","import React from 'react'\nimport { Button as Btn, Divider, Tooltip } from 'antd'\n\ninterface ButtonProps {\n icon: any\n tooltip?: string\n label?: string\n onClick?: (options: any) => void\n isSelected?: boolean\n}\n\n/**\n * React component for a button.\n */\nclass Button extends React.Component {\n constructor (props: ButtonProps) {\n super(props)\n this.handleClick = this.handleClick.bind(this)\n }\n\n handleClick (event: React.SyntheticEvent): void {\n if (this.props.onClick !== undefined) {\n this.props.onClick(event)\n }\n }\n\n render (): React.ReactNode {\n const Icon = this.props.icon\n if (Icon === undefined) {\n return null\n }\n\n let text\n if (this.props.label != null) {\n text = (\n <>\n \n {this.props.label}\n \n )\n }\n\n let button\n if (this.props.isSelected ?? false) {\n button = (\n }\n type='primary'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n } else {\n button = (\n }\n type='default'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n }\n\n if (this.props.tooltip !== undefined) {\n return (\n \n {button}\n \n )\n } else {\n return button\n }\n }\n}\n\nexport default Button\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface EquipmentProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n}\n\n/**\n * React component representing a list of DICOM Equipment Entities.\n */\nclass Equipment extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const attributes = [\n {\n name: 'Manufacturer',\n value: this.props.metadata.Manufacturer\n },\n {\n name: 'Model Name',\n value: this.props.metadata.ManufacturerModelName\n },\n {\n name: 'Device Serial Number',\n value: this.props.metadata.DeviceSerialNumber\n },\n {\n name: 'Software Versions',\n value: this.props.metadata.SoftwareVersions\n }\n ]\n if (this.props.metadata.InstitutionName != null) {\n attributes.push({\n name: 'Institution Name',\n value: this.props.metadata.InstitutionName\n })\n }\n return \n }\n}\n\nexport default Equipment\n","import * as dcmjs from 'dcmjs'\n\n/**\n * Check whether a DICOM SR content item has a given name.\n *\n * @param item - Content item\n * @param name - Coded name that should be compared\n * @returns Whether the content item has the given name\n */\nconst hasName = (\n item: dcmjs.sr.valueTypes.ContentItem,\n name: dcmjs.sr.coding.CodedConcept\n): boolean => {\n const concept = item.ConceptNameCodeSequence[0]\n return (\n concept.CodeValue === name.CodeValue &&\n concept.CodingSchemeDesignator === name.CodingSchemeDesignator\n )\n}\n\n/**\n * Check whether a DICOM SR content item has a given value type.\n *\n * @param item - Content item\n * @param valueType - Value Type\n * @returns Whether the content item has the given value type\n */\nconst hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: dcmjs.sr.valueTypes.ValueTypes\n): boolean => {\n console.log(item.ValueType, valueType)\n return item.ValueType === valueType\n}\n\n/**\n * Find content items in a DICOM SR document given their name.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param name - Coded name that should be compared\n * @returns Matched content items\n */\nexport const findContentItemsByName = (\n { content, name }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n name: dcmjs.sr.coding.CodedConcept\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasName(i, name)) {\n items.push(i)\n }\n })\n return items\n}\n\n/**\n * Find content items in a DICOM SR document given their value type.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param valueType - Value Type\n * @returns Matched content items\n */\nexport const findContentItemsByValueType = (\n { content, valueType }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n valueType: dcmjs.sr.valueTypes.ValueTypes\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, valueType)) {\n items.push(i)\n }\n })\n return items\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Divider } from 'antd'\nimport { v4 as generateUUID } from 'uuid'\n\nimport Description from './Description'\nimport Patient from './Patient'\nimport Study from './Study'\nimport { findContentItemsByName } from '../utils/sr'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nexport const hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: string\n): boolean => {\n return item.ValueType === valueType\n}\n\nconst findMeasurementItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.NumContentItem[] => {\n const items: dcmjs.sr.valueTypes.NumContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.NUM)) {\n const measurement = i as dcmjs.sr.valueTypes.NumContentItem\n items.push(measurement)\n }\n })\n return items\n}\n\nconst findEvaluationItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.CodeContentItem[] => {\n const items: dcmjs.sr.valueTypes.CodeContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.CODE)) {\n const evaluation = i as dcmjs.sr.valueTypes.CodeContentItem\n items.push(evaluation)\n }\n })\n return items\n}\n\nconst getROIs = (report: dmv.metadata.Comprehensive3DSR): dmv.roi.ROI[] => {\n // TID 1500 Measurement Report\n const matches = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (matches.length !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Imaging Measurements\" not found.' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\".'\n )\n )\n }\n const measurementsItem = matches[0] as dcmjs.sr.valueTypes.ContainerContentItem\n // TID 1410 Planar ROI Measurements and Qualitative Evaluations\n const measurementGroupItems = findContentItemsByName({\n content: measurementsItem.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n const rois: dmv.roi.ROI[] = []\n measurementGroupItems.forEach((item) => {\n const evaluations = []\n let observerType: string\n const group = item as dcmjs.sr.valueTypes.ContainerContentItem\n let items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '112040',\n schemeDesignator: 'DCM',\n meaning: 'Tracking Unique Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Tracking Unique Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const trackingUIDItem = items[0] as dcmjs.sr.valueTypes.UIDRefContentItem\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n schemeDesignator: 'DCM',\n meaning: 'Finding'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Finding\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111001',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Name'\n })\n })\n if (items.length !== 0) {\n const algorithmNameItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmNameItem)\n observerType = 'Device'\n } else {\n observerType = 'Person'\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111003',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Version'\n })\n })\n if (items.length !== 0) {\n const algorithmVersionItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmVersionItem)\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const regionItem = items[0] as dcmjs.sr.valueTypes.Scoord3DContentItem\n let scoord3d: any\n if (regionItem.GraphicType === 'POINT') {\n scoord3d = new dmv.scoord3d.Point({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: regionItem.GraphicData\n })\n } else {\n const coordinates: number[][] = []\n for (let i = 0; i < regionItem.GraphicData.length; i += 3) {\n coordinates.push(regionItem.GraphicData.slice(i, i + 3))\n }\n if (regionItem.GraphicType === 'POLYGON') {\n scoord3d = new dmv.scoord3d.Polygon({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'MULTIPOINT') {\n scoord3d = new dmv.scoord3d.MultiPoint({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'POLYLINE') {\n scoord3d = new dmv.scoord3d.Polyline({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSE') {\n scoord3d = new dmv.scoord3d.Ellipse({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSOID') {\n scoord3d = new dmv.scoord3d.Ellipsoid({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" has unknown graphic type ' +\n `\"${regionItem.GraphicType}\". ` +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n }\n\n evaluations.push(\n ...findEvaluationItems({ content: group.ContentSequence })\n )\n const measurements = findMeasurementItems({\n content: group.ContentSequence\n })\n\n const roi = new dmv.roi.ROI({\n scoord3d: scoord3d,\n uid: generateUUID(),\n properties: {\n trackingUID: trackingUIDItem.UID,\n observerType: observerType,\n evaluations: evaluations,\n measurements: measurements\n }\n })\n rois.push(roi)\n })\n return rois\n}\n\nclass MeasurementReport {\n public PersonObserverName?: string\n\n public PersonObserverLoginName?: string\n\n public DeviceObserverUID?: string\n\n public DeviceObserverName?: string\n\n public SpecimenUID: string\n\n public SpecimenIdentifier: string\n\n public ContainerIdentifier: string\n\n public ROIs: dmv.roi.ROI[] = []\n\n constructor (report: dmv.metadata.Comprehensive3DSR) {\n let items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121039',\n schemeDesignator: 'DCM',\n meaning: 'Specimen UID'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen UID\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.SpecimenUID = specimenUIDItem.UID\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.SpecimenIdentifier = specimenIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111700',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Container Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Container Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const containerIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.ContainerIdentifier = containerIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121008',\n schemeDesignator: 'DCM',\n meaning: 'Person Observer Name'\n })\n })\n if (items.length !== 0) {\n const personNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.PNameContentItem\n )\n this.PersonObserverName = personNameItem.PersonName\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '128774',\n schemeDesignator: 'DCM',\n meaning: \"Person Observer's Login Name\"\n })\n })\n if (items.length !== 0) {\n const personLoginNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.PersonObserverLoginName = personLoginNameItem.TextValue\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121012',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer UID'\n })\n })\n if (items.length > 0) {\n const deviceUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.DeviceObserverUID = deviceUIDItem.UID\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121013',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer Name'\n })\n })\n if (items.length !== 0) {\n const deviceNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.DeviceObserverName = deviceNameItem.TextValue\n }\n\n this.ROIs = getROIs(report)\n }\n}\n\ninterface ReportProps {\n dataset: dmv.metadata.Comprehensive3DSR\n}\n\n/**\n * React component representing a DICOM SR document that displays the\n * document content (a selected subset of content items).\n */\nclass Report extends React.Component {\n render (): React.ReactNode {\n const report = new MeasurementReport(this.props.dataset)\n const containerAttrs = [\n {\n name: 'ID',\n value: report.ContainerIdentifier\n }\n ]\n const specimenAttrs = [\n {\n name: 'ID',\n value: report.SpecimenIdentifier\n }\n ]\n const observerAttrs = [\n {\n name: 'Name',\n value: report.PersonObserverName\n }\n ]\n const annotations = report.ROIs.map(\n (roi, index): React.ReactNode => {\n const id = `Region ${index + 1}`\n const attrs: Array<{ name: string, value: string }> = []\n roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem\n )\n ) => {\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.ConceptCodeSequence[0].CodeMeaning\n })\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.TextValue\n })\n }\n })\n return \n }\n )\n\n return (\n
\n Patient\n \n Case\n \n Slide\n \n Specimen\n \n Observer\n \n Annotations\n {annotations}\n
\n )\n }\n}\n\nexport default Report\nexport { MeasurementReport }\n","import React from 'react'\nimport { List } from 'antd'\n\nimport Description, { Attribute, AttributeGroup } from './Description'\n\ninterface ItemProps {\n uid: string\n identifier: string\n attributes: Attribute[]\n groups?: AttributeGroup[]\n children?: React.ReactElement[]\n type?: string\n hasLongValues?: boolean\n}\n\n/**\n * React component for a list item that consists of a header element\n * containing an identifier and a body element containing a description list\n * of attributes rendered as name-value pairs.\n */\nclass Item extends React.Component {\n render (): React.ReactNode {\n let groups = null\n if (this.props.groups !== undefined) {\n groups = this.props.groups.map((item, index: number) => (\n \n ))\n }\n let title\n if (this.props.type !== undefined) {\n title = `${this.props.type}: ${this.props.identifier}`\n } else {\n title = this.props.identifier\n }\n return (\n \n \n {groups}\n
\n {this.props.children}\n \n )\n }\n}\n\nexport default Item\n","import * as dcmjs from 'dcmjs'\n\nexport const SpecimenPreparationTypes: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n COLLECTION: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING: new dcmjs.sr.coding.CodedConcept({\n value: '433465004',\n schemeDesignator: 'SCT',\n meaning: 'Sampling of tissue specimen'\n }),\n STAINING: new dcmjs.sr.coding.CodedConcept({\n value: '127790008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen staining'\n }),\n PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '9265001',\n schemeDesignator: 'SCT',\n meaning: 'Specimen processing'\n })\n}\n\nexport const SpecimenPreparationAdditives: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n FIXATIVE: new dcmjs.sr.coding.CodedConcept({\n value: '430864009',\n schemeDesignator: 'SCT',\n meaning: 'Tissue fixative'\n }),\n EMBEDDING_MEDIUM: new dcmjs.sr.coding.CodedConcept({\n value: '430863003',\n schemeDesignator: 'SCT',\n meaning: 'Embedding medium'\n })\n}\n\nexport const SpecimenPreparationStepItems: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen identifier'\n }),\n PARENT_SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '111705',\n schemeDesignator: 'DCM',\n meaning: 'Parent specimen identifier'\n }),\n PROCESSING_TYPE: new dcmjs.sr.coding.CodedConcept({\n value: '111701',\n schemeDesignator: 'DCM',\n meaning: 'Processing type'\n }),\n DATETIME_OF_PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '111702',\n schemeDesignator: 'DCM',\n meaning: 'Datetime of processing'\n }),\n PROCESSING_STEP_DESCRIPTION: new dcmjs.sr.coding.CodedConcept({\n value: '111703',\n schemeDesignator: 'DCM',\n meaning: 'Processing step description'\n }),\n COLLECTION_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '111704',\n schemeDesignator: 'DCM',\n meaning: 'Sampling method'\n }),\n STAIN: new dcmjs.sr.coding.CodedConcept({\n value: '424361007',\n schemeDesignator: 'SCT',\n meaning: 'Using substance'\n }),\n ...SpecimenPreparationAdditives\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Item from './Item'\nimport { Attribute } from './Description'\nimport { SpecimenPreparationStepItems } from '../data/specimens'\n\ninterface SpecimenItemProps {\n index: number\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a DICOM Specimen Information Entity and\n * displays specimen-related attributes of a DICOM Slide Microscopy image.\n */\nclass SpecimenItem extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const specimenDescription = this.props.metadata.SpecimenDescriptionSequence[\n this.props.index\n ]\n const attributes: Attribute[] = []\n if (specimenDescription.SpecimenShortDescription !== undefined) {\n attributes.push({\n name: 'Description',\n value: specimenDescription.SpecimenShortDescription\n })\n }\n if (specimenDescription.PrimaryAnatomicStructureSequence !== undefined) {\n if (specimenDescription.PrimaryAnatomicStructureSequence.length > 0) {\n const structures = specimenDescription.PrimaryAnatomicStructureSequence\n attributes.push({\n name: 'Anatomical structure',\n value: structures.map(item => item.CodeMeaning).join(', ')\n })\n }\n }\n\n // TID 8001 \"Specimen Preparation\"\n const preparationSteps: dmv.metadata.SpecimenPreparation[] = (\n specimenDescription.SpecimenPreparationSequence ?? []\n )\n preparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (\n name.equals(SpecimenPreparationStepItems.COLLECTION_METHOD)\n ) {\n attributes.push({\n name: 'Collection method',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.FIXATIVE)\n ) {\n attributes.push({\n name: 'Tissue fixative',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.EMBEDDING_MEDIUM)\n ) {\n attributes.push({\n name: 'Tissue embedding medium',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.PARENT_SPECIMEN_IDENTIFIER)\n ) {\n attributes.push({\n name: 'Parent specimen',\n value: item.TextValue\n })\n }\n }\n })\n }\n )\n const uid = specimenDescription.SpecimenUID\n const identifier = specimenDescription.SpecimenIdentifier\n return (\n \n )\n }\n}\n\nexport default SpecimenItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { List } from 'antd'\n\nimport SpecimenItem from './SpecimenItem'\n\ninterface SpecimenListProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a list of DICOM Specimen Information Entities.\n */\nclass SpecimenList extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n /*\n * Specimen Description Sequence is a type 1 attribute. However, it is\n * nevertheless missing in some data sets. This is a violation of the\n * standard, but it may be better to facilitate display of the data.\n */\n const descriptions = this.props.metadata.SpecimenDescriptionSequence ?? []\n const items = descriptions.map(\n (item: dmv.metadata.SpecimenDescription, index: number) => {\n return (\n \n )\n }\n )\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SpecimenList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch,\n Tooltip\n} from 'antd'\nimport {\n DeleteOutlined,\n EyeOutlined,\n EyeInvisibleOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport Description from './Description'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport { SpecimenPreparationStepItems } from '../data/specimens'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\ninterface OpticalPathItemProps {\n opticalPath: dmv.opticalPath.OpticalPath\n metadata: dmv.metadata.VLWholeSlideMicroscopyImage[]\n isVisible: boolean\n isRemovable: boolean\n defaultStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n onVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n }) => void\n onRemoval: (opticalPathIdentifier: string) => void\n}\n\ninterface OpticalPathItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n}\n\n/**\n * React component representing an optical path of a\n * multi-channel acquistion with control of visualization parameters.\n */\nclass OpticalPathItem extends React.Component {\n constructor (props: OpticalPathItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleLimitChange = this.handleLimitChange.bind(this)\n this.handleLowerLimitChange = this.handleLowerLimitChange.bind(this)\n this.handleUpperLimitChange = this.handleUpperLimitChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.handleRemoval = this.handleRemoval.bind(this)\n this.getCurrentColors = this.getCurrentColors.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color,\n paletteColorLookupTable: this.props.defaultStyle.paletteColorLookupTable,\n limitValues: this.props.defaultStyle.limitValues\n }\n }\n }\n\n componentDidUpdate (\n previousProps: OpticalPathItemProps,\n previousState: OpticalPathItemState\n ): void {\n if (this.props.defaultStyle !== previousProps.defaultStyle) {\n this.setState({\n currentStyle: this.props.defaultStyle\n })\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState({\n isVisible: checked\n })\n this.props.onVisibilityChange({\n opticalPathIdentifier: identifier,\n isVisible: checked\n })\n }\n\n handleOpacityChange (\n value: number | null\n ): void {\n if (value != null) {\n const identifier = this.props.opticalPath.identifier\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { opacity: value }\n })\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: value,\n limitValues: state.currentStyle.limitValues\n }\n }))\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColors (): string[] {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.props.defaultStyle.paletteColorLookupTable != null) {\n const colormap = this.props.defaultStyle.paletteColorLookupTable.data\n return colormap.map(values => rgb2hex(values))\n } else if (this.state.currentStyle.color != null) {\n return [\n '#000000',\n rgb2hex(this.state.currentStyle.color)\n ]\n } else {\n return ['white', 'white']\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { limitValues: values }\n })\n }\n\n handleRemoval (): void {\n const identifier = this.props.opticalPath.identifier\n this.props.onRemoval(identifier)\n }\n\n render (): React.ReactNode {\n const identifier = this.props.opticalPath.identifier\n const description = this.props.opticalPath.description\n const attributes: Array<{ name: string, value: string }> = []\n if (this.props.opticalPath.illuminationWaveLength !== undefined) {\n attributes.push(\n {\n name: 'Illumination wavelength',\n value: `${this.props.opticalPath.illuminationWaveLength} nm`\n }\n )\n }\n if (this.props.opticalPath.illuminationColor !== undefined) {\n attributes.push(\n {\n name: 'Illumination color',\n value: this.props.opticalPath.illuminationColor.CodeMeaning\n }\n )\n }\n\n // TID 8001 \"Specimen Preparation\"\n const specimenDescriptions: dmv.metadata.SpecimenDescription[] = (\n this.props.metadata[0].SpecimenDescriptionSequence ?? []\n )\n try {\n specimenDescriptions.forEach(description => {\n const specimenPreparationSteps: dmv.metadata.SpecimenPreparation[] =\n description.SpecimenPreparationSequence ?? []\n specimenPreparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n }\n }\n }\n })\n }\n )\n })\n } catch (error: any) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DCMJS,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n error.message\n )\n )\n }\n\n const maxValue = Math.pow(2, this.props.metadata[0].BitsAllocated) - 1\n\n const title = (\n description != null ? `${identifier}: ${description}` : identifier\n )\n let settings\n let item\n if (this.props.opticalPath.isMonochromatic) {\n // monochrome images that can be pseudo-colored\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n )\n } else {\n colorSettings = (\n <>\n \n Color\n \n Custom pseudo-coloring is disabled because pixels are colorized via\n a provided palette color lookup table.\n \n )\n }\n\n let windowSettings\n if (this.state.currentStyle.limitValues != null) {\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n settings = (\n
\n {windowSettings}\n {colorSettings}\n \n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n const colors = this.getCurrentColors()\n item = (\n \n \n \n )\n } else {\n // color images\n settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n item = (\n \n )\n }\n\n const buttons = []\n if (this.props.isRemovable) {\n buttons.push(\n \n }\n onClick={this.handleRemoval}\n />\n \n )\n }\n\n const {\n defaultStyle,\n isRemovable,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n onRemoval,\n opticalPath,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n {buttons}\n \n
\n {item}\n
\n \n )\n }\n}\n\nexport default OpticalPathItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Button as Btn, Menu, Select, Space, Tooltip } from 'antd'\nimport { AppstoreAddOutlined } from '@ant-design/icons'\n\nimport OpticalPathItem from './OpticalPathItem'\n\nconst { Option } = Select\n\ninterface OpticalPathListProps {\n opticalPaths: dmv.opticalPath.OpticalPath[]\n metadata: {\n [opticalPathIdentifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n }\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n defaultOpticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n }\n onOpticalPathVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onOpticalPathStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }) => void\n onOpticalPathActivityChange: ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }) => void\n selectedPresentationStateUID?: string\n}\n\ninterface OpticalPathListState {\n selectedOpticalPathIdentifier?: string\n}\n\n/**\n * React component representing a list of optical paths.\n */\nclass OpticalPathList extends React.Component {\n state = {\n selectedOpticalPathIdentifier: undefined\n }\n\n constructor (props: OpticalPathListProps) {\n super(props)\n this.handleItemAddition = this.handleItemAddition.bind(this)\n this.handleItemRemoval = this.handleItemRemoval.bind(this)\n this.handleItemSelectionChange = this.handleItemSelectionChange.bind(this)\n }\n\n /**\n * Handler that gets called when an optical path should be removed.\n */\n handleItemRemoval (opticalPathIdentifier: string): void {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier,\n isActive: false\n })\n }\n\n /**\n * Handler that gets called when the selection of an optical path should change.\n */\n handleItemSelectionChange (\n value: string\n ): void {\n this.setState({ selectedOpticalPathIdentifier: value })\n }\n\n /**\n * Handler that gets called when an optical path should be added.\n */\n handleItemAddition (): void {\n const identifier = this.state.selectedOpticalPathIdentifier\n if (identifier !== undefined) {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier: identifier,\n isActive: true\n })\n this.setState({ selectedOpticalPathIdentifier: undefined })\n }\n }\n\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n\n const isSelectable = this.props.opticalPaths.length > 1\n const opticalPathItems: React.ReactNode[] = []\n const optionItems: React.ReactNode[] = []\n this.props.opticalPaths.forEach(opticalPath => {\n const opticalPathIdentifier = opticalPath.identifier\n const images = this.props.metadata[opticalPathIdentifier]\n const seriesInstanceUID = images[0].SeriesInstanceUID\n images[0].OpticalPathSequence.forEach(opticalPathItem => {\n const id = opticalPathItem.OpticalPathIdentifier\n const description = opticalPathItem.OpticalPathDescription\n if (opticalPath.identifier === id) {\n if (this.props.activeOpticalPathIdentifiers.has(id)) {\n opticalPathItems.push(\n \n )\n } else {\n let title\n if (description !== '') {\n title = `${id} - ${description}`\n } else {\n title = `${id}`\n }\n optionItems.push(\n \n )\n }\n }\n })\n })\n\n let opticalPathSelector\n if (isSelectable) {\n opticalPathSelector = (\n \n \n {optionItems}\n \n \n }\n type='primary'\n onClick={this.handleItemAddition}\n />\n \n \n )\n }\n\n return (\n \n {opticalPathItems}\n {opticalPathSelector}\n \n )\n }\n}\n\nexport default OpticalPathList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface MappingItemProps {\n mapping: dmv.mapping.ParameterMapping\n metadata: dmv.metadata.ParametricMap[]\n isVisible: boolean\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\ninterface MappingItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Real World Value Mapping.\n */\nclass MappingItem extends React.Component {\n constructor (props: MappingItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n mappingUID: this.props.mapping.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n mappingUID: this.props.mapping.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: value\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Description',\n value: this.props.mapping.description\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n mapping,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n \n
\n \n
\n \n )\n }\n}\n\nexport default MappingItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport MappingItem from './MappingItem'\n\ninterface MappingListProps {\n mappings: dmv.mapping.ParameterMapping[]\n metadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n }\n visibleMappingUIDs: Set\n defaultMappingStyles: {\n [mappingUID: string]: { opacity: number }\n }\n onMappingVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onMappingStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Real World Value Mappings.\n */\nclass MappingList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.mappings.map((mapping, index) => {\n const uid = mapping.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default MappingList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface SegmentItemProps {\n segment: dmv.segment.Segment\n isVisible: boolean\n metadata: dmv.metadata.Segmentation[]\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\ninterface SegmentItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Segment.\n */\nclass SegmentItem extends React.Component {\n constructor (props: SegmentItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: { opacity: this.props.defaultStyle.opacity }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n segmentUID: this.props.segment.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n segmentUID: this.props.segment.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({ currentStyle: { opacity: value } })\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property Type',\n value: this.props.segment.propertyType.CodeMeaning\n },\n {\n name: 'Property Category',\n value: this.props.segment.propertyCategory.CodeMeaning\n },\n {\n name: 'Algorithm Name',\n value: this.props.segment.algorithmName\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n segment,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n
\n \n )\n }\n}\n\nexport default SegmentItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport SegmentItem from './SegmentItem'\n\ninterface SegmentListProps {\n segments: dmv.segment.Segment[]\n visibleSegmentUIDs: Set\n metadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n }\n defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n }\n onSegmentVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onSegmentStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Segments.\n */\nclass SegmentList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.segments.map((segment, index) => {\n const uid = segment.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SegmentList\n","import React from 'react'\nimport {\n NavigateFunction,\n Params,\n useLocation,\n useNavigate,\n useParams,\n Location\n} from 'react-router-dom'\n\nexport interface RouteComponentProps {\n location: Location\n navigate: NavigateFunction\n params: Params\n}\n\nexport function withRouter (Component: React.ComponentType): Function {\n function ComponentWithRouterProp (props: any): JSX.Element {\n const location = useLocation()\n const navigate = useNavigate()\n const params = useParams()\n return (\n \n )\n }\n return ComponentWithRouterProp\n}\n","import React from 'react'\nimport { Checkbox, Col, Divider, InputNumber, Row, Slider } from 'antd'\n\ninterface ColorSettingsMenuProps {\n annotationGroupsUIDs: string[]\n defaultStyle: {\n opacity: number\n color: number[]\n contourOnly: boolean\n }\n onStyleChange: Function\n}\n\ninterface ColorSettingsMenuState {\n currentStyle: {\n opacity: number\n color?: number[]\n contourOnly: boolean\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass ColorSettingsMenu extends React.Component<\nColorSettingsMenuProps,\nColorSettingsMenuState\n> {\n constructor (props: ColorSettingsMenuProps) {\n super(props)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color,\n contourOnly: this.props.defaultStyle.contourOnly\n }\n }\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: this.state.currentStyle.color,\n opacity: value,\n contourOnly: this.state.currentStyle.contourOnly\n }\n })\n })\n this.updateCurrentStyle({ opacity: value })\n }\n }\n\n handleColorRChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.updateCurrentStyle({ color })\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity,\n contourOnly: this.state.currentStyle.contourOnly\n }\n })\n })\n }\n }\n\n handleColorGChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.updateCurrentStyle({ color })\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity,\n contourOnly: this.state.currentStyle.contourOnly\n }\n })\n })\n }\n }\n\n handleColorBChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.updateCurrentStyle({ color })\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity,\n contourOnly: this.state.currentStyle.contourOnly\n }\n })\n })\n }\n }\n\n handleShowOutlineOnly (value: boolean): void {\n this.updateCurrentStyle({ contourOnly: value })\n\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: this.state.currentStyle.color,\n opacity: this.state.currentStyle.opacity,\n contourOnly: value\n }\n })\n })\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n updateCurrentStyle ({\n color,\n opacity,\n contourOnly\n }: {\n color?: number[]\n opacity?: number\n contourOnly?: boolean\n }): void {\n this.setState((state) => ({\n currentStyle: {\n opacity: opacity ?? state.currentStyle.opacity,\n color: color ?? state.currentStyle.color,\n contourOnly: contourOnly ?? state.currentStyle.contourOnly\n }\n }))\n }\n\n render (): React.ReactNode {\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n Color\n \n Red\n \n \n \n \n \n \n \n\n \n Green\n \n \n \n \n \n \n \n\n \n Blue\n \n \n \n \n \n \n \n \n \n )\n }\n\n return (\n
\n {colorSettings}\n \n Opacity\n \n \n \n \n \n \n \n \n \n this.handleShowOutlineOnly(event.target.checked)}\n >\n Show outline only\n \n \n
\n )\n }\n}\n\nexport default ColorSettingsMenu\n","import React from 'react'\nimport { Menu, Space, Checkbox, Tooltip, Popover, Button } from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { Category, Type } from './AnnotationCategoryList'\nimport ColorSettingsMenu from './ColorSettingsMenu'\n\nconst AnnotationCategoryItem = ({\n category,\n onChange,\n checkedAnnotationUids,\n onStyleChange,\n defaultAnnotationStyles\n}: {\n category: Category\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n contourOnly: boolean\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const { types } = category\n\n const onCheckCategoryChange = (e: any): void => {\n const isVisible = e.target.checked\n types.forEach((type: Type) => {\n handleChangeCheckedType({ type, isVisible })\n })\n }\n\n const checkAll = types.every((type: Type) =>\n type.uids.every((uid: string) => checkedAnnotationUids.has(uid))\n )\n const indeterminate =\n !checkAll &&\n types.some((type: Type) =>\n type.uids.some((uid: string) => checkedAnnotationUids.has(uid))\n )\n\n const handleChangeCheckedType = ({\n type,\n isVisible\n }: {\n type: Type\n isVisible: boolean\n }): void => {\n type.uids.forEach((uid: string) => {\n onChange({ roiUID: uid, isVisible })\n })\n }\n\n return (\n \n \n
\n \n \n \n {category.CodeMeaning}\n \n (\n {\n return [...acc, ...type.uids]\n },\n []\n )}\n onStyleChange={onStyleChange}\n defaultStyle={\n defaultAnnotationStyles[types[0].uids[0]]\n }\n />\n )}\n >\n }\n />\n \n \n \n {types.map((type: Type) => {\n const { CodeMeaning, CodingSchemeDesignator, CodeValue, uids } =\n type\n const shortenedCodeMeaning = CodeMeaning.slice(0, 22)\n const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`\n const isChecked = uids.every((uid: string) =>\n checkedAnnotationUids.has(uid)\n )\n const indeterminateType =\n !isChecked &&\n uids.some((uid: string) => checkedAnnotationUids.has(uid))\n return (\n \n \n handleChangeCheckedType({\n type,\n isVisible: e.target.checked\n })}\n />\n
\n \n {displayCodeMeaning}\n \n (\n \n )}\n >\n }\n />\n \n
\n
\n )\n })}\n
\n \n \n )\n}\n\nexport default AnnotationCategoryItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport AnnotationCategoryItem from './AnnotationCategoryItem'\n\nexport interface AnnotationCategoryAndType {\n uid: string\n type: Omit\n category: Omit\n}\nexport interface Type {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n uids: string[]\n}\nexport interface Category {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n types: Type[]\n}\n\nconst getCategories = (annotations: any): Record => {\n const categories = annotations?.reduce(\n (\n categoriesAcc: Record }>,\n annotation: AnnotationCategoryAndType\n ) => {\n const { category, type, uid } = annotation\n const categoryKey = category.CodeMeaning\n const typeKey = type.CodeMeaning\n\n const oldCategory = categoriesAcc[categoryKey] ?? {\n ...category,\n types: {}\n }\n const oldType = oldCategory.types[typeKey] ?? {\n ...type,\n uids: []\n }\n\n return {\n ...categoriesAcc,\n [categoryKey]: {\n ...oldCategory,\n types: {\n ...oldCategory.types,\n [typeKey]: { ...oldType, uids: [...oldType.uids, uid] }\n }\n }\n }\n },\n {}\n )\n\n // Normalizing types so that it's an array instead of an object:\n Object.keys(categories).forEach((categoryKey: string) => {\n const category = categories[categoryKey]\n const { types } = category\n const typesArr = Object.keys(types).map(\n (typeKey: string) => types[typeKey]\n )\n categories[categoryKey].types = typesArr\n })\n\n return categories\n}\n\nconst AnnotationCategoryList = ({\n annotations,\n onChange,\n onStyleChange,\n defaultAnnotationStyles,\n checkedAnnotationUids\n}: {\n annotations: AnnotationCategoryAndType[]\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n contourOnly: boolean\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const categories: Record = getCategories(annotations)\n\n if (Object.keys(categories).length === 0) {\n return <>\n }\n\n const items = Object.keys(categories).map((categoryKey: any) => {\n const category = categories[categoryKey]\n return (\n \n )\n })\n\n return {items}\n}\nexport default AnnotationCategoryList\n","const HoveredRoiTooltip = ({\n xPosition,\n yPosition,\n rois\n}: {\n xPosition: number\n yPosition: number\n rois: Array<{ index: number, roiUid: string, attributes: Array<{ name: string, value: string }>}>\n}): JSX.Element => {\n return (\n \n {rois.map((roi, i) => {\n const attributes = roi.attributes\n return (\n
\n ROI {roi.index}\n {attributes.map((attr) => {\n return (\n
\n {attr.name}: {attr.value}\n
\n )\n })}\n
\n\n )\n })}\n \n )\n}\n\nexport default HoveredRoiTooltip\n","import * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { AnnotationCategoryAndType } from '../components/AnnotationCategoryList'\n\nexport const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndType => {\n const { uid, evaluations } = roi\n\n const result = {\n category: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n },\n type: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n }\n }\n\n evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = codeContentItem.ConceptCodeSequence[0]\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n result.category = { ...value }\n } else if (nameValue === '121071') {\n result.type = { ...value }\n }\n }\n })\n\n return {\n ...result,\n uid\n }\n}\n","import React from 'react'\nimport {\n FaCrosshairs,\n FaDrawPolygon,\n FaEye,\n FaEyeSlash,\n FaHandPaper,\n FaHandPointer,\n FaTrash,\n FaSave\n} from 'react-icons/fa'\nimport {\n Button as Btn,\n Checkbox,\n Descriptions,\n Divider,\n InputNumber,\n message,\n Menu,\n Modal,\n Layout,\n Row,\n Select,\n Space,\n Tooltip\n} from 'antd'\nimport { UndoOutlined, CheckOutlined, StopOutlined } from '@ant-design/icons'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport * as dwc from 'dicomweb-client'\n\nimport DicomWebManager from '../DicomWebManager'\nimport AnnotationList from './AnnotationList'\nimport AnnotationGroupList from './AnnotationGroupList'\nimport Button from './Button'\nimport Equipment from './Equipment'\nimport Report, { MeasurementReport } from './Report'\nimport SpecimenList from './SpecimenList'\nimport OpticalPathList from './OpticalPathList'\nimport MappingList from './MappingList'\nimport SegmentList from './SegmentList'\nimport { AnnotationSettings } from '../AppConfig'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { findContentItemsByName } from '../utils/sr'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport AnnotationCategoryList from './AnnotationCategoryList'\nimport HoveredRoiTooltip from './HoveredRoiTooltip'\nimport { adaptRoiToAnnotation } from '../services/RoiToAnnotationAdapter'\n\nconst DEFAULT_ROI_STROKE_COLOR: number[] = [255, 234, 0] // [0, 126, 163]\nconst DEFAULT_ROI_FILL_COLOR: number[] = [255, 234, 0, 0.2] // [0, 126, 163, 0.2]\nconst DEFAULT_ROI_STROKE_WIDTH: number = 2\nconst DEFAULT_ROI_RADIUS: number = 5\n\nconst DEFAULT_ANNOTATION_OPACITY = 0.4\nconst DEFAULT_ANNOTATION_STROKE_COLOR = [0, 0, 0]\nconst DEFAULT_ANNOTATION_COLOR_PALETTE = [\n [255, 0, 0],\n [0, 255, 0],\n [0, 0, 255],\n [255, 255, 0],\n [0, 255, 255],\n [0, 0, 0]\n]\n\nconst _buildKey = (concept: {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n CodingSchemeVersion?: string\n}): string => {\n const codingScheme = concept.CodingSchemeDesignator\n const codeValue = concept.CodeValue\n return `${codingScheme}-${codeValue}`\n}\n\nconst _getRoiKey = (roi: dmv.roi.ROI): string | undefined => {\n const matches = findContentItemsByName({\n content: roi.evaluations,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n })\n })\n if (matches.length === 0) {\n console.warn(`no finding found for ROI ${roi.uid}`)\n return\n }\n const finding = matches[0] as dcmjs.sr.valueTypes.CodeContentItem\n const findingName = finding.ConceptCodeSequence[0]\n return _buildKey(findingName)\n}\n\nconst _areROIsEqual = (a: dmv.roi.ROI, b: dmv.roi.ROI): boolean => {\n if (a.scoord3d.graphicType !== b.scoord3d.graphicType) {\n return false\n }\n if (a.scoord3d.frameOfReferenceUID !== b.scoord3d.frameOfReferenceUID) {\n return false\n }\n if (a.scoord3d.graphicData.length !== b.scoord3d.graphicData.length) {\n return false\n }\n\n const decimals = 6\n for (let i = 0; i < a.scoord3d.graphicData.length; ++i) {\n if (a.scoord3d.graphicType === 'POINT') {\n const s1 = a.scoord3d as dmv.scoord3d.Point\n const s2 = b.scoord3d as dmv.scoord3d.Point\n const c1 = s1.graphicData[i].toPrecision(decimals)\n const c2 = s2.graphicData[i].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n } else {\n const s1 = a.scoord3d as dmv.scoord3d.Polygon\n const s2 = b.scoord3d as dmv.scoord3d.Polygon\n for (let j = 0; j < s1.graphicData[i].length; ++j) {\n const c1 = s1.graphicData[i][j].toPrecision(decimals)\n const c2 = s2.graphicData[i][j].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n }\n }\n }\n return true\n}\n\nconst _formatRoiStyle = (style: {\n stroke?: {\n color?: number[]\n width?: number\n }\n fill?: {\n color?: number[]\n }\n radius?: number\n}): dmv.viewer.ROIStyleOptions => {\n const stroke = {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n }\n if (style.stroke != null) {\n if (style.stroke.color != null) {\n stroke.color = style.stroke.color\n }\n if (style.stroke.width != null) {\n stroke.width = style.stroke.width\n }\n }\n const fill = {\n color: DEFAULT_ROI_FILL_COLOR\n }\n if (style.fill != null) {\n if (style.fill.color != null) {\n fill.color = style.fill.color\n }\n }\n return {\n stroke,\n fill,\n image: {\n circle: {\n radius: style.radius != null\n ? style.radius\n : Math.max(5 - stroke.width, 1),\n stroke,\n fill\n }\n }\n }\n}\n\nconst _constructViewers = ({ clients, slide, preload }: {\n clients: { [key: string]: dwc.api.DICOMwebClient }\n slide: Slide\n preload?: boolean\n}): {\n volumeViewer: dmv.viewer.VolumeImageViewer\n labelViewer?: dmv.viewer.LabelImageViewer\n} => {\n console.info(\n 'instantiate viewer for VOLUME images of slide ' +\n `\"${slide.volumeImages[0].ContainerIdentifier}\"`\n )\n try {\n const volumeViewer = new dmv.viewer.VolumeImageViewer({\n clientMapping: clients,\n metadata: slide.volumeImages,\n controls: ['overview', 'position'],\n preload: preload,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV, error\n )\n }\n })\n volumeViewer.activateSelectInteraction({})\n\n let labelViewer\n if (slide.labelImages.length > 0) {\n console.info(\n 'instantiate viewer for LABEL image of slide ' +\n `\"${slide.labelImages[0].ContainerIdentifier}\"`\n )\n labelViewer = new dmv.viewer.LabelImageViewer({\n client: clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],\n metadata: slide.labelImages[0],\n resizeFactor: 1,\n orientation: 'vertical',\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n }\n\n return { volumeViewer, labelViewer }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to instantiate viewer'\n )\n )\n throw error\n }\n}\n\n/*\n * Check whether the report is structured according to template\n * TID 1500 \"MeasurementReport\".\n */\nconst _implementsTID1500 = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const templateSeq = report.ContentTemplateSequence\n if (templateSeq.length > 0) {\n const tid = templateSeq[0].TemplateIdentifier\n if (tid === '1500') {\n return true\n }\n }\n return false\n}\n\n/*\n * Check whether the subject described in the report is a specimen as compared\n * to a patient, fetus, or device.\n */\nconst _describesSpecimenSubject = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121024',\n schemeDesignator: 'DCM',\n meaning: 'Subject Class'\n })\n })\n if (items.length === 0) {\n return false\n }\n const subjectClassItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n const subjectClassValue = subjectClassItem.ConceptCodeSequence[0]\n const retrievedConcept = new dcmjs.sr.coding.CodedConcept({\n value: subjectClassValue.CodeValue,\n meaning: subjectClassValue.CodeMeaning,\n schemeDesignator: subjectClassValue.CodingSchemeDesignator\n })\n const expectedConcept = new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n meaning: 'Specimen',\n schemeDesignator: 'DCM'\n })\n if (retrievedConcept.equals(expectedConcept)) {\n return true\n }\n return false\n}\n\n/*\n * Check whether the report contains appropriate graphic ROI annotations.\n */\nconst _containsROIAnnotations = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const measurements = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (measurements.length === 0) {\n return false\n }\n const container = measurements[0] as dcmjs.sr.valueTypes.ContainerContentItem\n const measurementGroups = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n let foundRegion = false\n measurementGroups.forEach((group) => {\n const container = group as dcmjs.sr.valueTypes.ContainerContentItem\n const regions = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (regions.length > 0) {\n if (regions[0].ValueType === dcmjs.sr.valueTypes.ValueTypes.SCOORD3D) {\n foundRegion = true\n }\n }\n })\n\n return foundRegion\n}\n\ninterface EvaluationOptions {\n name: dcmjs.sr.coding.CodedConcept\n values: dcmjs.sr.coding.CodedConcept[]\n}\n\ninterface Evaluation {\n name: dcmjs.sr.coding.CodedConcept\n value: dcmjs.sr.coding.CodedConcept\n}\n\ninterface Measurement {\n name: dcmjs.sr.coding.CodedConcept\n value?: number\n unit: dcmjs.sr.coding.CodedConcept\n}\n\ninterface SlideViewerProps extends RouteComponentProps {\n slide: Slide\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n seriesInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload?: boolean\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n user?: {\n name: string\n email: string\n }\n selectedPresentationStateUID?: string\n}\n\ninterface SlideViewerState {\n visibleRoiUIDs: Set\n visibleSegmentUIDs: Set\n visibleMappingUIDs: Set\n visibleAnnotationGroupUIDs: Set\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n presentationStates: dmv.metadata.AdvancedBlendingPresentationState[]\n selectedPresentationStateUID?: string\n selectedFinding?: dcmjs.sr.coding.CodedConcept\n selectedEvaluations: Evaluation[]\n selectedGeometryType?: string\n selectedMarkup?: string\n selectedRoi?: dmv.roi.ROI\n selectedRoiUIDs: Set\n generatedReport?: dmv.metadata.Comprehensive3DSR\n isLoading: boolean\n isAnnotationModalVisible: boolean\n isSelectedRoiModalVisible: boolean\n isHoveredRoiTooltipVisible: boolean\n hoveredRoiAttributes: Array<{index: number, roiUid: string, attributes: Array<{ name: string, value: string }>}>\n hoveredRoiTooltipX: number\n hoveredRoiTooltipY: number\n isReportModalVisible: boolean\n isRoiDrawingActive: boolean\n isRoiModificationActive: boolean\n isRoiTranslationActive: boolean\n isGoToModalVisible: boolean\n isSelectedMagnificationValid: boolean\n isSelectedXCoordinateValid: boolean\n isSelectedYCoordinateValid: boolean\n selectedXCoordinate?: number\n validXCoordinateRange: number[]\n selectedYCoordinate?: number\n validYCoordinateRange: number[]\n selectedMagnification?: number\n areRoisHidden: boolean\n pixelDataStatistics: {\n [opticalPathIdentifier: string]: {\n min: number\n max: number\n numFramesSampled: number\n }\n }\n loadingFrames: Set\n}\n\n/**\n * React component for interactive viewing of an individual digital slide,\n * which corresponds to one DICOM Series of DICOM Slide Microscopy images and\n * potentially one or more associated DICOM Series of DICOM SR documents.\n */\nclass SlideViewer extends React.Component {\n private readonly findingOptions: dcmjs.sr.coding.CodedConcept[] = []\n\n private readonly evaluationOptions: { [key: string]: EvaluationOptions[] } = {}\n\n private readonly measurements: Measurement[] = []\n\n private readonly geometryTypeOptions: { [key: string]: string[] } = {}\n\n private readonly volumeViewportRef: React.RefObject\n\n private readonly labelViewportRef: React.RefObject\n\n private volumeViewer: dmv.viewer.VolumeImageViewer\n\n private labelViewer?: dmv.viewer.LabelImageViewer\n\n private hoveredRois = [] as dmv.roi.ROI[]\n\n private lastPixel = [0, 0] as [number, number]\n\n private readonly defaultRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n },\n fill: {\n color: DEFAULT_ROI_FILL_COLOR\n },\n image: {\n circle: {\n fill: {\n color: DEFAULT_ROI_STROKE_COLOR\n },\n radius: DEFAULT_ROI_RADIUS\n }\n }\n }\n\n private roiStyles: {[key: string]: dmv.viewer.ROIStyleOptions} = {}\n\n private defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n contourOnly: boolean\n }\n } = {}\n\n private readonly selectionColor: number[] = [140, 184, 198]\n\n private readonly selectedRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: { color: [...this.selectionColor, 1], width: 3 },\n fill: { color: [...this.selectionColor, 0.2] },\n image: {\n circle: {\n radius: 5,\n fill: { color: [...this.selectionColor, 1] }\n }\n }\n }\n\n constructor (props: SlideViewerProps) {\n super(props)\n console.info(\n `view slide \"${this.props.slide.containerIdentifier}\": `,\n this.props.slide\n )\n const geometryTypeOptions = [\n 'point',\n 'circle',\n 'box',\n 'polygon',\n 'line',\n 'freehandpolygon',\n 'freehandline'\n ]\n props.annotations.forEach((annotation: AnnotationSettings) => {\n const finding = new dcmjs.sr.coding.CodedConcept(annotation.finding)\n this.findingOptions.push(finding)\n const key = _buildKey(finding)\n if (annotation.geometryTypes !== undefined) {\n this.geometryTypeOptions[key] = annotation.geometryTypes\n } else {\n this.geometryTypeOptions[key] = geometryTypeOptions\n }\n this.evaluationOptions[key] = []\n if (annotation.evaluations !== undefined) {\n annotation.evaluations.forEach(evaluation => {\n this.evaluationOptions[key].push({\n name: new dcmjs.sr.coding.CodedConcept(evaluation.name),\n values: evaluation.values.map(value => {\n return new dcmjs.sr.coding.CodedConcept(value)\n })\n })\n })\n }\n if (annotation.measurements !== undefined) {\n annotation.measurements.forEach(measurement => {\n this.measurements.push({\n name: new dcmjs.sr.coding.CodedConcept(measurement.name),\n value: undefined,\n unit: new dcmjs.sr.coding.CodedConcept(measurement.unit)\n })\n })\n }\n if (annotation.style != null) {\n this.roiStyles[key] = _formatRoiStyle(annotation.style)\n } else {\n this.roiStyles[key] = this.defaultRoiStyle\n }\n })\n\n this.componentSetup = this.componentSetup.bind(this)\n this.componentCleanup = this.componentCleanup.bind(this)\n\n this.onWindowResize = this.onWindowResize.bind(this)\n this.handleRoiDrawing = this.handleRoiDrawing.bind(this)\n this.handleRoiTranslation = this.handleRoiTranslation.bind(this)\n this.handleRoiModification = this.handleRoiModification.bind(this)\n this.handleRoiVisibilityChange = this.handleRoiVisibilityChange.bind(this)\n this.handleRoiRemoval = this.handleRoiRemoval.bind(this)\n this.handleRoiSelectionCancellation = this.handleRoiSelectionCancellation.bind(this)\n this.handleAnnotationConfigurationCancellation = this.handleAnnotationConfigurationCancellation.bind(this)\n this.handleAnnotationGeometryTypeSelection = this.handleAnnotationGeometryTypeSelection.bind(this)\n this.handleAnnotationMeasurementActivation = this.handleAnnotationMeasurementActivation.bind(this)\n this.handleAnnotationFindingSelection = this.handleAnnotationFindingSelection.bind(this)\n this.handleAnnotationEvaluationSelection = this.handleAnnotationEvaluationSelection.bind(this)\n this.handleAnnotationEvaluationClearance = this.handleAnnotationEvaluationClearance.bind(this)\n this.handleAnnotationConfigurationCompletion = this.handleAnnotationConfigurationCompletion.bind(this)\n this.handleAnnotationSelection = this.handleAnnotationSelection.bind(this)\n this.handleAnnotationVisibilityChange = this.handleAnnotationVisibilityChange.bind(this)\n this.handleAnnotationGroupVisibilityChange = this.handleAnnotationGroupVisibilityChange.bind(this)\n this.handleAnnotationGroupStyleChange = this.handleAnnotationGroupStyleChange.bind(this)\n this.handleRoiStyleChange = this.handleRoiStyleChange.bind(this)\n this.handleGoTo = this.handleGoTo.bind(this)\n this.handleXCoordinateSelection = this.handleXCoordinateSelection.bind(this)\n this.handleYCoordinateSelection = this.handleYCoordinateSelection.bind(this)\n this.handleMagnificationSelection = this.handleMagnificationSelection.bind(this)\n this.handleSlidePositionSelection = this.handleSlidePositionSelection.bind(this)\n this.handleSlidePositionSelectionCancellation = this.handleSlidePositionSelectionCancellation.bind(this)\n this.handleReportGeneration = this.handleReportGeneration.bind(this)\n this.handleReportVerification = this.handleReportVerification.bind(this)\n this.handleReportCancellation = this.handleReportCancellation.bind(this)\n this.handleSegmentVisibilityChange = this.handleSegmentVisibilityChange.bind(this)\n this.handleSegmentStyleChange = this.handleSegmentStyleChange.bind(this)\n this.handleMappingVisibilityChange = this.handleMappingVisibilityChange.bind(this)\n this.handleMappingStyleChange = this.handleMappingStyleChange.bind(this)\n this.handleOpticalPathVisibilityChange = this.handleOpticalPathVisibilityChange.bind(this)\n this.handleOpticalPathStyleChange = this.handleOpticalPathStyleChange.bind(this)\n this.handleOpticalPathActivityChange = this.handleOpticalPathActivityChange.bind(this)\n this.handlePresentationStateSelection = this.handlePresentationStateSelection.bind(this)\n this.handlePresentationStateReset = this.handlePresentationStateReset.bind(this)\n\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n this.volumeViewportRef = React.createRef()\n this.labelViewportRef = React.createRef()\n\n /**\n * Deactivate all optical paths. Visibility will be set later, potentially\n * using based on available presentation state instances.\n */\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n this.volumeViewer.deactivateOpticalPath(opticalPath.identifier)\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.state = {\n selectedRoiUIDs: new Set(),\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers: new Set(),\n activeOpticalPathIdentifiers: new Set(),\n presentationStates: [],\n selectedFinding: undefined,\n selectedEvaluations: [],\n generatedReport: undefined,\n isLoading: false,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isHoveredRoiTooltipVisible: false,\n hoveredRoiTooltipX: 0,\n hoveredRoiTooltipY: 0,\n hoveredRoiAttributes: [],\n isSelectedMagnificationValid: false,\n isReportModalVisible: false,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n selectedXCoordinate: undefined,\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n selectedYCoordinate: undefined,\n validYCoordinateRange: [offset[1], offset[1] + size[1]],\n selectedMagnification: undefined,\n areRoisHidden: false,\n pixelDataStatistics: {},\n selectedPresentationStateUID: this.props.selectedPresentationStateUID,\n loadingFrames: new Set()\n }\n }\n\n componentDidUpdate (\n previousProps: SlideViewerProps,\n previousState: SlideViewerState\n ): void {\n /** Fetch data and update the viewports if the route has changed (\n * i.e., if another series has been selected) or if the client has changed.\n */\n if (\n this.props.location.pathname !== previousProps.location.pathname ||\n this.props.studyInstanceUID !== previousProps.studyInstanceUID ||\n this.props.seriesInstanceUID !== previousProps.seriesInstanceUID ||\n this.props.slide !== previousProps.slide ||\n this.props.clients !== previousProps.clients\n ) {\n if (this.volumeViewportRef.current != null) {\n this.volumeViewportRef.current.innerHTML = ''\n }\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n if (this.labelViewportRef.current != null) {\n this.labelViewportRef.current.innerHTML = ''\n }\n this.labelViewer.cleanup()\n }\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n\n const activeOpticalPathIdentifiers: Set = new Set()\n const visibleOpticalPathIdentifiers: Set = new Set()\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n const identifier = opticalPath.identifier\n if (this.volumeViewer.isOpticalPathVisible(identifier)) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n if (this.volumeViewer.isOpticalPathActive(identifier)) {\n activeOpticalPathIdentifiers.add(identifier)\n }\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.setState({\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers,\n activeOpticalPathIdentifiers,\n presentationStates: [],\n loadingFrames: new Set(),\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n validYCoordinateRange: [offset[1], offset[1] + size[1]]\n })\n this.populateViewports()\n }\n }\n\n /**\n * Retrieve Presentation State instances that reference the any images of\n * the currently selected series.\n */\n loadPresentationStates = (): void => {\n console.info('search for Presentation State instances')\n const client = this.props.clients[\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE\n ]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'PR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach((rawInstance, index) => {\n const { dataset } = dmv.metadata.formatMetadata(rawInstance)\n const instance = dataset as dmv.metadata.Instance\n console.info(`retrieve PR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n if (this.props.slide.areVolumeImagesMonochrome) {\n const presentationState = (\n dataset as\n unknown as\n dmv.metadata.AdvancedBlendingPresentationState\n )\n let doesMatch = false\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n doesMatch = this.props.slide.seriesInstanceUIDs.includes(\n blendingItem.SeriesInstanceUID\n )\n }\n )\n if (doesMatch) {\n console.info(\n 'include Advanced Blending Presentation State instance ' +\n `\"${presentationState.SOPInstanceUID}\"`\n )\n if (\n index === 0 &&\n this.props.selectedPresentationStateUID == null\n ) {\n this.setPresentationState(presentationState)\n } else {\n if (\n presentationState.SOPInstanceUID ===\n this.props.selectedPresentationStateUID\n ) {\n this.setPresentationState(presentationState)\n }\n }\n this.setState(state => {\n const mapping: {\n [sopInstanceUID: string]:\n dmv.metadata.AdvancedBlendingPresentationState\n } = {}\n state.presentationStates.forEach(instance => {\n mapping[instance.SOPInstanceUID] = instance\n })\n mapping[presentationState.SOPInstanceUID] = presentationState\n return { presentationStates: Object.values(mapping) }\n })\n }\n } else {\n console.info(\n `ignore presentation state \"${instance.SOPInstanceUID}\", ` +\n 'application of presentation states for color images ' +\n 'has not (yet) been implemented'\n )\n }\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n console.error(\n 'failed to load presentation state ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n })\n }\n\n /**\n * Set presentation state as specified by a DICOM Presentation State instance.\n */\n setPresentationState = (\n presentationState: dmv.metadata.AdvancedBlendingPresentationState\n ): void => {\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n console.info(\n `apply Presentation State instance \"${presentationState.SOPInstanceUID}\"`\n )\n const opticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n } | null\n } = {}\n opticalPaths.forEach(opticalPath => {\n // First, deactivate and hide all optical paths and reset style\n const identifier = opticalPath.identifier\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n /**\n * Referenced Instance Sequence should be used instead of Referenced\n * Image Sequence, but that's easy to mix up and we have encountered\n * implementations that get it wrong.\n */\n let refInstanceItems = blendingItem.ReferencedInstanceSequence\n if (refInstanceItems === undefined) {\n refInstanceItems = blendingItem.ReferencedImageSequence\n }\n if (refInstanceItems === undefined) {\n return\n }\n refInstanceItems.forEach(imageItem => {\n const isReferenced = opticalPath.sopInstanceUIDs.includes(\n imageItem.ReferencedSOPInstanceUID\n ) as boolean\n if (isReferenced) {\n let paletteColorLUT\n if (blendingItem.PaletteColorLookupTableSequence != null) {\n const cpLUTItem = blendingItem.PaletteColorLookupTableSequence[0]\n paletteColorLUT = new dmv.color.PaletteColorLookupTable({\n uid: (\n cpLUTItem.PaletteColorLookupTableUID != null\n ? cpLUTItem.PaletteColorLookupTableUID\n : ''\n ),\n redDescriptor:\n cpLUTItem.RedPaletteColorLookupTableDescriptor,\n greenDescriptor:\n cpLUTItem.GreenPaletteColorLookupTableDescriptor,\n blueDescriptor:\n cpLUTItem.BluePaletteColorLookupTableDescriptor,\n redData: (\n (cpLUTItem.RedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.RedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenData: (\n (cpLUTItem.GreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.GreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueData: (\n (cpLUTItem.BluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.BluePaletteColorLookupTableData\n )\n : undefined\n ),\n redSegmentedData: (\n (cpLUTItem.SegmentedRedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedRedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenSegmentedData: (\n (cpLUTItem.SegmentedGreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedGreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueSegmentedData: (\n (cpLUTItem.SegmentedBluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedBluePaletteColorLookupTableData\n )\n : undefined\n )\n })\n }\n\n let limitValues\n if (blendingItem.SoftcopyVOILUTSequence != null) {\n const voiLUTItem = blendingItem.SoftcopyVOILUTSequence[0]\n const windowCenter = voiLUTItem.WindowCenter\n const windowWidth = voiLUTItem.WindowWidth\n limitValues = [\n windowCenter - windowWidth * 0.5,\n windowCenter + windowWidth * 0.5\n ]\n }\n\n opticalPathStyles[identifier] = {\n opacity: 1,\n paletteColorLookupTable: paletteColorLUT,\n limitValues: limitValues\n }\n }\n })\n })\n })\n\n const selectedOpticalPathIdentifiers: Set = new Set()\n Object.keys(opticalPathStyles).forEach(identifier => {\n const styleOptions = opticalPathStyles[identifier]\n if (styleOptions != null) {\n this.volumeViewer.setOpticalPathStyle(identifier, styleOptions)\n this.volumeViewer.activateOpticalPath(identifier)\n this.volumeViewer.showOpticalPath(identifier)\n selectedOpticalPathIdentifiers.add(identifier)\n } else {\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n }\n })\n const searchParams = new URLSearchParams(this.props.location.search)\n searchParams.set('state', presentationState.SOPInstanceUID)\n this.props.navigate(\n {\n pathname: this.props.location.pathname,\n search: searchParams.toString()\n },\n { replace: true }\n )\n this.setState(state => ({\n activeOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n visibleOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n selectedPresentationStateUID: presentationState.SOPInstanceUID\n }))\n }\n\n getRoiStyle = (key?: string): dmv.viewer.ROIStyleOptions => {\n if (key == null) {\n return this.defaultRoiStyle\n }\n if (this.roiStyles[key] !== undefined) {\n return this.roiStyles[key]\n }\n return this.defaultRoiStyle\n }\n\n /**\n * Retrieve Structured Report instances that contain regions of interests\n * with 3D spatial coordinates defined in the same frame of reference as the\n * currently selected series and add them to the VOLUME image viewer.\n */\n addAnnotations = (): void => {\n console.info('search for Comprehensive 3D SR instances')\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach(i => {\n const { dataset } = dmv.metadata.formatMetadata(i)\n const instance = dataset as dmv.metadata.Instance\n if (instance.SOPClassUID === StorageClasses.COMPREHENSIVE_3D_SR) {\n console.info(`retrieve SR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n const report = dataset as unknown as dmv.metadata.Comprehensive3DSR\n /*\n * Perform a couple of checks to ensure the document content of the\n * report fullfils the requirements of the application.\n */\n if (!_implementsTID1500(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it is not structured according to template ' +\n 'TID 1500 \"MeasurementReport\"'\n )\n return\n }\n if (!_describesSpecimenSubject(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not describe a specimen subject'\n )\n return\n }\n if (!_containsROIAnnotations(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not contain any suitable ROI annotations'\n )\n return\n }\n\n const content = new MeasurementReport(report)\n content.ROIs.forEach(roi => {\n console.info(`add ROI \"${roi.uid}\"`)\n const scoord3d = roi.scoord3d\n const image = this.props.slide.volumeImages[0]\n if (scoord3d.frameOfReferenceUID === image.FrameOfReferenceUID) {\n /*\n * ROIs may get assigned new UIDs upon re-rendering of the\n * page and we need to ensure that we don't add them twice.\n * The same ROI may be stored in multiple SR documents and\n * we don't want them to show up twice.\n * TODO: We should probably either \"merge\" measurements and\n * quantitative evaluations or pick the ROI from the \"best\"\n * available report (COMPLETE and VERIFIED).\n */\n const doesROIExist = this.volumeViewer.getAllROIs().some(\n (otherROI: dmv.roi.ROI): boolean => {\n return _areROIsEqual(otherROI, roi)\n }\n )\n if (!doesROIExist) {\n try {\n // Add ROI without style such that it won't be visible.\n this.volumeViewer.addROI(roi, {})\n } catch {\n console.error(`could not add ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(`skip already existing ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(\n `skip ROI \"${roi.uid}\" ` +\n `of SR document \"${report.SOPInstanceUID}\"` +\n 'because it is defined in another frame of reference'\n )\n }\n })\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n console.error(\n 'failed to load ROIs ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n /*\n * React is not aware of the fact that ROIs have been added via the\n * viewer (the viewport is a ref object) and won't show the\n * annotations in the user interface unless an update is forced.\n */\n this.forceUpdate()\n }\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n })\n }\n\n /**\n * Retrieve Microscopy Bulk Simple Annotations instances that contain\n * annotation groups defined in the same frame of reference as the currently\n * selected series and add them to the VOLUME image viewer.\n */\n addAnnotationGroups = (): void => {\n console.info('search for Microscopy Bulk Simple Annotations instances')\n const client = this.props.clients[\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION\n ]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'ANN'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const annotations: dmv.metadata.MicroscopyBulkSimpleAnnotations[] = retrievedMetadata.map(metadata => {\n return new dmv.metadata.MicroscopyBulkSimpleAnnotations({\n metadata\n })\n })\n // annotations = annotations.filter(ann => {\n // const refImage = this.props.slide.volumeImages[0]\n // return (\n // ann.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n // ann.ContainerIdentifier === refImage.ContainerIdentifier\n // )\n // })\n annotations.forEach(ann => {\n try {\n this.volumeViewer.addAnnotationGroups(ann)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Microscopy Bulk Simple Annotations cannot be displayed.'\n )\n )\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n console.error('failed to add annotation groups:', error)\n }\n ann.AnnotationGroupSequence.forEach(item => {\n const annotationGroupUID = item.AnnotationGroupUID\n const finding = item.AnnotationPropertyTypeCodeSequence[0]\n const key = _buildKey(finding)\n const style = this.roiStyles[key]\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (style != null && style.fill != null) {\n this.volumeViewer.setAnnotationGroupStyle(\n annotationGroupUID,\n { color: style.fill.color }\n )\n }\n })\n })\n /*\n * React is not aware of the fact that annotation groups have been\n * added via the viewer (the underlying HTML viewport element is a\n * ref object) and won't show the annotation groups in the user\n * interface unless an update is forced.\n */\n this.forceUpdate()\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Microscopy Bulk Simple Annotations ' +\n 'instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Microscopy Bulk Simple Annotations instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Segmentation instances that contain segments defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addSegmentations = (): void => {\n console.info('search for Segmentation instances')\n const client = this.props.clients[StorageClasses.SEGMENTATION]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SEG'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach((s, i) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const segmentations: dmv.metadata.Segmentation[] = []\n retrievedMetadata.forEach(metadata => {\n const seg = new dmv.metadata.Segmentation({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n seg.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n seg.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n segmentations.push(seg)\n }\n })\n if (segmentations.length > 0) {\n try {\n this.volumeViewer.addSegments(segmentations)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Segmentations cannot be displayed'\n )\n )\n console.error('failed to add segments: ', error)\n }\n /*\n * React is not aware of the fact that segments have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the segments in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Segmentation instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Segmentation instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Parametric Map instances that contain mappings defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addParametricMaps = (): void => {\n console.info('search for Parametric Map instances')\n const client = this.props.clients[StorageClasses.PARAMETRIC_MAP]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'OT'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const parametricMaps: dmv.metadata.ParametricMap[] = []\n retrievedMetadata.forEach(metadata => {\n const pm = new dmv.metadata.ParametricMap({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n pm.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n pm.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n parametricMaps.push(pm)\n } else {\n console.warn(\n `skip Parametric Map instance \"${pm.SOPInstanceUID}\"`\n )\n }\n })\n if (parametricMaps.length > 0) {\n try {\n this.volumeViewer.addParameterMappings(parametricMaps)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Parametric Map cannot be displayed'\n )\n )\n console.error('failed to add mappings: ', error)\n }\n /*\n * React is not aware of the fact that mappings have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the mappings in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Parametric Map instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Parametric Map instances failed.'\n )\n )\n })\n }\n\n /**\n * Populate viewports of the VOLUME and LABEL image viewers.\n */\n populateViewports = (): void => {\n console.info('populate viewports...')\n this.setState({\n isLoading: true,\n presentationStates: []\n })\n\n if (this.volumeViewportRef.current != null) {\n this.volumeViewer.render({ container: this.volumeViewportRef.current })\n }\n if (\n this.labelViewportRef.current != null &&\n this.labelViewer != null\n ) {\n this.labelViewer.render({ container: this.labelViewportRef.current })\n }\n\n // State update will also ensure that the component is re-rendered.\n this.setState({ isLoading: false })\n\n this.setDefaultPresentationState()\n this.loadPresentationStates()\n\n this.addAnnotations()\n this.addAnnotationGroups()\n this.addSegmentations()\n this.addParametricMaps()\n }\n\n onRoiModified = (event: CustomEventInit): void => {\n // Update state to trigger rendering\n this.setState(state => ({\n visibleRoiUIDs: new Set(state.visibleRoiUIDs)\n }))\n }\n\n onWindowResize = (event: Event): void => {\n console.info('resize viewports')\n this.volumeViewer.resize()\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }\n\n onRoiDrawn = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n const selectedFinding = this.state.selectedFinding\n const selectedEvaluations = this.state.selectedEvaluations\n if (roi !== undefined && selectedFinding !== undefined) {\n console.debug(`add ROI \"${roi.uid}\"`)\n const findingItem = new dcmjs.sr.valueTypes.CodeContentItem({\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n }),\n value: selectedFinding,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(findingItem)\n selectedEvaluations.forEach((evaluation: Evaluation) => {\n const item = new dcmjs.sr.valueTypes.CodeContentItem({\n name: evaluation.name,\n value: evaluation.value,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(item)\n })\n const key = _buildKey(selectedFinding)\n const style = this.getRoiStyle(key)\n this.volumeViewer.addROI(roi, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.debug(`could not add ROI \"${roi.uid}\"`)\n }\n }\n\n onRoiDoubleClicked = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n this.setState({\n isSelectedRoiModalVisible: true\n })\n } else {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n }\n\n setHoveredRoiAttributes = (hoveredRois: dmv.roi.ROI[]): void => {\n const rois = this.volumeViewer.getAllROIs()\n const result = hoveredRois.map((roi) => {\n const attributes: Array<{ name: string, value: string }> = []\n const evaluations = roi.evaluations\n evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n\n const index = (rois.findIndex((r) => r.uid === roi.uid) ?? 0) + 1\n return { index, roiUid: roi.uid, attributes }\n }, [] as Array)\n\n this.setState({ hoveredRoiAttributes: result })\n }\n\n clearHoveredRois = (): void => {\n this.hoveredRois = [] as any\n }\n\n getUniqueHoveredRois = (newRoi: dmv.roi.ROI | null): dmv.roi.ROI[] => {\n if (newRoi == null) {\n return []\n }\n const allRois = [...this.hoveredRois, newRoi]\n const uniqueIds = Array.from(new Set(allRois.map(roi => roi.uid)))\n // @ts-expect-error\n return uniqueIds.map(id => allRois.find(roi => roi.uid === id)).filter(roi => roi !== undefined)\n }\n\n isSamePixelAsLast = (event: any): boolean => {\n return event.clientX === this.lastPixel[0] && event.clientY === this.lastPixel[1]\n }\n\n onPointerMove = (event: CustomEventInit): void => {\n const { feature: hoveredRoi, event: evt } = event.detail.payload\n const originalEvent = evt.originalEvent\n\n if (!this.isSamePixelAsLast(originalEvent)) {\n this.lastPixel = [originalEvent.clientX, originalEvent.clientY]\n this.clearHoveredRois()\n }\n\n this.hoveredRois = this.getUniqueHoveredRois(hoveredRoi)\n\n if (this.hoveredRois.length > 0) {\n this.setHoveredRoiAttributes(this.hoveredRois)\n this.setState({\n isHoveredRoiTooltipVisible: true,\n hoveredRoiTooltipX: originalEvent.clientX,\n hoveredRoiTooltipY: originalEvent.clientY\n })\n } else {\n this.setState({\n isHoveredRoiTooltipVisible: false\n })\n }\n }\n\n onRoiSelected = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI | null\n if (selectedRoi == null) {\n this.setState({\n selectedRoiUIDs: new Set(),\n selectedRoi: undefined\n })\n return\n }\n\n console.debug(`selected ROI \"${selectedRoi.uid}\"`)\n const oldSelectedRois = Array.from(this.state.selectedRoiUIDs)\n this.setState({\n selectedRoiUIDs: new Set([...oldSelectedRois, selectedRoi.uid]),\n selectedRoi: selectedRoi\n })\n }\n\n handleRoiSelectionCancellation (): void {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n\n onLoadingStarted = (event: CustomEventInit): void => {\n this.setState({ isLoading: true })\n }\n\n onLoadingEnded = (event: CustomEventInit): void => {\n this.setState({ isLoading: false })\n }\n\n onFrameLoadingStarted = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n } = event.detail.payload\n const key: string = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.add(key)\n return state\n })\n }\n\n onFrameLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load frame')\n }\n\n onLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load data')\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const message = (event.detail?.payload?.message === null ? 'Failed to load data' : event.detail?.payload?.message) as string\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n message\n ) as any\n )\n }\n\n onFrameLoadingEnded = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n pixelArray: Uint8Array|Uint16Array|Float32Array|null\n } = event.detail.payload\n const key = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.delete(key)\n let isLoading: boolean = false\n if (state.loadingFrames.size > 0) {\n isLoading = true\n }\n return {\n isLoading,\n loadingFrames: state.loadingFrames\n }\n })\n if (\n frameInfo.sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE &&\n this.props.slide.areVolumeImagesMonochrome\n ) {\n const opticalPathIdentifier = frameInfo.channelIdentifier\n if (\n !(opticalPathIdentifier in this.state.pixelDataStatistics) &&\n frameInfo.pixelArray != null\n ) {\n /*\n * There are limits on the number of arguments Math.min and Math.max\n * functions can accept. Therefore, we compute values in smaller chunks.\n */\n const size = 2 ** 16\n const chunks = Math.ceil(frameInfo.pixelArray.length / size)\n let offset = 0\n const minValues: number[] = []\n const maxValues: number[] = []\n for (let i = 0; i < chunks; i++) {\n offset = i * size\n const pixels = frameInfo.pixelArray.slice(offset, offset + size)\n minValues.push(Math.min(...pixels))\n maxValues.push(Math.max(...pixels))\n }\n const min = Math.min(...minValues)\n const max = Math.max(...maxValues)\n this.setState(state => {\n const stats = state.pixelDataStatistics\n if (stats[opticalPathIdentifier] != null) {\n stats[opticalPathIdentifier] = {\n min: Math.min(stats[opticalPathIdentifier].min, min),\n max: Math.max(stats[opticalPathIdentifier].max, max),\n numFramesSampled: stats[opticalPathIdentifier].numFramesSampled + 1\n }\n } else {\n stats[opticalPathIdentifier] = {\n min: min,\n max: max,\n numFramesSampled: 1\n }\n }\n if (state.selectedPresentationStateUID == null) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(opticalPathIdentifier)\n }\n style.limitValues = [\n stats[opticalPathIdentifier].min,\n stats[opticalPathIdentifier].max\n ]\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, style)\n }\n return state\n })\n }\n }\n }\n\n onRoiRemoved = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n console.debug(`removed ROI \"${roi.uid}\"`)\n }\n\n componentCleanup (): void {\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.removeEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.removeEventListener('resize', this.onWindowResize)\n\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n /*\n * FIXME: React appears to not clean the content of referenced\n * HTMLDivElement objects when the page is reloaded. As a consequence,\n * optical paths and other display items cannot be toggled or updated after\n * a manual page reload. I have tried using ref callbacks and passing the\n * ref objects from the parent component via the props. Both didn't work\n * either.\n */\n }\n\n onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiModificationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiTranslationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.activateSelectInteraction({})\n }\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else if (event.altKey) {\n if (event.code === 'KeyD') {\n this.handleRoiDrawing()\n } else if (event.code === 'KeyM') {\n this.handleRoiModification()\n } else if (event.code === 'KeyT') {\n this.handleRoiTranslation()\n } else if (event.code === 'KeyR') {\n this.handleRoiRemoval()\n } else if (event.code === 'KeyV') {\n this.handleRoiVisibilityChange()\n } else if (event.code === 'KeyS') {\n this.handleReportGeneration()\n } else if (event.code === 'KeyG') {\n this.handleGoTo()\n }\n }\n }\n\n componentWillUnmount (): void {\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n window.removeEventListener('beforeunload', this.componentCleanup)\n }\n\n componentSetup (): void {\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_error',\n this.onLoadingError\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_error',\n this.onFrameLoadingError\n )\n document.body.addEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.addEventListener('beforeunload', this.componentCleanup)\n window.addEventListener('resize', this.onWindowResize)\n }\n\n componentDidMount (): void {\n this.componentSetup()\n this.populateViewports()\n\n if (!this.props.slide.areVolumeImagesMonochrome) {\n let hasICCProfile = false\n const image = this.props.slide.volumeImages[0]\n const metadataItem = image.OpticalPathSequence[0]\n if (metadataItem.ICCProfile == null) {\n if ('OpticalPathSequence' in image.bulkdataReferences) {\n // @ts-expect-error\n const bulkdataItem = image.bulkdataReferences.OpticalPathSequence[0]\n if ('ICCProfile' in bulkdataItem) {\n hasICCProfile = true\n }\n }\n } else {\n hasICCProfile = true\n }\n if (!hasICCProfile) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No ICC Profile was found for color images')\n }\n }\n }\n\n /**\n * Handler that gets called when a finding has been selected for annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationFindingSelection (\n value: string,\n option: any\n ): void {\n this.findingOptions.forEach(finding => {\n if (finding.CodeValue === value) {\n console.info(`selected finding \"${finding.CodeMeaning}\"`)\n this.setState({\n selectedFinding: finding,\n selectedEvaluations: []\n })\n }\n })\n }\n\n /**\n * Handler that gets called when a geometry type has been selected for\n * annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationGeometryTypeSelection (value: string, option: any): void {\n this.setState({ selectedGeometryType: value })\n }\n\n /**\n * Handler that gets called when measurements have been selected for\n * annotation.\n */\n handleAnnotationMeasurementActivation (event: any): void {\n const active: boolean = event.target.checked\n if (active) {\n this.setState({ selectedMarkup: 'measurement' })\n } else {\n this.setState({ selectedMarkup: undefined })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been selected for an\n * annotation.\n *\n * @param value - Code value of the coded evaluation that got selected\n * @param option - Option that got selected\n */\n handleAnnotationEvaluationSelection (\n value: string,\n option: any\n ): void {\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n const name = option.label\n this.evaluationOptions[key].forEach(evaluation => {\n if (\n evaluation.name.CodeValue === name.CodeValue &&\n evaluation.name.CodingSchemeDesignator === name.CodingSchemeDesignator\n ) {\n evaluation.values.forEach(code => {\n if (code.CodeValue === value) {\n const filteredEvaluations = this.state.selectedEvaluations.filter(\n (item: Evaluation) => item.name !== evaluation.name\n )\n this.setState({\n selectedEvaluations: [\n ...filteredEvaluations,\n { name: name, value: code }\n ]\n })\n }\n })\n }\n })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been cleared for an\n * annotation.\n */\n handleAnnotationEvaluationClearance (): void {\n this.setState({\n selectedEvaluations: []\n })\n }\n\n handleXCoordinateSelection (value: any): void {\n if (value != null) {\n const x = Number(value)\n const start = this.state.validXCoordinateRange[0]\n const end = this.state.validXCoordinateRange[1]\n if (x >= start && x <= end) {\n this.setState({\n selectedXCoordinate: x,\n isSelectedXCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedXCoordinate: undefined,\n isSelectedXCoordinateValid: false\n })\n }\n\n handleYCoordinateSelection (value: any): void {\n if (value != null) {\n const y = Number(value)\n const start = this.state.validYCoordinateRange[0]\n const end = this.state.validYCoordinateRange[1]\n if (y >= start && y <= end) {\n this.setState({\n selectedYCoordinate: y,\n isSelectedYCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedYCoordinate: undefined,\n isSelectedYCoordinateValid: false\n })\n }\n\n handleMagnificationSelection (value: any): void {\n if (value != null) {\n if (value > 0 && value <= 40) {\n this.setState({\n selectedMagnification: Number(value),\n isSelectedMagnificationValid: true\n })\n return\n }\n }\n this.setState({\n selectedMagnification: undefined,\n isSelectedMagnificationValid: false\n })\n }\n\n /**\n * Handler that gets called when the selection of slide position was\n * completed.\n */\n handleSlidePositionSelection (): void {\n if (\n this.state.isSelectedXCoordinateValid &&\n this.state.isSelectedYCoordinateValid &&\n this.state.isSelectedMagnificationValid &&\n this.state.selectedXCoordinate != null &&\n this.state.selectedYCoordinate != null &&\n this.state.selectedMagnification != null\n ) {\n console.info(\n 'select slide position ' +\n `(${this.state.selectedXCoordinate}, ` +\n `${this.state.selectedYCoordinate}) ` +\n `at ${this.state.selectedMagnification}x magnification`\n )\n\n const factor = this.state.selectedMagnification\n /**\n * On an optical microscope an objective with 1x magnification\n * corresponds to approximately 10 micrometer pixel spacing\n * (due to the ocular).\n */\n const targetPixelSpacing = 0.01 / factor\n const diffs = []\n for (let i = 0; i < this.volumeViewer.numLevels; i++) {\n const actualPixelSpacing = this.volumeViewer.getPixelSpacing(i)[0]\n diffs.push(Math.abs(targetPixelSpacing - actualPixelSpacing))\n }\n const level = diffs.indexOf(Math.min(...diffs))\n this.volumeViewer.navigate({\n position: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate\n ],\n level: level\n })\n const point = new dmv.scoord3d.Point({\n coordinates: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate,\n 0\n ],\n frameOfReferenceUID: this.volumeViewer.frameOfReferenceUID\n })\n const roi = new dmv.roi.ROI({ scoord3d: point })\n this.volumeViewer.addROI(roi, this.defaultRoiStyle)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return {\n visibleRoiUIDs,\n isGoToModalVisible: false\n }\n })\n }\n }\n\n /**\n * Handler that gets called when the selection of a slide position was\n * canceled.\n */\n handleSlidePositionSelectionCancellation (): void {\n console.log('cancel slide position selection')\n this.setState({\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n isSelectedMagnificationValid: false,\n selectedXCoordinate: undefined,\n selectedYCoordinate: undefined,\n selectedMagnification: undefined\n })\n }\n\n /**\n * Handler that gets called when annotation configuration has been completed.\n */\n handleAnnotationConfigurationCompletion (): void {\n console.debug('complete annotation configuration')\n const finding = this.state.selectedFinding\n const geometryType = this.state.selectedGeometryType\n const markup = this.state.selectedMarkup\n if (geometryType !== undefined && finding !== undefined) {\n this.volumeViewer.activateDrawInteraction({ geometryType, markup })\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: true\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Could not complete annotation configuration'\n )\n )\n }\n }\n\n /**\n * Handler that gets called when annotation configuration has been cancelled.\n */\n handleAnnotationConfigurationCancellation (): void {\n console.debug('cancel annotation configuration')\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that gets called when a report should be generated for the current\n * set of annotations.\n */\n handleReportGeneration (): void {\n console.info('save ROIs')\n const rois = this.volumeViewer.getAllROIs()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n const metadata = this.volumeViewer.getOpticalPathMetadata(\n opticalPaths[0].identifier\n )\n // Metadata should be sorted such that the image with the highest\n // resolution is the last item in the array.\n const refImage = metadata[metadata.length - 1]\n // We assume that there is only one specimen (tissue section) per\n // ontainer (slide). Only the tissue section is tracked with a unique\n // identifier, even if the section may be composed of different biological\n // samples.\n if (refImage.SpecimenDescriptionSequence.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'More than one specimen has been described for the slide'\n )\n )\n }\n const refSpecimen = refImage.SpecimenDescriptionSequence[0]\n\n console.debug('create Observation Context')\n let observer\n if (this.props.user !== undefined) {\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: this.props.user.name,\n loginName: this.props.user.email\n })\n } else {\n console.warn('no user information available')\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: 'ANONYMOUS'\n })\n }\n const observationContext = new dcmjs.sr.templates.ObservationContext({\n observerPersonContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121006',\n schemeDesignator: 'DCM',\n meaning: 'Person'\n }),\n observerIdentifyingAttributes: observer\n }),\n observerDeviceContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121007',\n schemeDesignator: 'DCM',\n meaning: 'Device'\n }),\n observerIdentifyingAttributes:\n new dcmjs.sr.templates.DeviceObserverIdentifyingAttributes({\n uid: this.props.app.uid,\n manufacturerName: 'MGH Computational Pathology',\n modelName: this.props.app.name\n })\n }),\n subjectContext: new dcmjs.sr.templates.SubjectContext({\n subjectClass: new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n schemeDesignator: 'DCM',\n meaning: 'Specimen'\n }),\n subjectClassSpecificContext:\n new dcmjs.sr.templates.SubjectContextSpecimen({\n uid: refSpecimen.SpecimenUID,\n identifier: refSpecimen.SpecimenIdentifier,\n containerIdentifier: refImage.ContainerIdentifier\n })\n })\n })\n\n console.debug('encode Imaging Measurements')\n const imagingMeasurements: dcmjs.sr.valueTypes.ContainerContentItem[] = []\n for (let i = 0; i < rois.length; i++) {\n const roi = rois[i]\n if (!this.state.visibleRoiUIDs.has(roi.uid)) {\n continue\n }\n let findingType = roi.evaluations.find(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue === '121071'\n }\n )\n if (findingType === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `No finding type was specified for ROI \"${roi.uid}\"`\n )\n )\n }\n findingType = findingType as dcmjs.sr.valueTypes.CodeContentItem\n const group = new dcmjs.sr.templates.PlanarROIMeasurementsAndQualitativeEvaluations({\n trackingIdentifier: new dcmjs.sr.templates.TrackingIdentifier({\n uid: roi.properties.trackingUID ?? roi.uid,\n identifier: `ROI #${i + 1}`\n }),\n referencedRegion: new dcmjs.sr.contentItems.ImageRegion3D({\n graphicType: roi.scoord3d.graphicType,\n graphicData: roi.scoord3d.graphicData,\n frameOfReferenceUID: roi.scoord3d.frameOfReferenceUID\n }),\n findingType: new dcmjs.sr.coding.CodedConcept({\n value: findingType.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n findingType.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: findingType.ConceptCodeSequence[0].CodeMeaning\n }),\n qualitativeEvaluations: roi.evaluations.filter(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue !== '121071'\n }\n ),\n measurements: roi.measurements\n })\n const measurements = group as dcmjs.sr.valueTypes.ContainerContentItem[]\n measurements[0].ContentTemplateSequence = [{\n MappingResource: 'DCMR',\n TemplateIdentifier: '1410'\n }]\n imagingMeasurements.push(...measurements)\n }\n\n console.debug('create Measurement Report document content')\n const measurementReport = new dcmjs.sr.templates.MeasurementReport({\n languageOfContentItemAndDescendants: new dcmjs.sr.templates.LanguageOfContentItemAndDescendants({}),\n observationContext: observationContext,\n procedureReported: new dcmjs.sr.coding.CodedConcept({\n value: '112703',\n schemeDesignator: 'DCM',\n meaning: 'Whole Slide Imaging'\n }),\n imagingMeasurements: imagingMeasurements\n })\n\n console.info('create Comprehensive 3D SR document')\n const dataset = new dcmjs.sr.documents.Comprehensive3DSR({\n content: measurementReport[0],\n evidence: [refImage],\n seriesInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n seriesNumber: 1,\n seriesDescription: 'Annotation',\n sopInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n instanceNumber: 1,\n manufacturer: 'MGH Computational Pathology',\n previousVersions: undefined // TODO\n })\n\n this.setState({\n isReportModalVisible: true,\n generatedReport: dataset as dmv.metadata.Comprehensive3DSR\n })\n }\n\n /**\n * Handler that gets called when a report should be verified. The current\n * list of annotations will be presented to the user together with other\n * pertinent metadata about the patient, study, and specimen.\n */\n handleReportVerification (): void {\n console.info('verfied report')\n\n const report = this.state.generatedReport\n if (report !== undefined) {\n const dataset = report as unknown as dmv.metadata.Comprehensive3DSR\n console.debug('create File Meta Information')\n const fileMetaInformationVersionArray = new Uint8Array(2)\n fileMetaInformationVersionArray[1] = 1\n const fileMeta = {\n // FileMetaInformationVersion\n '00020001': {\n Value: [fileMetaInformationVersionArray.buffer],\n vr: 'OB'\n },\n // MediaStorageSOPClassUID\n '00020002': {\n Value: [dataset.SOPClassUID],\n vr: 'UI'\n },\n // MediaStorageSOPInstanceUID\n '00020003': {\n Value: [dataset.SOPInstanceUID],\n vr: 'UI'\n },\n // TransferSyntaxUID\n '00020010': {\n Value: ['1.2.840.10008.1.2.1'],\n vr: 'UI'\n },\n // ImplementationClassUID\n '00020012': {\n Value: [this.props.app.uid],\n vr: 'UI'\n }\n }\n\n console.info('store Comprehensive 3D SR document')\n const writer = new dcmjs.data.DicomDict(fileMeta)\n writer.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset)\n const buffer = writer.write()\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.storeInstances({ datasets: [buffer] }).then(\n (response: any) => message.info('Annotations were saved.')\n ).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Annotations could not be saved'\n )\n )\n })\n }\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when report generation has been cancelled.\n */\n handleReportCancellation (): void {\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when an annotation has been selected from the\n * current list of annotations.\n */\n handleAnnotationSelection ({ roiUID }: { roiUID: string }): void {\n console.log(`selected ROI ${roiUID}`)\n this.setState({ selectedRoiUIDs: new Set([roiUID]) })\n this.volumeViewer.getAllROIs().forEach((roi) => {\n let style = {}\n if (roi.uid === roiUID) {\n style = this.selectedRoiStyle\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n if (this.state.visibleRoiUIDs.has(roi.uid)) {\n const key = _getRoiKey(roi)\n style = this.getRoiStyle(key)\n }\n }\n this.volumeViewer.setROIStyle(roi.uid, style)\n })\n }\n\n /**\n * Handle toggling of annotation visibility, i.e., whether a given\n * annotation should be either displayed or hidden by the viewer.\n */\n handleAnnotationVisibilityChange ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }): void {\n if (isVisible) {\n console.info(`show ROI ${roiUID}`)\n const roi = this.volumeViewer.getROI(roiUID)\n const key = _getRoiKey(roi)\n const style = this.getRoiStyle(key)\n this.volumeViewer.setROIStyle(roi.uid, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.info(`hide ROI ${roiUID}`)\n this.setState(state => {\n const selectedRoiUIDs = state.selectedRoiUIDs\n selectedRoiUIDs.delete(roiUID)\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.delete(roiUID)\n return { visibleRoiUIDs, selectedRoiUIDs }\n })\n this.volumeViewer.setROIStyle(roiUID, {})\n }\n }\n\n /**\n * Handle toggling of annotation group visibility, i.e., whether a given\n * annotation group should be either displayed or hidden by the viewer.\n */\n handleAnnotationGroupVisibilityChange ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of annotation group ${annotationGroupUID}`)\n if (isVisible) {\n console.info(`show annotation group ${annotationGroupUID}`)\n try {\n this.volumeViewer.showAnnotationGroup(annotationGroupUID)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to show annotation group.'\n )\n )\n throw error\n }\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.add(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n } else {\n console.info(`hide annotation group ${annotationGroupUID}`)\n this.volumeViewer.hideAnnotationGroup(annotationGroupUID)\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.delete(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n }\n }\n\n /**\n * Handle change of annotation group style.\n */\n handleAnnotationGroupStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }): void {\n console.log(`change style of annotation group ${uid}`)\n try {\n this.volumeViewer.setAnnotationGroupStyle(\n uid,\n styleOptions\n )\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of annotation group.'\n )\n )\n throw error\n }\n }\n\n generateRoiStyle (\n styleOptions: {\n opacity?: number\n color?: number[]\n contourOnly: boolean\n }): dmv.viewer.ROIStyleOptions {\n const opacity = styleOptions.opacity ?? DEFAULT_ANNOTATION_OPACITY\n const strokeColor = styleOptions.color ?? DEFAULT_ANNOTATION_STROKE_COLOR\n const fillColor = styleOptions.contourOnly ? [0, 0, 0, 0] : strokeColor.map((c) => Math.min(c + 25, 255))\n const style = _formatRoiStyle({\n fill: { color: [...fillColor, opacity] },\n stroke: { color: [...strokeColor, opacity] },\n radius: this.defaultRoiStyle.stroke?.width\n })\n return style\n }\n\n handleRoiStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity: number\n color: number[]\n contourOnly: boolean\n }\n }): void {\n console.log(`change style of ROI ${uid}`)\n try {\n this.defaultAnnotationStyles[uid] = styleOptions\n const style = this.generateRoiStyle(styleOptions)\n\n const roi = this.volumeViewer.getROI(uid)\n const key = _getRoiKey(roi) as string\n this.roiStyles[key] = style\n this.volumeViewer.setROIStyle(uid, style)\n this.state.visibleRoiUIDs.add(uid)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of ROI.'\n )\n )\n throw error\n }\n }\n\n /**\n * Handle toggling of segment visibility, i.e., whether a given\n * segment should be either displayed or hidden by the viewer.\n */\n handleSegmentVisibilityChange ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of segment ${segmentUID}`)\n if (isVisible) {\n console.info(`show segment ${segmentUID}`)\n this.volumeViewer.showSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.add(segmentUID)\n return { visibleSegmentUIDs }\n })\n } else {\n console.info(`hide segment ${segmentUID}`)\n this.volumeViewer.hideSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.delete(segmentUID)\n return { visibleSegmentUIDs }\n })\n }\n }\n\n /**\n * Handle change of segment style.\n */\n handleSegmentStyleChange ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of segment ${segmentUID}`)\n this.volumeViewer.setSegmentStyle(segmentUID, styleOptions)\n }\n\n /**\n * Handle toggling of mapping visibility, i.e., whether a given\n * mapping should be either displayed or hidden by the viewer.\n */\n handleMappingVisibilityChange ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of mapping ${mappingUID}`)\n if (isVisible) {\n console.info(`show mapping ${mappingUID}`)\n this.volumeViewer.showParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.add(mappingUID)\n return { visibleMappingUIDs }\n })\n } else {\n console.info(`hide mapping ${mappingUID}`)\n this.volumeViewer.hideParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.delete(mappingUID)\n return { visibleMappingUIDs }\n })\n }\n }\n\n /**\n * Handle change of mapping style.\n */\n handleMappingStyleChange ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of mapping ${mappingUID}`)\n this.volumeViewer.setParameterMappingStyle(mappingUID, styleOptions)\n }\n\n /**\n * Handle toggling of optical path visibility, i.e., whether a given\n * optical path should be either displayed or hidden by the viewer.\n */\n handleOpticalPathVisibilityChange ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of optical path ${opticalPathIdentifier}`)\n if (isVisible) {\n console.info(`show optical path ${opticalPathIdentifier}`)\n this.volumeViewer.showOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n } else {\n console.info(`hide optical path ${opticalPathIdentifier}`)\n this.volumeViewer.hideOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Handle change of optical path style.\n */\n handleOpticalPathStyleChange ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }): void {\n console.log(`change style of optical path ${opticalPathIdentifier}`)\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, styleOptions)\n }\n\n /**\n * Handle toggling of optical path activity, i.e., whether a given\n * optical path should be either added or removed from the viewport.\n */\n handleOpticalPathActivityChange ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }): void {\n console.log(`change activity of optical path ${opticalPathIdentifier}`)\n if (isActive) {\n console.info(`activate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.activateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n } else {\n console.info(`deactivate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.deactivateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Set default presentation state that is either defined by metadata included\n * in the DICOM Slide Microscopy instance or by the viewer.\n */\n setDefaultPresentationState (): void {\n const visibleOpticalPathIdentifiers: Set = new Set()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n if (item.isMonochromatic) {\n /*\n * If the image metadata contains a palette color lookup table for the\n * optical path, then it will be displayed by default.\n */\n if (item.paletteColorLookupTableUID != null) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n } else {\n /* Color images will always be displayed by default. */\n visibleOpticalPathIdentifiers.add(identifier)\n }\n })\n\n /*\n * If no optical paths have been selected for visualization so far, select\n * first n optical paths and set a default value of interest (VOI) window\n * (using pre-computed pixel data statistics) and a default color.\n */\n if (visibleOpticalPathIdentifiers.size === 0) {\n const defaultColors = [\n [255, 255, 255]\n ]\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n if (item.isMonochromatic) {\n const numVisible = visibleOpticalPathIdentifiers.size\n if (numVisible < defaultColors.length) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n const index = numVisible\n style.color = defaultColors[index]\n const stats = this.state.pixelDataStatistics[item.identifier]\n if (stats != null) {\n style.limitValues = [stats.min, stats.max]\n }\n this.volumeViewer.setOpticalPathStyle(item.identifier, style)\n visibleOpticalPathIdentifiers.add(item.identifier)\n }\n }\n })\n }\n\n console.info(\n `selected n=${visibleOpticalPathIdentifiers.size} optical paths ` +\n 'for visualization'\n )\n visibleOpticalPathIdentifiers.forEach(identifier => {\n this.volumeViewer.showOpticalPath(identifier)\n })\n this.setState(state => ({\n activeOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers),\n visibleOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers)\n }))\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateReset (): void {\n this.setState({ selectedPresentationStateUID: undefined })\n const urlPath = this.props.location.pathname\n this.props.navigate(urlPath)\n this.setDefaultPresentationState()\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateSelection (\n value?: string,\n option?: any\n ): void {\n if (value != null) {\n console.info(`select Presentation State instance \"${value}\"`)\n let presentationState\n this.state.presentationStates.forEach(instance => {\n if (instance.SOPInstanceUID === value) {\n presentationState = instance\n }\n })\n if (presentationState != null) {\n let urlPath = this.props.location.pathname\n urlPath += `?state=${value}`\n this.props.navigate(urlPath)\n this.setPresentationState(presentationState)\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be found'\n )\n )\n console.log(\n 'failed to handle section of presentation state: ' +\n `could not find instance \"${value}\"`\n )\n }\n } else {\n this.handlePresentationStateReset()\n }\n this.setState({ selectedPresentationStateUID: value })\n }\n\n /**\n * Handler that will toggle the ROI drawing tool, i.e., either activate or\n * de-activate it, depending on its current state.\n */\n handleRoiDrawing (): void {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else {\n console.info('activate drawing of ROIs')\n this.setState({\n isAnnotationModalVisible: true,\n isSelectedRoiModalVisible: false,\n isRoiDrawingActive: true,\n isRoiModificationActive: false,\n isRoiTranslationActive: false,\n isGoToModalVisible: false\n })\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n }\n }\n\n /**\n * Handler that will toggle the ROI modification tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiModification (): void {\n console.info('toggle modification of ROIs')\n if (this.volumeViewer.isModifyInteractionActive) {\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiModificationActive: true,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false\n })\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateSnapInteraction({})\n this.volumeViewer.activateModifyInteraction({})\n }\n }\n\n /**\n * Handler that will toggle the ROI translation tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiTranslation (): void {\n console.info('toggle translation of ROIs')\n if (this.volumeViewer.isTranslateInteractionActive) {\n this.volumeViewer.deactivateTranslateInteraction()\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiTranslationActive: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateTranslateInteraction({})\n }\n }\n\n handleGoTo (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.setState({\n isGoToModalVisible: true,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isReportModalVisible: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that will toggle the ROI removal tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiRemoval (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n if (this.state.selectedRoiUIDs.size > 0) {\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No annotation was selected for removal')\n return\n }\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.info('Annotation was removed')\n })\n this.setState({\n selectedRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.state.visibleRoiUIDs.forEach(uid => {\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n })\n this.setState({\n visibleRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n }\n this.volumeViewer.activateSelectInteraction({})\n }\n\n /**\n * Handler that will toggle the ROI visibility tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiVisibilityChange (): void {\n console.info('toggle visibility of ROIs')\n if (this.volumeViewer.areROIsVisible) {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.hideROIs()\n this.setState({\n areRoisHidden: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isRoiTranslationActive: false\n })\n } else {\n this.volumeViewer.showROIs()\n this.volumeViewer.activateSelectInteraction({})\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid !== undefined) {\n this.volumeViewer.setROIStyle(uid, this.selectedRoiStyle)\n }\n })\n this.setState({ areRoisHidden: false })\n }\n }\n\n render (): React.ReactNode {\n const rois: dmv.roi.ROI[] = []\n const segments: dmv.segment.Segment[] = []\n const mappings: dmv.mapping.ParameterMapping[] = []\n const annotationGroups: dmv.annotation.AnnotationGroup[] = []\n rois.push(...this.volumeViewer.getAllROIs())\n segments.push(...this.volumeViewer.getAllSegments())\n mappings.push(...this.volumeViewer.getAllParameterMappings())\n const allAnnotationGroups = this.volumeViewer.getAllAnnotationGroups()\n const filteredAnnotationGroups = allAnnotationGroups?.filter((annotationGroup) =>\n annotationGroup.referencedSeriesInstanceUID === this.props.seriesInstanceUID\n )\n annotationGroups.push(...filteredAnnotationGroups)\n\n const annotations = rois.map(roi => adaptRoiToAnnotation(roi))\n\n const openSubMenuItems = [\n 'specimens', 'optical-paths', 'annotations', 'presentation-states'\n ]\n\n let report: React.ReactNode\n const dataset = this.state.generatedReport\n if (dataset !== undefined) {\n report = \n }\n\n let annotationMenuItems: React.ReactNode\n if (rois.length > 0) {\n annotationMenuItems = (\n \n )\n }\n\n const findingOptions = this.findingOptions.map(finding => {\n return (\n \n {finding.CodeMeaning}\n \n )\n })\n\n const geometryTypeOptionsMapping: { [key: string]: React.ReactNode } = {\n point: Point,\n circle: Circle,\n box: Box,\n polygon: Polygon,\n line: Line,\n freehandpolygon: (\n \n Polygon (freehand)\n \n ),\n freehandline: (\n \n Line (freehand)\n \n )\n }\n\n const annotationConfigurations: React.ReactNode[] = [\n (\n \n {findingOptions}\n \n )\n ]\n\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n this.evaluationOptions[key].forEach(evaluation => {\n const evaluationOptions = evaluation.values.map(code => {\n return (\n \n {code.CodeMeaning}\n \n )\n })\n annotationConfigurations.push(\n <>\n {evaluation.name.CodeMeaning}\n \n {evaluationOptions}\n \n \n )\n })\n const geometryTypeOptions = this.geometryTypeOptions[key].map(name => {\n return geometryTypeOptionsMapping[name]\n })\n annotationConfigurations.push(\n <>\n ROI geometry type\n \n {geometryTypeOptions}\n \n \n )\n annotationConfigurations.push(\n \n measure\n \n )\n }\n\n const specimenMenu = (\n \n \n \n )\n\n const equipmentMenu = (\n \n \n \n )\n\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n const opticalPathStyles: {\n [identifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n } = {}\n const opticalPathMetadata: {\n [identifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n } = {}\n opticalPaths.forEach(opticalPath => {\n const identifier = opticalPath.identifier\n const metadata = this.volumeViewer.getOpticalPathMetadata(identifier)\n opticalPathMetadata[identifier] = metadata\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n opticalPathStyles[identifier] = style\n })\n const opticalPathMenu = (\n \n \n \n )\n\n let presentationStateMenu\n if (this.state.presentationStates.length > 0) {\n const presentationStateOptions = []\n this.state.presentationStates.forEach(instance => {\n presentationStateOptions.push(\n \n {instance.ContentDescription}\n \n )\n })\n presentationStateOptions.push(\n \n <>\n \n )\n presentationStateMenu = (\n \n \n \n {presentationStateOptions}\n \n \n }\n type='primary'\n onClick={this.handlePresentationStateReset}\n />\n \n \n \n )\n }\n\n let segmentationMenu\n if (segments.length > 0) {\n const defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n } = {}\n const segmentMetadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n } = {}\n const segments = this.volumeViewer.getAllSegments()\n segments.forEach(segment => {\n defaultSegmentStyles[segment.uid] = this.volumeViewer.getSegmentStyle(\n segment.uid\n )\n segmentMetadata[segment.uid] = this.volumeViewer.getSegmentMetadata(\n segment.uid\n )\n })\n segmentationMenu = (\n \n \n \n )\n openSubMenuItems.push('segmentations')\n }\n\n let parametricMapMenu\n if (mappings.length > 0) {\n const defaultMappingStyles: {\n [mappingUID: string]: {\n opacity: number\n }\n } = {}\n const mappingMetadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n } = {}\n mappings.forEach(mapping => {\n defaultMappingStyles[mapping.uid] = this.volumeViewer.getParameterMappingStyle(\n mapping.uid\n )\n mappingMetadata[mapping.uid] = this.volumeViewer.getParameterMappingMetadata(\n mapping.uid\n )\n })\n parametricMapMenu = (\n \n \n \n )\n openSubMenuItems.push('parametric-maps')\n }\n\n let annotationGroupMenu\n\n if (annotations.length > 0) {\n annotations.forEach((annotation) => {\n const roi = this.volumeViewer.getROI(annotation.uid)\n const key = _getRoiKey(roi) as string\n const color = this.roiStyles[key] !== undefined\n ? this.roiStyles[key].stroke?.color.slice(0, 3)\n : DEFAULT_ANNOTATION_COLOR_PALETTE[\n Object.keys(this.roiStyles).length % DEFAULT_ANNOTATION_COLOR_PALETTE.length\n ]\n this.defaultAnnotationStyles[annotation.uid] = {\n color,\n opacity: DEFAULT_ANNOTATION_OPACITY,\n contourOnly: false\n } as any\n\n this.roiStyles[key] = this.generateRoiStyle(\n this.defaultAnnotationStyles[annotation.uid]\n )\n })\n }\n\n if (annotationGroups.length > 0) {\n const annotationGroupMetadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n } = {}\n const defaultAnnotationGroupStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n annotationGroups.forEach(annotationGroup => {\n defaultAnnotationGroupStyles[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupStyle(\n annotationGroup.uid\n )\n annotationGroupMetadata[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupMetadata(\n annotationGroup.uid\n )\n })\n annotationGroupMenu = (\n \n \n \n )\n openSubMenuItems.push('annotationGroups')\n }\n\n let toolbar\n let toolbarHeight = '0px'\n const annotationTools = [\n ,\n ,\n ,\n ,\n ,\n \n ]\n const controlTools = [\n \n ]\n if (this.props.enableAnnotationTools) {\n toolbar = (\n \n {annotationTools.map((item, i) => {\n return {item}\n })}\n {controlTools.map((item, i) => {\n return {item}\n })}\n \n )\n toolbarHeight = '50px'\n }\n\n let cursor = 'default'\n if (this.state.isLoading) {\n cursor = 'progress'\n }\n\n let selectedRoiInformation\n if (this.state.selectedRoi != null) {\n const roiAttributes: Array<{\n name: string\n value: string\n unit?: string\n }> = [\n {\n name: 'UID',\n value: this.state.selectedRoi.uid\n }\n ]\n const roiScoordAttributes: Array<{\n name: string\n value: string\n }> = [\n {\n name: 'Graphic type',\n value: this.state.selectedRoi.scoord3d.graphicType\n }\n ]\n const roiEvaluationAttributes: Array<{\n name: string\n value: string\n }> = []\n this.state.selectedRoi.evaluations.forEach(item => {\n if (item.ValueType === 'CODE') {\n const codeItem = item as dcmjs.sr.valueTypes.CodeContentItem\n roiEvaluationAttributes.push({\n name: codeItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: codeItem.ConceptCodeSequence[0].CodeMeaning\n })\n } else {\n const textItem = item as dcmjs.sr.valueTypes.TextContentItem\n roiEvaluationAttributes.push({\n name: textItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: textItem.TextValue\n })\n }\n })\n const roiMeasurmentAttributesPerOpticalPath: {\n [identifier: string]: Array<{\n name: string\n value: string\n unit?: string\n }>\n } = {}\n this.state.selectedRoi.measurements.forEach(item => {\n let identifier = 'default'\n if (item.ContentSequence != null) {\n const refItems = findContentItemsByName({\n content: item.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121112',\n meaning: 'Source of Measurement',\n schemeDesignator: 'DCM'\n })\n })\n if (refItems.length > 0) {\n identifier = (\n refItems[0]\n // @ts-expect-error\n .ReferencedSOPSequence[0]\n .ReferencedOpticalPathIdentifier\n )\n }\n }\n if (!(identifier in roiMeasurmentAttributesPerOpticalPath)) {\n roiMeasurmentAttributesPerOpticalPath[identifier] = []\n }\n const measuredValueItem = item.MeasuredValueSequence[0]\n roiMeasurmentAttributesPerOpticalPath[identifier].push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: measuredValueItem.NumericValue.toString(),\n unit: measuredValueItem.MeasurementUnitsCodeSequence[0].CodeMeaning\n })\n })\n const createRoiDescription = (\n attributes: Array<{ name: string, value: string, unit?: string }>\n ): React.ReactNode[] => {\n return attributes.map(item => {\n let value\n if (item.unit != null) {\n value = `${item.value} [${item.unit}]`\n } else {\n value = item.value\n }\n return (\n \n {value}\n \n )\n })\n }\n const roiDescriptions = createRoiDescription(roiAttributes)\n const roiScoordDescriptions = createRoiDescription(\n roiScoordAttributes\n )\n const roiEvaluationDescriptions = createRoiDescription(\n roiEvaluationAttributes\n )\n const roiMeasurementDescriptions = []\n for (const identifier in roiMeasurmentAttributesPerOpticalPath) {\n const descriptions = createRoiDescription(\n roiMeasurmentAttributesPerOpticalPath[identifier]\n )\n if (identifier === 'default') {\n roiMeasurementDescriptions.push(descriptions)\n } else {\n roiMeasurementDescriptions.push(\n <>\n \n {identifier}\n \n {descriptions}\n \n )\n }\n }\n selectedRoiInformation = (\n <>\n \n {roiDescriptions}\n \n \n Spatial coordinates\n \n \n {roiScoordDescriptions}\n \n \n Evaluations\n \n \n {roiEvaluationDescriptions}\n \n \n Measurements\n \n \n {roiMeasurementDescriptions}\n \n \n )\n }\n\n return (\n \n \n {toolbar}\n\n \n\n \n \n {annotationConfigurations}\n \n \n\n \n \n {selectedRoiInformation}\n \n \n\n \n \n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n \n\n \n {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(() => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }, 100)\n }}\n >\n {this.labelViewportRef.current != null && (\n \n \n \n \n \n )}\n {specimenMenu}\n {equipmentMenu}\n {opticalPathMenu}\n {presentationStateMenu}\n \n {annotationMenuItems}\n \n {annotationGroupMenu}\n {annotations.length === 0\n ? (\n <>\n )\n : (\n \n \n \n )}\n {segmentationMenu}\n {parametricMapMenu}\n \n \n {this.state.isHoveredRoiTooltipVisible &&\n this.state.hoveredRoiAttributes.length > 0\n ? (\n \n )\n : (\n <>\n )}\n \n )\n }\n}\n\nexport default withRouter(SlideViewer)\n","import * as dmv from 'dicom-microscopy-viewer'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nenum ImageFlavors {\n VOLUME = 'VOLUME',\n LABEL = 'LABEL',\n OVERVIEW = 'OVERVIEW',\n THUMBNAIL = 'THUMBNAIL'\n}\n\nconst hasImageFlavor = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n imageFlavor: ImageFlavors\n): boolean => {\n return image.ImageType[2] === imageFlavor\n}\n\nconst areSameAcquisition = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n refImage: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean => {\n if (image.AcquisitionUID != null) {\n return image.AcquisitionUID === refImage.AcquisitionUID\n }\n return false\n}\n\ninterface SlideImageCollection {\n acquisitionUID?: string\n frameOfReferenceUID: string\n containerIdentifier: string\n volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n}\n\ninterface SlideOptions {\n images: dmv.metadata.VLWholeSlideMicroscopyImage[]\n description?: string\n}\n\n/**\n * Slide - collection of images with the same Frame of Reference UID and\n * Container Identifier.\n */\nclass Slide {\n readonly description: string\n readonly acquisitionUID: string | null | undefined\n readonly frameOfReferenceUID: string\n readonly containerIdentifier: string\n readonly seriesInstanceUIDs: string[]\n readonly opticalPathIdentifiers: string[]\n readonly pyramidUIDs: string[] = []\n readonly areVolumeImagesMonochrome: boolean\n readonly volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n\n /**\n * @param options\n * @param options.images - Metadata of images associated with the slide\n * @param options.description - Description of the slide\n */\n constructor (\n options: SlideOptions\n ) {\n if (options.images.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Value of option \"images\" have been non-zero length.'\n )\n )\n }\n\n const seriesInstanceUIDs = new Set([] as string[])\n const acquisitionUIDs = new Set([] as string[])\n const opticalPathIdentifiers = new Set([] as string[])\n const containerIdentifiers = new Set([] as string[])\n const frameOfReferenceUIDs = {\n VOLUME: new Set([] as string[]),\n LABEL: new Set([] as string[]),\n OVERVIEW: new Set([] as string[])\n }\n const pyramidUIDs: {\n [key: string]: { [opticalPathIdentifier: string]: Set }\n } = {\n VOLUME: {}\n }\n const volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n options.images.forEach((image) => {\n containerIdentifiers.add(image.ContainerIdentifier)\n seriesInstanceUIDs.add(image.SeriesInstanceUID)\n image.OpticalPathSequence.forEach(item => {\n opticalPathIdentifiers.add(item.OpticalPathIdentifier)\n })\n if (image.AcquisitionUID != null) {\n acquisitionUIDs.add(image.AcquisitionUID)\n }\n if (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n ) {\n frameOfReferenceUIDs.VOLUME.add(image.FrameOfReferenceUID)\n if (image.PyramidUID != null) {\n for (const identifier in opticalPathIdentifiers) {\n pyramidUIDs.VOLUME[identifier].add(image.PyramidUID)\n }\n }\n volumeImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.LABEL)) {\n frameOfReferenceUIDs.LABEL.add(image.FrameOfReferenceUID)\n labelImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.OVERVIEW)) {\n frameOfReferenceUIDs.OVERVIEW.add(image.FrameOfReferenceUID)\n overviewImages.push(image)\n }\n })\n if (volumeImages.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'At least one VOLUME image must be provided for a slide.'\n )\n )\n } else {\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const samplesPerPixel = new Set([] as number[])\n volumeImages.forEach((image) => {\n samplesPerPixel.add(image.SamplesPerPixel)\n })\n if (samplesPerPixel.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const isNotResampled = volumeImages.filter(image => {\n return image.ImageType[3] !== 'RESAMPLED'\n })\n if (isNotResampled.length > opticalPathIdentifiers.size) {\n console.warn(\n 'the set of VOLUME images of a slide must contain only a single ' +\n 'image that has not been resampled per optical path'\n )\n }\n }\n this.volumeImages = volumeImages\n this.labelImages = labelImages\n this.overviewImages = overviewImages\n\n this.seriesInstanceUIDs = [...seriesInstanceUIDs]\n this.opticalPathIdentifiers = [...opticalPathIdentifiers]\n\n if (containerIdentifiers.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All images of a slide must have the same Container Identifier.'\n )\n )\n }\n this.containerIdentifier = [...containerIdentifiers][0]\n\n if (frameOfReferenceUIDs.VOLUME.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have ' +\n 'the same Frame of Reference UID.'\n )\n )\n }\n this.frameOfReferenceUID = [...frameOfReferenceUIDs.VOLUME][0]\n\n let requirePyramidUID = false\n if (Object.keys(pyramidUIDs.VOLUME).length > 0) {\n requirePyramidUID = true\n }\n this.opticalPathIdentifiers.forEach(identifier => {\n if (pyramidUIDs.VOLUME[identifier] != null) {\n if (pyramidUIDs.VOLUME[identifier].size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `All VOLUME images for optical path \"${identifier}\"` +\n 'must be part of the same multi-resolution pyramid.'\n )\n )\n } else if (pyramidUIDs.VOLUME[identifier].size === 1) {\n this.pyramidUIDs.push([...pyramidUIDs.VOLUME[identifier]][0])\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n } else {\n if (requirePyramidUID) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n }\n })\n\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must be part of the same ' +\n 'acquisition and have the same Acquisition UID.'\n )\n )\n } else if (acquisitionUIDs.size === 1) {\n this.acquisitionUID = [...acquisitionUIDs][0]\n } else {\n this.acquisitionUID = null\n }\n\n this.areVolumeImagesMonochrome = (\n this.volumeImages[0].SamplesPerPixel === 1 &&\n this.volumeImages[0].PhotometricInterpretation === 'MONOCHROME2'\n )\n\n this.description = (\n options.description !== undefined ? options.description : ''\n )\n }\n}\n\n/**\n * Create slides.\n *\n * @param imagesPerSeries - Image instances grouped per series\n * @param referenceSeriesInstanceUID - Unique identifier of the series that serves as a reference for the slide\n * @returns Slides\n */\nconst createSlides = (\n images: dmv.metadata.VLWholeSlideMicroscopyImage[][]\n): Slide[] => {\n const slideMetadata: SlideImageCollection[] = []\n images.forEach((series) => {\n if (series.length > 0) {\n const volumeImages = series.filter((image) => {\n return (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n )\n })\n if (volumeImages.length > 0) {\n const refImage = volumeImages[0]\n const filteredVolumeImages = volumeImages.filter((image) => {\n return refImage.SamplesPerPixel === image.SamplesPerPixel\n })\n const slideMetadataIndex = slideMetadata.findIndex((slide) => {\n return _doesImageBelongToSlide(slide, refImage)\n })\n\n const labelImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.LABEL)\n })\n let filteredLabelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (labelImages.length > 1) {\n filteredLabelImages = labelImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredLabelImages = labelImages\n }\n const overviewImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.OVERVIEW)\n })\n let filteredOverviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (overviewImages.length > 1) {\n filteredOverviewImages = overviewImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredOverviewImages = overviewImages\n }\n\n if (slideMetadataIndex === -1) {\n const slideMetadataItem: SlideImageCollection = {\n acquisitionUID: refImage.AcquisitionUID,\n frameOfReferenceUID: refImage.FrameOfReferenceUID,\n containerIdentifier: refImage.ContainerIdentifier,\n volumeImages: filteredVolumeImages,\n labelImages: filteredLabelImages,\n overviewImages: filteredOverviewImages\n }\n slideMetadata.push(slideMetadataItem)\n } else {\n const slideMetadataItem = slideMetadata[slideMetadataIndex]\n slideMetadataItem.volumeImages.push(...filteredVolumeImages)\n slideMetadataItem.labelImages.push(...filteredLabelImages)\n slideMetadataItem.overviewImages.push(...filteredOverviewImages)\n }\n }\n }\n })\n\n let slides: Slide[] = slideMetadata.map((item) => {\n return new Slide({\n images: [\n ...item.volumeImages,\n ...item.labelImages,\n ...item.overviewImages\n ]\n })\n })\n slides = slides.sort((a, b) => {\n const imgA = a.volumeImages[0]\n const imgB = b.volumeImages[0]\n if (imgA.ContainerIdentifier != null && imgB.ContainerIdentifier != null) {\n return Number(imgA.ContainerIdentifier) - Number(imgB.ContainerIdentifier)\n } else {\n return 0\n }\n })\n\n return slides\n}\n\n/**\n * Check if instance belongs to the slide.\n *\n * Compares values of Frame of Reference UID and Container Identifier attributes.\n *\n * @param slide - Slide metadata object\n * @param image - Metadata of VOLUME, LABEL or OVERVIEW image instance\n */\nfunction _doesImageBelongToSlide (\n slide: SlideImageCollection,\n image: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean {\n if (\n slide.frameOfReferenceUID === image.FrameOfReferenceUID &&\n slide.containerIdentifier === image.ContainerIdentifier &&\n slide.acquisitionUID === image.AcquisitionUID\n ) {\n return true\n }\n return false\n}\n\nexport { Slide, createSlides }\n","import * as dmv from 'dicom-microscopy-viewer'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { StorageClasses } from '../data/uids'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './NotificationMiddleware'\nimport { createSlides, Slide } from '../data/slides'\n\ninterface FetchImageMetadataParams {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n onSuccess: (slides: Slide[]) => void\n onError: (error: Error) => void\n}\n\nexport const fetchImageMetadata = async ({\n clients,\n studyInstanceUID,\n onSuccess,\n onError\n}: FetchImageMetadataParams): Promise => {\n try {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n\n const client = clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(\n matchedSeries.map(async (s) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const loadingSeries = dataset as dmv.metadata.Series\n console.info(\n `retrieve metadata of series \"${loadingSeries.SeriesInstanceUID}\"`\n )\n const retrievedMetadata = await client.retrieveSeriesMetadata({\n studyInstanceUID: studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item) => {\n if (\n item['00080016']?.Value?.[0] ===\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n })\n )\n const newSlides = createSlides(images)\n onSuccess(newSlides)\n } catch (err) {\n console.error(err)\n const customError = new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.'\n )\n onError(customError)\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n customError\n )\n }\n}\n","import { useState, useEffect } from 'react'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { Slide } from '../data/slides'\nimport { fetchImageMetadata } from '../services/fetchImageMetadata'\n\ninterface UseSlidesProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\ninterface UseSlidesReturn {\n slides: Slide[]\n isLoading: boolean\n error: Error | null\n}\n\nconst slidesCache = new Map()\nconst pendingRequests = new Map>()\n\n/**\n * Hook to fetch and manage whole slide microscopy images for a given study.\n * Values are cached so they can be reused if props are not provided.\n *\n * @param props - Hook configuration props\n * @param props.clients - Map of DICOM web clients keyed by storage class\n */\nexport const useSlides = ({ clients, studyInstanceUID }: UseSlidesProps): UseSlidesReturn => {\n const [slides, setSlides] = useState([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState(null)\n\n useEffect(() => {\n if (studyInstanceUID === undefined) {\n setSlides([])\n setIsLoading(false)\n return\n }\n\n const cachedData = slidesCache.get(studyInstanceUID)\n if (cachedData !== undefined) {\n setSlides(cachedData)\n setIsLoading(false)\n return\n }\n\n setIsLoading(true)\n\n const fetchSlides = async (): Promise => {\n // Check if there's already a pending request for this study\n let pendingRequest = pendingRequests.get(studyInstanceUID)\n\n if (pendingRequest === undefined) {\n // Create a new promise for this request\n pendingRequest = new Promise((resolve, reject): void => {\n fetchImageMetadata({\n clients,\n studyInstanceUID,\n onSuccess: (newSlides) => {\n slidesCache.set(studyInstanceUID, newSlides)\n resolve(newSlides)\n },\n onError: (err) => {\n reject(err)\n }\n }).catch((err) => {\n reject(err)\n })\n })\n pendingRequests.set(studyInstanceUID, pendingRequest)\n }\n\n try {\n const newSlides = await pendingRequest\n setSlides(newSlides)\n setError(null)\n } catch (err) {\n setError(err as Error)\n setSlides([])\n } finally {\n pendingRequests.delete(studyInstanceUID)\n setIsLoading(false)\n }\n }\n\n void fetchSlides()\n }, [clients, studyInstanceUID])\n\n return { slides, isLoading, error }\n}\n","import { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport { AnnotationSettings } from '../AppConfig'\nimport ClinicalTrial from './ClinicalTrial'\nimport DicomWebManager from '../DicomWebManager'\nimport Patient from './Patient'\nimport Study from './Study'\nimport SlideList from './SlideList'\nimport SlideViewer from './SlideViewer'\n\nimport { User } from '../auth'\nimport { Slide } from '../data/slides'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { useSlides } from '../hooks/useSlides'\n\nfunction ParametrizedSlideViewer ({\n clients,\n slides,\n user,\n app,\n preload,\n enableAnnotationTools,\n annotations\n}: {\n clients: { [key: string]: DicomWebManager }\n slides: Slide[]\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload: boolean\n enableAnnotationTools: boolean\n annotations: AnnotationSettings[]\n}): JSX.Element | null {\n const { studyInstanceUID, seriesInstanceUID } = useParams()\n const location = useLocation()\n\n const selectedSlide = slides.find((slide: Slide) => {\n return slide.seriesInstanceUIDs.find((uid: string) => {\n return uid === seriesInstanceUID\n })\n })\n const searchParams = new URLSearchParams(location.search)\n let presentationStateUID: string | null | undefined\n if (!searchParams.has('access_token')) {\n presentationStateUID = searchParams.get('state')\n if (presentationStateUID === null) {\n presentationStateUID = undefined\n }\n }\n let viewer = null\n if (selectedSlide != null) {\n viewer = (\n \n )\n }\n return viewer\n}\n\ninterface ViewerProps extends RouteComponentProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n preload: boolean\n user?: {\n name: string\n email: string\n }\n}\n\nfunction Viewer (props: ViewerProps): JSX.Element | null {\n const { clients, studyInstanceUID, location, navigate } = props\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n\n const handleSeriesSelection = ({ seriesInstanceUID }: { seriesInstanceUID: string }): void => {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (location.pathname.includes('/projects/')) {\n urlPath = location.pathname\n if (!location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n location.pathname.includes('/series/') &&\n location.search != null\n ) {\n urlPath += location.search\n }\n\n navigate(urlPath, { replace: true })\n }\n\n if (isLoading) {\n return null\n }\n\n if (slides.length === 0) {\n return null\n }\n\n const firstSlide = slides[0]\n const volumeInstances = firstSlide.volumeImages\n if (volumeInstances.length === 0) {\n return null\n }\n const refImage = volumeInstances[0]\n\n /* If a series is encoded in the path, route the viewer to this series.\n * Otherwise select the first series correspondent to\n * the first slide contained in the study.\n */\n let selectedSeriesInstanceUID: string\n if (location.pathname.includes('series/')) {\n const seriesFragment = location.pathname.split('series/')[1]\n selectedSeriesInstanceUID = seriesFragment.includes('/') ? seriesFragment.split('/')[0] : seriesFragment\n } else {\n selectedSeriesInstanceUID = volumeInstances[0].SeriesInstanceUID\n }\n\n let clinicalTrialMenu\n if (refImage.ClinicalTrialSponsorName != null) {\n clinicalTrialMenu = (\n \n \n \n )\n }\n\n return (\n \n \n \n \n \n \n \n \n \n {clinicalTrialMenu}\n \n \n \n \n \n\n \n \n }\n />\n \n \n )\n}\n\nexport default withRouter(Viewer)\n","import dcmjs from 'dcmjs'\n\nconst { DicomMetaDictionary } = dcmjs.data\n\ninterface TagInfo {\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TagInfo[]\n level: number\n}\n\nexport interface DicomTag {\n name: string\n vr: string\n Value?: any[]\n [key: string]: any\n}\n\nconst formatValue = (val: any): string => {\n if (typeof val === 'object' && val !== null) {\n return JSON.stringify(val)\n }\n return String(val)\n}\n\nexport const formatTagValue = (tag: DicomTag): string => {\n if (tag.Value == null) return ''\n\n if (Array.isArray(tag.Value)) {\n return tag.Value.map(formatValue).join(', ')\n }\n\n return formatValue(tag.Value)\n}\n\n/**\n * Processes DICOM metadata and returns a flattened array of tag information\n * @param metadata - The DICOM metadata object to process\n * @param depth - The current depth level for nested sequences (default: 0)\n * @returns Array of processed tag information\n */\nexport function getRows (metadata: Record, depth = 0): TagInfo[] {\n if (metadata === undefined || metadata === null) return []\n const keywords = Object.keys(metadata).filter(key => key !== '_vrMap')\n\n return keywords.flatMap(keyword => {\n // @ts-expect-error\n const tagInfo = DicomMetaDictionary.nameMap[keyword] as TagInfo | undefined\n let value = metadata[keyword]\n\n // Handle private or unknown tags\n if (tagInfo === undefined) {\n const regex = /[0-9A-Fa-f]{6}/g\n if (keyword.match(regex) == null) return []\n\n return [{\n tag: `(${keyword.substring(0, 4)},${keyword.substring(4, 8)})`,\n vr: '',\n keyword: 'Private Tag',\n value: value?.toString() ?? '',\n level: depth\n }]\n }\n\n // Handle sequence values (SQ VR)\n if (tagInfo.vr === 'SQ' && value !== undefined) {\n const sequenceItems = Array.isArray(value) ? value : [value]\n\n // Create a parent sequence node\n const sequenceNode: TagInfo = {\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword,\n value: `Sequence with ${sequenceItems.length} item(s)`,\n level: depth,\n children: []\n }\n\n // Create individual nodes for each sequence item\n sequenceNode.children = sequenceItems.map((item, index) => {\n const itemNode: TagInfo = {\n tag: `${tagInfo.tag}.${index + 1}`,\n vr: 'Item',\n keyword: `Item ${index + 1}`,\n value: `Sequence Item ${index + 1}`,\n level: depth + 1,\n children: getRows(item, depth + 2)\n }\n return itemNode\n })\n\n return [sequenceNode]\n }\n\n // Handle array values\n if (Array.isArray(value)) {\n value = value.map(formatValue).join('\\\\')\n } else if (typeof value === 'object' && value !== null) {\n value = formatValue(value)\n }\n\n return [{\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword: keyword.replace('RETIRED_', ''),\n value: value?.toString() ?? '',\n level: depth\n }]\n })\n}\n\n/**\n * Sorts DICOM tags alphabetically by tag value\n * @param metadata - The DICOM metadata object to process\n * @returns Sorted array of tag information\n */\nexport function getSortedTags (metadata: Record): TagInfo[] {\n const tagList = getRows(metadata)\n return tagList.sort((a, b) => a.tag.localeCompare(b.tag))\n}\n","/**\n * Formats a DICOM datetime string (YYYYMMDD:HHmmss) into a human-readable format\n *\n * @param dateStr - DICOM datetime string in format \"YYYYMMDD:HHmmss\"\n * @returns Formatted date string (e.g., \"Mon, Jan 1 2024\")\n * @example\n * formatDicomDate(\"20240101:120000\") // Returns \"Mon, Jan 1 2024\"\n * formatDicomDate(\"invalid\") // Returns \"invalid\"\n */\nexport const formatDicomDate = (dateStr: string): string => {\n // Parse YYYYMMDD:HHmmss format\n const match = dateStr.match(/^(\\d{4})(\\d{2})(\\d{2}):(\\d{2})(\\d{2})(\\d{2})/)\n if (match == null) return dateStr\n\n const [, year, month, day, hour, minute, second] = match\n\n // Validate month and day\n const monthNum = parseInt(month)\n const dayNum = parseInt(day)\n if (monthNum < 1 || monthNum > 12 || dayNum < 1 || dayNum > 31) {\n return dateStr\n }\n\n const date = new Date(\n parseInt(year),\n monthNum - 1, // months are 0-based\n dayNum,\n parseInt(hour),\n parseInt(minute),\n parseInt(second)\n )\n\n // Check if the date is invalid or if the month/day combination is invalid\n // This catches cases like February 31st where the date rolls over to March\n if (\n date.getMonth() !== monthNum - 1 || // month rolled over\n date.getDate() !== dayNum // day rolled over\n ) {\n return dateStr\n }\n\n // Format parts separately to avoid the extra comma\n const weekday = date.toLocaleDateString('en-US', { weekday: 'short' })\n const monthName = date.toLocaleDateString('en-US', { month: 'short' })\n const dayFormatted = date.getDate()\n const yearNum = date.getFullYear()\n\n return `${weekday}, ${monthName} ${dayFormatted} ${yearNum}`\n}\n","import { v4 as generateUUID } from 'uuid'\n\n/**\n * Consumer must implement:\n * this.listeners = {}\n * this.EVENTS = { \"EVENT_KEY\": \"EVENT_VALUE\" }\n */\nconst pubSubInterface = {\n subscribe,\n _broadcastEvent,\n _unsubscribe,\n _isValidEvent\n}\n\nexport default pubSubInterface\n\n/**\n * Subscribe to updates.\n *\n * @param {string} eventName The name of the event\n * @param {Function} callback Events callback\n * @return {Object} Observable object with actions\n */\nfunction subscribe (this: PubSubService, eventName: string, callback: Function): { unsubscribe: () => any } {\n if (this._isValidEvent(eventName)) {\n const listenerId = generateUUID()\n const subscription = { id: listenerId, callback }\n\n // console.info(`Subscribing to '${eventName}'.`);\n if (Array.isArray(this.listeners[eventName])) {\n this.listeners[eventName].push(subscription)\n } else {\n this.listeners[eventName] = [subscription]\n }\n\n return {\n unsubscribe: () => this._unsubscribe(eventName, listenerId)\n }\n } else {\n throw new Error(`Event ${eventName} not supported.`)\n }\n}\n\n/**\n * Unsubscribe to measurement updates.\n *\n * @param {string} eventName The name of the event\n * @param {string} listenerId The listeners id\n * @return void\n */\nfunction _unsubscribe (this: PubSubService, eventName: string, listenerId: string): void {\n if (this.listeners[eventName] === undefined) {\n return\n }\n\n const listeners = this.listeners[eventName]\n if (Array.isArray(listeners)) {\n this.listeners[eventName] = listeners.filter(({ id }) => id !== listenerId)\n } else {\n this.listeners[eventName] = []\n }\n}\n\n/**\n * Check if a given event is valid.\n *\n * @param {string} eventName The name of the event\n * @return {boolean} Event name validation\n */\nfunction _isValidEvent (this: PubSubService, eventName: string): boolean {\n return Object.values(this.EVENTS).includes(eventName)\n}\n\n/**\n * Broadcasts changes.\n *\n * @param {string} eventName - The event name\n * @param {func} callbackProps - Properties to pass callback\n * @return void\n */\nfunction _broadcastEvent (this: PubSubService, eventName: string, callbackProps: any): void {\n const hasListeners = Object.keys(this.listeners).length > 0\n const hasCallbacks = Array.isArray(this.listeners[eventName])\n\n if (hasListeners && hasCallbacks) {\n this.listeners[eventName].forEach((listener: { id: string, callback: Function }) => {\n listener.callback(callbackProps)\n })\n }\n}\n\n/** Export a PubSubService class to be used instead of the individual items */\nexport class PubSubService {\n EVENTS: any\n subscribe: (\n eventName: string,\n callback: Function\n ) => { unsubscribe: () => any }\n\n _broadcastEvent: (eventName: string, callbackProps: any) => void\n _unsubscribe: (eventName: string, listenerId: string) => void\n _isValidEvent: (eventName: string) => boolean\n listeners: { [key: string]: Array<{ id: string, callback: Function }> }\n unsubscriptions: any[]\n constructor (EVENTS: Record) {\n this.EVENTS = EVENTS\n this.subscribe = subscribe\n this._broadcastEvent = _broadcastEvent\n this._unsubscribe = _unsubscribe\n this._isValidEvent = _isValidEvent\n this.listeners = {}\n this.unsubscriptions = []\n }\n\n reset (): void {\n this.unsubscriptions.forEach((unsub) => unsub())\n this.unsubscriptions = []\n }\n\n /**\n * Creates an event that records whether or not someone\n * has consumed it. Call eventData.consume() to consume the event.\n * Check eventData.isConsumed to see if it is consumed or not.\n * @param props - to include in the event\n */\n protected createConsumableEvent (props: Record): Record {\n return {\n ...props,\n isConsumed: false,\n consume: function Consume () {\n this.isConsumed = true\n }\n }\n }\n}\n","import { Instance, Series } from '../services/DICOMMetadataStore'\n\nfunction createSeriesMetadata (SeriesInstanceUID: string, defaultInstances?: Instance[]): Series {\n const instances: Instance[] = []\n const instancesMap = new Map()\n\n return {\n SeriesInstanceUID,\n Modality: '',\n SeriesNumber: 0,\n SeriesDescription: '',\n SeriesDate: '',\n SeriesTime: '',\n ...defaultInstances?.[0],\n instances,\n addInstance: function (newInstance: Instance) {\n this.addInstances([newInstance])\n },\n addInstances: function (newInstances: Instance[]) {\n for (let i = 0, len = newInstances.length; i < len; i++) {\n const instance = newInstances[i]\n\n if (!instancesMap.has(instance.SOPInstanceUID)) {\n instancesMap.set(instance.SOPInstanceUID, instance)\n instances.push(instance)\n }\n }\n },\n getInstance: function (SOPInstanceUID: string) {\n return instancesMap.get(SOPInstanceUID)\n }\n }\n}\n\nexport default createSeriesMetadata\n","import createSeriesMetadata from './createSeriesMetadata'\n\nimport { Study, Series, Instance } from '../services/DICOMMetadataStore'\n\nfunction createStudyMetadata (StudyInstanceUID: string): Study {\n return {\n StudyInstanceUID,\n StudyDescription: '',\n PatientID: '',\n PatientName: '',\n StudyDate: '',\n AccessionNumber: '',\n NumInstances: 0,\n ModalitiesInStudy: [],\n isLoaded: false,\n series: [] as Series[],\n /**\n * @param {object} instance\n */\n addInstanceToSeries: function (instance: Instance) {\n this.addInstancesToSeries([instance])\n },\n /**\n * @param {object[]} instances\n * @param {string} instances[].SeriesInstanceUID\n * @param {string} instances[].StudyDescription\n */\n addInstancesToSeries: function (instances: Instance[]) {\n const { SeriesInstanceUID } = instances[0]\n\n if (this.StudyDescription !== '' && this.StudyDescription !== undefined) {\n this.StudyDescription = instances[0].StudyDescription\n }\n\n let series = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n series = createSeriesMetadata(SeriesInstanceUID, instances)\n this.series.push(series)\n }\n\n series.addInstances(instances)\n },\n\n setSeriesMetadata: function (\n SeriesInstanceUID: string,\n seriesMetadata: any\n ) {\n let existingSeries = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (existingSeries != null) {\n existingSeries = Object.assign(existingSeries, seriesMetadata)\n } else {\n const series = createSeriesMetadata(SeriesInstanceUID)\n this.series.push(Object.assign(series, seriesMetadata))\n }\n }\n }\n}\n\nexport default createStudyMetadata\n","import dcmjs from 'dcmjs'\n\nimport pubSubServiceInterface from '../utils/pubSubServiceInterface'\nimport createStudyMetadata from '../utils/createStudyMetadata'\n\nexport const EVENTS = {\n STUDY_ADDED: 'event::dicomMetadataStore:studyAdded',\n INSTANCES_ADDED: 'event::dicomMetadataStore:instancesAdded',\n SERIES_ADDED: 'event::dicomMetadataStore:seriesAdded',\n SERIES_UPDATED: 'event::dicomMetadataStore:seriesUpdated'\n}\n\nexport interface Instance {\n SOPInstanceUID: string\n SOPClassUID: string\n Rows: number\n Columns: number\n PatientSex: string\n Modality: string\n InstanceNumber: string\n imageId?: string\n [key: string]: any // For dynamic metadata properties\n}\n\nexport interface Series {\n Modality: string\n SeriesInstanceUID: string\n SeriesNumber: number\n SeriesDate: string\n SeriesTime: string\n SeriesDescription: string\n instances: Instance[]\n addInstance: (newInstance: Instance) => void\n addInstances: (newInstances: Instance[]) => void\n getInstance: (SOPInstanceUID: string) => Instance | undefined\n}\n\nexport interface Study {\n StudyInstanceUID: string\n StudyDescription: string\n PatientID: string\n PatientName: string\n StudyDate: string\n AccessionNumber: string\n NumInstances: number\n ModalitiesInStudy: any[]\n NumberOfStudyRelatedSeries?: number\n isLoaded: boolean\n series: Series[]\n addInstanceToSeries: (instance: Instance) => void\n addInstancesToSeries: (instances: Instance[]) => void\n setSeriesMetadata: (SeriesInstanceUID: string, metadata: any) => void\n}\n\ninterface Model {\n studies: Study[]\n}\n\nconst _model: Model = {\n studies: []\n}\n\nfunction _getStudyInstanceUIDs (): string[] {\n return _model.studies.map((aStudy) => aStudy.StudyInstanceUID)\n}\n\nfunction _getStudy (StudyInstanceUID: string): Study | undefined {\n return _model.studies.find(\n (aStudy) => aStudy.StudyInstanceUID === StudyInstanceUID\n )\n}\n\nfunction _getSeries (StudyInstanceUID: string, SeriesInstanceUID: string): Series | undefined {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n return study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n}\n\nfunction _getInstance (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n SOPInstanceUID: string\n): Instance | undefined {\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n\n if (series == null) {\n return\n }\n\n return series.getInstance(SOPInstanceUID)\n}\n\nfunction _getInstanceByImageId (imageId: string): Instance | undefined {\n for (const study of _model.studies) {\n for (const series of study.series) {\n for (const instance of series.instances) {\n if (instance.imageId === imageId) {\n return instance\n }\n }\n }\n }\n}\n\n/**\n * Update the metadata of a specific series\n * @param {*} StudyInstanceUID\n * @param {*} SeriesInstanceUID\n * @param {*} metadata metadata inform of key value pairs\n * @returns\n */\nfunction _updateMetadataForSeries (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n metadata: Record\n): void {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n const series = study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n return\n }\n\n const { instances } = series\n instances.forEach((instance) => {\n Object.keys(metadata).forEach((key) => {\n if (typeof metadata[key] === 'object') {\n instance[key] = { ...instance[key], ...metadata[key] }\n } else {\n instance[key] = metadata[key]\n }\n })\n })\n}\n\ninterface BaseImplementationType {\n EVENTS: typeof EVENTS\n listeners: Record\n addInstance: (dicomJSONDatasetOrP10ArrayBuffer: ArrayBuffer | Record) => void\n addInstances: (instances: Instance[], madeInClient?: boolean) => void\n updateSeriesMetadata: (seriesMetadata: Record) => void\n addSeriesMetadata: (seriesSummaryMetadata: Array>, madeInClient?: boolean) => void\n addStudy: (study: Record) => void\n getStudyInstanceUIDs: typeof _getStudyInstanceUIDs\n getStudy: typeof _getStudy\n getSeries: typeof _getSeries\n getInstance: typeof _getInstance\n getInstanceByImageId: typeof _getInstanceByImageId\n updateMetadataForSeries: typeof _updateMetadataForSeries\n _broadcastEvent: (eventName: string, data: any) => void\n}\n\nconst BaseImplementation: BaseImplementationType = {\n EVENTS,\n listeners: {},\n addInstance (dicomJSONDatasetOrP10ArrayBuffer) {\n let dicomJSONDataset\n\n // If Arraybuffer, parse to DICOMJSON before naturalizing.\n if (dicomJSONDatasetOrP10ArrayBuffer instanceof ArrayBuffer) {\n const dicomData = dcmjs.data.DicomMessage.readFile(\n dicomJSONDatasetOrP10ArrayBuffer\n )\n\n dicomJSONDataset = dicomData.dict\n } else {\n dicomJSONDataset = dicomJSONDatasetOrP10ArrayBuffer\n }\n\n let naturalizedDataset: Instance\n\n if (!('SeriesInstanceUID' in dicomJSONDataset)) {\n naturalizedDataset =\n dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomJSONDataset) as Instance\n } else {\n naturalizedDataset = dicomJSONDataset as unknown as Instance\n }\n\n const { StudyInstanceUID } = naturalizedDataset\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstanceToSeries(naturalizedDataset)\n },\n addInstances (instances, madeInClient = false) {\n const { StudyInstanceUID, SeriesInstanceUID } = instances[0]\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstancesToSeries(instances)\n\n // Broadcast an event even if we used cached data.\n // This is because the mode needs to listen to instances that are added to build up its active displaySets.\n // It will see there are cached displaySets and end early if this Series has already been fired in this\n // Mode session for some reason.\n this._broadcastEvent(EVENTS.INSTANCES_ADDED, {\n StudyInstanceUID,\n SeriesInstanceUID,\n madeInClient\n })\n },\n updateSeriesMetadata (seriesMetadata) {\n const { StudyInstanceUID, SeriesInstanceUID } = seriesMetadata\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n if (series == null) {\n return\n }\n\n const study = _getStudy(StudyInstanceUID)\n if (study != null) {\n study.setSeriesMetadata(SeriesInstanceUID, seriesMetadata)\n }\n },\n addSeriesMetadata (seriesSummaryMetadata, madeInClient = false) {\n if (\n seriesSummaryMetadata === undefined ||\n seriesSummaryMetadata.length === 0 ||\n seriesSummaryMetadata[0] === undefined\n ) {\n return\n }\n\n const { StudyInstanceUID } = seriesSummaryMetadata[0]\n let study = _getStudy(StudyInstanceUID)\n if (study == null) {\n study = createStudyMetadata(StudyInstanceUID)\n // Will typically be undefined with a compliant DICOMweb server, reset later\n study.StudyDescription = seriesSummaryMetadata[0].StudyDescription\n seriesSummaryMetadata?.forEach((item) => {\n if (study !== undefined && !study.ModalitiesInStudy?.includes(item.Modality)) {\n study.ModalitiesInStudy?.push(item.Modality)\n }\n })\n study.NumberOfStudyRelatedSeries = seriesSummaryMetadata.length\n _model.studies.push(study)\n }\n\n seriesSummaryMetadata.forEach((series) => {\n const { SeriesInstanceUID } = series\n study?.setSeriesMetadata(SeriesInstanceUID, series)\n })\n\n this._broadcastEvent(EVENTS.SERIES_ADDED, {\n StudyInstanceUID,\n seriesSummaryMetadata,\n madeInClient\n })\n },\n addStudy (study) {\n const { StudyInstanceUID } = study\n\n const existingStudy = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (existingStudy == null) {\n const newStudy = createStudyMetadata(StudyInstanceUID)\n\n newStudy.PatientID = study.PatientID\n newStudy.PatientName = study.PatientName\n newStudy.StudyDate = study.StudyDate\n newStudy.ModalitiesInStudy = study.ModalitiesInStudy\n newStudy.StudyDescription = study.StudyDescription\n newStudy.AccessionNumber = study.AccessionNumber\n newStudy.NumInstances = study.NumInstances // todo: Correct naming?\n\n _model.studies.push(newStudy)\n }\n },\n getStudyInstanceUIDs: _getStudyInstanceUIDs,\n getStudy: _getStudy,\n getSeries: _getSeries,\n getInstance: _getInstance,\n getInstanceByImageId: _getInstanceByImageId,\n updateMetadataForSeries: _updateMetadataForSeries,\n _broadcastEvent (eventName: string, data: any): void {\n }\n}\n\ninterface DicomMetadataStoreType extends BaseImplementationType {\n subscribe: (event: string, callback: (data: any) => void) => { unsubscribe: () => any }\n unsubscribe: (event: string, callback: (data: any) => void) => void\n}\n\nconst DicomMetadataStore = Object.assign(\n {},\n BaseImplementation,\n pubSubServiceInterface\n) as unknown as DicomMetadataStoreType\n\nexport { DicomMetadataStore }\nexport default DicomMetadataStore\n","import { useState, useEffect } from 'react'\n\n/**\n * A hook that delays updating a value for the specified time\n * @param value The value to debounce\n * @param delay The delay time in milliseconds\n * @returns The debounced value\n * @example\n * const debouncedSearchTerm = useDebounce(searchTerm, 300)\n */\nexport const useDebounce = (value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n","import { useState, useMemo, useEffect } from 'react'\nimport { Select, Input, Slider, Typography, Table } from 'antd'\nimport { SearchOutlined } from '@ant-design/icons'\n\nimport DicomWebManager from '../../DicomWebManager'\nimport './DicomTagBrowser.css'\nimport { useSlides } from '../../hooks/useSlides'\nimport { getSortedTags } from './dicomTagUtils'\nimport { formatDicomDate } from '../../utils/formatDicomDate'\nimport DicomMetadataStore, { Series, Study } from '../../services/DICOMMetadataStore'\nimport { useDebounce } from '../../hooks/useDebounce'\n\nconst { Option } = Select\n\ninterface DisplaySet {\n displaySetInstanceUID: number\n SeriesDate?: string\n SeriesTime?: string\n SeriesNumber: string\n SeriesDescription?: string\n Modality: string\n images: any[]\n}\n\ninterface TableDataItem {\n key: string\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TableDataItem[]\n}\n\ninterface DicomTagBrowserProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\nconst DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): JSX.Element => {\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n const [study, setStudy] = useState(undefined)\n\n const [displaySets, setDisplaySets] = useState([])\n const [selectedDisplaySetInstanceUID, setSelectedDisplaySetInstanceUID] = useState(0)\n const [instanceNumber, setInstanceNumber] = useState(1)\n const [filterValue, setFilterValue] = useState('')\n const [expandedKeys, setExpandedKeys] = useState([])\n const [searchInput, setSearchInput] = useState('')\n\n const debouncedSearchValue = useDebounce(searchInput, 300)\n\n useEffect(() => {\n if (debouncedSearchValue === '') {\n setFilterValue('')\n setExpandedKeys([])\n } else {\n setFilterValue(debouncedSearchValue)\n }\n }, [debouncedSearchValue])\n\n useEffect(() => {\n const handler = (event: any): void => {\n const study: Study | undefined = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n }\n const seriesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.SERIES_ADDED, handler)\n const instancesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.INSTANCES_ADDED, handler)\n\n const study = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n\n return () => {\n seriesAddedSubscription.unsubscribe()\n instancesAddedSubscription.unsubscribe()\n }\n }, [studyInstanceUID])\n\n useEffect(() => {\n let displaySets: DisplaySet[] = []\n let derivedDisplaySets: DisplaySet[] = []\n const processedSeries: string[] = []\n let index = 0\n\n if (slides.length > 0) {\n displaySets = slides\n .map((slide): DisplaySet | null => {\n const { volumeImages } = slide\n if (volumeImages?.[0] === undefined) return null\n\n const {\n SeriesDate,\n SeriesTime,\n SeriesNumber,\n SeriesInstanceUID,\n SeriesDescription,\n Modality\n } = volumeImages[0]\n\n processedSeries.push(SeriesInstanceUID)\n\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate,\n SeriesTime,\n SeriesInstanceUID,\n // @ts-expect-error\n SeriesNumber,\n SeriesDescription,\n Modality,\n images: volumeImages\n }\n index++\n return ds\n })\n .filter((set): set is DisplaySet => set !== null)\n }\n\n if (study !== undefined && study.series?.length > 0) {\n derivedDisplaySets = study.series.filter(s => !processedSeries.includes(s.SeriesInstanceUID))\n .map((series: Series): DisplaySet => {\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate: series.SeriesDate,\n SeriesTime: series.SeriesTime,\n // @ts-expect-error\n SeriesNumber: series.SeriesNumber,\n SeriesDescription: series.SeriesDescription,\n SeriesInstanceUID: series.SeriesInstanceUID,\n Modality: series.Modality,\n images: series?.instances?.length > 0 ? series.instances : [series]\n }\n index++\n return ds\n })\n }\n\n setDisplaySets([...displaySets, ...derivedDisplaySets])\n }, [slides, study])\n\n const displaySetList = useMemo(() => {\n displaySets.sort((a, b) => Number(a.SeriesNumber) - Number(b.SeriesNumber))\n return displaySets.map((displaySet, index) => {\n const {\n SeriesDate = '',\n SeriesTime = '',\n SeriesNumber = '',\n SeriesDescription = '',\n Modality = ''\n } = displaySet\n\n const dateStr = `${SeriesDate}:${SeriesTime}`.split('.')[0]\n const displayDate = formatDicomDate(dateStr)\n\n return {\n value: index,\n label: `${SeriesNumber} (${Modality}): ${SeriesDescription}`,\n description: displayDate\n }\n })\n }, [displaySets])\n\n const showInstanceList =\n displaySets[selectedDisplaySetInstanceUID]?.images.length > 1\n\n console.debug('displaySets:', displaySets)\n\n const instanceSliderMarks = useMemo(() => {\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return {}\n const totalInstances = displaySets[selectedDisplaySetInstanceUID].images.length\n\n // Create marks for first, middle, and last instances\n const marks: Record = {\n 1: '1', // First\n [Math.ceil(totalInstances / 2)]: String(Math.ceil(totalInstances / 2)), // Middle\n [totalInstances]: String(totalInstances) // Last\n }\n\n return marks\n }, [selectedDisplaySetInstanceUID, displaySets])\n\n const columns = [\n {\n title: 'Tag',\n dataIndex: 'tag',\n key: 'tag',\n width: '30%'\n },\n {\n title: 'VR',\n dataIndex: 'vr',\n key: 'vr',\n width: '5%'\n },\n {\n title: 'Keyword',\n dataIndex: 'keyword',\n key: 'keyword',\n width: '30%'\n },\n {\n title: 'Value',\n dataIndex: 'value',\n key: 'value',\n width: '40%'\n }\n ]\n\n const tableData = useMemo(() => {\n const transformTagsToTableData = (tags: any[], parentKey = ''): TableDataItem[] => {\n return tags.map((tag, index) => {\n // Create a unique key using tag value if available, otherwise use index\n const keyBase: string = tag.tag !== '' ? tag.tag.replace(/[(),]/g, '') : index.toString()\n const currentKey: string = parentKey !== '' ? `${parentKey}-${keyBase}` : keyBase\n\n const item: TableDataItem = {\n key: currentKey,\n tag: tag.tag,\n vr: tag.vr,\n keyword: tag.keyword,\n value: tag.value\n }\n\n if (tag.children !== undefined && tag.children.length > 0) {\n item.children = transformTagsToTableData(tag.children, currentKey)\n }\n\n return item\n })\n }\n\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return []\n const metadata = displaySets[selectedDisplaySetInstanceUID]?.images[instanceNumber - 1]\n const tags = getSortedTags(metadata)\n return transformTagsToTableData(tags)\n }, [instanceNumber, selectedDisplaySetInstanceUID, displaySets])\n\n const filteredData = useMemo(() => {\n if (filterValue === undefined || filterValue === '') return tableData\n\n const searchLower = filterValue.toLowerCase()\n const matchedKeys = new Set()\n\n const nodeMatches = (node: TableDataItem): boolean => {\n return (\n (node.tag?.toLowerCase() ?? '').includes(searchLower) ||\n (node.vr?.toLowerCase() ?? '').includes(searchLower) ||\n (node.keyword?.toLowerCase() ?? '').includes(searchLower) ||\n (node.value?.toString().toLowerCase() ?? '').includes(searchLower)\n )\n }\n\n // First pass: find all matching nodes and their parent paths\n const findMatchingPaths = (\n node: TableDataItem,\n parentPath: TableDataItem[] = []\n ): TableDataItem[][] => {\n const currentPath = [...parentPath, node]\n let matchingPaths: TableDataItem[][] = []\n\n if (nodeMatches(node)) {\n matchingPaths.push(currentPath)\n }\n\n if (node.children != null) {\n node.children.forEach(child => {\n const childPaths = findMatchingPaths(child, currentPath)\n matchingPaths = [...matchingPaths, ...childPaths]\n })\n }\n\n return matchingPaths\n }\n\n // Find all paths that contain matches\n const matchingPaths = tableData.flatMap(node => findMatchingPaths(node))\n\n // Second pass: reconstruct the tree with matching paths\n const reconstructTree = (\n paths: TableDataItem[][],\n level = 0\n ): TableDataItem[] => {\n if (paths.length === 0 || level >= paths[0].length) return []\n\n const nodesAtLevel = new Map()\n\n paths.forEach(path => {\n if (level < path.length) {\n const node = path[level]\n if (!nodesAtLevel.has(node.key)) {\n nodesAtLevel.set(node.key, {\n node: { ...node },\n childPaths: []\n })\n }\n if (level + 1 < path.length) {\n nodesAtLevel.get(node.key)?.childPaths.push(path)\n }\n }\n })\n\n return Array.from(nodesAtLevel.values()).map(({ node, childPaths }) => {\n matchedKeys.add(node.key)\n const children = reconstructTree(childPaths, level + 1)\n return children.length > 0 ? { ...node, children } : node\n })\n }\n\n const filtered = reconstructTree(matchingPaths)\n setExpandedKeys(Array.from(matchedKeys))\n\n return filtered\n }, [tableData, filterValue])\n\n if (isLoading) {\n return
Loading...
\n }\n\n return (\n
\n \n
\n
\n Slides\n {\n setSelectedDisplaySetInstanceUID(value)\n setInstanceNumber(1)\n }}\n optionLabelProp='label'\n optionFilterProp='label'\n >\n {displaySetList.map((item) => (\n
\n \n ))}\n \n
\n\n {showInstanceList && (\n
\n \n Instance Number: {instanceNumber}\n \n setInstanceNumber(value)}\n marks={instanceSliderMarks}\n tooltip={{\n formatter: (value: number | undefined) => value !== undefined ? `Instance ${value}` : ''\n }}\n />\n
\n )}\n
\n\n }\n onChange={(e) => setSearchInput(e.target.value)}\n value={searchInput}\n />\n\n setExpandedKeys(keys as string[])\n }}\n size='small'\n scroll={{ y: 500 }}\n />\n \n \n )\n}\n\nexport default DicomTagBrowser\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\n FileSearchOutlined,\n UnorderedListOutlined,\n UserOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport { detect } from 'detect-browser'\n\nimport Button from './Button'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport NotificationMiddleware, { NotificationMiddlewareEvents } from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\nimport { v4 as uuidv4 } from 'uuid'\nimport DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser'\nimport DicomWebManager from '../DicomWebManager'\n\ninterface HeaderProps extends RouteComponentProps {\n app: {\n name: string\n version: string\n homepage: string\n uid: string\n organization?: string\n }\n user?: {\n name: string\n email: string\n }\n clients: { [key: string]: DicomWebManager }\n showWorklistButton: boolean\n onServerSelection: ({ url }: { url: string }) => void\n onUserLogout?: () => void\n showServerSelectionButton: boolean\n}\n\ninterface ExtendedCustomError extends CustomError {\n source: string\n}\n\ninterface HeaderState {\n selectedServerUrl?: string\n isServerSelectionModalVisible: boolean\n isServerSelectionDisabled: boolean\n errorObj: ExtendedCustomError[]\n errorCategory: string[]\n warnings: string[]\n}\n\n/**\n * React component for the application header.\n */\nclass Header extends React.Component {\n constructor (props: HeaderProps) {\n super(props)\n this.state = {\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n }\n\n const onErrorHandler = ({ source, error }: {\n source: string\n error: CustomError\n }): void => {\n this.setState(state => ({\n ...state,\n errorObj: [...state.errorObj, { ...error, source }],\n errorCategory: [...state.errorCategory, error.type]\n }))\n }\n\n const onWarningHandler = (warning: string): void => {\n this.setState(state => ({\n ...state,\n warnings: [...state.warnings, warning]\n }))\n }\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnError,\n onErrorHandler\n )\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnWarning,\n onWarningHandler\n )\n }\n\n componentDidUpdate (prevProps: Readonly, prevState: Readonly): void {\n if (((prevState.warnings.length > 0) || (prevState.errorObj.length > 0)) && this.props.location.pathname !== prevProps.location.pathname) {\n this.setState({\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n })\n }\n }\n\n handleInfoButtonClick = (): void => {\n const browser = detect()\n const environment: {\n browser: {\n name?: string\n version?: string\n }\n os: {\n name?: string\n }\n } = {\n browser: {},\n os: {}\n }\n if (browser != null) {\n environment.browser = {\n name: browser.name != null ? browser.name : undefined,\n version: browser.version != null ? browser.version : undefined\n }\n environment.os = {\n name: browser.os != null ? browser.os : undefined\n }\n }\n\n Modal.info({\n title: 'About',\n width: 600,\n content: (\n <>\n \n \n {this.props.app.name}\n \n \n {this.props.app.version}\n \n \n {this.props.app.homepage}\n \n \n \n \n {environment.browser.name}\n \n \n {environment.browser.version}\n \n \n \n \n {environment.os.name}\n \n \n \n ),\n onOk (): void {}\n })\n }\n\n handleDicomTagBrowserButtonClick = (): void => {\n const width = window.innerWidth - 200\n Modal.info({\n title: 'DICOM Tag Browser',\n width,\n content: ,\n onOk (): void {}\n })\n }\n\n handleDebugButtonClick = (): void => {\n const errorMsgs: {\n Authentication: string[]\n Communication: string[]\n EncodingDecoding: string[]\n Visualization: string[]\n } = {\n Authentication: [],\n Communication: [],\n EncodingDecoding: [],\n Visualization: []\n }\n\n type ObjectKey = keyof typeof errorMsgs\n const errorNum = this.state.errorObj.length\n\n if (errorNum > 0) {\n for (let i = 0; i < errorNum; i++) {\n const category = this.state.errorCategory[i] as ObjectKey\n errorMsgs[category].push(`${this.state.errorObj[i].message as string} (Source: ${this.state.errorObj[i].source})`)\n }\n }\n\n const { Panel } = Collapse\n\n const showErrorCount = (errcount: number): JSX.Element => (\n \n )\n\n const showWarningCount = (warncount: number): JSX.Element => (\n \n )\n\n Modal.info({\n title: 'Debug Information\\n (Check console for more information)',\n width: 800,\n content: (\n \n \n
    \n {errorMsgs.Communication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.EncodingDecoding.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Visualization.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Authentication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {this.state.warnings.map(warning => (\n
  1. {warning}
  2. \n ))}\n
\n \n
\n ),\n onOk (): void {}\n })\n }\n\n handleServerSelectionButtonClick = (): void => {\n this.setState({ isServerSelectionModalVisible: true })\n }\n\n render (): React.ReactNode {\n let user = null\n if (this.props.user !== undefined) {\n const userMenuItems = []\n if (this.props.onUserLogout !== undefined) {\n userMenuItems.push(\n {\n label: 'Logout',\n key: 'user-logout',\n onClick: () => {\n if (this.props.onUserLogout !== undefined) {\n this.props.onUserLogout()\n }\n }\n }\n )\n }\n const userMenu = { items: userMenuItems }\n user = (\n \n e.preventDefault()}\n label={`${this.props.user.name} (${this.props.user.email})`}\n />\n \n )\n }\n\n let worklistButton\n if (this.props.showWorklistButton) {\n worklistButton = (\n \n \n this.handleReset(clearFilters)}\n size='small'\n style={{ width: 90 }}\n >\n Reset\n \n \n \n ),\n filterIcon: (filtered: boolean) => (\n \n )\n })\n}\n\nexport default withRouter(Worklist)\n","/**\n * Join a URI with a path to form a full URL.\n *\n * @param path - Path component\n * @param uri - Base URI to which the path component should be added\n */\nexport const joinUrl = (path: string, uri: string): string => {\n let baseUri = uri\n if (!baseUri.endsWith('/')) {\n baseUri += '/'\n }\n const url = new URL(path, baseUri)\n return url.toString()\n}\n\n/**\n * Check whether a URL contains an OAuth 2.0 authorization code.\n *\n * @param location - URL components (JavaScript location object)\n * @returns Whether the URL contains a code\n */\nexport const isAuthorizationCodeInUrl = (location: {\n search: string\n hash: string\n}): boolean => {\n const searchParams = new URLSearchParams(location.search)\n const hashParams = new URLSearchParams(location.hash.replace('#', '?'))\n\n return Boolean(\n searchParams.get('code') ??\n searchParams.get('id_token') ??\n searchParams.get('session_state') ??\n hashParams.get('code') ??\n hashParams.get('id_token') ??\n hashParams.get('session_state')\n )\n}\n","import { UserManager, User as UserData } from 'oidc-client'\n\nimport { OidcSettings } from '../AppConfig'\nimport { isAuthorizationCodeInUrl } from '../utils/url'\nimport { User, AuthManager, SignInCallback } from './'\nimport NotificationMiddleware,\n{ NotificationMiddlewareContext } from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nconst createUser = (userData: UserData | null): User => {\n let profile\n if (userData !== null) {\n profile = userData.profile\n }\n\n if (profile !== undefined) {\n if (profile.name === undefined || profile.email === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user \"name\" and \"email\".'\n )\n )\n } else {\n return {\n name: profile.name,\n email: profile.email\n }\n }\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n return {\n name: undefined,\n email: undefined\n }\n}\n\nexport default class OidcManager implements AuthManager {\n private _oidc: UserManager\n\n constructor (baseUri: string, settings: OidcSettings) {\n let responseType = 'code'\n if (settings.grantType !== undefined) {\n if (settings.grantType === 'implicit') {\n responseType = 'id_token token'\n }\n }\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`\n })\n if (settings.endSessionEndpoint != null) {\n /*\n * Unfortunately, the end session endpoint alone cannot be provided to\n * the construction of UserManager and the other metadata parameters\n * would need to be provided as well. However, configuring all of them\n * individually would not be desirable and they will be automatically\n * determined anyways. Therefore, we first construct an object, get the\n * metadata, update the metadata, and then reconstruct an object with the\n * updated metadata.\n */\n this._oidc.metadataService.getMetadata().then(metadata => {\n if (settings.endSessionEndpoint != null) {\n metadata.end_session_endpoint = settings.endSessionEndpoint\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`,\n metadata\n })\n }\n }).catch((error) => {\n console.error(\n 'failed to get metadata from authorization server: ',\n error\n )\n })\n }\n }\n\n /**\n * Sign-in to authenticate the user and obtain authorization.\n */\n signIn = async ({ onSignIn }: {\n onSignIn?: SignInCallback\n }): Promise => {\n const handleSignIn = (userData: UserData): void => {\n const user = createUser(userData)\n const authorization = `${userData.token_type} ${userData.access_token}`\n if (onSignIn != null) {\n console.info('handling sign-in using provided callback function')\n onSignIn({ user: user, authorization: authorization })\n } else {\n console.warn('no callback function was provided to handle sign-in')\n }\n }\n\n if (isAuthorizationCodeInUrl(window.location)) {\n /* Handle the callback from the authorization server: extract the code\n * from the callback URL, obtain user information and the access token\n * for the DICOMweb server.\n */\n console.info('obtaining authorization')\n const userData = await this._oidc.signinCallback()\n if (userData != null) {\n console.info('obtained user data: ', userData)\n handleSignIn(userData)\n }\n } else {\n /* Redirect to the authorization server to authenticate the user\n * and authorize the application to obtain user information and access\n * the DICOMweb server.\n */\n const userData = await this._oidc.getUser()\n if (userData === null || userData.expired) {\n console.info('authenticating user')\n await this._oidc.signinRedirect()\n } else {\n console.info('user has already been authenticated')\n handleSignIn(userData)\n }\n }\n }\n\n /**\n * Sign-out to revoke authorization.\n */\n signOut = async (): Promise => {\n console.log('signing out user and revoking authorization')\n return await this._oidc.signoutRedirect()\n }\n\n /**\n * Get authorization. Requires prior sign-in.\n */\n getAuthorization = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData !== null) {\n return userData.access_token\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n })\n }\n\n /**\n * Get user information. Requires prior sign-in.\n */\n getUser = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData === null) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user information.'\n )\n )\n }\n return createUser(userData)\n })\n }\n}\n","import retry from 'retry'\n\nimport {\n RetryRequestSettings,\n DICOMwebClientRequestHookMetadata\n} from '../AppConfig'\n\ntype RequestHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n) => XMLHttpRequest\n\n/**\n * Returns a configured retry request hook function\n * that can be used to add retry functionality to XHR request.\n *\n * Default options:\n * retries: 5\n * factor: 3\n * minTimeout: 1 * 1000\n * maxTimeout: 60 * 1000\n * randomize: true\n *\n * @param options\n * @param options.retires - Number of retries\n * @param options.factor - Factor\n * @param options.minTimeout - Min number of seconds to wait before next retry\n * @param options.maxTimeout - Max number of seconds to wait before next retry\n * @param options.randomize - Whether randomization should be applied\n * @param options.retryableStatusCodes HTTP status codes that can trigger a retry\n * @returns Configured retry request function\n */\nexport const getXHRRetryHook = (options: RetryRequestSettings = {\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n retryableStatusCodes: [429, 500]\n}): RequestHook => {\n const retryOptions = options\n\n if (options.retries != null) {\n retryOptions.retries = options.retries\n }\n\n if (options.factor != null) {\n retryOptions.factor = options.factor\n }\n\n if (options.minTimeout != null) {\n retryOptions.minTimeout = options.minTimeout\n }\n\n if (options.maxTimeout != null) {\n retryOptions.maxTimeout = options.maxTimeout\n }\n\n if (options.randomize != null) {\n retryOptions.randomize = options.randomize\n }\n\n if (options.retryableStatusCodes != null) {\n retryOptions.retryableStatusCodes = options.retryableStatusCodes\n }\n\n /**\n * Request hook used to add retry functionality to XHR requests.\n *\n * @param request - XHR request instance\n * @param metadata - Metadata about the request\n * @param metadata.url - URL\n * @param metadata.method - HTTP method\n * @returns - XHR request instance (potentially modified)\n */\n const xhrRetryHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n ): XMLHttpRequest => {\n const { url, method } = metadata\n\n function faultTolerantRequestSend (...args: any): void {\n const operation = retry.operation(retryOptions)\n\n operation.attempt(function operationAttempt (currentAttempt) {\n const originalOnReadyStateChange = request.onreadystatechange\n\n /** Overriding/extending XHR function */\n request.onreadystatechange = function onReadyStateChange (...args: any): void {\n if (originalOnReadyStateChange != null) {\n originalOnReadyStateChange.apply(request, args)\n }\n\n if (retryOptions.retryableStatusCodes.includes(request.status)) {\n const errorMessage = `Attempt to request ${url} failed.`\n const attemptFailedError = new Error(errorMessage)\n operation.retry(attemptFailedError)\n }\n }\n\n /** Call open only on retry (after headers and other things were set in the xhr instance) */\n if (currentAttempt > 1) {\n console.warn(`Requesting ${url}... (attempt: ${currentAttempt})`)\n request.open(method, url, true)\n }\n })\n\n originalRequestSend.apply(request, args)\n }\n\n /** Overriding/extending XHR function */\n const originalRequestSend = request.send\n request.send = faultTolerantRequestSend\n\n return request\n }\n\n return xhrRetryHook\n}\n\nexport default getXHRRetryHook\n","import * as dwc from 'dicomweb-client'\nimport * as dcmjs from 'dcmjs'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport { ServerSettings, DicomWebManagerErrorHandler } from './AppConfig'\nimport { joinUrl } from './utils/url'\nimport getXHRRetryHook from './utils/xhrRetryHook'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\nimport DicomMetadataStore, { Instance } from './services/DICOMMetadataStore'\n\nconst { naturalizeDataset } = dcmjs.data.DicomMetaDictionary\n\ninterface Store {\n id: string\n read: boolean\n write: boolean\n client: dwc.api.DICOMwebClient\n}\n\nexport default class DicomWebManager implements dwc.api.DICOMwebClient {\n private readonly stores: Store[] = []\n\n private readonly handleError: DicomWebManagerErrorHandler\n\n constructor ({ baseUri, settings, onError }: {\n baseUri: string\n settings: ServerSettings[]\n onError?: DicomWebManagerErrorHandler\n }) {\n if (onError != null) {\n this.handleError = onError\n } else {\n this.handleError = (error, serverSettings) => {\n console.error(error, serverSettings)\n }\n }\n\n settings.forEach(serverSettings => {\n if (serverSettings === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'At least one server needs to be configured.'\n )\n )\n }\n\n let serviceUrl\n if (serverSettings.url !== undefined) {\n serviceUrl = serverSettings.url\n } else if (serverSettings.path !== undefined) {\n serviceUrl = joinUrl(serverSettings.path, baseUri)\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Either path or full URL needs to be configured for server.'\n )\n )\n }\n\n const hasHttpsUrl = (url?: string): boolean => url?.startsWith('https') ?? false\n\n const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\n }\n\n const shouldUpgradeInsecure = serverSettings.upgradeInsecureRequests === true && [\n serviceUrl,\n serverSettings.qidoPathPrefix,\n serverSettings.wadoPathPrefix,\n serverSettings.stowPathPrefix\n ].some(hasHttpsUrl)\n\n if (serverSettings.qidoPathPrefix !== undefined) {\n clientSettings.qidoURLPrefix = serverSettings.qidoPathPrefix\n }\n if (serverSettings.wadoPathPrefix !== undefined) {\n clientSettings.wadoURLPrefix = serverSettings.wadoPathPrefix\n }\n if (serverSettings.stowPathPrefix !== undefined) {\n clientSettings.stowURLPrefix = serverSettings.stowPathPrefix\n }\n\n if (shouldUpgradeInsecure) {\n clientSettings.headers = {\n ...clientSettings.headers,\n 'Content-Security-Policy': 'upgrade-insecure-requests'\n }\n }\n\n if (serverSettings.retry !== undefined) {\n clientSettings.requestHooks = [getXHRRetryHook(serverSettings.retry)]\n }\n\n clientSettings.errorInterceptor = (error: dwc.api.DICOMwebClientError) => {\n this.handleError(error, serverSettings)\n }\n\n this.stores.push({\n id: serverSettings.id,\n write: serverSettings.write ?? false,\n read: serverSettings.read ?? true,\n client: new dwc.api.DICOMwebClient(clientSettings)\n })\n })\n\n if (this.stores.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one store is supported for now.'\n )\n )\n }\n }\n\n get baseURL (): string {\n return this.stores[0].client.baseURL\n }\n\n updateHeaders = (fields: { [name: string]: string }): void => {\n for (const f in fields) {\n this.stores[0].client.headers[f] = fields[f]\n }\n }\n\n get headers (): { [name: string]: string } {\n return this.stores[0].client.headers\n }\n\n storeInstances = async (\n options: dwc.api.StoreInstancesOptions\n ): Promise => {\n if (this.stores[0].write) {\n return await this.stores[0].client.storeInstances(options)\n } else {\n return await Promise.reject(\n new Error('Store is not writable.')\n )\n }\n }\n\n searchForStudies = async (\n options: dwc.api.SearchForStudiesOptions\n ): Promise => {\n return await this.stores[0].client.searchForStudies(options)\n }\n\n searchForSeries = async (\n options: dwc.api.SearchForSeriesOptions\n ): Promise => {\n return await this.stores[0].client.searchForSeries(options)\n }\n\n searchForInstances = async (\n options: dwc.api.SearchForInstancesOptions\n ): Promise => {\n return await this.stores[0].client.searchForInstances(options)\n }\n\n retrieveStudyMetadata = async (\n options: dwc.api.RetrieveStudyMetadataOptions\n ): Promise => {\n const studySummaryMetadata = await this.stores[0].client.retrieveStudyMetadata(options)\n const naturalized = naturalizeDataset(studySummaryMetadata)\n DicomMetadataStore.addStudy(naturalized)\n return studySummaryMetadata\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n const seriesSummaryMetadata = await this.stores[0].client.retrieveSeriesMetadata(options)\n console.debug('seriesSummaryMetadata:', seriesSummaryMetadata)\n const naturalized = seriesSummaryMetadata.map(naturalizeDataset)\n console.debug('naturalized:', naturalized)\n DicomMetadataStore.addSeriesMetadata(naturalized, true)\n return seriesSummaryMetadata\n }\n\n retrieveInstanceMetadata = async (\n options: dwc.api.RetrieveInstanceMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceMetadata(options)\n }\n\n retrieveInstance = async (\n options: dwc.api.RetrieveInstanceOptions\n ): Promise => {\n const instance = await this.stores[0].client.retrieveInstance(options)\n const data = dcmjs.data.DicomMessage.readFile(instance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n DicomMetadataStore.addInstances([dataset as Instance])\n return instance\n }\n\n retrieveInstanceFrames = async (\n options: dwc.api.RetrieveInstanceFramesOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFrames(options)\n }\n\n retrieveInstanceRendered = async (\n options: dwc.api.RetrieveInstanceRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceRendered(options)\n }\n\n retrieveInstanceFramesRendered = async (\n options: dwc.api.RetrieveInstanceFramesRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFramesRendered(options)\n }\n\n retrieveBulkData = async (\n options: dwc.api.RetrieveBulkDataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveBulkData(options)\n }\n}\n","import React from 'react'\nimport {\n BrowserRouter,\n Navigate,\n Route,\n Routes,\n useParams\n} from 'react-router-dom'\nimport { Layout, message } from 'antd'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dwc from 'dicomweb-client'\n\nimport AppConfig, { ServerSettings, ErrorMessageSettings } from './AppConfig'\nimport CaseViewer from './components/CaseViewer'\nimport Header from './components/Header'\nimport InfoPage from './components/InfoPage'\nimport Worklist from './components/Worklist'\n\nimport { User, AuthManager } from './auth'\nimport OidcManager from './auth/OidcManager'\nimport { StorageClasses } from './data/uids'\nimport DicomWebManager from './DicomWebManager'\nimport { joinUrl } from './utils/url'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\n\nfunction ParametrizedCaseViewer ({ clients, user, app, config }: {\n clients: { [key: string]: DicomWebManager }\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n config: AppConfig\n}): JSX.Element {\n const { studyInstanceUID } = useParams()\n\n const enableAnnotationTools = !(config.disableAnnotationTools ?? false)\n const preload = config.preload ?? false\n return (\n \n )\n}\n\nfunction _createClientMapping ({ baseUri, gcpBaseUrl, settings, onError }: {\n baseUri: string\n gcpBaseUrl: string\n settings: ServerSettings[]\n onError: (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ) => void\n}): { [sopClassUID: string]: DicomWebManager } {\n const storageClassMapping: { [key: string]: number } = { default: 0 }\n const clientMapping: { [sopClassUID: string]: DicomWebManager } = {}\n\n settings.forEach(serverSettings => {\n if (serverSettings.storageClasses != null) {\n serverSettings.storageClasses.forEach(sopClassUID => {\n if (Object.values(StorageClasses).includes(sopClassUID)) {\n if (sopClassUID in storageClassMapping) {\n storageClassMapping[sopClassUID] += 1\n } else {\n storageClassMapping[sopClassUID] = 1\n }\n } else {\n console.warn(\n `unknown storage class \"${sopClassUID}\" specified ` +\n `for configured server \"${serverSettings.id}\"`\n )\n }\n })\n } else {\n if (window.location.pathname.includes('/projects/')) {\n const pathname = window.location.pathname.split('/study/')[0]\n const pathUrl = `${gcpBaseUrl}${pathname}/dicomWeb`\n serverSettings.url = pathUrl\n }\n\n storageClassMapping.default += 1\n clientMapping.default = new DicomWebManager({\n baseUri,\n settings: [serverSettings],\n onError\n })\n }\n })\n\n if (storageClassMapping.default > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one default server can be configured without specification ' +\n 'of storage classes.'\n )\n )\n }\n\n for (const key in storageClassMapping) {\n if (key === 'default') {\n continue\n }\n if (storageClassMapping[key] > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one configured server can specify a given storage class. ' +\n `Storage class \"${key}\" is specified by more than one ` +\n 'of the configured servers.'\n )\n )\n }\n }\n\n if (Object.keys(storageClassMapping).length > 1) {\n settings.forEach(server => {\n const client = new DicomWebManager({\n baseUri,\n settings: [server],\n onError\n })\n if (server.storageClasses != null) {\n server.storageClasses.forEach(sopClassUID => {\n clientMapping[sopClassUID] = client\n })\n }\n })\n }\n\n Object.values(StorageClasses).forEach(sopClassUID => {\n if (!(sopClassUID in clientMapping)) {\n clientMapping[sopClassUID] = clientMapping.default\n }\n })\n return clientMapping\n}\n\ninterface AppProps {\n name: string\n homepage: string\n version: string\n config: AppConfig\n}\n\ninterface AppState {\n clients: { [sopClassUID: string]: DicomWebManager }\n user?: User\n isLoading: boolean\n redirectTo?: string\n wasAuthSuccessful: boolean\n error?: ErrorMessageSettings\n}\n\nclass App extends React.Component {\n private readonly auth?: AuthManager\n\n private readonly handleDICOMwebError = (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ): void => {\n if (error.status === 401) {\n this.signIn()\n } else if (error.status === 403) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'User is not authorized to access DICOMweb resources.')\n )\n }\n\n const logServerError = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'An unexpected server error occured.'\n )\n )\n }\n\n if (serverSettings.errorMessages !== undefined) {\n serverSettings.errorMessages.forEach((setting: ErrorMessageSettings) => {\n if (error.status === setting.status) {\n this.setState({\n error: {\n status: error.status,\n message: setting.message\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n }\n\n constructor (props: AppProps) {\n super(props)\n\n console.info('instatiate app')\n console.info(`app is located at \"${props.config.path}\"`)\n const { protocol, host } = window.location\n const baseUri = `${protocol}//${host}`\n const appUri = joinUrl(props.config.path, baseUri)\n\n const oidcSettings = props.config.oidc\n if (oidcSettings !== undefined) {\n console.info(\n 'app uses the following OIDC configuration: ',\n props.config.oidc\n )\n this.auth = new OidcManager(appUri, oidcSettings)\n }\n\n if (props.config.servers.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'One server needs to be configured.')\n )\n }\n console.info(\n 'app uses the following DICOMweb server configuration: ',\n props.config.servers\n )\n\n this.handleServerSelection = this.handleServerSelection.bind(this)\n\n message.config({ duration: 5 })\n this.addGcpSecondaryAnnotationServer(props.config)\n\n this.state = {\n clients: _createClientMapping({\n baseUri,\n gcpBaseUrl: props.config.gcpBaseUrl ?? 'https://healthcare.googleapis.com/v1',\n settings: props.config.servers,\n onError: this.handleDICOMwebError\n }),\n isLoading: true,\n wasAuthSuccessful: false\n }\n }\n\n addGcpSecondaryAnnotationServer (config: AppProps['config']): void {\n const serverId = 'gcp_secondary_annotation_server'\n const urlParams = new URLSearchParams(window.location.search)\n const url = urlParams.get('gcp')\n const gcpSecondaryAnnotationServer = config.servers.find(\n (server) => server.id === serverId\n )\n if (gcpSecondaryAnnotationServer === undefined && typeof url === 'string') {\n config.servers.push({\n id: serverId,\n write: true,\n url,\n storageClasses: [\n StorageClasses.COMPREHENSIVE_SR,\n StorageClasses.COMPREHENSIVE_3D_SR,\n StorageClasses.SEGMENTATION,\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION,\n StorageClasses.PARAMETRIC_MAP,\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE,\n StorageClasses.COLOR_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE\n ]\n })\n }\n }\n\n handleServerSelection ({ url }: { url: string }): void {\n console.info('select DICOMweb server: ', url)\n const tmpClient = new DicomWebManager({\n baseUri: '',\n settings: [{\n id: 'tmp',\n url,\n read: true,\n write: false\n }],\n onError: this.handleDICOMwebError\n })\n tmpClient.updateHeaders(this.state.clients.default.headers)\n /**\n * Use the newly created client for all storage classes. We may want to\n * make this more sophisticated in the future to allow users to override\n * the entire server configuration.\n */\n this.setState(state => {\n const clients: { [key: string]: DicomWebManager } = {}\n for (const key in state.clients) {\n clients[key] = tmpClient\n }\n return { clients }\n })\n }\n\n /**\n * Handle successful authentication event.\n *\n * Authorizes the DICOMweb client to access the DICOMweb server and directs\n * the user back to the App.\n *\n * @param user - Information about the user\n * @param authorization - Value of the \"Authorization\" HTTP header field\n */\n handleSignIn = ({ user, authorization }: {\n user: User\n authorization: string\n }): void => {\n for (const key in this.state.clients) {\n const client = this.state.clients[key]\n client.updateHeaders({ Authorization: authorization })\n }\n const storedPath = window.localStorage.getItem('slim_path')\n const storedSearch = window.localStorage.getItem('slim_search')\n if (storedPath != null) {\n const currentPath = window.location.pathname\n if (storedPath !== currentPath) {\n let path = storedPath\n if (storedSearch != null) {\n path += storedSearch\n }\n window.location.href = path\n }\n }\n window.localStorage.removeItem('slim_path')\n window.localStorage.removeItem('slim_search')\n this.setState({ user: user })\n }\n\n signIn (): void {\n if (this.auth !== undefined) {\n console.info('try to sign in user')\n this.auth.signIn({ onSignIn: this.handleSignIn }).then(() => {\n console.info('sign-in was successful')\n this.setState({\n isLoading: false,\n wasAuthSuccessful: true\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Could not sign-in user.')\n )\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: false\n })\n })\n } else {\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: true\n })\n }\n }\n\n componentDidMount (): void {\n const path = window.localStorage.getItem('slim_path')\n if (path == null) {\n window.localStorage.setItem('slim_path', window.location.pathname)\n window.localStorage.setItem('slim_search', window.location.search)\n }\n this.signIn()\n }\n\n render (): React.ReactNode {\n const appInfo = {\n name: this.props.name,\n version: this.props.version,\n homepage: this.props.homepage,\n uid: '1.2.826.0.1.3680043.9.7433.1.5',\n organization: this.props.config.organization\n }\n\n const enableWorklist = !(\n this.props.config.disableWorklist ?? false\n )\n const enableServerSelection = (\n this.props.config.enableServerSelection ?? false\n )\n\n let worklist\n if (enableWorklist) {\n worklist = \n } else {\n worklist =
Worklist has been disabled.
\n }\n\n let isLogoutPossible = false\n let onLogout: () => void\n if (\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n this.props.config.oidc != null &&\n this.props.config.oidc.endSessionEndpoint != null\n ) {\n onLogout = (): void => {\n if (this.auth != null) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.auth.signOut()\n }\n }\n isLogoutPossible = true\n } else {\n onLogout = () => {}\n isLogoutPossible = false\n }\n\n const layoutStyle = { height: '100vh' }\n const layoutContentStyle = { height: '100%' }\n\n if (this.state.redirectTo !== undefined) {\n return (\n \n \n \n )\n } else if (this.state.isLoading) {\n return (\n \n \n \n \n \n \n \n \n )\n } else if (!this.state.wasAuthSuccessful) {\n return (\n \n )\n } else if (this.state.error != null) {\n return (\n \n )\n } else {\n return (\n \n \n \n \n \n {worklist}\n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n Logged out\n \n }\n />\n \n \n )\n }\n }\n}\n\nexport default App\n"],"names":["Description","layout","labelLineHeight","undefined","this","props","hasLongValues","items","attributes","map","item","index","uid","generateUUID","label","name","labelStyle","lineHeight","contentStyle","fontWeight","whiteSpace","span","value","icon","title","header","extra","size","hoverable","selectable","bordered","actions","methods","column","children","React","metadata","ClinicalTrialSponsorName","push","ClinicalTrialProtocolID","ClinicalTrialProtocolName","ClinicalTrialSiteName","ClinicalTrialTimePointID","parseName","Alphabetic","split","join","parseDate","year","substring","month","day","parseTime","hours","minutes","seconds","parseSex","F","M","O","PatientID","PatientName","PatientSex","PatientBirthDate","AccessionNumber","StudyID","StudyDate","StudyTime","StorageClasses","_subscriptions","Symbol","_lastSubscriptionId","PubSub","eventName","callback","Error","hasOwnProperty","subscriptionId","callbacks","payload","errorTypes","CustomError","type","message","stack","NotificationMiddlewareEvents","NotificationMiddlewareContext","NotificationType","NotificationSourceDefinition","sources","category","notificationType","outerContext","args","publish","Array","from","warn","console","JSON","stringify","arguments","includes","apply","prototype","slice","call","source","error","notificationMsg","errorCategory","find","s","String","notification","description","duration","state","isLoading","overviewViewportRef","overviewViewer","setState","slide","overviewImages","length","current","innerHTML","info","ContainerIdentifier","dmv","client","clients","VL_WHOLE_SLIDE_MICROSCOPY_IMAGE","resizeFactor","errorInterceptor","NotificationMiddleware","render","container","resize","style","height","containerIdentifier","ref","seriesInstanceUIDs","selectedSeriesInstanceUID","onSeriesSelection","seriesInstanceUID","slideList","slideItemList","i","slideItem","selectedKeys","width","onSelect","key","keyPath","domEvent","toString","mode","inlineIndent","handleVisibilityChange","bind","checked","event","onVisibilityChange","roiUID","roi","isVisible","identifier","otherProps","evaluations","forEach","nameValue","ConceptNameCodeSequence","CodeValue","nameMeaning","CodeMeaning","ValueType","dcmjs","valueMeaning","ConceptCodeSequence","textContentItem","TextValue","measurements","seq","MeasuredValueSequence","NumericValue","toPrecision","unit","MeasurementUnitsCodeSequence","align","paddingLeft","onChange","checkedChildren","unCheckedChildren","handleMenuItemSelection","rois","visibleRoiUIDs","object","onSelection","has","paddingTop","paddingBottom","selectedRoiUIDs","values","onClick","handleMeasurementSelection","handleOpacityChange","handleColorRChange","handleColorGChange","handleColorBChange","getCurrentColor","currentStyle","opacity","defaultStyle","color","annotationGroupUID","annotationGroup","onStyleChange","styleOptions","limitValues","isArray","option","codeComponents","measurement","schemeDesignator","meaning","colorSettings","windowSettings","explorationSettings","AnnotationGroupSequence","findIndex","AnnotationGroupUID","propertyType","propertyCategory","GraphicType","AnnotationCoordinateType","measurementsSequence","MeasurementsSequence","measurementOptions","measurementItem","CodingSchemeDesignator","dropdownMatchSelectWidth","disabled","plain","justify","gutter","range","min","max","step","handleLowerLimitChange","handleLimitChange","handleUpperLimitChange","minWidth","defaultValue","settings","isBadgeVisible","direction","placement","content","overlayStyle","shape","SettingOutlined","offset","count","borderStyle","borderWidth","borderColor","visibility","backgroundImage","annotationGroups","visibleAnnotationGroupUIDs","defaultAnnotationGroupStyles","onAnnotationGroupVisibilityChange","onAnnotationGroupStyleChange","handleClick","text","button","Icon","isSelected","tooltip","Manufacturer","ManufacturerModelName","DeviceSerialNumber","SoftwareVersions","InstitutionName","findContentItemsByName","concept","hasName","hasValueType","valueType","getROIs","report","matches","ContentSequence","measurementsItem","measurementGroupItems","observerType","group","trackingUIDItem","algorithmNameItem","algorithmVersionItem","scoord3d","regionItem","frameOfReferenceUID","ReferencedFrameOfReferenceUID","coordinates","GraphicData","evaluation","findEvaluationItems","findMeasurementItems","properties","trackingUID","UID","MeasurementReport","PersonObserverName","PersonObserverLoginName","DeviceObserverUID","DeviceObserverName","SpecimenUID","SpecimenIdentifier","ROIs","specimenUIDItem","specimenIdItem","containerIdItem","personNameItem","PersonName","personLoginNameItem","deviceUIDItem","deviceNameItem","dataset","containerAttrs","specimenAttrs","observerAttrs","annotations","id","attrs","orientation","groups","SpecimenPreparationAdditives","FIXATIVE","EMBEDDING_MEDIUM","SpecimenPreparationStepItems","SPECIMEN_IDENTIFIER","PARENT_SPECIMEN_IDENTIFIER","PROCESSING_TYPE","DATETIME_OF_PROCESSING","PROCESSING_STEP_DESCRIPTION","COLLECTION_METHOD","SAMPLING_METHOD","STAIN","specimenDescription","SpecimenDescriptionSequence","SpecimenShortDescription","PrimaryAnatomicStructureSequence","structures","SpecimenPreparationSequence","SpecimenPreparationStepContentItemSequence","equals","showstain","overflowY","handleRemoval","getCurrentColors","paletteColorLookupTable","previousProps","previousState","opticalPath","opticalPathIdentifier","rgb2hex","data","onRemoval","illuminationWaveLength","illuminationColor","specimenDescriptions","maxValue","Math","pow","BitsAllocated","isMonochromatic","colors","buttons","isRemovable","DeleteOutlined","EyeOutlined","EyeInvisibleOutlined","Option","Select","selectedOpticalPathIdentifier","handleItemAddition","handleItemRemoval","handleItemSelectionChange","onOpticalPathActivityChange","isActive","opticalPathSelector","isSelectable","opticalPaths","opticalPathItems","optionItems","images","SeriesInstanceUID","OpticalPathSequence","opticalPathItem","OpticalPathIdentifier","OpticalPathDescription","activeOpticalPathIdentifiers","visibleOpticalPathIdentifiers","defaultOpticalPathStyles","onOpticalPathVisibilityChange","onOpticalPathStyleChange","padding","allowClear","AppstoreAddOutlined","mappingUID","mapping","mappings","visibleMappingUIDs","defaultMappingStyles","onMappingVisibilityChange","onMappingStyleChange","segmentUID","segment","algorithmName","segments","visibleSegmentUIDs","defaultSegmentStyles","onSegmentVisibilityChange","onSegmentStyleChange","withRouter","Component","location","useLocation","navigate","useNavigate","params","useParams","contourOnly","annotationGroupsUIDs","updateCurrentStyle","handleShowOutlineOnly","target","checkedAnnotationUids","defaultAnnotationStyles","types","checkAll","every","uids","indeterminate","some","handleChangeCheckedType","e","mouseEnterDelay","reduce","acc","marginLeft","shortenedCodeMeaning","displayCodeMeaning","isChecked","indeterminateType","display","flexDirection","categories","categoriesAcc","annotation","categoryKey","typeKey","oldCategory","oldType","Object","keys","typesArr","getCategories","xPosition","yPosition","position","top","left","backgroundColor","minHeight","pointerEvents","attr","roiUid","DEFAULT_ROI_STROKE_COLOR","DEFAULT_ROI_FILL_COLOR","DEFAULT_ANNOTATION_STROKE_COLOR","DEFAULT_ANNOTATION_COLOR_PALETTE","_buildKey","codingScheme","codeValue","_getRoiKey","findingName","_formatRoiStyle","stroke","fill","image","circle","radius","_constructViewers","preload","volumeImages","labelViewer","volumeViewer","clientMapping","controls","activateSelectInteraction","labelImages","SlideViewer","findingOptions","evaluationOptions","geometryTypeOptions","volumeViewportRef","labelViewportRef","hoveredRois","lastPixel","defaultRoiStyle","roiStyles","selectionColor","selectedRoiStyle","loadPresentationStates","ADVANCED_BLENDING_PRESENTATION_STATE","searchForInstances","studyInstanceUID","queryParams","Modality","then","matchedInstances","rawInstance","instance","SOPInstanceUID","retrieveInstance","sopInstanceUID","retrievedInstance","dict","areVolumeImagesMonochrome","presentationState","doesMatch","AdvancedBlendingSequence","blendingItem","selectedPresentationStateUID","setPresentationState","presentationStates","catch","getAllOpticalPaths","opticalPathStyles","hideOpticalPath","deactivateOpticalPath","getOpticalPathDefaultStyle","setOpticalPathStyle","refInstanceItems","ReferencedInstanceSequence","ReferencedImageSequence","imageItem","sopInstanceUIDs","ReferencedSOPInstanceUID","paletteColorLUT","PaletteColorLookupTableSequence","cpLUTItem","PaletteColorLookupTableUID","redDescriptor","RedPaletteColorLookupTableDescriptor","greenDescriptor","GreenPaletteColorLookupTableDescriptor","blueDescriptor","BluePaletteColorLookupTableDescriptor","redData","RedPaletteColorLookupTableData","Uint16Array","greenData","GreenPaletteColorLookupTableData","blueData","BluePaletteColorLookupTableData","redSegmentedData","SegmentedRedPaletteColorLookupTableData","greenSegmentedData","SegmentedGreenPaletteColorLookupTableData","blueSegmentedData","SegmentedBluePaletteColorLookupTableData","SoftcopyVOILUTSequence","voiLUTItem","windowCenter","WindowCenter","windowWidth","WindowWidth","selectedOpticalPathIdentifiers","Set","activateOpticalPath","showOpticalPath","add","searchParams","URLSearchParams","search","set","pathname","replace","getRoiStyle","addAnnotations","COMPREHENSIVE_3D_SR","SOPClassUID","templateSeq","ContentTemplateSequence","TemplateIdentifier","_implementsTID1500","subjectClassValue","retrievedConcept","expectedConcept","_describesSpecimenSubject","debug","measurementGroups","foundRegion","regions","_containsROIAnnotations","FrameOfReferenceUID","doesROIExist","getAllROIs","otherROI","a","b","graphicType","graphicData","s1","s2","j","_areROIsEqual","addROI","forceUpdate","addAnnotationGroups","MICROSCOPY_BULK_SIMPLE_ANNOTATION","searchForSeries","matchedSeries","series","retrieveSeriesMetadata","retrievedMetadata","ann","finding","AnnotationPropertyTypeCodeSequence","setAnnotationGroupStyle","addSegmentations","SEGMENTATION","segmentations","seg","refImage","addSegments","addParametricMaps","PARAMETRIC_MAP","parametricMaps","pm","addParameterMappings","populateViewports","setDefaultPresentationState","onRoiModified","onWindowResize","onRoiDrawn","detail","selectedFinding","selectedEvaluations","findingItem","relationshipType","addEvaluation","onRoiDoubleClicked","isSelectedRoiModalVisible","setHoveredRoiAttributes","result","r","hoveredRoiAttributes","clearHoveredRois","getUniqueHoveredRois","newRoi","allRois","filter","isSamePixelAsLast","clientX","clientY","onPointerMove","hoveredRoi","feature","originalEvent","isHoveredRoiTooltipVisible","hoveredRoiTooltipX","hoveredRoiTooltipY","onRoiSelected","selectedRoi","oldSelectedRois","onLoadingStarted","onLoadingEnded","onFrameLoadingStarted","frameInfo","frameNumber","loadingFrames","onFrameLoadingError","onLoadingError","onFrameLoadingEnded","delete","sopClassUID","channelIdentifier","pixelDataStatistics","pixelArray","chunks","ceil","minValues","maxValues","pixels","stats","numFramesSampled","getOpticalPathStyle","onRoiRemoved","onKeyUp","isRoiDrawingActive","deactivateDrawInteraction","isRoiModificationActive","deactivateModifyInteraction","isRoiTranslationActive","deactivateTranslateInteraction","isAnnotationModalVisible","isGoToModalVisible","altKey","code","handleRoiDrawing","handleRoiModification","handleRoiTranslation","handleRoiRemoval","handleRoiVisibilityChange","handleReportGeneration","handleGoTo","geometryTypes","componentSetup","componentCleanup","handleRoiSelectionCancellation","handleAnnotationConfigurationCancellation","handleAnnotationGeometryTypeSelection","handleAnnotationMeasurementActivation","handleAnnotationFindingSelection","handleAnnotationEvaluationSelection","handleAnnotationEvaluationClearance","handleAnnotationConfigurationCompletion","handleAnnotationSelection","handleAnnotationVisibilityChange","handleAnnotationGroupVisibilityChange","handleAnnotationGroupStyleChange","handleRoiStyleChange","handleXCoordinateSelection","handleYCoordinateSelection","handleMagnificationSelection","handleSlidePositionSelection","handleSlidePositionSelectionCancellation","handleReportVerification","handleReportCancellation","handleSegmentVisibilityChange","handleSegmentStyleChange","handleMappingVisibilityChange","handleMappingStyleChange","handleOpticalPathVisibilityChange","handleOpticalPathStyleChange","handleOpticalPathActivityChange","handlePresentationStateSelection","handlePresentationStateReset","boundingBox","generatedReport","isSelectedMagnificationValid","isReportModalVisible","isSelectedXCoordinateValid","isSelectedYCoordinateValid","selectedXCoordinate","validXCoordinateRange","selectedYCoordinate","validYCoordinateRange","selectedMagnification","areRoisHidden","cleanup","isOpticalPathVisible","isOpticalPathActive","document","body","removeEventListener","window","addEventListener","hasICCProfile","ICCProfile","bulkdataReferences","selectedGeometryType","selectedMarkup","filteredEvaluations","x","Number","start","end","y","targetPixelSpacing","diffs","numLevels","actualPixelSpacing","getPixelSpacing","abs","level","indexOf","point","log","geometryType","markup","activateDrawInteraction","getOpticalPathMetadata","observer","refSpecimen","user","loginName","email","observationContext","observerPersonContext","observerIdentifyingAttributes","observerDeviceContext","app","manufacturerName","modelName","subjectContext","subjectClass","subjectClassSpecificContext","imagingMeasurements","findingType","trackingIdentifier","referencedRegion","qualitativeEvaluations","MappingResource","measurementReport","languageOfContentItemAndDescendants","procedureReported","evidence","seriesNumber","seriesDescription","instanceNumber","manufacturer","previousVersions","fileMetaInformationVersionArray","Uint8Array","fileMeta","Value","buffer","vr","writer","write","storeInstances","datasets","response","setROIStyle","getROI","showAnnotationGroup","hideAnnotationGroup","strokeColor","fillColor","c","generateRoiStyle","showSegment","hideSegment","setSegmentStyle","showParameterMapping","hideParameterMapping","setParameterMappingStyle","sort","localeCompare","paletteColorLookupTableUID","defaultColors","numVisible","urlPath","deactivateSelectInteraction","deactivateSnapInteraction","isModifyInteractionActive","activateSnapInteraction","activateModifyInteraction","isTranslateInteractionActive","activateTranslateInteraction","removeROI","areROIsVisible","hideROIs","showROIs","getAllSegments","getAllParameterMappings","allAnnotationGroups","getAllAnnotationGroups","filteredAnnotationGroups","referencedSeriesInstanceUID","annotationMenuItems","adaptRoiToAnnotation","openSubMenuItems","geometryTypeOptionsMapping","box","polygon","line","freehandpolygon","freehandline","annotationConfigurations","defaultActiveFirstOption","onClear","specimenMenu","equipmentMenu","opticalPathMetadata","presentationStateMenu","segmentationMenu","parametricMapMenu","annotationGroupMenu","toolbar","opticalPathMenu","presentationStateOptions","ContentDescription","maxWidth","UndoOutlined","segmentMetadata","getSegmentStyle","getSegmentMetadata","mappingMetadata","getParameterMappingStyle","getParameterMappingMetadata","annotationGroupMetadata","getAnnotationGroupStyle","getAnnotationGroupMetadata","toolbarHeight","annotationTools","FaDrawPolygon","FaHandPointer","FaHandPaper","FaTrash","FaEye","FaEyeSlash","FaSave","controlTools","FaCrosshairs","enableAnnotationTools","selectedRoiInformation","cursor","roiAttributes","roiScoordAttributes","roiEvaluationAttributes","codeItem","textItem","roiMeasurmentAttributesPerOpticalPath","refItems","ReferencedSOPSequence","ReferencedOpticalPathIdentifier","measuredValueItem","createRoiDescription","roiDescriptions","roiScoordDescriptions","roiEvaluationDescriptions","roiMeasurementDescriptions","descriptions","orientationMargin","dashed","hasSider","overflow","open","onOk","onCancel","okText","maskClosable","footer","placeholder","prefix","onPressEnter","addonAfter","CheckOutlined","StopOutlined","reverseArrow","borderLeft","borderLeftWidth","background","defaultOpenKeys","forceSubMenuRender","onOpenChange","setTimeout","ImageFlavors","hasImageFlavor","imageFlavor","ImageType","areSameAcquisition","AcquisitionUID","Slide","options","acquisitionUID","opticalPathIdentifiers","pyramidUIDs","acquisitionUIDs","containerIdentifiers","frameOfReferenceUIDs","VOLUME","LABEL","OVERVIEW","THUMBNAIL","PyramidUID","samplesPerPixel","SamplesPerPixel","requirePyramidUID","PhotometricInterpretation","createSlides","slideMetadata","filteredLabelImages","filteredVolumeImages","slideMetadataIndex","_doesImageBelongToSlide","filteredOverviewImages","slideMetadataItem","slides","imgA","imgB","fetchImageMetadata","onSuccess","onError","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","newSlides","customError","slidesCache","Map","pendingRequests","useSlides","useState","setSlides","setIsLoading","setError","useEffect","cachedData","get","fetchSlides","pendingRequest","resolve","reject","err","ParametrizedSlideViewer","presentationStateUID","selectedSlide","viewer","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","DicomMetaDictionary","formatValue","val","getRows","depth","keywords","flatMap","keyword","tagInfo","nameMap","match","tag","sequenceItems","sequenceNode","getSortedTags","subscribe","_broadcastEvent","_unsubscribe","_isValidEvent","listenerId","subscription","listeners","unsubscribe","EVENTS","callbackProps","hasListeners","hasCallbacks","listener","defaultInstances","instances","instancesMap","SeriesNumber","SeriesDescription","SeriesDate","SeriesTime","addInstance","newInstance","addInstances","newInstances","len","getInstance","StudyDescription","NumInstances","ModalitiesInStudy","isLoaded","addInstanceToSeries","addInstancesToSeries","createSeriesMetadata","setSeriesMetadata","seriesMetadata","existingSeries","assign","STUDY_ADDED","INSTANCES_ADDED","SERIES_ADDED","SERIES_UPDATED","_model","studies","_getStudy","aStudy","_getSeries","study","aSeries","BaseImplementation","dicomJSONDatasetOrP10ArrayBuffer","dicomJSONDataset","naturalizedDataset","ArrayBuffer","createStudyMetadata","madeInClient","updateSeriesMetadata","addSeriesMetadata","seriesSummaryMetadata","NumberOfStudyRelatedSeries","addStudy","existingStudy","newStudy","getStudyInstanceUIDs","getStudy","getSeries","getInstanceByImageId","imageId","updateMetadataForSeries","pubSubServiceInterface","setStudy","displaySets","setDisplaySets","selectedDisplaySetInstanceUID","setSelectedDisplaySetInstanceUID","setInstanceNumber","filterValue","setFilterValue","expandedKeys","setExpandedKeys","searchInput","setSearchInput","debouncedSearchValue","delay","debouncedValue","setDebouncedValue","timer","clearTimeout","useDebounce","handler","DicomMetadataStore","seriesAddedSubscription","instancesAddedSubscription","derivedDisplaySets","processedSeries","ds","displaySetInstanceUID","displaySetList","useMemo","displaySet","displayDate","dateStr","hour","minute","second","monthNum","parseInt","dayNum","date","Date","getMonth","getDate","weekday","toLocaleDateString","monthName","dayFormatted","yearNum","getFullYear","formatDicomDate","showInstanceList","instanceSliderMarks","totalInstances","tableData","transformTagsToTableData","tags","parentKey","keyBase","currentKey","filteredData","searchLower","toLowerCase","matchedKeys","nodeMatches","node","findMatchingPaths","parentPath","currentPath","matchingPaths","child","childPaths","filtered","reconstructTree","paths","nodesAtLevel","className","gap","marginBottom","flex","strong","optionLabelProp","optionFilterProp","fontSize","marks","formatter","SearchOutlined","columns","dataIndex","dataSource","pagination","expandable","expandedRowKeys","onExpandedRowsChange","scroll","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","handleDicomTagBrowserButtonClick","innerWidth","handleDebugButtonClick","errorMsgs","Authentication","Communication","EncodingDecoding","Visualization","errorNum","errorObj","warncount","Panel","Collapse","showErrorCount","errcount","uuidv4","warnings","warning","handleServerSelectionButtonClick","isServerSelectionModalVisible","isServerSelectionDisabled","prevProps","prevState","worklistButton","userMenuItems","onUserLogout","userMenu","menu","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","dicomTagBrowserButton","FileSearchOutlined","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","filterIcon","fetchData","handleChange","numStudies","pageSize","searchOptions","searchForStudies","limit","searchCriteria","fuzzymatching","filters","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","onRow","loading","joinUrl","uri","baseUri","endsWith","isAuthorizationCodeInUrl","hashParams","hash","Boolean","createUser","userData","profile","OidcManager","_oidc","signIn","onSignIn","handleSignIn","authorization","token_type","access_token","signinCallback","getUser","expired","signinRedirect","signOut","signoutRedirect","getAuthorization","responseType","grantType","UserManager","authority","client_id","clientId","redirect_uri","scope","response_type","loadUserInfo","automaticSilentRenew","revokeAccessTokenOnSignout","post_logout_redirect_uri","endSessionEndpoint","metadataService","getMetadata","end_session_endpoint","retries","factor","minTimeout","maxTimeout","randomize","retryableStatusCodes","retryOptions","xhrRetryHook","request","method","originalRequestSend","send","operation","retry","attempt","currentAttempt","originalOnReadyStateChange","onreadystatechange","status","errorMessage","attemptFailedError","naturalizeDataset","DicomWebManager","stores","handleError","updateHeaders","fields","f","headers","retrieveStudyMetadata","studySummaryMetadata","naturalized","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","shouldUpgradeInsecure","upgradeInsecureRequests","qidoPathPrefix","wadoPathPrefix","stowPathPrefix","qidoURLPrefix","wadoURLPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","handleDICOMwebError","logServerError","errorMessages","setting","Authorization","storedPath","localStorage","getItem","storedSearch","href","removeItem","host","appUri","oidcSettings","oidc","servers","addGcpSecondaryAnnotationServer","wasAuthSuccessful","serverId","COMPREHENSIVE_SR","COLOR_SOFTCOPY_PRESENTATION_STATE","GRAYSCALE_SOFTCOPY_PRESENTATION_STATE","PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE","tmpClient","redirectTo","setItem","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.8fe53f05.js b/static/js/main.991ec8ac.js similarity index 99% rename from static/js/main.8fe53f05.js rename to static/js/main.991ec8ac.js index f7e923eb..e80bc04b 100644 --- a/static/js/main.8fe53f05.js +++ b/static/js/main.991ec8ac.js @@ -1,3 +1,3 @@ -/*! For license information please see main.8fe53f05.js.LICENSE.txt */ -(()=>{var e={6327:(e,t,n)=>{"use strict";n.d(t,{R_:()=>d});var r=n(3669),a=n(7763),o=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function i(e){var t=e.r,n=e.g,a=e.b,o=(0,r.py)(t,n,a);return{h:360*o.h,s:o.s,v:o.v}}function l(e){var t=e.r,n=e.g,a=e.b;return"#".concat((0,r.vq)(t,n,a,!1))}function u(e,t,n){var r=n/100;return{r:(t.r-e.r)*r+e.r,g:(t.g-e.g)*r+e.g,b:(t.b-e.b)*r+e.b}}function c(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function s(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function f(e,t,n){var r;return(r=n?e.v+.05*t:e.v-.15*t)>1&&(r=1),Number(r.toFixed(2))}function d(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=(0,a.uA)(e),d=5;d>0;d-=1){var p=i(r),v=l((0,a.uA)({h:c(p,d,!0),s:s(p,d,!0),v:f(p,d,!0)}));n.push(v)}n.push(l(r));for(var h=1;h<=4;h+=1){var m=i(r),g=l((0,a.uA)({h:c(m,h),s:s(m,h),v:f(m,h)}));n.push(g)}return"dark"===t.theme?o.map((function(e){var r=e.index,o=e.opacity;return l(u((0,a.uA)(t.backgroundColor||"#141414"),(0,a.uA)(n[r]),100*o))})):n}var p={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},v={},h={};Object.keys(p).forEach((function(e){v[e]=d(p[e]),v[e].primary=v[e][5],h[e]=d(p[e],{theme:"dark",backgroundColor:"#141414"}),h[e].primary=h[e][5]}));v.red,v.volcano,v.gold,v.orange,v.yellow,v.lime,v.green,v.cyan,v.blue,v.geekblue,v.purple,v.magenta,v.grey},4291:(e,t,n)=>{"use strict";n.d(t,{Z:()=>N});var r=n(1413),a=n(9439),o=n(4942),i=n(4925),l=n(2791),u=n(1694),c=n.n(u),s=n(808),f=n(1002),d=n(6327),p=n(632),v=n(5561);function h(e){return"object"===(0,f.Z)(e)&&"string"===typeof e.name&&"string"===typeof e.theme&&("object"===(0,f.Z)(e.icon)||"function"===typeof e.icon)}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce((function(t,n){var r=e[n];if("class"===n)t.className=r,delete t.class;else t[n]=r;return t}),{})}function g(e,t,n){return n?l.createElement(e.tag,(0,r.Z)((0,r.Z)({key:t},m(e.attrs)),n),(e.children||[]).map((function(n,r){return g(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))):l.createElement(e.tag,(0,r.Z)({key:t},m(e.attrs)),(e.children||[]).map((function(n,r){return g(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})))}function y(e){return(0,d.R_)(e)[0]}function b(e){return e?Array.isArray(e)?e:[e]:[]}var w="\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",k=["icon","className","onClick","style","primaryColor","secondaryColor"],E={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var C=function(e){var t,n,a=e.icon,o=e.className,u=e.onClick,c=e.style,f=e.primaryColor,d=e.secondaryColor,m=(0,i.Z)(e,k),b=E;if(f&&(b={primaryColor:f,secondaryColor:d||y(f)}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w,t=(0,l.useContext)(s.Z).csp;(0,l.useEffect)((function(){(0,v.hq)(e,"@ant-design-icons",{prepend:!0,csp:t})}),[])}(),t=h(a),n="icon should be icon definiton, but got ".concat(a),(0,p.ZP)(t,"[@ant-design/icons] ".concat(n)),!h(a))return null;var C=a;return C&&"function"===typeof C.icon&&(C=(0,r.Z)((0,r.Z)({},C),{},{icon:C.icon(b.primaryColor,b.secondaryColor)})),g(C.icon,"svg-".concat(C.name),(0,r.Z)({className:o,onClick:u,style:c,"data-icon":C.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},m))};C.displayName="IconReact",C.getTwoToneColors=function(){return(0,r.Z)({},E)},C.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;E.primaryColor=t,E.secondaryColor=n||y(t),E.calculated=!!n};const x=C;function S(e){var t=b(e),n=(0,a.Z)(t,2),r=n[0],o=n[1];return x.setTwoToneColors({primaryColor:r,secondaryColor:o})}var P=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];S("#1890ff");var Z=l.forwardRef((function(e,t){var n,u=e.className,f=e.icon,d=e.spin,p=e.rotate,v=e.tabIndex,h=e.onClick,m=e.twoToneColor,g=(0,i.Z)(e,P),y=l.useContext(s.Z),w=y.prefixCls,k=void 0===w?"anticon":w,E=y.rootClassName,C=c()(E,k,(n={},(0,o.Z)(n,"".concat(k,"-").concat(f.name),!!f.name),(0,o.Z)(n,"".concat(k,"-spin"),!!d||"loading"===f.name),n),u),S=v;void 0===S&&h&&(S=-1);var Z=p?{msTransform:"rotate(".concat(p,"deg)"),transform:"rotate(".concat(p,"deg)")}:void 0,N=b(m),F=(0,a.Z)(N,2),_=F[0],O=F[1];return l.createElement("span",(0,r.Z)((0,r.Z)({role:"img","aria-label":f.name},g),{},{ref:t,tabIndex:S,onClick:h,className:C}),l.createElement(x,{icon:f,primaryColor:_,secondaryColor:O,style:Z}))}));Z.displayName="AntdIcon",Z.getTwoToneColor=function(){var e=x.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Z.setTwoToneColor=S;const N=Z},808:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=(0,n(2791).createContext)({})},7557:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="CheckCircleFilled";const u=a.forwardRef(l)},8944:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="CheckCircleOutlined";const u=a.forwardRef(l)},2621:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"}}]},name:"close-circle",theme:"filled"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="CloseCircleFilled";const u=a.forwardRef(l)},1532:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 00-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z"}},{tag:"path",attrs:{d:"M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"close-circle",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="CloseCircleOutlined";const u=a.forwardRef(l)},732:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"}}]},name:"close",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="CloseOutlined";const u=a.forwardRef(l)},187:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="ExclamationCircleFilled";const u=a.forwardRef(l)},5796:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="ExclamationCircleOutlined";const u=a.forwardRef(l)},9966:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="InfoCircleOutlined";const u=a.forwardRef(l)},7106:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="LoadingOutlined";const u=a.forwardRef(l)},1938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a=n(2791);const o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"};var i=n(4291),l=function(e,t){return a.createElement(i.Z,(0,r.Z)((0,r.Z)({},e),{},{ref:t,icon:o}))};l.displayName="RightOutlined";const u=a.forwardRef(l)},3669:(e,t,n)=>{"use strict";n.d(t,{T6:()=>p,VD:()=>v,WE:()=>c,Yt:()=>h,lC:()=>o,py:()=>u,rW:()=>a,s:()=>f,ve:()=>l,vq:()=>s});var r=n(9521);function a(e,t,n){return{r:255*(0,r.sh)(e,255),g:255*(0,r.sh)(t,255),b:255*(0,r.sh)(n,255)}}function o(e,t,n){e=(0,r.sh)(e,255),t=(0,r.sh)(t,255),n=(0,r.sh)(n,255);var a=Math.max(e,t,n),o=Math.min(e,t,n),i=0,l=0,u=(a+o)/2;if(a===o)l=0,i=0;else{var c=a-o;switch(l=u>.5?c/(2-a-o):c/(a+o),a){case e:i=(t-n)/c+(t1&&(n-=1),n<1/6?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function l(e,t,n){var a,o,l;if(e=(0,r.sh)(e,360),t=(0,r.sh)(t,100),n=(0,r.sh)(n,100),0===t)o=n,l=n,a=n;else{var u=n<.5?n*(1+t):n+t-n*t,c=2*n-u;a=i(c,u,e+1/3),o=i(c,u,e),l=i(c,u,e-1/3)}return{r:255*a,g:255*o,b:255*l}}function u(e,t,n){e=(0,r.sh)(e,255),t=(0,r.sh)(t,255),n=(0,r.sh)(n,255);var a=Math.max(e,t,n),o=Math.min(e,t,n),i=0,l=a,u=a-o,c=0===a?0:u/a;if(a===o)i=0;else{switch(a){case e:i=(t-n)/u+(t>16,g:(65280&e)>>8,b:255&e}}},7586:(e,t,n)=>{"use strict";n.d(t,{R:()=>r});var r={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},7763:(e,t,n)=>{"use strict";n.d(t,{uA:()=>i});var r=n(3669),a=n(7586),o=n(9521);function i(e){var t={r:0,g:0,b:0},n=1,i=null,l=null,u=null,c=!1,d=!1;return"string"===typeof e&&(e=function(e){if(e=e.trim().toLowerCase(),0===e.length)return!1;var t=!1;if(a.R[e])e=a.R[e],t=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=s.rgb.exec(e);if(n)return{r:n[1],g:n[2],b:n[3]};if(n=s.rgba.exec(e),n)return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=s.hsl.exec(e),n)return{h:n[1],s:n[2],l:n[3]};if(n=s.hsla.exec(e),n)return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=s.hsv.exec(e),n)return{h:n[1],s:n[2],v:n[3]};if(n=s.hsva.exec(e),n)return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=s.hex8.exec(e),n)return{r:(0,r.VD)(n[1]),g:(0,r.VD)(n[2]),b:(0,r.VD)(n[3]),a:(0,r.T6)(n[4]),format:t?"name":"hex8"};if(n=s.hex6.exec(e),n)return{r:(0,r.VD)(n[1]),g:(0,r.VD)(n[2]),b:(0,r.VD)(n[3]),format:t?"name":"hex"};if(n=s.hex4.exec(e),n)return{r:(0,r.VD)(n[1]+n[1]),g:(0,r.VD)(n[2]+n[2]),b:(0,r.VD)(n[3]+n[3]),a:(0,r.T6)(n[4]+n[4]),format:t?"name":"hex8"};if(n=s.hex3.exec(e),n)return{r:(0,r.VD)(n[1]+n[1]),g:(0,r.VD)(n[2]+n[2]),b:(0,r.VD)(n[3]+n[3]),format:t?"name":"hex"};return!1}(e)),"object"===typeof e&&(f(e.r)&&f(e.g)&&f(e.b)?(t=(0,r.rW)(e.r,e.g,e.b),c=!0,d="%"===String(e.r).substr(-1)?"prgb":"rgb"):f(e.h)&&f(e.s)&&f(e.v)?(i=(0,o.JX)(e.s),l=(0,o.JX)(e.v),t=(0,r.WE)(e.h,i,l),c=!0,d="hsv"):f(e.h)&&f(e.s)&&f(e.l)&&(i=(0,o.JX)(e.s),u=(0,o.JX)(e.l),t=(0,r.ve)(e.h,i,u),c=!0,d="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=(0,o.Yq)(n),{ok:c,format:e.format||d,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var l="(?:".concat("[-\\+]?\\d*\\.\\d+%?",")|(?:").concat("[-\\+]?\\d+%?",")"),u="[\\s|\\(]+(".concat(l,")[,|\\s]+(").concat(l,")[,|\\s]+(").concat(l,")\\s*\\)?"),c="[\\s|\\(]+(".concat(l,")[,|\\s]+(").concat(l,")[,|\\s]+(").concat(l,")[,|\\s]+(").concat(l,")\\s*\\)?"),s={CSS_UNIT:new RegExp(l),rgb:new RegExp("rgb"+u),rgba:new RegExp("rgba"+c),hsl:new RegExp("hsl"+u),hsla:new RegExp("hsla"+c),hsv:new RegExp("hsv"+u),hsva:new RegExp("hsva"+c),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function f(e){return Boolean(s.CSS_UNIT.exec(String(e)))}},9521:(e,t,n)=>{"use strict";function r(e,t){(function(e){return"string"===typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"===typeof e&&-1!==e.indexOf("%")}(e);return e=360===t?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t))}function a(e){return Math.min(1,Math.max(0,e))}function o(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function i(e){return e<=1?"".concat(100*Number(e),"%"):e}function l(e){return 1===e.length?"0"+e:String(e)}n.d(t,{FZ:()=>l,JX:()=>i,V2:()=>a,Yq:()=>o,sh:()=>r})},9464:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>c,mL:()=>u,q0:()=>l});var r=function(){return{height:0,opacity:0}},a=function(e){return{height:e.scrollHeight,opacity:1}},o=function(e,t){return!0===(null===t||void 0===t?void 0:t.deadline)||"height"===t.propertyName},i={motionName:"ant-motion-collapse",onAppearStart:r,onEnterStart:r,onAppearActive:a,onEnterActive:a,onLeaveStart:function(e){return{height:e?e.offsetHeight:0}},onLeaveActive:r,onAppearEnd:o,onEnterEnd:o,onLeaveEnd:o,motionDeadline:500},l=((0,n(9393).b)("bottomLeft","bottomRight","topLeft","topRight"),function(e){return void 0===e||"topLeft"!==e&&"topRight"!==e?"slide-up":"slide-down"}),u=function(e,t,n){return void 0!==n?n:"".concat(e,"-").concat(t)};const c=i},1113:(e,t,n)=>{"use strict";n.d(t,{M2:()=>o,Tm:()=>i,l$:()=>a});var r=n(2791),a=r.isValidElement;function o(e){return e&&a(e)&&e.type===r.Fragment}function i(e,t){return function(e,t,n){return a(e)?r.cloneElement(e,"function"===typeof n?n(e.props||{}):n):t}(e,e,t)}},6096:(e,t,n)=>{"use strict";n.d(t,{fk:()=>i,jD:()=>o});var r,a=n(4937),o=function(){return(0,a.Z)()&&window.document.documentElement},i=function(){if(!o())return!1;if(void 0!==r)return r;var e=document.createElement("div");return e.style.display="flex",e.style.flexDirection="column",e.style.rowGap="1px",e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),document.body.appendChild(e),r=1===e.scrollHeight,document.body.removeChild(e),r}},9393:(e,t,n)=>{"use strict";n.d(t,{a:()=>a,b:()=>r});var r=function(){for(var e=arguments.length,t=new Array(e),n=0;n{"use strict";n.d(t,{Z:()=>E});var r=n(5671),a=n(3144),o=n(7326),i=n(136),l=n(7277),u=n(5561),c=n(8834),s=n(2791),f=n(1929),d=n(5314),p=0,v={};function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=p++,r=t;function a(){(r-=1)<=0?(e(),delete v[n]):v[n]=(0,d.Z)(a)}return v[n]=(0,d.Z)(a),n}h.cancel=function(e){void 0!==e&&(d.Z.cancel(v[e]),delete v[e])},h.ids=v;var m,g=n(1113);function y(e){return!e||null===e.offsetParent||e.hidden}function b(e){return e instanceof Document?e.body:Array.from(e.childNodes).find((function(e){return(null===e||void 0===e?void 0:e.nodeType)===Node.ELEMENT_NODE}))}function w(e){var t=(e||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);return!(t&&t[1]&&t[2]&&t[3])||!(t[1]===t[2]&&t[2]===t[3])}var k=function(e){(0,i.Z)(n,e);var t=(0,l.Z)(n);function n(){var e;return(0,r.Z)(this,n),(e=t.apply(this,arguments)).containerRef=s.createRef(),e.animationStart=!1,e.destroyed=!1,e.onClick=function(t,n){var r,a,i=e.props,l=i.insertExtraNode;if(!i.disabled&&t&&!y(t)&&!t.className.includes("-leave")){e.extraNode=document.createElement("div");var c=(0,o.Z)(e).extraNode,s=e.context.getPrefixCls;c.className="".concat(s(""),"-click-animating-node");var f=e.getAttributeName();if(t.setAttribute(f,"true"),n&&"#fff"!==n&&"#ffffff"!==n&&"rgb(255, 255, 255)"!==n&&"rgba(255, 255, 255, 1)"!==n&&w(n)&&!/rgba\((?:\d*, ){3}0\)/.test(n)&&"transparent"!==n){c.style.borderColor=n;var d=(null===(r=t.getRootNode)||void 0===r?void 0:r.call(t))||t.ownerDocument,p=null!==(a=b(d))&&void 0!==a?a:d;m=(0,u.hq)("\n [".concat(s(""),"-click-animating-without-extra-node='true']::after, .").concat(s(""),"-click-animating-node {\n --antd-wave-shadow-color: ").concat(n,";\n }"),"antd-wave",{csp:e.csp,attachTo:p})}l&&t.appendChild(c),["transition","animation"].forEach((function(n){t.addEventListener("".concat(n,"start"),e.onTransitionStart),t.addEventListener("".concat(n,"end"),e.onTransitionEnd)}))}},e.onTransitionStart=function(t){if(!e.destroyed){var n=e.containerRef.current;t&&t.target===n&&!e.animationStart&&e.resetEffect(n)}},e.onTransitionEnd=function(t){t&&"fadeEffect"===t.animationName&&e.resetEffect(t.target)},e.bindAnimationEvent=function(t){if(t&&t.getAttribute&&!t.getAttribute("disabled")&&!t.className.includes("disabled")){var n=function(n){if("INPUT"!==n.target.tagName&&!y(n.target)){e.resetEffect(t);var r=getComputedStyle(t).getPropertyValue("border-top-color")||getComputedStyle(t).getPropertyValue("border-color")||getComputedStyle(t).getPropertyValue("background-color");e.clickWaveTimeoutId=window.setTimeout((function(){return e.onClick(t,r)}),0),h.cancel(e.animationStartId),e.animationStart=!0,e.animationStartId=h((function(){e.animationStart=!1}),10)}};return t.addEventListener("click",n,!0),{cancel:function(){t.removeEventListener("click",n,!0)}}}},e.renderWave=function(t){var n=t.csp,r=e.props.children;if(e.csp=n,!s.isValidElement(r))return r;var a=e.containerRef;return(0,c.Yr)(r)&&(a=(0,c.sQ)(r.ref,e.containerRef)),(0,g.Tm)(r,{ref:a})},e}return(0,a.Z)(n,[{key:"componentDidMount",value:function(){this.destroyed=!1;var e=this.containerRef.current;e&&1===e.nodeType&&(this.instance=this.bindAnimationEvent(e))}},{key:"componentWillUnmount",value:function(){this.instance&&this.instance.cancel(),this.clickWaveTimeoutId&&clearTimeout(this.clickWaveTimeoutId),this.destroyed=!0}},{key:"getAttributeName",value:function(){var e=this.context.getPrefixCls,t=this.props.insertExtraNode;return"".concat(e(""),t?"-click-animating":"-click-animating-without-extra-node")}},{key:"resetEffect",value:function(e){var t=this;if(e&&e!==this.extraNode&&e instanceof Element){var n=this.props.insertExtraNode,r=this.getAttributeName();e.setAttribute(r,"false"),m&&(m.innerHTML=""),n&&this.extraNode&&e.contains(this.extraNode)&&e.removeChild(this.extraNode),["transition","animation"].forEach((function(n){e.removeEventListener("".concat(n,"start"),t.onTransitionStart),e.removeEventListener("".concat(n,"end"),t.onTransitionEnd)}))}}},{key:"render",value:function(){return s.createElement(f.C,null,this.renderWave)}}]),n}(s.Component);k.contextType=f.E_;const E=k},2571:(e,t,n)=>{"use strict";n.d(t,{n:()=>O,Z:()=>R});var r=n(7462),a=n(4942),o=n(9439),i=n(1002),l=n(1694),u=n.n(l),c=n(1818),s=n(2791),f=n(1929),d=n(9125),p=n(1815),v=n(11),h=n(1113),m=n(9393),g=n(2833),y=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a{"use strict";n.d(t,{Z:()=>r});const r=n(2571).Z},63:(e,t,n)=>{"use strict";n.d(t,{Z:()=>R});var r=n(7462),a=n(4942),o=n(1938),i=n(1694),l=n.n(i),u=n(3433),c=n(5671),s=n(3144),f=n(136),d=n(7277),p=n(1002),v=n(5501),h=n(2791),m=n(9613),g=n.n(m),y=n(4925),b=n(5207),w=n(9439),k=h.forwardRef((function(e,t){var n,r=e.prefixCls,o=e.forceRender,i=e.className,u=e.style,c=e.children,s=e.isActive,f=e.role,d=h.useState(s||o),p=(0,w.Z)(d,2),v=p[0],m=p[1];return h.useEffect((function(){(o||s)&&m(!0)}),[o,s]),v?h.createElement("div",{ref:t,className:l()("".concat(r,"-content"),(n={},(0,a.Z)(n,"".concat(r,"-content-active"),s),(0,a.Z)(n,"".concat(r,"-content-inactive"),!s),n),i),style:u,role:f},h.createElement("div",{className:"".concat(r,"-content-box")},c)):null}));k.displayName="PanelContent";const E=k;var C=["className","id","style","prefixCls","headerClass","children","isActive","destroyInactivePanel","accordion","forceRender","openMotion","extra","collapsible"],x=function(e){(0,f.Z)(n,e);var t=(0,d.Z)(n);function n(){var e;(0,c.Z)(this,n);for(var r=arguments.length,a=new Array(r),o=0;o-1?t.splice(n,1):t.push(e)}r.setActiveKey(t)},r.getNewChild=function(e,t){if(!e)return null;var n=r.state.activeKey,a=r.props,o=a.prefixCls,i=a.openMotion,l=a.accordion,u=a.destroyInactivePanel,c=a.expandIcon,s=a.collapsible,f=e.key||String(t),d=e.props,p=d.header,v=d.headerClass,m=d.destroyInactivePanel,g=d.collapsible,y=null!==g&&void 0!==g?g:s,b={key:f,panelKey:f,header:p,headerClass:v,isActive:l?n[0]===f:n.indexOf(f)>-1,prefixCls:o,destroyInactivePanel:null!==m&&void 0!==m?m:u,openMotion:i,accordion:l,children:e.props.children,onItemClick:"disabled"===y?null:r.onClickItem,expandIcon:c,collapsible:y};return"string"===typeof e.type?e:(Object.keys(b).forEach((function(e){"undefined"===typeof b[e]&&delete b[e]})),h.cloneElement(e,b))},r.getItems=function(){var e=r.props.children;return(0,v.Z)(e).map(r.getNewChild)},r.setActiveKey=function(e){"activeKey"in r.props||r.setState({activeKey:e}),r.props.onChange(r.props.accordion?e[0]:e)};var a=e.activeKey,o=e.defaultActiveKey;return"activeKey"in e&&(o=a),r.state={activeKey:P(o)},r}return(0,s.Z)(n,[{key:"shouldComponentUpdate",value:function(e,t){return!g()(this.props,e)||!g()(this.state,t)}},{key:"render",value:function(){var e,t=this.props,n=t.prefixCls,r=t.className,o=t.style,i=t.accordion,u=l()((e={},(0,a.Z)(e,n,!0),(0,a.Z)(e,r,!!r),e));return h.createElement("div",{className:u,style:o,role:i?"tablist":null},this.getItems())}}],[{key:"getDerivedStateFromProps",value:function(e){var t={};return"activeKey"in e&&(t.activeKey=P(e.activeKey)),t}}]),n}(h.Component);Z.defaultProps={prefixCls:"rc-collapse",onChange:function(){},accordion:!1,destroyInactivePanel:!1},Z.Panel=S;const N=Z;Z.Panel;var F=n(1818),_=n(1929),O=n(9464),T=n(1113);var M=function(e){var t,n=h.useContext(_.E_),i=n.getPrefixCls,u=n.direction,c=e.prefixCls,s=e.className,f=void 0===s?"":s,d=e.bordered,p=void 0===d||d,m=e.ghost,g=e.expandIconPosition,y=void 0===g?"start":g,b=i("collapse",c),w=h.useMemo((function(){return"left"===y?"start":"right"===y?"end":y}),[y]),k=l()("".concat(b,"-icon-position-").concat(w),(t={},(0,a.Z)(t,"".concat(b,"-borderless"),!p),(0,a.Z)(t,"".concat(b,"-rtl"),"rtl"===u),(0,a.Z)(t,"".concat(b,"-ghost"),!!m),t),f),E=(0,r.Z)((0,r.Z)({},O.ZP),{motionAppear:!1,leavedClassName:"".concat(b,"-content-hidden")});return h.createElement(N,(0,r.Z)({openMotion:E},e,{expandIcon:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.expandIcon,r=n?n(t):h.createElement(o.Z,{rotate:t.isActive?90:void 0});return(0,T.Tm)(r,(function(){return{className:l()(r.props.className,"".concat(b,"-arrow"))}}))},prefixCls:b,className:k}),function(){var t=e.children;return(0,v.Z)(t).map((function(e,t){var n;if(null===(n=e.props)||void 0===n?void 0:n.disabled){var a=e.key||String(t),o=e.props,i=o.disabled,l=o.collapsible,u=(0,r.Z)((0,r.Z)({},(0,F.Z)(e.props,["disabled"])),{key:a,collapsible:null!==l&&void 0!==l?l:i?"disabled":void 0});return(0,T.Tm)(e,u)}return e}))}())};M.Panel=function(e){var t=h.useContext(_.E_).getPrefixCls,n=e.prefixCls,o=e.className,i=void 0===o?"":o,u=e.showArrow,c=void 0===u||u,s=t("collapse",n),f=l()((0,a.Z)({},"".concat(s,"-no-arrow"),!c),i);return h.createElement(N.Panel,(0,r.Z)({},e,{prefixCls:s,className:f}))};const R=M},9125:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,n:()=>o});var r=n(2791),a=r.createContext(!1),o=function(e){var t=e.children,n=e.disabled,o=r.useContext(a);return r.createElement(a.Provider,{value:null!==n&&void 0!==n?n:o},t)};const i=a},1815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,q:()=>o});var r=n(2791),a=r.createContext(void 0),o=function(e){var t=e.children,n=e.size;return r.createElement(a.Consumer,null,(function(e){return r.createElement(a.Provider,{value:n||e},t)}))};const i=a},1929:(e,t,n)=>{"use strict";n.d(t,{C:()=>a,E_:()=>r});var r=n(2791).createContext({getPrefixCls:function(e,t){return t||(e?"ant-".concat(e):"ant")}}),a=r.Consumer},2067:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>A,w6:()=>M});var r=n(7462),a=n(808),o=n(3023),i=n(1534),l=n(2791),u=n(2073),c=n(3094);const s=function(e){var t=e.locale,n=void 0===t?{}:t,a=e.children;e._ANT_MARK__;l.useEffect((function(){return(0,u.f)(n&&n.Modal),function(){(0,u.f)()}}),[n]);var o=l.useMemo((function(){return(0,r.Z)((0,r.Z)({},n),{exist:!0})}),[n]);return l.createElement(c.Z.Provider,{value:o},a)};var f=n(3486),d=n(3578),p=n(3695),v=n(3085),h=n(1929),m=n(6327),g=n(3669),y=n(7586),b=n(7763),w=n(9521),k=function(){function e(t,n){var r;if(void 0===t&&(t=""),void 0===n&&(n={}),t instanceof e)return t;"number"===typeof t&&(t=(0,g.Yt)(t)),this.originalInput=t;var a=(0,b.uA)(t);this.originalInput=t,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=n.format)&&void 0!==r?r:a.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255;return.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=(0,w.Yq)(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return 0===this.toHsl().s},e.prototype.toHsv=function(){var e=(0,g.py)(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=(0,g.py)(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsva(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=(0,g.lC)(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=(0,g.lC)(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsla(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),(0,g.vq)(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),(0,g.s)(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"rgba(".concat(e,", ").concat(t,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*(0,w.sh)(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*(0,w.sh)(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+(0,g.vq)(this.r,this.g,this.b,!1),t=0,n=Object.entries(y.R);t=0;return t||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=(0,w.V2)(n.l),new e(n)},e.prototype.brighten=function(t){void 0===t&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-t/100*255))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-t/100*255))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-t/100*255))),new e(n)},e.prototype.darken=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=(0,w.V2)(n.l),new e(n)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=(0,w.V2)(n.s),new e(n)},e.prototype.saturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=(0,w.V2)(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){void 0===n&&(n=50);var r=this.toRgb(),a=new e(t).toRgb(),o=n/100;return new e({r:(a.r-r.r)*o+r.r,g:(a.g-r.g)*o+r.g,b:(a.b-r.b)*o+r.b,a:(a.a-r.a)*o+r.a})},e.prototype.analogous=function(t,n){void 0===t&&(t=6),void 0===n&&(n=30);var r=this.toHsl(),a=360/n,o=[this];for(r.h=(r.h-(a*t>>1)+720)%360;--t;)r.h=(r.h+a)%360,o.push(new e(r));return o},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var n=this.toHsv(),r=n.h,a=n.s,o=n.v,i=[],l=1/t;t--;)i.push(new e({h:r,s:a,v:o})),o=(o+l)%1;return i},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb();return new e({r:r.r+(n.r-r.r)*n.a,g:r.g+(n.g-r.g)*n.a,b:r.b+(n.b-r.b)*n.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,a=[this],o=360/t,i=1;i0&&(T=l.createElement(o.RV,{validateMessages:M},u)),v&&(T=l.createElement(s,{locale:v,_ANT_MARK__:"internalMark"},T)),(C||c)&&(T=l.createElement(a.Z.Provider,{value:O},T)),m&&(T=l.createElement(F.q,{size:m},T)),void 0!==x&&(T=l.createElement(N.n,{disabled:x},T)),l.createElement(h.E_.Provider,{value:Z},T)},L=function(e){return l.useEffect((function(){e.direction&&(p.ZP.config({rtl:"rtl"===e.direction}),v.Z.config({rtl:"rtl"===e.direction}))}),[e.direction]),l.createElement(f.Z,null,(function(t,n,a){return l.createElement(h.C,null,(function(t){return l.createElement(R,(0,r.Z)({parentContext:t,legacyLocale:a},e))}))}))};L.ConfigContext=h.E_,L.SizeContext=F.Z,L.config=function(e){var t=e.prefixCls,n=e.iconPrefixCls,r=e.theme;void 0!==t&&(P=t),void 0!==n&&(Z=n),r&&S(O(),r)};const A=L},1940:(e,t,n)=>{"use strict";n.d(t,{Ux:()=>i,aM:()=>o});var r=n(7462),a=(n(3023),n(2791)),o=a.createContext({}),i=function(e){var t=e.children,n=e.status,i=e.override,l=(0,a.useContext)(o),u=(0,a.useMemo)((function(){var e=(0,r.Z)({},l);return i&&delete e.isFormItemInput,n&&(delete e.status,delete e.hasFeedback,delete e.feedbackIcon),e}),[n,i,l]);return a.createElement(o.Provider,{value:u},t)}},3486:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l,E:()=>u});var r=n(7462),a=n(2791),o=n(3094);const i=n(3578).Z;const l=function(e){var t=e.componentName,n=void 0===t?"global":t,l=e.defaultLocale,u=e.children,c=a.useContext(o.Z);return u(a.useMemo((function(){var e,t=l||i[n],a=null!==(e=null===c||void 0===c?void 0:c[n])&&void 0!==e?e:{};return(0,r.Z)((0,r.Z)({},t instanceof Function?t():t),a||{})}),[n,l,c]),a.useMemo((function(){var e=c&&c.locale;return c&&c.exist&&!e?i.locale:e}),[c]),c)};var u=function(e,t){var n=a.useContext(o.Z);return[a.useMemo((function(){var a,o=t||i[e],l=null!==(a=null===n||void 0===n?void 0:n[e])&&void 0!==a?a:{};return(0,r.Z)((0,r.Z)({},"function"===typeof o?o():o),l||{})}),[e,t,n])]}},3094:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=(0,n(2791).createContext)(void 0)},3578:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(1771),a=n(7462);const o={locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"};const i={placeholder:"Select time",rangePlaceholder:["Start time","End time"]};const l={lang:(0,a.Z)({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},o),timePickerLocale:(0,a.Z)({},i)},u=l;var c="${label} is not a valid ${type}";const s={locale:"en",Pagination:r.Z,DatePicker:l,TimePicker:i,Calendar:u,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckall:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand"},PageHeader:{back:"Back"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:c,method:c,array:c,object:c,number:c,date:c,boolean:c,integer:c,float:c,regexp:c,email:c,url:c,hex:c},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"}}},3695:(e,t,n)=>{"use strict";n.d(t,{Df:()=>z,ZP:()=>j,S$:()=>T,z$:()=>L});var r=n(7462),a=n(4942),o=n(7557),i=n(2621),l=n(187),u=n(1413),c=n(2791);const s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"};var f=n(4291),d=function(e,t){return c.createElement(f.Z,(0,u.Z)((0,u.Z)({},e),{},{ref:t,icon:s}))};d.displayName="InfoCircleFilled";const p=c.forwardRef(d);var v,h=n(7106),m=n(1694),g=n.n(m),y=n(4703),b=n(2067),w=n(9439),k=n(5081),E=n(1929);var C,x,S,P=3,Z=1,N="",F="move-up",_=!1,O=!1;function T(){return Z++}function M(e,t){var n=e.prefixCls,r=e.getPopupContainer,a=(0,b.w6)(),o=a.getPrefixCls,i=a.getRootPrefixCls,l=a.getIconPrefixCls,u=o("message",n||N),c=i(e.rootPrefixCls,u),s=l();if(v)t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:v});else{var f={prefixCls:u,transitionName:_?F:"".concat(c,"-").concat(F),style:{top:C},getContainer:x||r,maxCount:S};y.Z.newInstance(f,(function(e){v?t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:v}):(v=e,t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:e}))}))}}var R={info:p,success:o.Z,error:i.Z,warning:l.Z,loading:h.Z},L=Object.keys(R);function A(e,t,n){var r,o=void 0!==e.duration?e.duration:P,i=R[e.type],l=g()("".concat(t,"-custom-content"),(r={},(0,a.Z)(r,"".concat(t,"-").concat(e.type),e.type),(0,a.Z)(r,"".concat(t,"-rtl"),!0===O),r));return{key:e.key,duration:o,style:e.style||{},className:e.className,content:c.createElement(b.ZP,{iconPrefixCls:n},c.createElement("div",{className:l},e.icon||i&&c.createElement(i,null),c.createElement("span",null,e.content))),onClose:e.onClose,onClick:e.onClick}}var I={open:function(e){var t=e.key||T(),n=new Promise((function(n){var a=function(){return"function"===typeof e.onClose&&e.onClose(),n(!0)};M(e,(function(n){var o=n.prefixCls,i=n.iconPrefixCls;n.instance.notice(A((0,r.Z)((0,r.Z)({},e),{key:t,onClose:a}),o,i))}))})),a=function(){var n;v&&(v.removeNotice(t),null===(n=e.onClose)||void 0===n||n.call(e))};return a.then=function(e,t){return n.then(e,t)},a.promise=n,a},config:function(e){void 0!==e.top&&(C=e.top,v=null),void 0!==e.duration&&(P=e.duration),void 0!==e.prefixCls&&(N=e.prefixCls),void 0!==e.getContainer&&(x=e.getContainer,v=null),void 0!==e.transitionName&&(F=e.transitionName,v=null,_=!0),void 0!==e.maxCount&&(S=e.maxCount,v=null),void 0!==e.rtl&&(O=e.rtl)},destroy:function(e){if(v)if(e){(0,v.removeNotice)(e)}else{var t=v.destroy;t(),v=null}}};function z(e,t){e[t]=function(n,a,o){return function(e){return"[object Object]"===Object.prototype.toString.call(e)&&!!e.content}(n)?e.open((0,r.Z)((0,r.Z)({},n),{type:t})):("function"===typeof a&&(o=a,a=void 0),e.open({content:n,duration:a,type:t,onClose:o}))}}L.forEach((function(e){return z(I,e)})),I.warn=I.warning,I.useMessage=function(e,t){return function(){var n,a,o=null,i={add:function(e,t){null===o||void 0===o||o.component.add(e,t)}},l=(0,k.Z)(i),u=(0,w.Z)(l,2),s=u[0],f=u[1];var d=c.useRef({});return d.current.open=function(i){var l=i.prefixCls,u=n("message",l),c=n(),f=i.key||T(),d=new Promise((function(n){var l=function(){return"function"===typeof i.onClose&&i.onClose(),n(!0)};e((0,r.Z)((0,r.Z)({},i),{prefixCls:u,rootPrefixCls:c,getPopupContainer:a}),(function(e){var n=e.prefixCls,a=e.instance;o=a,s(t((0,r.Z)((0,r.Z)({},i),{key:f,onClose:l}),n))}))})),p=function(){o&&o.removeNotice(f)};return p.then=function(e,t){return d.then(e,t)},p.promise=d,p},L.forEach((function(e){return z(d.current,e)})),[d.current,c.createElement(E.C,{key:"holder"},(function(e){return n=e.getPrefixCls,a=e.getPopupContainer,f}))]}}(M,A);const j=I},6784:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Ne});var r=n(3433),a=n(7462),o=n(8944),i=n(1532),l=n(5796),u=n(9966),c=n(4699),s=n(2791),f=n.t(s,2),d=n(2067),p=n(4942),v=n(1694),h=n.n(v),m=n(9439),g=n(8368),y=n(7309),b=n(2571);function w(e){return!(!e||!e.then)}const k=function(e){var t=s.useRef(!1),n=s.useRef(null),r=(0,g.Z)(!1),o=(0,m.Z)(r,2),i=o[0],l=o[1],u=e.close,c=function(){null===u||void 0===u||u.apply(void 0,arguments)};s.useEffect((function(){var t=null;return e.autoFocus&&(t=setTimeout((function(){var e;null===(e=n.current)||void 0===e||e.focus()}))),function(){t&&clearTimeout(t)}}),[]);var f=e.type,d=e.children,p=e.prefixCls,v=e.buttonProps;return s.createElement(y.Z,(0,a.Z)({},(0,b.n)(f),{onClick:function(n){var r=e.actionFn;if(!t.current)if(t.current=!0,r){var a;if(e.emitEvent){if(a=r(n),e.quitOnNullishReturnValue&&!w(a))return t.current=!1,void c(n)}else if(r.length)a=r(u),t.current=!1;else if(!(a=r()))return void c();!function(e){w(e)&&(l(!0),e.then((function(){l(!1,!0),c.apply(void 0,arguments),t.current=!1}),(function(e){console.error(e),l(!1,!0),t.current=!1})))}(a)}else c()},loading:i,prefixCls:p},v,{ref:n}),d)};var E=n(9464),C=n(732),x=n(4164),S=n(4937),P=n(8834);const Z=s.createContext(null);var N=n(1605),F=[];var _=n(5561),O=n(9025);var T="rc-util-locker-".concat(Date.now()),M=0;function R(e){var t=!!e,n=s.useState((function(){return M+=1,"".concat(T,"_").concat(M)})),r=(0,m.Z)(n,1)[0];(0,N.Z)((function(){if(t){var e=(0,O.Z)(),n=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth;(0,_.hq)("\nhtml body {\n overflow-y: hidden;\n ".concat(n?"width: calc(100% - ".concat(e,"px);"):"","\n}"),r)}else(0,_.jL)(r);return function(){(0,_.jL)(r)}}),[t,r])}var L=!1;var A=function(e){return!1!==e&&((0,S.Z)()&&e?"string"===typeof e?document.querySelector(e):"function"===typeof e?e():e:null)};const I=s.forwardRef((function(e,t){var n=e.open,a=e.autoLock,o=e.getContainer,i=(e.debug,e.autoDestroy),l=void 0===i||i,u=e.children,c=s.useState(n),f=(0,m.Z)(c,2),d=f[0],p=f[1],v=d||n;s.useEffect((function(){(l||n)&&p(n)}),[n,l]);var h=s.useState((function(){return A(o)})),g=(0,m.Z)(h,2),y=g[0],b=g[1];s.useEffect((function(){var e=A(o);b(null!==e&&void 0!==e?e:null)}));var w=function(e,t){var n=s.useState((function(){return(0,S.Z)()?document.createElement("div"):null})),a=(0,m.Z)(n,1)[0],o=s.useContext(Z),i=s.useState(F),l=(0,m.Z)(i,2),u=l[0],c=l[1],f=o||function(e){c((function(t){return[e].concat((0,r.Z)(t))}))};function d(){a.parentElement||document.body.appendChild(a)}function p(){var e;null===(e=a.parentElement)||void 0===e||e.removeChild(a)}return(0,N.Z)((function(){return e?o?o(d):d():p(),p}),[e]),(0,N.Z)((function(){u.length&&(u.forEach((function(e){return e()})),c(F))}),[u]),[a,f]}(v&&!y),k=(0,m.Z)(w,2),E=k[0],C=k[1],_=null!==y&&void 0!==y?y:E;R(a&&n&&(0,S.Z)()&&(_===E||_===document.body));var O=null;u&&(0,P.Yr)(u)&&t&&(O=u.ref);var T=(0,P.x1)(O,t);if(!v||!(0,S.Z)()||void 0===y)return null;var M,I=!1===_||("boolean"===typeof M&&(L=M),L),z=u;return t&&(z=s.cloneElement(u,{ref:T})),s.createElement(Z.Provider,{value:C},I?z:(0,x.createPortal)(z,_))}));var z=n(1413),j=n(1354);var D=0;function V(e){var t=s.useState("ssr-id"),n=(0,m.Z)(t,2),r=n[0],a=n[1],o=(0,z.Z)({},f).useId,i=null===o||void 0===o?void 0:o();return s.useEffect((function(){if(!o){var e=D;D+=1,a("rc_unique_".concat(e))}}),[]),e||(i||r)}var U=n(520),$=n(4170),H=n(5207);function q(e){var t=e.prefixCls,n=e.style,r=e.visible,o=e.maskProps,i=e.motionName;return s.createElement(H.Z,{key:"mask",visible:r,motionName:i,leavedClassName:"".concat(t,"-mask-hidden")},(function(e,r){var i=e.className,l=e.style;return s.createElement("div",(0,a.Z)({ref:r,style:(0,z.Z)((0,z.Z)({},l),n),className:h()("".concat(t,"-mask"),i)},o))}))}function W(e,t,n){var r=t;return!r&&n&&(r="".concat(e,"-").concat(n)),r}function B(e,t){var n=e["page".concat(t?"Y":"X","Offset")],r="scroll".concat(t?"Top":"Left");if("number"!==typeof n){var a=e.document;"number"!==typeof(n=a.documentElement[r])&&(n=a.body[r])}return n}const K=s.memo((function(e){return e.children}),(function(e,t){return!t.shouldUpdate}));var Q={width:0,height:0,overflow:"hidden",outline:"none"};const Y=s.forwardRef((function(e,t){var n=e.prefixCls,r=e.className,o=e.style,i=e.title,l=e.ariaId,u=e.footer,c=e.closable,f=e.closeIcon,d=e.onClose,p=e.children,v=e.bodyStyle,m=e.bodyProps,g=e.modalRender,y=e.onMouseDown,b=e.onMouseUp,w=e.holderRef,k=e.visible,E=e.forceRender,C=e.width,x=e.height,S=(0,s.useRef)(),P=(0,s.useRef)();s.useImperativeHandle(t,(function(){return{focus:function(){var e;null===(e=S.current)||void 0===e||e.focus()},changeActive:function(e){var t=document.activeElement;e&&t===P.current?S.current.focus():e||t!==S.current||P.current.focus()}}}));var Z,N,F,_={};void 0!==C&&(_.width=C),void 0!==x&&(_.height=x),u&&(Z=s.createElement("div",{className:"".concat(n,"-footer")},u)),i&&(N=s.createElement("div",{className:"".concat(n,"-header")},s.createElement("div",{className:"".concat(n,"-title"),id:l},i))),c&&(F=s.createElement("button",{type:"button",onClick:d,"aria-label":"Close",className:"".concat(n,"-close")},f||s.createElement("span",{className:"".concat(n,"-close-x")})));var O=s.createElement("div",{className:"".concat(n,"-content")},F,N,s.createElement("div",(0,a.Z)({className:"".concat(n,"-body"),style:v},m),p),Z);return s.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":i?l:null,"aria-modal":"true",ref:w,style:(0,z.Z)((0,z.Z)({},o),_),className:h()(n,r),onMouseDown:y,onMouseUp:b},s.createElement("div",{tabIndex:0,ref:S,style:Q,"aria-hidden":"true"}),s.createElement(K,{shouldUpdate:k||E},g?g(O):O),s.createElement("div",{tabIndex:0,ref:P,style:Q,"aria-hidden":"true"}))}));var G=s.forwardRef((function(e,t){var n=e.prefixCls,r=e.title,o=e.style,i=e.className,l=e.visible,u=e.forceRender,c=e.destroyOnClose,f=e.motionName,d=e.ariaId,p=e.onVisibleChanged,v=e.mousePosition,g=(0,s.useRef)(),y=s.useState(),b=(0,m.Z)(y,2),w=b[0],k=b[1],E={};function C(){var e=function(e){var t=e.getBoundingClientRect(),n={left:t.left,top:t.top},r=e.ownerDocument,a=r.defaultView||r.parentWindow;return n.left+=B(a),n.top+=B(a,!0),n}(g.current);k(v?"".concat(v.x-e.left,"px ").concat(v.y-e.top,"px"):"")}return w&&(E.transformOrigin=w),s.createElement(H.Z,{visible:l,onVisibleChanged:p,onAppearPrepare:C,onEnterPrepare:C,forceRender:u,motionName:f,removeOnLeave:c,ref:g},(function(l,u){var c=l.className,f=l.style;return s.createElement(Y,(0,a.Z)({},e,{ref:t,title:r,ariaId:d,prefixCls:n,holderRef:u,style:(0,z.Z)((0,z.Z)((0,z.Z)({},f),o),E),className:h()(i,c)}))}))}));G.displayName="Content";const X=G;function J(e){var t=e.prefixCls,n=void 0===t?"rc-dialog":t,r=e.zIndex,o=e.visible,i=void 0!==o&&o,l=e.keyboard,u=void 0===l||l,c=e.focusTriggerAfterClose,f=void 0===c||c,d=e.wrapStyle,p=e.wrapClassName,v=e.wrapProps,g=e.onClose,y=e.afterClose,b=e.transitionName,w=e.animation,k=e.closable,E=void 0===k||k,C=e.mask,x=void 0===C||C,S=e.maskTransitionName,P=e.maskAnimation,Z=e.maskClosable,N=void 0===Z||Z,F=e.maskStyle,_=e.maskProps,O=e.rootClassName,T=(0,s.useRef)(),M=(0,s.useRef)(),R=(0,s.useRef)(),L=s.useState(i),A=(0,m.Z)(L,2),I=A[0],D=A[1],H=V();function B(e){null===g||void 0===g||g(e)}var K=(0,s.useRef)(!1),Q=(0,s.useRef)(),Y=null;return N&&(Y=function(e){K.current?K.current=!1:M.current===e.target&&B(e)}),(0,s.useEffect)((function(){i&&(D(!0),(0,U.Z)(M.current,document.activeElement)||(T.current=document.activeElement))}),[i]),(0,s.useEffect)((function(){return function(){clearTimeout(Q.current)}}),[]),s.createElement("div",(0,a.Z)({className:h()("".concat(n,"-root"),O)},(0,$.Z)(e,{data:!0})),s.createElement(q,{prefixCls:n,visible:x&&i,motionName:W(n,S,P),style:(0,z.Z)({zIndex:r},F),maskProps:_}),s.createElement("div",(0,a.Z)({tabIndex:-1,onKeyDown:function(e){if(u&&e.keyCode===j.Z.ESC)return e.stopPropagation(),void B(e);i&&e.keyCode===j.Z.TAB&&R.current.changeActive(!e.shiftKey)},className:h()("".concat(n,"-wrap"),p),ref:M,onClick:Y,style:(0,z.Z)((0,z.Z)({zIndex:r},d),{},{display:I?null:"none"})},v),s.createElement(X,(0,a.Z)({},e,{onMouseDown:function(){clearTimeout(Q.current),K.current=!0},onMouseUp:function(){Q.current=setTimeout((function(){K.current=!1}))},ref:R,closable:E,ariaId:H,prefixCls:n,visible:i&&I,onClose:B,onVisibleChanged:function(e){if(e)!function(){var e;(0,U.Z)(M.current,document.activeElement)||null===(e=R.current)||void 0===e||e.focus()}();else{if(D(!1),x&&T.current&&f){try{T.current.focus({preventScroll:!0})}catch(t){}T.current=null}I&&(null===y||void 0===y||y())}},motionName:W(n,b,w)}))))}var ee=function(e){var t=e.visible,n=e.getContainer,r=e.forceRender,o=e.destroyOnClose,i=void 0!==o&&o,l=e.afterClose,u=s.useState(t),c=(0,m.Z)(u,2),f=c[0],d=c[1];return s.useEffect((function(){t&&d(!0)}),[t]),r||!i||f?s.createElement(I,{open:t||r||f,autoDestroy:!1,getContainer:n,autoLock:t||f},s.createElement(J,(0,a.Z)({},e,{destroyOnClose:i,afterClose:function(){null===l||void 0===l||l(),d(!1)}}))):null};ee.displayName="Dialog";const te=ee;var ne,re=n(1929),ae=n(1940),oe=n(3486),ie=n(11),le=n(6096),ue=n(2073),ce=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a{"use strict";n.d(t,{A:()=>l,f:()=>i});var r=n(7462),a=n(3578),o=(0,r.Z)({},a.Z.Modal);function i(e){o=e?(0,r.Z)((0,r.Z)({},o),e):(0,r.Z)({},a.Z.Modal)}function l(){return o}},3085:(e,t,n)=>{"use strict";n.d(t,{Z:()=>M});var r=n(7462),a=n(4942),o=n(8944),i=n(1532),l=n(732),u=n(5796),c=n(9966),s=n(1694),f=n.n(s),d=n(4703),p=n(2791),v=n(2067),h=n(9439),m=n(5081),g=n(1929);var y,b,w,k={},E=4.5,C=24,x=24,S="",P="topRight",Z=!1;function N(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;switch(e){case"top":t={left:"50%",transform:"translateX(-50%)",right:"auto",top:n,bottom:"auto"};break;case"topLeft":t={left:0,top:n,bottom:"auto"};break;case"topRight":t={right:0,top:n,bottom:"auto"};break;case"bottom":t={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:r};break;case"bottomLeft":t={left:0,top:"auto",bottom:r};break;default:t={right:0,top:"auto",bottom:r}}return t}function F(e,t){var n=e.placement,r=void 0===n?P:n,o=e.top,i=e.bottom,l=e.getContainer,u=void 0===l?y:l,c=e.prefixCls,s=(0,v.w6)(),p=s.getPrefixCls,h=s.getIconPrefixCls,m=p("notification",c||S),g=h(),b="".concat(m,"-").concat(r),E=k[b];if(E)Promise.resolve(E).then((function(e){t({prefixCls:"".concat(m,"-notice"),iconPrefixCls:g,instance:e})}));else{var C=f()("".concat(m,"-").concat(r),(0,a.Z)({},"".concat(m,"-rtl"),!0===Z));k[b]=new Promise((function(e){d.Z.newInstance({prefixCls:m,className:C,style:N(r,o,i),getContainer:u,maxCount:w},(function(n){e(n),t({prefixCls:"".concat(m,"-notice"),iconPrefixCls:g,instance:n})}))}))}}var _={success:o.Z,info:c.Z,error:i.Z,warning:u.Z};function O(e,t,n){var r=e.duration,o=e.icon,i=e.type,u=e.description,c=e.message,s=e.btn,d=e.onClose,h=e.onClick,m=e.key,g=e.style,y=e.className,w=e.closeIcon,k=void 0===w?b:w,C=e.props,x=void 0===r?E:r,S=null;o?S=p.createElement("span",{className:"".concat(t,"-icon")},e.icon):i&&(S=p.createElement(_[i]||null,{className:"".concat(t,"-icon ").concat(t,"-icon-").concat(i)}));var P=p.createElement("span",{className:"".concat(t,"-close-x")},k||p.createElement(l.Z,{className:"".concat(t,"-close-icon")})),Z=!u&&S?p.createElement("span",{className:"".concat(t,"-message-single-line-auto-margin")}):null;return{content:p.createElement(v.ZP,{iconPrefixCls:n},p.createElement("div",{className:S?"".concat(t,"-with-icon"):"",role:"alert"},S,p.createElement("div",{className:"".concat(t,"-message")},Z,c),p.createElement("div",{className:"".concat(t,"-description")},u),s?p.createElement("span",{className:"".concat(t,"-btn")},s):null)),duration:x,closable:!0,closeIcon:P,onClose:d,onClick:h,key:m,style:g||{},className:f()(y,(0,a.Z)({},"".concat(t,"-").concat(i),!!i)),props:C}}var T={open:function(e){F(e,(function(t){var n=t.prefixCls,r=t.iconPrefixCls;t.instance.notice(O(e,n,r))}))},close:function(e){Object.keys(k).forEach((function(t){return Promise.resolve(k[t]).then((function(t){t.removeNotice(e)}))}))},config:function(e){var t=e.duration,n=e.placement,r=e.bottom,a=e.top,o=e.getContainer,i=e.closeIcon,l=e.prefixCls;void 0!==l&&(S=l),void 0!==t&&(E=t),void 0!==n?P=n:e.rtl&&(P="topLeft"),void 0!==r&&(x=r),void 0!==a&&(C=a),void 0!==o&&(y=o),void 0!==i&&(b=i),void 0!==e.rtl&&(Z=e.rtl),void 0!==e.maxCount&&(w=e.maxCount)},destroy:function(){Object.keys(k).forEach((function(e){Promise.resolve(k[e]).then((function(e){e.destroy()})),delete k[e]}))}};["success","info","warning","error"].forEach((function(e){T[e]=function(t){return T.open((0,r.Z)((0,r.Z)({},t),{type:e}))}})),T.warn=T.warning,T.useNotification=function(e,t){return function(){var n,a=null,o={add:function(e,t){null===a||void 0===a||a.component.add(e,t)}},i=(0,m.Z)(o),l=(0,h.Z)(i,2),u=l[0],c=l[1];var s=p.useRef({});return s.current.open=function(o){var i=o.prefixCls,l=n("notification",i);e((0,r.Z)((0,r.Z)({},o),{prefixCls:l}),(function(e){var n=e.prefixCls,r=e.instance;a=r,u(t(o,n))}))},["success","info","warning","error"].forEach((function(e){s.current[e]=function(t){return s.current.open((0,r.Z)((0,r.Z)({},t),{type:e}))}})),[s.current,p.createElement(g.C,{key:"holder"},(function(e){return n=e.getPrefixCls,c}))]}}(F,O);const M=T},11:(e,t,n)=>{"use strict";n.d(t,{BR:()=>p,ZP:()=>h,ri:()=>d});var r=n(7462),a=n(4942),o=n(1694),i=n.n(o),l=n(5501),u=n(2791),c=n(1929),s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a{var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t{"use strict";n.d(t,{zb:()=>y,RV:()=>je});var r=n(2791),a=n(7462),o=n(4925),i=n(4942),l=n(1413),u=n(3433),c=n(5671),s=n(3144),f=n(7326),d=n(136),p=n(7277),v=n(5501),h=n(632),m="RC_FORM_INTERNAL_HOOKS",g=function(){(0,h.ZP)(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")};const y=r.createContext({getFieldValue:g,getFieldsValue:g,getFieldError:g,getFieldWarning:g,getFieldsError:g,isFieldsTouched:g,isFieldTouched:g,isFieldValidating:g,isFieldsValidating:g,resetFields:g,setFields:g,setFieldValue:g,setFieldsValue:g,validateFields:g,submit:g,getInternalHooks:function(){return g(),{dispatch:g,initEntityValue:g,registerField:g,useSubscribe:g,setInitialValues:g,destroyForm:g,setCallbacks:g,registerWatch:g,getFields:g,setValidateMessages:g,setPreserve:g,getInitialValue:g}}});function b(e){return void 0===e||null===e?[]:Array.isArray(e)?e:[e]}var w=n(4165),k=n(5861);function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),r=1;r=o)return e;switch(e){case"%s":return String(n[a++]);case"%d":return Number(n[a++]);case"%j":try{return JSON.stringify(n[a++])}catch(t){return"[Circular]"}break;default:return e}}));return i}return e}function O(e,t){return void 0===e||null===e||(!("array"!==t||!Array.isArray(e)||e.length)||!(!function(e){return"string"===e||"url"===e||"hex"===e||"email"===e||"date"===e||"pattern"===e}(t)||"string"!==typeof e||e))}function T(e,t,n){var r=0,a=e.length;!function o(i){if(i&&i.length)n(i);else{var l=r;r+=1,l()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,D=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,V={integer:function(e){return V.number(e)&&parseInt(e,10)===e},float:function(e){return V.number(e)&&!V.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(t){return!1}},date:function(e){return"function"===typeof e.getTime&&"function"===typeof e.getMonth&&"function"===typeof e.getYear&&!isNaN(e.getTime())},number:function(e){return!isNaN(e)&&"number"===typeof e},object:function(e){return"object"===typeof e&&!V.array(e)},method:function(e){return"function"===typeof e},email:function(e){return"string"===typeof e&&e.length<=320&&!!e.match(j)},url:function(e){return"string"===typeof e&&e.length<=2048&&!!e.match(function(){if(I)return I;var e="[a-fA-F\\d:]",t=function(t){return t&&t.includeBoundaries?"(?:(?<=\\s|^)(?="+e+")|(?<="+e+")(?=\\s|$))":""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",a=("\n(?:\n(?:"+r+":){7}(?:"+r+"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:"+r+":){6}(?:"+n+"|:"+r+"|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:"+r+":){5}(?::"+n+"|(?::"+r+"){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:"+r+":){4}(?:(?::"+r+"){0,1}:"+n+"|(?::"+r+"){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:"+r+":){3}(?:(?::"+r+"){0,2}:"+n+"|(?::"+r+"){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:"+r+":){2}(?:(?::"+r+"){0,3}:"+n+"|(?::"+r+"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:"+r+":){1}(?:(?::"+r+"){0,4}:"+n+"|(?::"+r+"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::"+r+"){0,5}:"+n+"|(?::"+r+"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),o=new RegExp("(?:^"+n+"$)|(?:^"+a+"$)"),i=new RegExp("^"+n+"$"),l=new RegExp("^"+a+"$"),u=function(e){return e&&e.exact?o:new RegExp("(?:"+t(e)+n+t(e)+")|(?:"+t(e)+a+t(e)+")","g")};u.v4=function(e){return e&&e.exact?i:new RegExp(""+t(e)+n+t(e),"g")},u.v6=function(e){return e&&e.exact?l:new RegExp(""+t(e)+a+t(e),"g")};var c=u.v4().source,s=u.v6().source;return I=new RegExp("(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|"+c+"|"+s+'|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?$)',"i")}())},hex:function(e){return"string"===typeof e&&!!e.match(D)}},U="enum",$={required:z,whitespace:function(e,t,n,r,a){(/^\s+$/.test(t)||""===t)&&r.push(_(a.messages.whitespace,e.fullField))},type:function(e,t,n,r,a){if(e.required&&void 0===t)z(e,t,n,r,a);else{var o=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(o)>-1?V[o](t)||r.push(_(a.messages.types[o],e.fullField,e.type)):o&&typeof t!==e.type&&r.push(_(a.messages.types[o],e.fullField,e.type))}},range:function(e,t,n,r,a){var o="number"===typeof e.len,i="number"===typeof e.min,l="number"===typeof e.max,u=t,c=null,s="number"===typeof t,f="string"===typeof t,d=Array.isArray(t);if(s?c="number":f?c="string":d&&(c="array"),!c)return!1;d&&(u=t.length),f&&(u=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),o?u!==e.len&&r.push(_(a.messages[c].len,e.fullField,e.len)):i&&!l&&ue.max?r.push(_(a.messages[c].max,e.fullField,e.max)):i&&l&&(ue.max)&&r.push(_(a.messages[c].range,e.fullField,e.min,e.max))},enum:function(e,t,n,r,a){e[U]=Array.isArray(e[U])?e[U]:[],-1===e[U].indexOf(t)&&r.push(_(a.messages[U],e.fullField,e[U].join(", ")))},pattern:function(e,t,n,r,a){if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||r.push(_(a.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"===typeof e.pattern){new RegExp(e.pattern).test(t)||r.push(_(a.messages.pattern.mismatch,e.fullField,t,e.pattern))}}},H=function(e,t,n,r,a){var o=e.type,i=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t,o)&&!e.required)return n();$.required(e,t,r,i,a,o),O(t,o)||$.type(e,t,r,i,a)}n(i)},q={string:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t,"string")&&!e.required)return n();$.required(e,t,r,o,a,"string"),O(t,"string")||($.type(e,t,r,o,a),$.range(e,t,r,o,a),$.pattern(e,t,r,o,a),!0===e.whitespace&&$.whitespace(e,t,r,o,a))}n(o)},method:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&$.type(e,t,r,o,a)}n(o)},number:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(""===t&&(t=void 0),O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&($.type(e,t,r,o,a),$.range(e,t,r,o,a))}n(o)},boolean:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&$.type(e,t,r,o,a)}n(o)},regexp:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),O(t)||$.type(e,t,r,o,a)}n(o)},integer:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&($.type(e,t,r,o,a),$.range(e,t,r,o,a))}n(o)},float:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&($.type(e,t,r,o,a),$.range(e,t,r,o,a))}n(o)},array:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if((void 0===t||null===t)&&!e.required)return n();$.required(e,t,r,o,a,"array"),void 0!==t&&null!==t&&($.type(e,t,r,o,a),$.range(e,t,r,o,a))}n(o)},object:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&$.type(e,t,r,o,a)}n(o)},enum:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a),void 0!==t&&$.enum(e,t,r,o,a)}n(o)},pattern:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t,"string")&&!e.required)return n();$.required(e,t,r,o,a),O(t,"string")||$.pattern(e,t,r,o,a)}n(o)},date:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t,"date")&&!e.required)return n();var i;if($.required(e,t,r,o,a),!O(t,"date"))i=t instanceof Date?t:new Date(t),$.type(e,i,r,o,a),i&&$.range(e,i.getTime(),r,o,a)}n(o)},url:H,hex:H,email:H,required:function(e,t,n,r,a){var o=[],i=Array.isArray(t)?"array":typeof t;$.required(e,t,r,o,a,i),n(o)},any:function(e,t,n,r,a){var o=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(O(t)&&!e.required)return n();$.required(e,t,r,o,a)}n(o)}};function W(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var B=W(),K=function(){function e(e){this.rules=null,this._messages=B,this.define(e)}var t=e.prototype;return t.define=function(e){var t=this;if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!==typeof e||Array.isArray(e))throw new Error("Rules must be an object");this.rules={},Object.keys(e).forEach((function(n){var r=e[n];t.rules[n]=Array.isArray(r)?r:[r]}))},t.messages=function(e){return e&&(this._messages=A(W(),e)),this._messages},t.validate=function(t,n,r){var a=this;void 0===n&&(n={}),void 0===r&&(r=function(){});var o=t,i=n,l=r;if("function"===typeof i&&(l=i,i={}),!this.rules||0===Object.keys(this.rules).length)return l&&l(null,o),Promise.resolve(o);if(i.messages){var u=this.messages();u===B&&(u=W()),A(u,i.messages),i.messages=u}else i.messages=this.messages();var c={};(i.keys||Object.keys(this.rules)).forEach((function(e){var n=a.rules[e],r=o[e];n.forEach((function(n){var i=n;"function"===typeof i.transform&&(o===t&&(o=E({},o)),r=o[e]=i.transform(r)),(i="function"===typeof i?{validator:i}:E({},i)).validator=a.getValidationMethod(i),i.validator&&(i.field=e,i.fullField=i.fullField||e,i.type=a.getType(i),c[e]=c[e]||[],c[e].push({rule:i,value:r,source:o,field:e}))}))}));var s={};return R(c,i,(function(t,n){var r,a=t.rule,l=("object"===a.type||"array"===a.type)&&("object"===typeof a.fields||"object"===typeof a.defaultField);function u(e,t){return E({},t,{fullField:a.fullField+"."+e,fullFields:a.fullFields?[].concat(a.fullFields,[e]):[e]})}function c(r){void 0===r&&(r=[]);var c=Array.isArray(r)?r:[r];!i.suppressWarning&&c.length&&e.warning("async-validator:",c),c.length&&void 0!==a.message&&(c=[].concat(a.message));var f=c.map(L(a,o));if(i.first&&f.length)return s[a.field]=1,n(f);if(l){if(a.required&&!t.value)return void 0!==a.message?f=[].concat(a.message).map(L(a,o)):i.error&&(f=[i.error(a,_(i.messages.required,a.field))]),n(f);var d={};a.defaultField&&Object.keys(t.value).map((function(e){d[e]=a.defaultField})),d=E({},d,t.rule.fields);var p={};Object.keys(d).forEach((function(e){var t=d[e],n=Array.isArray(t)?t:[t];p[e]=n.map(u.bind(null,e))}));var v=new e(p);v.messages(i.messages),t.rule.options&&(t.rule.options.messages=i.messages,t.rule.options.error=i.error),v.validate(t.value,t.rule.options||i,(function(e){var t=[];f&&f.length&&t.push.apply(t,f),e&&e.length&&t.push.apply(t,e),n(t.length?t:null)}))}else n(f)}if(l=l&&(a.required||!a.required&&t.value),a.field=t.field,a.asyncValidator)r=a.asyncValidator(a,t.value,c,t.source,i);else if(a.validator){try{r=a.validator(a,t.value,c,t.source,i)}catch(f){null==console.error||console.error(f),i.suppressValidatorError||setTimeout((function(){throw f}),0),c(f.message)}!0===r?c():!1===r?c("function"===typeof a.message?a.message(a.fullField||a.field):a.message||(a.fullField||a.field)+" fails"):r instanceof Array?c(r):r instanceof Error&&c(r.message)}r&&r.then&&r.then((function(){return c()}),(function(e){return c(e)}))}),(function(e){!function(e){var t=[],n={};function r(e){var n;Array.isArray(e)?t=(n=t).concat.apply(n,e):t.push(e)}for(var a=0;a3&&void 0!==arguments[3]&&arguments[3];return t.length&&r&&void 0===n&&!X(e,t.slice(0,-1))?e:ee(e,t,n,r)}function ne(e){return Array.isArray(e)?function(e){return e.map((function(e){return ne(e)}))}(e):"object"===(0,G.Z)(e)&&null!==e?function(e){if(Object.getPrototypeOf(e)===Object.prototype){var t={};for(var n in e)t[n]=ne(e[n]);return t}return e}(e):e}const re=ne;function ae(e){return b(e)}function oe(e,t){return X(e,t)}function ie(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=te(e,t,n,r);return a}function le(e,t){var n={};return t.forEach((function(t){var r=oe(e,t);n=ie(n,t,r)})),n}function ue(e,t){return e&&e.some((function(e){return de(e,t)}))}function ce(e){return"object"===(0,G.Z)(e)&&null!==e&&Object.getPrototypeOf(e)===Object.prototype}function se(e,t){var n=Array.isArray(e)?(0,u.Z)(e):(0,l.Z)({},e);return t?(Object.keys(t).forEach((function(e){var r=n[e],a=t[e],o=ce(r)&&ce(a);n[e]=o?se(r,a||{}):re(a)})),n):n}function fe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=r||n<0||n>=r)return e;var a=e[t],o=t-n;return o>0?[].concat((0,u.Z)(e.slice(0,n)),[a],(0,u.Z)(e.slice(n,t)),(0,u.Z)(e.slice(t+1,r))):o<0?[].concat((0,u.Z)(e.slice(0,t)),(0,u.Z)(e.slice(t+1,n+1)),[a],(0,u.Z)(e.slice(n+1,r))):e}var he=K;function me(e,t){return e.replace(/\$\{\w+\}/g,(function(e){var n=e.slice(2,-1);return t[n]}))}var ge="CODE_LOGIC_ERROR";function ye(e,t,n,r,a){return be.apply(this,arguments)}function be(){return be=(0,k.Z)((0,w.Z)().mark((function e(t,n,a,o,c){var s,f,d,p,v,h,m,g,y;return(0,w.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete(s=(0,l.Z)({},a)).ruleIndex,s.validator&&(f=s.validator,s.validator=function(){try{return f.apply(void 0,arguments)}catch(e){return console.error(e),Promise.reject(ge)}}),d=null,s&&"array"===s.type&&s.defaultField&&(d=s.defaultField,delete s.defaultField),p=new he((0,i.Z)({},t,[s])),v=fe({},Y,o.validateMessages),p.messages(v),h=[],e.prev=9,e.next=12,Promise.resolve(p.validate((0,i.Z)({},t,n),(0,l.Z)({},o)));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(9),e.t0.errors&&(h=e.t0.errors.map((function(e,t){var n=e.message,a=n===ge?v.default:n;return r.isValidElement(a)?r.cloneElement(a,{key:"error_".concat(t)}):a})));case 17:if(h.length||!d){e.next=22;break}return e.next=20,Promise.all(n.map((function(e,n){return ye("".concat(t,".").concat(n),e,d,o,c)})));case 20:return m=e.sent,e.abrupt("return",m.reduce((function(e,t){return[].concat((0,u.Z)(e),(0,u.Z)(t))}),[]));case 22:return g=(0,l.Z)((0,l.Z)({},a),{},{name:t,enum:(a.enum||[]).join(", ")},c),y=h.map((function(e){return"string"===typeof e?me(e,g):e})),e.abrupt("return",y);case 25:case"end":return e.stop()}}),e,null,[[9,14]])}))),be.apply(this,arguments)}function we(e,t,n,r,a,o){var i,u=e.join("."),c=n.map((function(e,t){var n=e.validator,r=(0,l.Z)((0,l.Z)({},e),{},{ruleIndex:t});return n&&(r.validator=function(e,t,r){var a=!1,o=n(e,t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:xe;if(a.validatePromise===r){var t;a.validatePromise=null;var n=[],o=[];null===(t=e.forEach)||void 0===t||t.call(e,(function(e){var t=e.rule.warningOnly,r=e.errors,a=void 0===r?xe:r;t?o.push.apply(o,(0,u.Z)(a)):n.push.apply(n,(0,u.Z)(a))})),a.errors=n,a.warnings=o,a.triggerMetaEvent(),a.reRender()}})),d}));return a.validatePromise=r,a.dirty=!0,a.errors=xe,a.warnings=xe,a.triggerMetaEvent(),a.reRender(),r},a.isFieldValidating=function(){return!!a.validatePromise},a.isFieldTouched=function(){return a.touched},a.isFieldDirty=function(){return!(!a.dirty&&void 0===a.props.initialValue)||void 0!==(0,a.props.fieldContext.getInternalHooks(m).getInitialValue)(a.getNamePath())},a.getErrors=function(){return a.errors},a.getWarnings=function(){return a.warnings},a.isListField=function(){return a.props.isListField},a.isList=function(){return a.props.isList},a.isPreserve=function(){return a.props.preserve},a.getMeta=function(){return a.prevValidating=a.isFieldValidating(),{touched:a.isFieldTouched(),validating:a.prevValidating,errors:a.errors,warnings:a.warnings,name:a.getNamePath()}},a.getOnlyChild=function(e){if("function"===typeof e){var t=a.getMeta();return(0,l.Z)((0,l.Z)({},a.getOnlyChild(e(a.getControlled(),t,a.props.fieldContext))),{},{isFunction:!0})}var n=(0,v.Z)(e);return 1===n.length&&r.isValidElement(n[0])?{child:n[0],isFunction:!1}:{child:n,isFunction:!1}},a.getValue=function(e){var t=a.props.fieldContext.getFieldsValue,n=a.getNamePath();return oe(e||t(!0),n)},a.getControlled=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a.props,n=t.trigger,r=t.validateTrigger,o=t.getValueFromEvent,u=t.normalize,c=t.valuePropName,s=t.getValueProps,f=t.fieldContext,d=void 0!==r?r:f.validateTrigger,p=a.getNamePath(),v=f.getInternalHooks,h=f.getFieldsValue,g=v(m),y=g.dispatch,w=a.getValue(),k=s||function(e){return(0,i.Z)({},c,e)},E=e[n],C=(0,l.Z)((0,l.Z)({},e),k(w));C[n]=function(){var e;a.touched=!0,a.dirty=!0,a.triggerMetaEvent();for(var t=arguments.length,n=new Array(t),r=0;r=0&&t<=n.length?(s.keys=[].concat((0,u.Z)(s.keys.slice(0,t)),[s.id],(0,u.Z)(s.keys.slice(t))),o([].concat((0,u.Z)(n.slice(0,t)),[e],(0,u.Z)(n.slice(t))))):(s.keys=[].concat((0,u.Z)(s.keys),[s.id]),o([].concat((0,u.Z)(n),[e]))),s.id+=1},remove:function(e){var t=l(),n=new Set(Array.isArray(e)?e:[e]);n.size<=0||(s.keys=s.keys.filter((function(e,t){return!n.has(t)})),o(t.filter((function(e,t){return!n.has(t)}))))},move:function(e,t){if(e!==t){var n=l();e<0||e>=n.length||t<0||t>=n.length||(s.keys=ve(s.keys,e,t),o(ve(n,e,t)))}}},p=r||[];return Array.isArray(p)||(p=[]),a(p.map((function(e,t){var n=s.keys[t];return void 0===n&&(s.keys[t]=s.id,n=s.keys[t],s.id+=1),{name:t,key:n,isListField:!0}})),d,t)}))))};var _e=n(9439);var Oe="__@field_split__";function Te(e){return e.map((function(e){return"".concat((0,G.Z)(e),":").concat(e)})).join(Oe)}var Me=function(){function e(){(0,c.Z)(this,e),this.kvs=new Map}return(0,s.Z)(e,[{key:"set",value:function(e,t){this.kvs.set(Te(e),t)}},{key:"get",value:function(e){return this.kvs.get(Te(e))}},{key:"update",value:function(e,t){var n=t(this.get(e));n?this.set(e,n):this.delete(e)}},{key:"delete",value:function(e){this.kvs.delete(Te(e))}},{key:"map",value:function(e){return(0,u.Z)(this.kvs.entries()).map((function(t){var n=(0,_e.Z)(t,2),r=n[0],a=n[1],o=r.split(Oe);return e({key:o.map((function(e){var t=e.match(/^([^:]*):(.*)$/),n=(0,_e.Z)(t,3),r=n[1],a=n[2];return"number"===r?Number(a):a})),value:a})}))}},{key:"toJSON",value:function(){var e={};return this.map((function(t){var n=t.key,r=t.value;return e[n.join(".")]=r,null})),e}}]),e}();const Re=Me;var Le=["name","errors"],Ae=(0,s.Z)((function e(t){var n=this;(0,c.Z)(this,e),this.formHooked=!1,this.forceRootUpdate=void 0,this.subscribable=!0,this.store={},this.fieldEntities=[],this.initialValues={},this.callbacks={},this.validateMessages=null,this.preserve=null,this.lastValidatePromise=null,this.getForm=function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}},this.getInternalHooks=function(e){return e===m?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):((0,h.ZP)(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)},this.useSubscribe=function(e){n.subscribable=e},this.prevWithoutPreserves=null,this.setInitialValues=function(e,t){if(n.initialValues=e||{},t){var r,a=fe({},e,n.store);null===(r=n.prevWithoutPreserves)||void 0===r||r.map((function(t){var n=t.key;a=ie(a,n,oe(e,n))})),n.prevWithoutPreserves=null,n.updateStore(a)}},this.destroyForm=function(){var e=new Re;n.getFieldEntities(!0).forEach((function(t){n.isMergedPreserve(t.isPreserve())||e.set(t.getNamePath(),!0)})),n.prevWithoutPreserves=e},this.getInitialValue=function(e){var t=oe(n.initialValues,e);return e.length?re(t):t},this.setCallbacks=function(e){n.callbacks=e},this.setValidateMessages=function(e){n.validateMessages=e},this.setPreserve=function(e){n.preserve=e},this.watchList=[],this.registerWatch=function(e){return n.watchList.push(e),function(){n.watchList=n.watchList.filter((function(t){return t!==e}))}},this.notifyWatch=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(n.watchList.length){var t=n.getFieldsValue();n.watchList.forEach((function(n){n(t,e)}))}},this.timeoutId=null,this.warningUnhooked=function(){0},this.updateStore=function(e){n.store=e},this.getFieldEntities=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?n.fieldEntities.filter((function(e){return e.getNamePath().length})):n.fieldEntities},this.getFieldsMap=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=new Re;return n.getFieldEntities(e).forEach((function(e){var n=e.getNamePath();t.set(n,e)})),t},this.getFieldEntitiesForNamePathList=function(e){if(!e)return n.getFieldEntities(!0);var t=n.getFieldsMap(!0);return e.map((function(e){var n=ae(e);return t.get(n)||{INVALIDATE_NAME_PATH:ae(e)}}))},this.getFieldsValue=function(e,t){if(n.warningUnhooked(),!0===e&&!t)return n.store;var r=n.getFieldEntitiesForNamePathList(Array.isArray(e)?e:null),a=[];return r.forEach((function(n){var r,o="INVALIDATE_NAME_PATH"in n?n.INVALIDATE_NAME_PATH:n.getNamePath();if(e||!(null===(r=n.isListField)||void 0===r?void 0:r.call(n)))if(t){var i="getMeta"in n?n.getMeta():null;t(i)&&a.push(o)}else a.push(o)})),le(n.store,a.map(ae))},this.getFieldValue=function(e){n.warningUnhooked();var t=ae(e);return oe(n.store,t)},this.getFieldsError=function(e){return n.warningUnhooked(),n.getFieldEntitiesForNamePathList(e).map((function(t,n){return t&&!("INVALIDATE_NAME_PATH"in t)?{name:t.getNamePath(),errors:t.getErrors(),warnings:t.getWarnings()}:{name:ae(e[n]),errors:[],warnings:[]}}))},this.getFieldError=function(e){n.warningUnhooked();var t=ae(e);return n.getFieldsError([t])[0].errors},this.getFieldWarning=function(e){n.warningUnhooked();var t=ae(e);return n.getFieldsError([t])[0].warnings},this.isFieldsTouched=function(){n.warningUnhooked();for(var e=arguments.length,t=new Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=new Re,r=n.getFieldEntities(!0);r.forEach((function(e){var n=e.props.initialValue,r=e.getNamePath();if(void 0!==n){var a=t.get(r)||new Set;a.add({entity:e,value:n}),t.set(r,a)}}));var a,o=function(r){r.forEach((function(r){if(void 0!==r.props.initialValue){var a=r.getNamePath();if(void 0!==n.getInitialValue(a))(0,h.ZP)(!1,"Form already set 'initialValues' with path '".concat(a.join("."),"'. Field can not overwrite it."));else{var o=t.get(a);if(o&&o.size>1)(0,h.ZP)(!1,"Multiple Field with path '".concat(a.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(o){var i=n.getFieldValue(a);e.skipExist&&void 0!==i||n.updateStore(ie(n.store,a,(0,u.Z)(o)[0].value))}}}}))};e.entities?a=e.entities:e.namePathList?(a=[],e.namePathList.forEach((function(e){var n,r=t.get(e);r&&(n=a).push.apply(n,(0,u.Z)((0,u.Z)(r).map((function(e){return e.entity}))))}))):a=r,o(a)},this.resetFields=function(e){n.warningUnhooked();var t=n.store;if(!e)return n.updateStore(fe({},n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(t,null,{type:"reset"}),void n.notifyWatch();var r=e.map(ae);r.forEach((function(e){var t=n.getInitialValue(e);n.updateStore(ie(n.store,e,t))})),n.resetWithFieldInitialValue({namePathList:r}),n.notifyObservers(t,r,{type:"reset"}),n.notifyWatch(r)},this.setFields=function(e){n.warningUnhooked();var t=n.store,r=[];e.forEach((function(e){var a=e.name,i=(e.errors,(0,o.Z)(e,Le)),l=ae(a);r.push(l),"value"in i&&n.updateStore(ie(n.store,l,i.value)),n.notifyObservers(t,[l],{type:"setField",data:e})})),n.notifyWatch(r)},this.getFields=function(){return n.getFieldEntities(!0).map((function(e){var t=e.getNamePath(),r=e.getMeta(),a=(0,l.Z)((0,l.Z)({},r),{},{name:t,value:n.getFieldValue(t)});return Object.defineProperty(a,"originRCField",{value:!0}),a}))},this.initEntityValue=function(e){var t=e.props.initialValue;if(void 0!==t){var r=e.getNamePath();void 0===oe(n.store,r)&&n.updateStore(ie(n.store,r,t))}},this.isMergedPreserve=function(e){var t=void 0!==e?e:n.preserve;return null===t||void 0===t||t},this.registerField=function(e){n.fieldEntities.push(e);var t=e.getNamePath();if(n.notifyWatch([t]),void 0!==e.props.initialValue){var r=n.store;n.resetWithFieldInitialValue({entities:[e],skipExist:!0}),n.notifyObservers(r,[e.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(r,a){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter((function(t){return t!==e})),!n.isMergedPreserve(a)&&(!r||o.length>1)){var i=r?void 0:n.getInitialValue(t);if(t.length&&n.getFieldValue(t)!==i&&n.fieldEntities.every((function(e){return!de(e.getNamePath(),t)}))){var l=n.store;n.updateStore(ie(l,t,i,!0)),n.notifyObservers(l,[t],{type:"remove"}),n.triggerDependenciesUpdate(l,t)}}n.notifyWatch([t])}},this.dispatch=function(e){switch(e.type){case"updateValue":var t=e.namePath,r=e.value;n.updateValue(t,r);break;case"validateField":var a=e.namePath,o=e.triggerName;n.validateFields([a],{triggerName:o})}},this.notifyObservers=function(e,t,r){if(n.subscribable){var a=(0,l.Z)((0,l.Z)({},r),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach((function(n){(0,n.onStoreChange)(e,t,a)}))}else n.forceRootUpdate()},this.triggerDependenciesUpdate=function(e,t){var r=n.getDependencyChildrenFields(t);return r.length&&n.validateFields(r),n.notifyObservers(e,r,{type:"dependenciesUpdate",relatedFields:[t].concat((0,u.Z)(r))}),r},this.updateValue=function(e,t){var r=ae(e),a=n.store;n.updateStore(ie(n.store,r,t)),n.notifyObservers(a,[r],{type:"valueUpdate",source:"internal"}),n.notifyWatch([r]);var o=n.triggerDependenciesUpdate(a,r),i=n.callbacks.onValuesChange;i&&i(le(n.store,[r]),n.getFieldsValue());n.triggerOnFieldsChange([r].concat((0,u.Z)(o)))},this.setFieldsValue=function(e){n.warningUnhooked();var t=n.store;if(e){var r=fe(n.store,e);n.updateStore(r)}n.notifyObservers(t,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()},this.setFieldValue=function(e,t){n.setFields([{name:e,value:t}])},this.getDependencyChildrenFields=function(e){var t=new Set,r=[],a=new Re;n.getFieldEntities().forEach((function(e){(e.props.dependencies||[]).forEach((function(t){var n=ae(t);a.update(n,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;return t.add(e),t}))}))}));return function e(n){(a.get(n)||new Set).forEach((function(n){if(!t.has(n)){t.add(n);var a=n.getNamePath();n.isFieldDirty()&&a.length&&(r.push(a),e(a))}}))}(e),r},this.triggerOnFieldsChange=function(e,t){var r=n.callbacks.onFieldsChange;if(r){var a=n.getFields();if(t){var o=new Re;t.forEach((function(e){var t=e.name,n=e.errors;o.set(t,n)})),a.forEach((function(e){e.errors=o.get(e.name)||e.errors}))}r(a.filter((function(t){var n=t.name;return ue(e,n)})),a)}},this.validateFields=function(e,t){n.warningUnhooked();var r=!!e,a=r?e.map(ae):[],o=[];n.getFieldEntities(!0).forEach((function(i){if(r||a.push(i.getNamePath()),(null===t||void 0===t?void 0:t.recursive)&&r){var c=i.getNamePath();c.every((function(t,n){return e[n]===t||void 0===e[n]}))&&a.push(c)}if(i.props.rules&&i.props.rules.length){var s=i.getNamePath();if(!r||ue(a,s)){var f=i.validateRules((0,l.Z)({validateMessages:(0,l.Z)((0,l.Z)({},Y),n.validateMessages)},t));o.push(f.then((function(){return{name:s,errors:[],warnings:[]}})).catch((function(e){var t,n=[],r=[];return null===(t=e.forEach)||void 0===t||t.call(e,(function(e){var t=e.rule.warningOnly,a=e.errors;t?r.push.apply(r,(0,u.Z)(a)):n.push.apply(n,(0,u.Z)(a))})),n.length?Promise.reject({name:s,errors:n,warnings:r}):{name:s,errors:n,warnings:r}})))}}}));var i=function(e){var t=!1,n=e.length,r=[];return e.length?new Promise((function(a,o){e.forEach((function(e,i){e.catch((function(e){return t=!0,e})).then((function(e){n-=1,r[i]=e,n>0||(t&&o(r),a(r))}))}))})):Promise.resolve([])}(o);n.lastValidatePromise=i,i.catch((function(e){return e})).then((function(e){var t=e.map((function(e){return e.name}));n.notifyObservers(n.store,t,{type:"validateFinish"}),n.triggerOnFieldsChange(t,e)}));var c=i.then((function(){return n.lastValidatePromise===i?Promise.resolve(n.getFieldsValue(a)):Promise.reject([])})).catch((function(e){var t=e.filter((function(e){return e&&e.errors.length}));return Promise.reject({values:n.getFieldsValue(a),errorFields:t,outOfDate:n.lastValidatePromise!==i})}));return c.catch((function(e){return e})),c},this.submit=function(){n.warningUnhooked(),n.validateFields().then((function(e){var t=n.callbacks.onFinish;if(t)try{t(e)}catch(r){console.error(r)}})).catch((function(e){var t=n.callbacks.onFinishFailed;t&&t(e)}))},this.forceRootUpdate=t}));const Ie=function(e){var t=r.useRef(),n=r.useState({}),a=(0,_e.Z)(n,2)[1];if(!t.current)if(e)t.current=e;else{var o=new Ae((function(){a({})}));t.current=o.getForm()}return[t.current]};var ze=r.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),je=function(e){var t=e.validateMessages,n=e.onFormChange,a=e.onFormFinish,o=e.children,u=r.useContext(ze),c=r.useRef({});return r.createElement(ze.Provider,{value:(0,l.Z)((0,l.Z)({},u),{},{validateMessages:(0,l.Z)((0,l.Z)({},u.validateMessages),t),triggerFormChange:function(e,t){n&&n(e,{changedFields:t,forms:c.current}),u.triggerFormChange(e,t)},triggerFormFinish:function(e,t){a&&a(e,{values:t,forms:c.current}),u.triggerFormFinish(e,t)},registerForm:function(e,t){e&&(c.current=(0,l.Z)((0,l.Z)({},c.current),{},(0,i.Z)({},e,t))),u.registerForm(e,t)},unregisterForm:function(e){var t=(0,l.Z)({},c.current);delete t[e],c.current=t,u.unregisterForm(e)}})},o)};const De=ze;var Ve=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed"];const Ue=function(e,t){var n=e.name,i=e.initialValues,c=e.fields,s=e.form,f=e.preserve,d=e.children,p=e.component,v=void 0===p?"form":p,h=e.validateMessages,g=e.validateTrigger,b=void 0===g?"onChange":g,w=e.onValuesChange,k=e.onFieldsChange,E=e.onFinish,C=e.onFinishFailed,x=(0,o.Z)(e,Ve),S=r.useContext(De),P=Ie(s),Z=(0,_e.Z)(P,1)[0],N=Z.getInternalHooks(m),F=N.useSubscribe,_=N.setInitialValues,O=N.setCallbacks,T=N.setValidateMessages,M=N.setPreserve,R=N.destroyForm;r.useImperativeHandle(t,(function(){return Z})),r.useEffect((function(){return S.registerForm(n,Z),function(){S.unregisterForm(n)}}),[S,Z,n]),T((0,l.Z)((0,l.Z)({},S.validateMessages),h)),O({onValuesChange:w,onFieldsChange:function(e){if(S.triggerFormChange(n,e),k){for(var t=arguments.length,r=new Array(t>1?t-1:0),a=1;a{"use strict";n.d(t,{V:()=>oe,Z:()=>ie});var r=n(4942),a=n(1413),o=n(9439),i=n(1002),l=n(2791),u=n(4304),c=n(8834),s=n(1694),f=n.n(s),d=n(4937);function p(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var v=function(e,t){var n={animationend:p("Animation","AnimationEnd"),transitionend:p("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}((0,d.Z)(),"undefined"!==typeof window?window:{}),h={};if((0,d.Z)()){var m=document.createElement("div");h=m.style}var g={};function y(e){if(g[e])return g[e];var t=v[e];if(t)for(var n=Object.keys(t),r=n.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:2;t();var o=(0,L.Z)((function(){a<=1?r({isCanceled:function(){return o!==e.current}}):n(r,a-1)}));e.current=o},t]}(),c=(0,o.Z)(u,2),s=c[0],f=c[1];return A((function(){if(a!==F&&a!==M){var e=I.indexOf(a),n=I[e+1],r=t(a);false===r?i(n,!0):s((function(e){function t(){e.isCanceled()||i(n,!0)}!0===r?t():Promise.resolve(r).then(t)}))}}),[e,a]),l.useEffect((function(){return function(){f()}}),[]),[function(){i(_,!0)},a]};function D(e,t,n,i){var u=i.motionEnter,c=void 0===u||u,s=i.motionAppear,f=void 0===s||s,d=i.motionLeave,p=void 0===d||d,v=i.motionDeadline,h=i.motionLeaveImmediately,m=i.onAppearPrepare,g=i.onEnterPrepare,y=i.onLeavePrepare,b=i.onAppearStart,w=i.onEnterStart,k=i.onLeaveStart,x=i.onAppearActive,F=i.onEnterActive,M=i.onLeaveActive,L=i.onAppearEnd,I=i.onEnterEnd,D=i.onLeaveEnd,V=i.onVisibleChanged,U=(0,R.Z)(),$=(0,o.Z)(U,2),H=$[0],q=$[1],W=(0,R.Z)(S),B=(0,o.Z)(W,2),K=B[0],Q=B[1],Y=(0,R.Z)(null),G=(0,o.Z)(Y,2),X=G[0],J=G[1],ee=(0,l.useRef)(!1),te=(0,l.useRef)(null);function ne(){return n()}var re=(0,l.useRef)(!1);function ae(e){var t=ne();if(!e||e.deadline||e.target===t){var n,r=re.current;K===P&&r?n=null===L||void 0===L?void 0:L(t,e):K===Z&&r?n=null===I||void 0===I?void 0:I(t,e):K===N&&r&&(n=null===D||void 0===D?void 0:D(t,e)),K!==S&&r&&!1!==n&&(Q(S,!0),J(null,!0))}}var oe=function(e){var t=(0,l.useRef)(),n=(0,l.useRef)(e);n.current=e;var r=l.useCallback((function(e){n.current(e)}),[]);function a(e){e&&(e.removeEventListener(C,r),e.removeEventListener(E,r))}return l.useEffect((function(){return function(){a(t.current)}}),[]),[function(e){t.current&&t.current!==e&&a(t.current),e&&e!==t.current&&(e.addEventListener(C,r),e.addEventListener(E,r),t.current=e)},a]}(ae),ie=(0,o.Z)(oe,1)[0],le=l.useMemo((function(){var e,t,n;switch(K){case P:return e={},(0,r.Z)(e,_,m),(0,r.Z)(e,O,b),(0,r.Z)(e,T,x),e;case Z:return t={},(0,r.Z)(t,_,g),(0,r.Z)(t,O,w),(0,r.Z)(t,T,F),t;case N:return n={},(0,r.Z)(n,_,y),(0,r.Z)(n,O,k),(0,r.Z)(n,T,M),n;default:return{}}}),[K]),ue=j(K,(function(e){if(e===_){var t=le[_];return!!t&&t(ne())}var n;fe in le&&J((null===(n=le[fe])||void 0===n?void 0:n.call(le,ne(),null))||null);return fe===T&&(ie(ne()),v>0&&(clearTimeout(te.current),te.current=setTimeout((function(){ae({deadline:!0})}),v))),true})),ce=(0,o.Z)(ue,2),se=ce[0],fe=ce[1],de=z(fe);re.current=de,A((function(){q(t);var n,r=ee.current;(ee.current=!0,e)&&(!r&&t&&f&&(n=P),r&&t&&c&&(n=Z),(r&&!t&&p||!r&&h&&!t&&p)&&(n=N),n&&(Q(n),se()))}),[t]),(0,l.useEffect)((function(){(K===P&&!f||K===Z&&!c||K===N&&!p)&&Q(S)}),[f,c,p]),(0,l.useEffect)((function(){return function(){ee.current=!1,clearTimeout(te.current)}}),[]);var pe=l.useRef(!1);(0,l.useEffect)((function(){H&&(pe.current=!0),void 0!==H&&K===S&&((pe.current||H)&&(null===V||void 0===V||V(H)),pe.current=!0)}),[H,K]);var ve=X;return le[_]&&fe===O&&(ve=(0,a.Z)({transition:"none"},ve)),[K,fe,ve,null!==H&&void 0!==H?H:t]}var V=n(5671),U=n(3144),$=n(136),H=n(7277);const q=function(e){(0,$.Z)(n,e);var t=(0,H.Z)(n);function n(){return(0,V.Z)(this,n),t.apply(this,arguments)}return(0,U.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(l.Component);const W=function(e){var t=e;function n(e){return!(!e.motionName||!t)}"object"===(0,i.Z)(e)&&(t=e.transitionSupport);var s=l.forwardRef((function(e,t){var i=e.visible,s=void 0===i||i,d=e.removeOnLeave,p=void 0===d||d,v=e.forceRender,h=e.children,m=e.motionName,g=e.leavedClassName,y=e.eventProps,b=n(e),w=(0,l.useRef)(),k=(0,l.useRef)();var E=D(b,s,(function(){try{return w.current instanceof HTMLElement?w.current:(0,u.Z)(k.current)}catch(e){return null}}),e),C=(0,o.Z)(E,4),P=C[0],Z=C[1],N=C[2],F=C[3],T=l.useRef(F);F&&(T.current=!0);var M,R=l.useCallback((function(e){w.current=e,(0,c.mH)(t,e)}),[t]),L=(0,a.Z)((0,a.Z)({},y),{},{visible:s});if(h)if(P!==S&&n(e)){var A,I;Z===_?I="prepare":z(Z)?I="active":Z===O&&(I="start"),M=h((0,a.Z)((0,a.Z)({},L),{},{className:f()(x(m,P),(A={},(0,r.Z)(A,x(m,"".concat(P,"-").concat(I)),I),(0,r.Z)(A,m,"string"===typeof m),A)),style:N}),R)}else M=F?h((0,a.Z)({},L),R):!p&&T.current?h((0,a.Z)((0,a.Z)({},L),{},{className:g}),R):v?h((0,a.Z)((0,a.Z)({},L),{},{style:{display:"none"}}),R):null;else M=null;l.isValidElement(M)&&(0,c.Yr)(M)&&(M.ref||(M=l.cloneElement(M,{ref:R})));return l.createElement(q,{ref:k},M)}));return s.displayName="CSSMotion",s}(k);var B=n(7462),K=n(4925),Q="add",Y="keep",G="remove",X="removed";function J(e){var t;return t=e&&"object"===(0,i.Z)(e)&&"key"in e?e:{key:e},(0,a.Z)((0,a.Z)({},t),{},{key:String(t.key)})}function ee(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(J)}function te(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,o=t.length,i=ee(e),l=ee(t);i.forEach((function(e){for(var t=!1,i=r;i1}));return c.forEach((function(e){(n=n.filter((function(t){var n=t.key,r=t.status;return n!==e||r!==G}))).forEach((function(t){t.key===e&&(t.status=Y)}))})),n}var ne=["component","children","onVisibleChanged","onAllRemoved"],re=["status"],ae=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];const oe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:W,n=function(e){(0,$.Z)(r,e);var n=(0,H.Z)(r);function r(){var e;(0,V.Z)(this,r);for(var t=arguments.length,o=new Array(t),i=0;i{"use strict";n.d(t,{Z:()=>p});var r=n(7462),a=n(4942),o=n(5671),i=n(3144),l=n(136),u=n(7277),c=n(2791),s=n(4164),f=n(1694),d=n.n(f),p=function(e){(0,l.Z)(n,e);var t=(0,u.Z)(n);function n(){var e;(0,o.Z)(this,n);for(var r=arguments.length,a=new Array(r),i=0;i{"use strict";n.d(t,{Z:()=>E});var r=n(4925),a=n(7462),o=n(1413),i=n(5671),l=n(3144),u=n(136),c=n(7277),s=n(2791),f=n(4699),d=n(1694),p=n.n(d),v=n(5207),h=n(8926),m=n(5081),g=["getContainer"],y=0,b=Date.now();function w(){var e=y;return y+=1,"rcNotification_".concat(b,"_").concat(e)}var k=function(e){(0,u.Z)(n,e);var t=(0,c.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var r=arguments.length,a=new Array(r),l=0;l=l&&(i.key=o[0].notice.key,i.updateMark=w(),i.userPassKey=a,o.shift()),o.push({notice:i,holderCallback:n})),{notices:o}}))},e.remove=function(t){e.setState((function(e){return{notices:e.notices.filter((function(e){var n=e.notice,r=n.key,a=n.userPassKey;return(null!==a&&void 0!==a?a:r)!==t}))}}))},e.noticePropsMap={},e}return(0,l.Z)(n,[{key:"getTransitionName",value:function(){var e=this.props,t=e.prefixCls,n=e.animation,r=this.props.transitionName;return!r&&n&&(r="".concat(t,"-").concat(n)),r}},{key:"render",value:function(){var e=this,t=this.state.notices,n=this.props,r=n.prefixCls,i=n.className,l=n.closeIcon,u=n.style,c=[];return t.forEach((function(n,a){var i=n.notice,u=n.holderCallback,s=a===t.length-1?i.updateMark:void 0,f=i.key,d=i.userPassKey,p=(0,o.Z)((0,o.Z)((0,o.Z)({prefixCls:r,closeIcon:l},i),i.props),{},{key:f,noticeKey:d||f,updateMark:s,onClose:function(t){var n;e.remove(t),null===(n=i.onClose)||void 0===n||n.call(i)},onClick:i.onClick,children:i.content});c.push(f),e.noticePropsMap[f]={props:p,holderCallback:u}})),s.createElement("div",{className:p()(r,i),style:u},s.createElement(v.V,{keys:c,motionName:this.getTransitionName(),onVisibleChanged:function(t,n){var r=n.key;t||delete e.noticePropsMap[r]}},(function(t){var n=t.key,i=t.className,l=t.style,u=t.visible,c=e.noticePropsMap[n],f=c.props,d=c.holderCallback;return d?s.createElement("div",{key:n,className:p()(i,"".concat(r,"-hook-holder")),style:(0,o.Z)({},l),ref:function(t){"undefined"!==typeof n&&(t?(e.hookRefs.set(n,t),d(t,f)):e.hookRefs.delete(n))}}):s.createElement(h.Z,(0,a.Z)({},f,{className:p()(i,null===f||void 0===f?void 0:f.className),style:(0,o.Z)((0,o.Z)({},l),null===f||void 0===f?void 0:f.style),visible:u}))})))}}]),n}(s.Component);k.newInstance=void 0,k.defaultProps={prefixCls:"rc-notification",animation:"fade",style:{top:65,left:"50%"}},k.newInstance=function(e,t){var n=e||{},o=n.getContainer,i=(0,r.Z)(n,g),l=document.createElement("div");o?o().appendChild(l):document.body.appendChild(l);var u=!1;(0,f.s)(s.createElement(k,(0,a.Z)({},i,{ref:function(e){u||(u=!0,t({notice:function(t){e.add(t)},removeNotice:function(t){e.remove(t)},component:e,destroy:function(){(0,f.v)(l),l.parentNode&&l.parentNode.removeChild(l)},useNotification:function(){return(0,m.Z)(e)}}))}})),l)};const E=k},5081:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(3433),a=n(7462),o=n(9439),i=n(2791),l=n(8926);function u(e){var t=i.useRef({}),n=i.useState([]),u=(0,o.Z)(n,2),c=u[0],s=u[1];return[function(n){var o=!0;e.add(n,(function(e,n){var u=n.key;if(e&&(!t.current[u]||o)){var c=i.createElement(l.Z,(0,a.Z)({},n,{holder:e}));t.current[u]=c,s((function(e){var t=e.findIndex((function(e){return e.key===n.key}));if(-1===t)return[].concat((0,r.Z)(e),[c]);var a=(0,r.Z)(e);return a[t]=c,a}))}o=!1}))},i.createElement(i.Fragment,null,c)]}},1771:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"}},5501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(2791),a=n(3873);function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];return r.Children.forEach(e,(function(e){(void 0!==e&&null!==e||t.keepEmpty)&&(Array.isArray(e)?n=n.concat(o(e)):(0,a.isFragment)(e)&&e.props?n=n.concat(o(e.props.children,t)):n.push(e))})),n}},4937:(e,t,n)=>{"use strict";function r(){return!("undefined"===typeof window||!window.document||!window.document.createElement)}n.d(t,{Z:()=>r})},520:(e,t,n)=>{"use strict";function r(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}n.d(t,{Z:()=>r})},5561:(e,t,n)=>{"use strict";n.d(t,{hq:()=>m,jL:()=>v});var r=n(4937),a=n(520),o="data-rc-order",i="rc-util-key",l=new Map;function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):i}function c(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function s(e){return"queue"===e?"prependQueue":e?"prepend":"append"}function f(e){return Array.from((l.get(e)||e).children).filter((function(e){return"STYLE"===e.tagName}))}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,r.Z)())return null;var n=t.csp,a=t.prepend,i=document.createElement("style");i.setAttribute(o,s(a)),(null===n||void 0===n?void 0:n.nonce)&&(i.nonce=null===n||void 0===n?void 0:n.nonce),i.innerHTML=e;var l=c(t),u=l.firstChild;if(a){if("queue"===a){var d=f(l).filter((function(e){return["prepend","prependQueue"].includes(e.getAttribute(o))}));if(d.length)return l.insertBefore(i,d[d.length-1].nextSibling),i}l.insertBefore(i,u)}else l.appendChild(i);return i}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=c(t);return f(n).find((function(n){return n.getAttribute(u(t))===e}))}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=p(e,t);if(n){var r=c(t);r.removeChild(n)}}function h(e,t){var n=l.get(e);if(!n||!(0,a.Z)(document,n)){var r=d("",t),o=r.parentNode;l.set(e,o),e.removeChild(r)}}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=c(n);h(r,n);var a=p(t,n);if(a){var o,i,l;if((null===(o=n.csp)||void 0===o?void 0:o.nonce)&&a.nonce!==(null===(i=n.csp)||void 0===i?void 0:i.nonce))a.nonce=null===(l=n.csp)||void 0===l?void 0:l.nonce;return a.innerHTML!==e&&(a.innerHTML=e),a}var s=d(e,n);return s.setAttribute(u(n),t),s}},4304:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(4164);function a(e){return e instanceof HTMLElement?e:r.findDOMNode(e)}},1354:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=r.F1&&t<=r.F12)return!1;switch(t){case r.ALT:case r.CAPS_LOCK:case r.CONTEXT_MENU:case r.CTRL:case r.DOWN:case r.END:case r.ESC:case r.HOME:case r.INSERT:case r.LEFT:case r.MAC_FF_META:case r.META:case r.NUMLOCK:case r.NUM_CENTER:case r.PAGE_DOWN:case r.PAGE_UP:case r.PAUSE:case r.PRINT_SCREEN:case r.RIGHT:case r.SHIFT:case r.UP:case r.WIN_KEY:case r.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=r.ZERO&&e<=r.NINE)return!0;if(e>=r.NUM_ZERO&&e<=r.NUM_MULTIPLY)return!0;if(e>=r.A&&e<=r.Z)return!0;if(-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case r.SPACE:case r.QUESTION_MARK:case r.NUM_PLUS:case r.NUM_MINUS:case r.NUM_PERIOD:case r.NUM_DIVISION:case r.SEMICOLON:case r.DASH:case r.EQUALS:case r.COMMA:case r.PERIOD:case r.SLASH:case r.APOSTROPHE:case r.SINGLE_QUOTE:case r.OPEN_SQUARE_BRACKET:case r.BACKSLASH:case r.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};const a=r},4699:(e,t,n)=>{"use strict";var r;n.d(t,{s:()=>m,v:()=>w});var a,o=n(4165),i=n(5861),l=n(1002),u=n(1413),c=n(4164),s=(0,u.Z)({},r||(r=n.t(c,2))),f=s.version,d=s.render,p=s.unmountComponentAtNode;try{Number((f||"").split(".")[0])>=18&&(a=s.createRoot)}catch(E){}function v(e){var t=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&"object"===(0,l.Z)(t)&&(t.usingClientEntryPoint=e)}var h="__rc_react_root__";function m(e,t){a?function(e,t){v(!0);var n=t[h]||a(t);v(!1),n.render(e),t[h]=n}(e,t):function(e,t){d(e,t)}(e,t)}function g(e){return y.apply(this,arguments)}function y(){return(y=(0,i.Z)((0,o.Z)().mark((function e(t){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.resolve().then((function(){var e;null===(e=t[h])||void 0===e||e.unmount(),delete t[h]})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){p(e)}function w(e){return k.apply(this,arguments)}function k(){return(k=(0,i.Z)((0,o.Z)().mark((function e(t){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===a){e.next=2;break}return e.abrupt("return",g(t));case 2:b(t);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},9025:(e,t,n)=>{"use strict";var r;function a(e){if("undefined"===typeof document)return 0;if(e||void 0===r){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var n=document.createElement("div"),a=n.style;a.position="absolute",a.top="0",a.left="0",a.pointerEvents="none",a.visibility="hidden",a.width="200px",a.height="150px",a.overflow="hidden",n.appendChild(t),document.body.appendChild(n);var o=t.offsetWidth;n.style.overflow="scroll";var i=t.offsetWidth;o===i&&(i=n.clientWidth),document.body.removeChild(n),r=o-i}return r}function o(e){var t=e.match(/^(.*)px$/),n=Number(null===t||void 0===t?void 0:t[1]);return Number.isNaN(n)?a():n}function i(e){if("undefined"===typeof document||!e||!(e instanceof Element))return{width:0,height:0};var t=getComputedStyle(e,"::-webkit-scrollbar"),n=t.width,r=t.height;return{width:o(n),height:o(r)}}n.d(t,{Z:()=>a,o:()=>i})},1605:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o,o:()=>i});var r=n(2791),a=(0,n(4937).Z)()?r.useLayoutEffect:r.useEffect;const o=a;var i=function(e,t){var n=r.useRef(!0);a((function(){if(!n.current)return e()}),t),a((function(){return n.current=!1,function(){n.current=!0}}),[])}},1534:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(2791);function a(e,t,n){var a=r.useRef({});return"value"in a.current&&!n(a.current.condition,t)||(a.current.value=e(),a.current.condition=t),a.current.value}},8368:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9439),a=n(2791);function o(e){var t=a.useRef(!1),n=a.useState(e),o=(0,r.Z)(n,2),i=o[0],l=o[1];return a.useEffect((function(){return t.current=!1,function(){t.current=!0}}),[]),[i,function(e,n){n&&t.current||l(e)}]}},1818:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(1413);function a(e,t){var n=(0,r.Z)({},e);return Array.isArray(t)&&t.forEach((function(e){delete n[e]})),n}},4170:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(1413),a="".concat("accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap"," ").concat("onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError").split(/[\s\n]+/),o="aria-",i="data-";function l(e,t){return 0===e.indexOf(t)}function u(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t=!1===n?{aria:!0,data:!0,attr:!0}:!0===n?{aria:!0}:(0,r.Z)({},n);var u={};return Object.keys(e).forEach((function(n){(t.aria&&("role"===n||l(n,o))||t.data&&l(n,i)||t.attr&&a.includes(n))&&(u[n]=e[n])})),u}},5314:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=function(e){return+setTimeout(e,16)},a=function(e){return clearTimeout(e)};"undefined"!==typeof window&&"requestAnimationFrame"in window&&(r=function(e){return window.requestAnimationFrame(e)},a=function(e){return window.cancelAnimationFrame(e)});var o=0,i=new Map;function l(e){i.delete(e)}var u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=o+=1;function a(t){if(0===t)l(n),e();else{var o=r((function(){a(t-1)}));i.set(n,o)}}return a(t),n};u.cancel=function(e){var t=i.get(e);return l(t),a(t)};const c=u},8834:(e,t,n)=>{"use strict";n.d(t,{Yr:()=>c,mH:()=>i,sQ:()=>l,x1:()=>u});var r=n(1002),a=n(3873),o=n(1534);function i(e,t){"function"===typeof e?e(t):"object"===(0,r.Z)(e)&&e&&"current"in e&&(e.current=t)}function l(){for(var e=arguments.length,t=new Array(e),n=0;n{"use strict";n.d(t,{Kp:()=>a,ZP:()=>i});var r={};function a(e,t){0}function o(e,t,n){t||r[n]||(e(!1,n),r[n]=!0)}const i=function(e,t){o(a,e,t)}},4501:(e,t)=>{"use strict";var n="function"===typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,a=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,s=n?Symbol.for("react.async_mode"):60111,f=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,v=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,g=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function k(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case s:case f:case o:case l:case i:case p:return e;default:switch(e=e&&e.$$typeof){case c:case d:case m:case h:case u:return e;default:return t}}case a:return t}}}function E(e){return k(e)===f}t.isFragment=function(e){return k(e)===o},t.isMemo=function(e){return k(e)===h}},3873:(e,t,n)=>{"use strict";e.exports=n(4501)},4463:(e,t,n)=>{"use strict";var r=n(2791),a=n(5296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n