From 997a335f90c65a5bf5eb5c25d6def89b939971f0 Mon Sep 17 00:00:00 2001 From: github-actions-bot Date: Sat, 5 Oct 2024 10:59:03 +0000 Subject: [PATCH] Updates --- asset-manifest.json | 10 +++++----- index.html | 2 +- static/js/315.d56edf4f.chunk.js.map | 1 - .../{315.d56edf4f.chunk.js => 315.df4e7f33.chunk.js} | 4 ++-- static/js/315.df4e7f33.chunk.js.map | 1 + static/js/{main.53b5e916.js => main.424ef37e.js} | 6 +++--- ...916.js.LICENSE.txt => main.424ef37e.js.LICENSE.txt} | 0 .../js/{main.53b5e916.js.map => main.424ef37e.js.map} | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 static/js/315.d56edf4f.chunk.js.map rename static/js/{315.d56edf4f.chunk.js => 315.df4e7f33.chunk.js} (77%) create mode 100644 static/js/315.df4e7f33.chunk.js.map rename static/js/{main.53b5e916.js => main.424ef37e.js} (99%) rename static/js/{main.53b5e916.js.LICENSE.txt => main.424ef37e.js.LICENSE.txt} (100%) rename static/js/{main.53b5e916.js.map => main.424ef37e.js.map} (99%) diff --git a/asset-manifest.json b/asset-manifest.json index 4385f7ad..b5355be8 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.53b5e916.js", + "main.js": "https://imagingdatacommons.github.io/slim/static/js/main.424ef37e.js", "static/css/455.4a238b84.chunk.css": "https://imagingdatacommons.github.io/slim/static/css/455.4a238b84.chunk.css", "static/js/455.931c3b89.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/455.931c3b89.chunk.js", "static/css/267.3925dd6d.chunk.css": "https://imagingdatacommons.github.io/slim/static/css/267.3925dd6d.chunk.css", "static/js/267.86c4dd77.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/267.86c4dd77.chunk.js", "static/js/745.33476272.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/745.33476272.chunk.js", - "static/js/315.d56edf4f.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/315.d56edf4f.chunk.js", + "static/js/315.df4e7f33.chunk.js": "https://imagingdatacommons.github.io/slim/static/js/315.df4e7f33.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.53b5e916.js.map": "https://imagingdatacommons.github.io/slim/static/js/main.53b5e916.js.map", + "main.424ef37e.js.map": "https://imagingdatacommons.github.io/slim/static/js/main.424ef37e.js.map", "455.4a238b84.chunk.css.map": "https://imagingdatacommons.github.io/slim/static/css/455.4a238b84.chunk.css.map", "455.931c3b89.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/455.931c3b89.chunk.js.map", "267.3925dd6d.chunk.css.map": "https://imagingdatacommons.github.io/slim/static/css/267.3925dd6d.chunk.css.map", "267.86c4dd77.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/267.86c4dd77.chunk.js.map", "745.33476272.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/745.33476272.chunk.js.map", - "315.d56edf4f.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/315.d56edf4f.chunk.js.map" + "315.df4e7f33.chunk.js.map": "https://imagingdatacommons.github.io/slim/static/js/315.df4e7f33.chunk.js.map" }, "entrypoints": [ "static/css/main.e6c13ad2.css", - "static/js/main.53b5e916.js" + "static/js/main.424ef37e.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 39477db2..9ef3eeff 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/315.d56edf4f.chunk.js.map b/static/js/315.d56edf4f.chunk.js.map deleted file mode 100644 index ced5c355..00000000 --- a/static/js/315.d56edf4f.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/315.d56edf4f.chunk.js","mappings":"2SA4BMA,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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c,IAAKuc,EACL9c,KAAMlxB,KAAKiH,MAAMiqB,KACjB8P,mBAAoBkN,EACpBpM,kBAAmB9hC,KAAKyhC,sBACxBf,aAAc4N,EAAmBD,OAAWtuC,EAC5CwhC,0BAA2B6M,KAE7B,SAAC,YAAc,CAAC7lC,MAAOimC,EAAmB,UACxC,SAACxD,GAAsB,CACrBjjC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjB+Z,OAAQjrC,KAAKC,MAAMgrC,OACnBxZ,IAAKuc,YAMf,SAAC,KAAK,CACJvP,KAAK,UACLC,SACE,UAAC,IAAM,CAACn2B,MAAOgmC,EAAY,WACzB,SAAC,GAAM,CACL9c,IAAKuc,EACL9c,KAAMlxB,KAAKiH,MAAMiqB,KACjB8P,oBAAoB,EACpBc,kBAAmB9hC,KAAKyhC,sBACxBf,aAAc4N,EAAmBD,OAAWtuC,EAC5CwhC,0BAA2B6M,IAC3B,wBArFZ,SAAC,GAAQ,CAACtpC,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EAhaM,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","components/CaseViewer.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
\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 {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(\n () => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n },\n 100\n )\n }}\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 React from 'react'\nimport { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport * as dmv from 'dicom-microscopy-viewer'\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, createSlides } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\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\ninterface ViewerState {\n slides: Slide[]\n isLoading: boolean\n}\n\nclass Viewer extends React.Component {\n state = {\n slides: [],\n isLoading: true\n }\n\n constructor (props: ViewerProps) {\n super(props)\n this.handleSeriesSelection = this.handleSeriesSelection.bind(this)\n }\n\n componentDidMount (): void {\n this.fetchImageMetadata().then(\n (metadata: dmv.metadata.VLWholeSlideMicroscopyImage[][]) => {\n this.setState({\n slides: createSlides(metadata),\n isLoading: false\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.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.')\n )\n this.setState({ isLoading: false })\n })\n }\n\n /**\n * Fetch metadata for VL Whole Slide Microscopy Image instances of the study.\n *\n * @returns Metadata of image instances of the study grouped per series\n */\n async fetchImageMetadata (): Promise {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n const studyInstanceUID = this.props.studyInstanceUID\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n const client = this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(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: this.props.studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item, index) => {\n if (item['00080016'] != null) {\n const values = item['00080016'].Value\n if (values != null) {\n const sopClassUID = values[0]\n if (sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n }\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n }))\n\n return images\n }\n\n handleSeriesSelection (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ): void {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${this.props.studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (this.props.location.pathname.includes('/projects/')) {\n urlPath = this.props.location.pathname\n if (!this.props.location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n this.props.location.pathname.includes('/series/') &&\n this.props.location.search != null\n ) {\n urlPath += this.props.location.search\n }\n\n this.props.navigate(urlPath, { replace: true })\n }\n\n render (): React.ReactNode {\n if (this.state.isLoading) {\n return null\n }\n\n if (this.state.slides.length === 0) {\n return null\n }\n const firstSlide = this.state.slides[0] as Slide\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 (this.props.location.pathname.includes('series/')) {\n const seriesFragment = this.props.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}\n\nexport default withRouter(Viewer)\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Menu,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\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'\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 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 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 = \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'\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'\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 const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\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 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 return await this.stores[0].client.retrieveStudyMetadata(options)\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveSeriesMetadata(options)\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 return await this.stores[0].client.retrieveInstance(options)\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 private memoryMonitoringIntervalId?: ReturnType;\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 this.memoryMonitoringIntervalId = setInterval(async () => {\n\n const performanceMemoryAvailable = Math.round(\n //@ts-ignore\n (performance?.memory?.totalJSHeapSize -\n //@ts-ignore\n performance?.memory?.usedJSHeapSize) /\n 1024 /\n 1024\n );\n console.log(\n \"Estimate of memory available:\",\n `${performanceMemoryAvailable} MB`\n );\n console.log(\n \"Estimate of memory usage:\",\n //@ts-ignore\n `${Math.round(performance?.memory?.usedJSHeapSize / 1024 / 1024)} MB`\n );\n\n }, 2000);\n }\n\n componentWillUnmount(): void {\n clearInterval(this.memoryMonitoringIntervalId);\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","visible","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","ParametrizedSlideViewer","presentationStateUID","selectedSlide","get","viewer","handleSeriesSelection","fetchImageMetadata","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","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","overlay","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","flex","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","dataIndex","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","marginBottom","SearchOutlined","filterIcon","filtered","fetchData","handleChange","studies","numStudies","pageSize","searchOptions","ModalitiesInStudy","searchForStudies","study","limit","searchCriteria","fuzzymatching","pagination","filters","columns","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","dataSource","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","open","DicomWebManager","onError","stores","handleError","updateHeaders","fields","f","headers","reject","retrieveStudyMetadata","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","qidoPathPrefix","qidoURLPrefix","wadoPathPrefix","wadoURLPrefix","stowPathPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","memoryMonitoringIntervalId","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","setInterval","performanceMemoryAvailable","round","performance","memory","totalJSHeapSize","usedJSHeapSize","clearInterval","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/315.d56edf4f.chunk.js b/static/js/315.df4e7f33.chunk.js similarity index 77% rename from static/js/315.d56edf4f.chunk.js rename to static/js/315.df4e7f33.chunk.js index b06d635e..23abd74a 100644 --- a/static/js/315.d56edf4f.chunk.js +++ b/static/js/315.df4e7f33.chunk.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkslim=self.webpackChunkslim||[]).push([[315],{2315:(e,t,n)=>{n.d(t,{Z:()=>Jt});var i=n(4165),a=n(5861),o=n(5671),r=n(3144),s=n(7326),l=n(136),c=n(7277),d=n(2791),u=n(7689),h=n(1087),p=n(3695),v=n(586),m=n(9135),f=n(6014),g=n(6658),y=n(4261),S=n(394),C=n(4970),I=n(184),b=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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,y.Z)();return(0,I.jsx)(S.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,I.jsx)(this.props.icon,{})),(0,I.jsxs)(C.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,I.jsx)(S.Z,{column:1,size:"small",layout:e,bordered:!1,children:n}),this.props.children]})}}]),n}(d.Component);const w=b;const x=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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,I.jsx)(w,{attributes:e})}}]),n}(d.Component);function Z(e){return"object"===typeof e&&null!==e&&void 0!==e&&void 0!==e.Alphabetic?e.Alphabetic.split("^").join(" "):""}function D(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 V(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 R(e){return null!==e&&void 0!==e?{F:"Female",M:"Male",O:"Other"}[e]:""}const O=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=[{name:"ID",value:this.props.metadata.PatientID},{name:"Name",value:Z(this.props.metadata.PatientName)},{name:"Gender",value:R(this.props.metadata.PatientSex)},{name:"Birthdate",value:D(this.props.metadata.PatientBirthDate)}];return(0,I.jsx)(w,{attributes:e})}}]),n}(d.Component);const j=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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:D(this.props.metadata.StudyDate)},{name:"Time",value:V(this.props.metadata.StudyTime)}];return(0,I.jsx)(w,{attributes:e})}}]),n}(d.Component);var M,P=n(1413);!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"}(M||(M={}));var E=Symbol("subscriptions"),A=Symbol("lastSubscriptionId"),U=function(){function e(){(0,o.Z)(this,e),this[E]={},this[A]=0}return(0,r.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[E].hasOwnProperty(e)||(this[E][e]={});var n="sub".concat(this[A]++);this[E][e][n]=t}},{key:"unsubscribe",value:function(e,t){var n=this[E][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[E][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 g.viewer.OverviewImageViewer({client:this.props.clients[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:e,resizeFactor:1,errorInterceptor:function(e){$.onError(W,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,I.jsx)(m.fCD,{}):(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%"}},this.props),{},{children:(0,I.jsx)(w,{header:this.props.slide.containerIdentifier,attributes:e,selectable:!0,children:(0,I.jsx)("div",{style:{height:"100px"},ref:this.overviewViewportRef})})}),this.props.slide.seriesInstanceUIDs[0])}}]),n}(d.Component);const te=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){var e;(0,o.Z)(this,n);for(var i=arguments.length,a=new Array(i),r=0;r0,checkedChildren:(0,I.jsx)(m.dSq,{}),unCheckedChildren:(0,I.jsx)(m.tgn,{})})}),(0,I.jsx)(f.Z,{selectedKeys:(0,ie.Z)(this.props.selectedRoiUIDs.values()),onSelect:this.handleMenuItemSelection,onClick:this.handleMenuItemSelection,children:t})]})}}]),n}(d.Component);var be=n(914),we=n(6272),xe=n(3020),Ze=n(5594),De=n(2414),Ve=["annotationGroup","defaultStyle","isVisible","metadata","onVisibilityChange","onStyleChange"];const Re=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleVisibilityChange=i.handleVisibilityChange.bind((0,s.Z)(i)),i.handleMeasurementSelection=i.handleMeasurementSelection.bind((0,s.Z)(i)),i.handleOpacityChange=i.handleOpacityChange.bind((0,s.Z)(i)),i.handleColorRChange=i.handleColorRChange.bind((0,s.Z)(i)),i.handleColorGChange=i.handleColorGChange.bind((0,s.Z)(i)),i.handleColorBChange=i.handleColorBChange.bind((0,s.Z)(i)),i.getCurrentColor=i.getCurrentColor.bind((0,s.Z)(i)),i.state={isVisible:i.props.isVisible,currentStyle:{opacity:i.props.defaultStyle.opacity,color:i.props.defaultStyle.color}},i}return(0,r.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 fe.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,I.jsx)(ae.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,I.jsx)(ae.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",disabled:!this.props.isVisible},"-")),null!=this.state.currentStyle.color&&(t=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,I.jsx)(de.Z,{plain:!0})]})),l.length>0){if(null!=this.state.currentStyle.limitValues){n=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Values of interest"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!0,min:0,max:1e3,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Exploration"}),(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:8,children:"Measurement"}),(0,I.jsx)(be.Z,{span:16,children:(0,I.jsx)(ae.Z,{style:{minWidth:"65px",width:"90%"},onSelect:this.handleMeasurementSelection,defaultValue:void 0,children:c},"annotation-group-measurements")})]})]})}var d=(0,I.jsxs)("div",{children:[t,n,(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,p=this.props,v=(p.annotationGroup,p.defaultStyle,p.isVisible,p.metadata,p.onVisibilityChange,p.onStyleChange,(0,ye.Z)(p,Ve));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},v),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(m.dSq,{}),unCheckedChildren:(0,I.jsx)(m.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:d,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})}),(0,I.jsx)(Ze.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,I.jsx)(w,{header:this.props.annotationGroup.label,attributes:s,selectable:!0,hasLongValues:!0})})]})}),this.props.annotationGroup.uid)}}]),n}(d.Component);const Oe=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.annotationGroups.map((function(t,n){var i=t.uid;return(0,I.jsx)(Re,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(d.Component);const je=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleClick=i.handleClick.bind((0,s.Z)(i)),i}return(0,r.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{type:"vertical"}),this.props.label]})),n=null!==(e=this.props.isSelected)&&void 0!==e&&e?(0,I.jsx)(le.Z,{onClick:this.handleClick,icon:(0,I.jsx)(i,{}),type:"primary",style:{lineHeight:"1.0"},children:t}):(0,I.jsx)(le.Z,{onClick:this.handleClick,icon:(0,I.jsx)(i,{}),type:"default",style:{lineHeight:"1.0"},children:t}),void 0!==this.props.tooltip?(0,I.jsx)(se.Z,{title:this.props.tooltip,children:n}):n)}}]),n}(d.Component);const Me=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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,I.jsx)(w,{attributes:e,hasLongValues:!0})}}]),n}(d.Component);var Pe=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},Ee=function(e,t){return e.ValueType===t},Ae=function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});1!==t.length&&$.onError(H,new q(N,'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=Pe({content:n.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=[];return i.forEach((function(e){var t,n=[],i=e,o=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"112040",schemeDesignator:"DCM",meaning:"Tracking Unique Identifier"})});0===o.length&&$.onError(H,new q(N,'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=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121071",schemeDesignator:"DCM",meaning:"Finding"})})).length&&$.onError(H,new q(N,'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=Pe({content:i.ContentSequence,name:new fe.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=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111003",schemeDesignator:"DCM",meaning:"Algorithm Version"})})).length){var l=o[0];n.push(l)}0===(o=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})})).length&&$.onError(H,new q(N,'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 g.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,ie.Z)(function(e){var t=e.content,n=[];return t.forEach((function(e){if(Ee(e,fe.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(Ee(e,fe.sr.valueTypes.ValueTypes.NUM)){var t=e;n.push(t)}})),n}({content:i.ContentSequence}),v=new g.roi.ROI({scoord3d:c,uid:(0,y.Z)(),properties:{trackingUID:r.UID,observerType:t,evaluations:n,measurements:p}});a.push(v)})),a},Ue=(0,r.Z)((function e(t){(0,o.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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121039",schemeDesignator:"DCM",meaning:"Specimen UID"})});0===n.length&&$.onError(H,new q(N,'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 i=n[0];this.SpecimenUID=i.UID,0===(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen Identifier"})})).length&&$.onError(H,new q(N,'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 a=n[0];this.SpecimenIdentifier=a.TextValue,0===(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111700",schemeDesignator:"DCM",meaning:"Specimen Container Identifier"})})).length&&$.onError(H,new q(N,'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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121008",schemeDesignator:"DCM",meaning:"Person Observer Name"})})).length){var s=n[0];this.PersonObserverName=s.PersonName}if(0!==(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"128774",schemeDesignator:"DCM",meaning:"Person Observer's Login Name"})})).length){var l=n[0];this.PersonObserverLoginName=l.TextValue}if((n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121012",schemeDesignator:"DCM",meaning:"Device Observer UID"})})).length>0){var c=n[0];this.DeviceObserverUID=c.UID}if(0!==(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121013",schemeDesignator:"DCM",meaning:"Device Observer Name"})})).length){var d=n[0];this.DeviceObserverName=d.TextValue}this.ROIs=Ae(t)}));const Te=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=new Ue(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===fe.sr.valueTypes.ValueTypes.CODE?i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.ConceptCodeSequence[0].CodeMeaning}):e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.TextValue})})),(0,I.jsx)(w,{header:n,attributes:i},e.uid)}));return(0,I.jsxs)("div",{children:[(0,I.jsx)(de.Z,{orientation:"left",children:"Patient"}),(0,I.jsx)(O,{metadata:this.props.dataset}),(0,I.jsx)(de.Z,{orientation:"left",children:"Case"}),(0,I.jsx)(j,{metadata:this.props.dataset}),(0,I.jsx)(de.Z,{orientation:"left",children:"Slide"}),(0,I.jsx)(w,{attributes:t}),(0,I.jsx)(de.Z,{orientation:"left",children:"Specimen"}),(0,I.jsx)(w,{attributes:n}),(0,I.jsx)(de.Z,{orientation:"left",children:"Observer"}),(0,I.jsx)(w,{attributes:i}),(0,I.jsx)(de.Z,{orientation:"left",children:"Annotations"}),a]})}}]),n}(d.Component);var ke=n(2126);const Le=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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,I.jsx)(w,{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,I.jsxs)(ke.ZP.Item,{children:[(0,I.jsx)(w,{header:e,attributes:this.props.attributes,hasLongValues:this.props.hasLongValues,children:t}),this.props.children]},this.props.uid)}}]),n}(d.Component);new fe.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),new fe.sr.coding.CodedConcept({value:"433465004",schemeDesignator:"SCT",meaning:"Sampling of tissue specimen"}),new fe.sr.coding.CodedConcept({value:"127790008",schemeDesignator:"SCT",meaning:"Specimen staining"}),new fe.sr.coding.CodedConcept({value:"9265001",schemeDesignator:"SCT",meaning:"Specimen processing"});var _e={FIXATIVE:new fe.sr.coding.CodedConcept({value:"430864009",schemeDesignator:"SCT",meaning:"Tissue fixative"}),EMBEDDING_MEDIUM:new fe.sr.coding.CodedConcept({value:"430863003",schemeDesignator:"SCT",meaning:"Embedding medium"})},Ne=(0,P.Z)({SPECIMEN_IDENTIFIER:new fe.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen identifier"}),PARENT_SPECIMEN_IDENTIFIER:new fe.sr.coding.CodedConcept({value:"111705",schemeDesignator:"DCM",meaning:"Parent specimen identifier"}),PROCESSING_TYPE:new fe.sr.coding.CodedConcept({value:"111701",schemeDesignator:"DCM",meaning:"Processing type"}),DATETIME_OF_PROCESSING:new fe.sr.coding.CodedConcept({value:"111702",schemeDesignator:"DCM",meaning:"Datetime of processing"}),PROCESSING_STEP_DESCRIPTION:new fe.sr.coding.CodedConcept({value:"111703",schemeDesignator:"DCM",meaning:"Processing step description"}),COLLECTION_METHOD:new fe.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),SAMPLING_METHOD:new fe.sr.coding.CodedConcept({value:"111704",schemeDesignator:"DCM",meaning:"Sampling method"}),STAIN:new fe.sr.coding.CodedConcept({value:"424361007",schemeDesignator:"SCT",meaning:"Using substance"})},_e);const Ge=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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 fe.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===fe.sr.valueTypes.ValueTypes.CODE){var o=new fe.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});a.equals(Ne.PROCESSING_TYPE)||(a.equals(Ne.COLLECTION_METHOD)?i.push({name:"Collection method",value:o.CodeMeaning}):a.equals(Ne.FIXATIVE)?i.push({name:"Tissue fixative",value:o.CodeMeaning}):a.equals(Ne.EMBEDDING_MEDIUM)?i.push({name:"Tissue embedding medium",value:o.CodeMeaning}):a.equals(Ne.STAIN)&&t.props.showstain&&i.push({name:"Tissue stain",value:o.CodeMeaning}))}else e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&(a.equals(Ne.STAIN)&&t.props.showstain?i.push({name:"Tissue stain",value:e.TextValue}):a.equals(Ne.PARENT_SPECIMEN_IDENTIFIER)&&i.push({name:"Parent specimen",value:e.TextValue}))}))}));var o=n.SpecimenUID,r=n.SpecimenIdentifier;return(0,I.jsx)(Le,{uid:o,identifier:r,attributes:i,hasLongValues:!0},o)}}]),n}(d.Component);const qe=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.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,I.jsx)(Ge,{index:n,metadata:t.props.metadata,showstain:t.props.showstain},e.SpecimenUID)}));return(0,I.jsx)(ke.ZP,{style:{overflowY:"auto"},children:n})}}]),n}(d.Component);var Fe=n(681),ze=n(2622),Be=n(4215),We=n(8272),Ye=["defaultStyle","isRemovable","isVisible","metadata","onVisibilityChange","onStyleChange","onRemoval","opticalPath"];const He=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleVisibilityChange=i.handleVisibilityChange.bind((0,s.Z)(i)),i.handleOpacityChange=i.handleOpacityChange.bind((0,s.Z)(i)),i.handleLimitChange=i.handleLimitChange.bind((0,s.Z)(i)),i.handleLowerLimitChange=i.handleLowerLimitChange.bind((0,s.Z)(i)),i.handleUpperLimitChange=i.handleUpperLimitChange.bind((0,s.Z)(i)),i.handleColorRChange=i.handleColorRChange.bind((0,s.Z)(i)),i.handleColorGChange=i.handleColorGChange.bind((0,s.Z)(i)),i.handleColorBChange=i.handleColorBChange.bind((0,s.Z)(i)),i.handleRemoval=i.handleRemoval.bind((0,s.Z)(i)),i.getCurrentColors=i.getCurrentColors.bind((0,s.Z)(i)),i.state={isVisible:i.props.isVisible,currentStyle:{opacity:i.props.defaultStyle.opacity,color:i.props.defaultStyle.color,paletteColorLookupTable:i.props.defaultStyle.paletteColorLookupTable,limitValues:i.props.defaultStyle.limitValues}},i}return(0,r.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 fe.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===fe.sr.valueTypes.ValueTypes.CODE){var a=new fe.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});n.equals(Ne.PROCESSING_TYPE)||n.equals(Ne.STAIN)&&i.push({name:"Tissue stain",value:a.CodeMeaning})}else e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&(n.equals(Ne.PROCESSING_TYPE)||n.equals(Ne.STAIN)&&i.push({name:"Tissue stain",value:e.TextValue}))}))}))}))}catch(m){$.onError(Y,new q(N,m.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Values of interest"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!0,min:0,max:s,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsxs)("div",{children:[d,c,(0,I.jsx)(de.Z,{plain:!0}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsx)(Ze.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,I.jsx)(w,{header:l,attributes:i,selectable:!0,hasLongValues:!0})})}else o=(0,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:1,size:"small",step:.1,style:{width:"60px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),r=(0,I.jsx)(w,{header:l,attributes:i,selectable:!0,hasLongValues:!0});var h=[];this.props.isRemovable&&h.push((0,I.jsx)(se.Z,{title:"Remove Optical Path",children:(0,I.jsx)(le.Z,{type:"default",shape:"circle",icon:(0,I.jsx)(ze.Z,{}),onClick:this.handleRemoval})}));var p=this.props,v=(p.defaultStyle,p.isRemovable,p.isVisible,p.metadata,p.onVisibilityChange,p.onStyleChange,p.onRemoval,p.opticalPath,(0,ye.Z)(p,Ye));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},v),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",checked:this.state.isVisible,onChange:this.handleVisibilityChange,checkedChildren:(0,I.jsx)(Be.Z,{}),unCheckedChildren:(0,I.jsx)(We.Z,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:o,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})}),h]})}),r]})}),this.props.opticalPath.identifier)}}]),n}(d.Component);var Xe=ae.Z.Option;const Ke=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).state={selectedOpticalPathIdentifier:void 0},i.handleItemAddition=i.handleItemAddition.bind((0,s.Z)(i)),i.handleItemRemoval=i.handleItemRemoval.bind((0,s.Z)(i)),i.handleItemSelectionChange=i.handleItemSelectionChange.bind((0,s.Z)(i)),i}return(0,r.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,I.jsx)(He,{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,I.jsx)(Xe,{value:c,children:l},c))))}))})),n&&(t=(0,I.jsxs)(re.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,I.jsx)(ae.Z,{defaultValue:"",style:{width:200},onChange:this.handleItemSelectionChange,value:this.state.selectedOpticalPathIdentifier,allowClear:!0,children:a}),(0,I.jsx)(se.Z,{title:"Add",children:(0,I.jsx)(le.Z,{icon:(0,I.jsx)(Fe.Z,{}),type:"primary",onClick:this.handleItemAddition})})]})),(0,I.jsxs)(f.Z,{selectable:!1,children:[i,t]})}}]),n}(d.Component);var Je=["defaultStyle","isVisible","mapping","metadata","onVisibilityChange","onStyleChange"];const Qe=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleVisibilityChange=i.handleVisibilityChange.bind((0,s.Z)(i)),i.handleOpacityChange=i.handleOpacityChange.bind((0,s.Z)(i)),i.state={isVisible:i.props.isVisible,currentStyle:{opacity:i.props.defaultStyle.opacity}},i}return(0,r.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,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,ye.Z)(n,Je));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsx)(re.Z,{direction:"vertical",align:"end",size:100,children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(m.dSq,{}),unCheckedChildren:(0,I.jsx)(m.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})})}),(0,I.jsx)(w,{header:this.props.mapping.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.mapping.uid)}}]),n}(d.Component);const $e=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.mappings.map((function(t,n){var i=t.uid;return(0,I.jsx)(Qe,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(d.Component);var et=["defaultStyle","isVisible","segment","metadata","onVisibilityChange","onStyleChange"];const tt=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleVisibilityChange=i.handleVisibilityChange.bind((0,s.Z)(i)),i.handleOpacityChange=i.handleOpacityChange.bind((0,s.Z)(i)),i.state={isVisible:i.props.isVisible,currentStyle:{opacity:i.props.defaultStyle.opacity}},i}return(0,r.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,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,ye.Z)(n,et));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(m.dSq,{}),unCheckedChildren:(0,I.jsx)(m.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})}),(0,I.jsx)(w,{header:this.props.segment.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.segment.uid)}}]),n}(d.Component);const nt=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=this,t=this.props.segments.map((function(t,n){var i=t.uid;return(0,I.jsx)(tt,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(d.Component);function it(e){return function(t){var n=(0,u.TH)(),i=(0,u.s0)(),a=(0,u.UO)();return(0,I.jsx)(e,(0,P.Z)((0,P.Z)({},t),{},{location:n,navigate:i,params:a}))}}var at=n(4942);const ot=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).handleOpacityChange=i.handleOpacityChange.bind((0,s.Z)(i)),i.handleColorRChange=i.handleColorRChange.bind((0,s.Z)(i)),i.handleColorGChange=i.handleColorGChange.bind((0,s.Z)(i)),i.handleColorBChange=i.handleColorBChange.bind((0,s.Z)(i)),i.getCurrentColor=i.getCurrentColor.bind((0,s.Z)(i)),i.state={currentStyle:{opacity:i.props.defaultStyle.opacity,color:i.props.defaultStyle.color}},i}return(0,r.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,I.jsx)(de.Z,{plain:!0})]})),(0,I.jsxs)("div",{children:[e,(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})]})}}]),n}(d.Component);const rt=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,I.jsx)(f.Z.Item,{style:{height:"100%",paddingLeft:"3px"},children:(0,I.jsx)(re.Z,{align:"start",children:(0,I.jsxs)("div",{style:{paddingLeft:"14px",color:"black"},children:[(0,I.jsx)(re.Z,{direction:"vertical",align:"end",children:(0,I.jsxs)(oe.Z,{indeterminate:l,checked:s,onChange:function(e){var t=e.target.checked;r.forEach((function(e){c({type:e,isVisible:t})}))},children:[(0,I.jsx)(se.Z,{title:"".concat(t.CodeValue,":").concat(t.CodingSchemeDesignator),mouseEnterDelay:1,children:t.CodeMeaning}),(0,I.jsx)(xe.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,I.jsx)(ot,{annotationGroupsUIDs:r.reduce((function(e,t){return[].concat((0,ie.Z)(e),(0,ie.Z)(t.uids))}),[]),onStyleChange:a,defaultStyle:o[r[0].uids[0]]})},children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,I.jsx)(De.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,I.jsxs)("div",{style:{paddingLeft:"25px",width:"100%",display:"flex",flexDirection:"row"},children:[(0,I.jsx)(oe.Z,{indeterminate:h,checked:u,onChange:function(t){return c({type:e,isVisible:t.target.checked})}}),(0,I.jsxs)("div",{style:{paddingLeft:"5px"},children:[(0,I.jsx)(se.Z,{title:"".concat(r,":").concat(n),mouseEnterDelay:1,children:d}),(0,I.jsx)(xe.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,I.jsx)(ot,{annotationGroupsUIDs:e.uids,onStyleChange:a,defaultStyle:o[e.uids[0]]})},children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,I.jsx)(De.Z,{})})})]})]},"".concat(e.CodingSchemeDesignator,":").concat(e.CodeMeaning))}))]})})},t.CodeMeaning)};const st=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,P.Z)((0,P.Z)({},a),{},{types:{}}),d=null!==(i=c.types[l])&&void 0!==i?i:(0,P.Z)((0,P.Z)({},o),{},{uids:[]});return(0,P.Z)((0,P.Z)({},e),{},(0,at.Z)({},s,(0,P.Z)((0,P.Z)({},c),{},{types:(0,P.Z)((0,P.Z)({},c.types),{},(0,at.Z)({},l,(0,P.Z)((0,P.Z)({},d),{},{uids:[].concat((0,ie.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,I.jsx)(I.Fragment,{});var s=Object.keys(r).map((function(e){var t=r[e];return(0,I.jsx)(rt,{category:t,onChange:n,onStyleChange:i,defaultAnnotationStyles:a,checkedAnnotationUids:o},t.CodeMeaning)}));return(0,I.jsx)(f.Z,{selectable:!1,children:s})};const lt=function(e){var t=e.xPosition,n=e.yPosition,i=e.attributes;return(0,I.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,I.jsxs)("div",{children:[e.name,": ",(0,I.jsx)("span",{style:{fontWeight:500},children:e.value})]},e.name)}))})};var ct=[255,234,0],dt=[255,234,0,.2],ut=[0,0,0],ht=[[54,162,235],[181,65,98],[75,192,192],[255,158,64],[153,102,254],[255,205,86],[200,203,207]],pt=function(e){var t=e.CodingSchemeDesignator,n=e.CodeValue;return"".concat(t,"-").concat(n)},vt=function(e){var t=Pe({content:e.evaluations,name:new fe.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"})});if(0!==t.length){var n=t[0].ConceptCodeSequence[0];return pt(n)}console.warn("no finding found for ROI ".concat(e.uid))},mt=function(e){var t={color:ct,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:dt};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}}}},ft=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 g.viewer.VolumeImageViewer({clientMapping:t,metadata:n.volumeImages,controls:["overview","position"],preload:i,errorInterceptor:function(e){$.onError(W,e)}});return o.activateSelectInteraction({}),n.labelImages.length>0&&(console.info("instantiate viewer for LABEL image of slide "+'"'.concat(n.labelImages[0].ContainerIdentifier,'"')),a=new g.viewer.LabelImageViewer({client:t[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:n.labelImages[0],resizeFactor:1,orientation:"vertical",errorInterceptor:function(e){$.onError(W,e)}})),{volumeViewer:o,labelViewer:a}}catch(r){throw $.onError(H,new q(G,"Failed to instantiate viewer")),r}},gt=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;(0,o.Z)(this,n),(i=t.call(this,e)).findingOptions=[],i.evaluationOptions={},i.measurements=[],i.geometryTypeOptions={},i.volumeViewportRef=void 0,i.labelViewportRef=void 0,i.volumeViewer=void 0,i.labelViewer=void 0,i.defaultRoiStyle={stroke:{color:ct,width:2},fill:{color:dt},image:{circle:{fill:{color:ct},radius:5}}},i.roiStyles={},i.defaultAnnotationStyles={},i.selectionColor=[140,184,198],i.selectedRoiStyle={stroke:{color:[].concat((0,ie.Z)(i.selectionColor),[1]),width:3},fill:{color:[].concat((0,ie.Z)(i.selectionColor),[.2])},image:{circle:{radius:5,fill:{color:[].concat((0,ie.Z)(i.selectionColor),[1])}}}},i.loadPresentationStates=function(){console.info("search for Presentation State instances");var e=i.props.clients[M.ADVANCED_BLENDING_PRESENTATION_STATE];e.searchForInstances({studyInstanceUID:i.props.studyInstanceUID,queryParams:{Modality:"PR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t,n){var a=g.metadata.formatMetadata(t).dataset;console.info('retrieve PR instance "'.concat(a.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:i.props.studyInstanceUID,seriesInstanceUID:a.SeriesInstanceUID,sopInstanceUID:a.SOPInstanceUID}).then((function(e){var t=fe.aT.DicomMessage.readFile(e),o=g.metadata.formatMetadata(t.dict).dataset;if(i.props.slide.areVolumeImagesMonochrome){var r=o,s=!1;r.AdvancedBlendingSequence.forEach((function(e){s=i.props.slide.seriesInstanceUIDs.includes(e.SeriesInstanceUID)})),s&&(console.info("include Advanced Blending Presentation State instance "+'"'.concat(r.SOPInstanceUID,'"')),(0===n&&null==i.props.selectedPresentationStateUID||r.SOPInstanceUID===i.props.selectedPresentationStateUID)&&i.setPresentationState(r),i.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(a.SOPInstanceUID,'", ')+"application of presentation states for color images has not (yet) been implemented")})).catch((function(e){$.onError(H,new q(G,"Presentation State could not be loaded")),console.error("failed to load presentation state "+'of SOP instance "'.concat(a.SOPInstanceUID,'" ')+'of series "'.concat(a.SeriesInstanceUID,'" ')+'of study "'.concat(i.props.studyInstanceUID,'": '),e)}))}))})).catch((function(e){console.error(e),$.onError(H,new q(G,"Presentation State could not be loaded"))}))},i.setPresentationState=function(e){var t=i.volumeViewer.getAllOpticalPaths();console.info('apply Presentation State instance "'.concat(e.SOPInstanceUID,'"'));var n={};t.forEach((function(t){var a=t.identifier;i.volumeViewer.hideOpticalPath(a),i.volumeViewer.deactivateOpticalPath(a);var o=i.volumeViewer.getOpticalPathDefaultStyle(a);i.volumeViewer.setOpticalPathStyle(a,o),e.AdvancedBlendingSequence.forEach((function(e){var i=e.ReferencedInstanceSequence;void 0===i&&(i=e.ReferencedImageSequence),void 0!==i&&i.forEach((function(i){if(t.sopInstanceUIDs.includes(i.ReferencedSOPInstanceUID)){var o,r;if(null!=e.PaletteColorLookupTableSequence){var s=e.PaletteColorLookupTableSequence[0];o=new g.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[a]={opacity:1,paletteColorLookupTable:o,limitValues:r}}}))}))}));var a=new Set;Object.keys(n).forEach((function(e){var t=n[e];null!=t?(i.volumeViewer.setOpticalPathStyle(e,t),i.volumeViewer.activateOpticalPath(e),i.volumeViewer.showOpticalPath(e),a.add(e)):(i.volumeViewer.hideOpticalPath(e),i.volumeViewer.deactivateOpticalPath(e))}));var o=new URLSearchParams(i.props.location.search);o.set("state",e.SOPInstanceUID),i.props.navigate({pathname:i.props.location.pathname,search:o.toString()},{replace:!0}),i.setState((function(t){return{activeOpticalPathIdentifiers:a,visibleOpticalPathIdentifiers:a,selectedPresentationStateUID:e.SOPInstanceUID}}))},i.getRoiStyle=function(e){return null==e?i.defaultRoiStyle:void 0!==i.roiStyles[e]?i.roiStyles[e]:i.defaultRoiStyle},i.addAnnotations=function(){console.info("search for Comprehensive 3D SR instances");var e=i.props.clients[M.COMPREHENSIVE_3D_SR];e.searchForInstances({studyInstanceUID:i.props.studyInstanceUID,queryParams:{Modality:"SR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=g.metadata.formatMetadata(t).dataset;n.SOPClassUID===M.COMPREHENSIVE_3D_SR&&(console.info('retrieve SR instance "'.concat(n.SOPInstanceUID,'"')),e.retrieveInstance({studyInstanceUID:i.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID,sopInstanceUID:n.SOPInstanceUID}).then((function(e){var t=fe.aT.DicomMessage.readFile(e),n=g.metadata.formatMetadata(t.dict).dataset;(function(e){var t=e.ContentTemplateSequence;return t.length>0&&"1500"===t[0].TemplateIdentifier})(n)?!function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121024",schemeDesignator:"DCM",meaning:"Subject Class"})});if(0===t.length)return!1;var n=t[0].ConceptCodeSequence[0],i=new fe.sr.coding.CodedConcept({value:n.CodeValue,meaning:n.CodeMeaning,schemeDesignator:n.CodingSchemeDesignator}),a=new fe.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=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});if(0===t.length)return!1;var n=t[0],i=Pe({content:n.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=!1;return i.forEach((function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})});t.length>0&&t[0].ValueType===fe.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 Ue(n).ROIs.forEach((function(e){console.info('add ROI "'.concat(e.uid,'"'));var t=e.scoord3d,a=i.props.slide.volumeImages[0];if(t.frameOfReferenceUID===a.FrameOfReferenceUID){var o=i.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{i.volumeViewer.addSegments(t)}catch(n){$.onError(H,new q(G,"Segmentations cannot be displayed")),console.error("failed to add segments: ",n)}i.forceUpdate()}})).catch((function(e){console.error(e),$.onError(H,new q(G,"Retrieval of metadata of Segmentation instances failed."))}))}))})).catch((function(e){console.error(e),$.onError(H,new q(G,"Search for Segmentation instances failed."))}))},i.addParametricMaps=function(){console.info("search for Parametric Map instances");var e=i.props.clients[M.PARAMETRIC_MAP];e.searchForSeries({studyInstanceUID:i.props.studyInstanceUID,queryParams:{Modality:"OT"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=g.metadata.formatMetadata(t).dataset;e.retrieveSeriesMetadata({studyInstanceUID:i.props.studyInstanceUID,seriesInstanceUID:n.SeriesInstanceUID}).then((function(e){var t=[];if(e.forEach((function(e){var n=new g.metadata.ParametricMap({metadata:e}),a=i.props.slide.volumeImages[0];n.FrameOfReferenceUID===a.FrameOfReferenceUID&&n.ContainerIdentifier===a.ContainerIdentifier?t.push(n):console.warn('skip Parametric Map instance "'.concat(n.SOPInstanceUID,'"'))})),t.length>0){try{i.volumeViewer.addParameterMappings(t)}catch(n){$.onError(H,new q(G,"Parametric Map cannot be displayed")),console.error("failed to add mappings: ",n)}i.forceUpdate()}})).catch((function(e){console.error(e),$.onError(H,new q(G,"Retrieval of metadata of Parametric Map instances failed."))}))}))})).catch((function(e){console.error(e),$.onError(H,new q(G,"Search for Parametric Map instances failed."))}))},i.populateViewports=function(){console.info("populate viewports..."),i.setState({isLoading:!0,presentationStates:[]}),null!=i.volumeViewportRef.current&&i.volumeViewer.render({container:i.volumeViewportRef.current}),null!=i.labelViewportRef.current&&null!=i.labelViewer&&i.labelViewer.render({container:i.labelViewportRef.current}),i.setState({isLoading:!1}),i.setDefaultPresentationState(),i.loadPresentationStates(),i.addAnnotations(),i.addAnnotationGroups(),i.addSegmentations(),i.addParametricMaps()},i.onRoiModified=function(e){i.setState((function(e){return{visibleRoiUIDs:new Set(e.visibleRoiUIDs)}}))},i.onWindowResize=function(e){console.info("resize viewports"),i.volumeViewer.resize(),null!=i.labelViewer&&i.labelViewer.resize()},i.onRoiDrawn=function(e){var t=e.detail.payload,n=i.state.selectedFinding,a=i.state.selectedEvaluations;if(void 0!==t&&void 0!==n){console.debug('add ROI "'.concat(t.uid,'"'));var o=new fe.sr.valueTypes.CodeContentItem({name:new fe.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"}),value:n,relationshipType:"CONTAINS"});t.addEvaluation(o),a.forEach((function(e){var n=new fe.sr.valueTypes.CodeContentItem({name:e.name,value:e.value,relationshipType:"CONTAINS"});t.addEvaluation(n)}));var r=pt(n),s=i.getRoiStyle(r);i.volumeViewer.addROI(t,s),i.setState((function(e){var n=e.visibleRoiUIDs;return n.add(t.uid),{visibleRoiUIDs:n}}))}else console.debug('could not add ROI "'.concat(t.uid,'"'))},i.onRoiDoubleClicked=function(e){null!=e.detail.payload?i.setState({isSelectedRoiModalVisible:!0}):i.setState({isSelectedRoiModalVisible:!1})},i.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===fe.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===fe.sr.valueTypes.ValueTypes.TEXT){var r=e;t.push({name:a,value:r.TextValue})}})),i.setState({hoveredRoiAttributes:t})},i.onPointerMove=function(e){var t=e.detail.payload,n=t.feature,a=t.event;if(null!=n){var o=a.originalEvent;i.setHoveredRoiAttributes(n),i.setState({isHoveredRoiTooltipVisible:!0,hoveredRoi:n,hoveredRoiTooltipX:o.clientX,hoveredRoiTooltipY:o.clientY})}else i.setState({isHoveredRoiTooltipVisible:!1})},i.onRoiSelected=function(e){var t=e.detail.payload;if(null!=t){console.debug('selected ROI "'.concat(t.uid,'"')),i.volumeViewer.setROIStyle(t.uid,i.selectedRoiStyle);var n=vt(t);i.volumeViewer.getAllROIs().forEach((function(e){e.uid!==t.uid&&i.volumeViewer.setROIStyle(e.uid,i.getRoiStyle(n))})),i.setState({selectedRoiUIDs:new Set([t.uid]),selectedRoi:t})}else i.setState({selectedRoiUIDs:new Set,selectedRoi:void 0})},i.onLoadingStarted=function(e){i.setState({isLoading:!0})},i.onLoadingEnded=function(e){i.setState({isLoading:!1})},i.onFrameLoadingStarted=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);i.setState((function(e){return e.loadingFrames.add(n),e}))},i.onFrameLoadingError=function(e){console.error("Failed to load frame")},i.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;$.onError(H,new q(G,o))},i.onFrameLoadingEnded=function(e){var t=e.detail.payload,n="".concat(t.sopInstanceUID,"-").concat(t.frameNumber);if(i.setState((function(e){e.loadingFrames.delete(n);var t=!1;return e.loadingFrames.size>0&&(t=!0),{isLoading:t,loadingFrames:e.loadingFrames}})),t.sopClassUID===M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE&&i.props.slide.areVolumeImagesMonochrome){var a=t.channelIdentifier;if(!(a in i.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&&$.onError(H,new q(G,"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 fe.sr.templates.PersonObserverIdentifyingAttributes({name:this.props.user.name,loginName:this.props.user.email}):(console.warn("no user information available"),a=new fe.sr.templates.PersonObserverIdentifyingAttributes({name:"ANONYMOUS"}));var r=new fe.sr.templates.ObservationContext({observerPersonContext:new fe.sr.templates.ObserverContext({observerType:new fe.sr.coding.CodedConcept({value:"121006",schemeDesignator:"DCM",meaning:"Person"}),observerIdentifyingAttributes:a}),observerDeviceContext:new fe.sr.templates.ObserverContext({observerType:new fe.sr.coding.CodedConcept({value:"121007",schemeDesignator:"DCM",meaning:"Device"}),observerIdentifyingAttributes:new fe.sr.templates.DeviceObserverIdentifyingAttributes({uid:this.props.app.uid,manufacturerName:"MGH Computational Pathology",modelName:this.props.app.name})}),subjectContext:new fe.sr.templates.SubjectContext({subjectClass:new fe.sr.coding.CodedConcept({value:"121027",schemeDesignator:"DCM",meaning:"Specimen"}),subjectClassSpecificContext:new fe.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),p.ZP.info("Annotation was removed")):p.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,ie.Z)(this.volumeViewer.getAllROIs())),n.push.apply(n,(0,ie.Z)(this.volumeViewer.getAllSegments())),i.push.apply(i,(0,ie.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,ie.Z)(r));var s,l,c=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===fe.sr.valueTypes.ValueTypes.CODE){var n=e.ConceptCodeSequence[0];"276214006"===t?i.category=(0,P.Z)({},n):"121071"===t&&(i.type=(0,P.Z)({},n))}})),(0,P.Z)((0,P.Z)({},i),{},{uid:t})}(e)})),u=["specimens","optical-paths","annotations","presentation-states"],h=this.state.generatedReport;void 0!==h&&(s=(0,I.jsx)(Te,{dataset:h})),t.length>0&&(l=(0,I.jsx)(Ie,{rois:t,selectedRoiUIDs:this.state.selectedRoiUIDs,visibleRoiUIDs:this.state.visibleRoiUIDs,onSelection:this.handleAnnotationSelection,onVisibilityChange:this.handleAnnotationVisibilityChange}));var p=this.findingOptions.map((function(e){return(0,I.jsx)(ae.Z.Option,{value:e.CodeValue,children:e.CodeMeaning},e.CodeValue)})),g={point:(0,I.jsx)(ae.Z.Option,{value:"point",children:"Point"},"point"),circle:(0,I.jsx)(ae.Z.Option,{value:"circle",children:"Circle"},"circle"),box:(0,I.jsx)(ae.Z.Option,{value:"box",children:"Box"},"box"),polygon:(0,I.jsx)(ae.Z.Option,{value:"polygon",children:"Polygon"},"polygon"),line:(0,I.jsx)(ae.Z.Option,{value:"line",children:"Line"},"line"),freehandpolygon:(0,I.jsx)(ae.Z.Option,{value:"freehandpolygon",children:"Polygon (freehand)"},"freehandpolygon"),freehandline:(0,I.jsx)(ae.Z.Option,{value:"freehandline",children:"Line (freehand)"},"freehandline")},y=[(0,I.jsx)(ae.Z,{style:{minWidth:130},onSelect:this.handleAnnotationFindingSelection,defaultActiveFirstOption:!0,children:p},"annotation-finding")],C=this.state.selectedFinding;if(void 0!==C){var b=pt(C);this.evaluationOptions[b].forEach((function(t){var n=t.values.map((function(e){return(0,I.jsx)(ae.Z.Option,{value:e.CodeValue,label:t.name,children:e.CodeMeaning},e.CodeValue)}));y.push((0,I.jsxs)(I.Fragment,{children:[t.name.CodeMeaning,(0,I.jsx)(ae.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 g[e]}));y.push((0,I.jsxs)(I.Fragment,{children:["ROI geometry type",(0,I.jsx)(ae.Z,{style:{minWidth:130},onSelect:this.handleAnnotationGeometryTypeSelection,children:w},"annotation-geometry-type")]})),y.push((0,I.jsx)(oe.Z,{onChange:this.handleAnnotationMeasurementActivation,children:"measure"},"annotation-measurement"))}var x=(0,I.jsx)(f.Z.SubMenu,{title:"Specimens",children:(0,I.jsx)(qe,{metadata:this.props.slide.volumeImages[0],showstain:!1})},"specimens"),Z=(0,I.jsx)(f.Z.SubMenu,{title:"Equipment",children:(0,I.jsx)(Me,{metadata:this.props.slide.volumeImages[0]})},"equipment"),D=this.volumeViewer.getAllOpticalPaths();D.sort((function(e,t){return 1===e.identifier.localeCompare(t.identifier)?1:1===t.identifier.localeCompare(e.identifier)?-1:0}));var V={},R={};D.forEach((function(t){var n=t.identifier,i=e.volumeViewer.getOpticalPathMetadata(n);R[n]=i;var a=(0,P.Z)({},e.volumeViewer.getOpticalPathStyle(n));V[n]=a}));var O,j,M,E,A,U=(0,I.jsx)(f.Z.SubMenu,{title:"Optical Paths",children:(0,I.jsx)(Ke,{metadata:R,opticalPaths:D,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,I.jsx)(ae.Z.Option,{value:e.SOPInstanceUID,dropdownMatchSelectWidth:!1,size:"small",children:e.ContentDescription},e.SOPInstanceUID))})),T.push((0,I.jsx)(ae.Z.Option,{value:null,dropdownMatchSelectWidth:!1,size:"small"},"default-presentation-state")),O=(0,I.jsx)(f.Z.SubMenu,{title:"Presentation States",children:(0,I.jsxs)(re.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,I.jsx)(ae.Z,{style:{minWidth:200,maxWidth:200},onSelect:this.handlePresentationStateSelection,value:this.state.selectedPresentationStateUID,children:T},"presentation-states"),(0,I.jsx)(se.Z,{title:"Reset",children:(0,I.jsx)(le.Z,{icon:(0,I.jsx)(pe.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)})),j=(0,I.jsx)(f.Z.SubMenu,{title:"Segmentations",children:(0,I.jsx)(nt,{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)})),M=(0,I.jsx)(f.Z.SubMenu,{title:"Parametric Maps",children:(0,I.jsx)($e,{mappings:i,metadata:G,defaultMappingStyles:N,visibleMappingUIDs:this.state.visibleMappingUIDs,onMappingVisibilityChange:this.handleMappingVisibilityChange,onMappingStyleChange:this.handleMappingStyleChange})},"parmetric-maps"),u.push("parametric-maps")}if(c.length>0&&c.forEach((function(t){var n,i=e.volumeViewer.getROI(t.uid),a=vt(i),o=void 0!==e.roiStyles[a]?null===(n=e.roiStyles[a].stroke)||void 0===n?void 0:n.color.slice(0,3):ht[Object.keys(e.roiStyles).length%ht.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)})),E=(0,I.jsx)(f.Z.SubMenu,{title:"Annotation Groups",children:(0,I.jsx)(Oe,{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,I.jsx)(je,{tooltip:"Draw ROI [Alt+D]",icon:m.vuA,onClick:this.handleRoiDrawing,isSelected:this.state.isRoiDrawingActive},"draw-roi-button"),(0,I.jsx)(je,{tooltip:"Modify ROIs [Alt+M]",icon:m.eAi,onClick:this.handleRoiModification,isSelected:this.state.isRoiModificationActive},"modify-roi-button"),(0,I.jsx)(je,{tooltip:"Translate ROIs [Alt+T]",icon:m.Jd7,onClick:this.handleRoiTranslation,isSelected:this.state.isRoiTranslationActive},"translate-roi-button"),(0,I.jsx)(je,{tooltip:"Remove selected ROI [Alt+R]",onClick:this.handleRoiRemoval,icon:m.Xm5},"remove-roi-button"),(0,I.jsx)(je,{tooltip:"Show/Hide ROIs [Alt+V]",icon:this.state.areRoisHidden?m.dSq:m.tgn,onClick:this.handleRoiVisibilityChange,isSelected:this.state.areRoisHidden},"toggle-roi-visibility-button"),(0,I.jsx)(je,{tooltip:"Save ROIs [Alt+S]",icon:m.TvB,onClick:this.handleReportGeneration},"generate-report-button")],W=[(0,I.jsx)(je,{tooltip:"Go to [Alt+G]",icon:m.Xe,onClick:this.handleGoTo},"go-to-slide-position-button")];this.props.enableAnnotationTools&&(A=(0,I.jsxs)(ce.Z,{justify:"start",children:[B.map((function(e,t){return(0,I.jsx)(d.Fragment,{children:e},t)})),W.map((function(e,t){return(0,I.jsx)(d.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}],J=[];this.state.selectedRoi.evaluations.forEach((function(e){if("CODE"===e.ValueType){var t=e;J.push({name:t.ConceptNameCodeSequence[0].CodeMeaning,value:t.ConceptCodeSequence[0].CodeMeaning})}else{var n=e;J.push({name:n.ConceptNameCodeSequence[0].CodeMeaning,value:n.TextValue})}}));var Q={};this.state.selectedRoi.measurements.forEach((function(e){var t="default";if(null!=e.ContentSequence){var n=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121112",meaning:"Source of Measurement",schemeDesignator:"DCM"})});n.length>0&&(t=n[0].ReferencedSOPSequence[0].ReferencedOpticalPathIdentifier)}t in Q||(Q[t]=[]);var i=e.MeasuredValueSequence[0];Q[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,I.jsx)(S.Z.Item,{label:e.name,children:t},e.name)}))},ee=$(X),te=$(K),ne=$(J),ge=[];for(var ye in Q){var Se=$(Q[ye]);"default"===ye?ge.push(Se):ge.push((0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,dashed:!0,plain:!0,children:ye}),Se]}))}Y=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ee}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Spatial coordinates"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:te}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Evaluations"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ne}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Measurements"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ge})]})}return(0,I.jsxs)(v.Z,{style:{height:"100%"},hasSider:!0,children:[(0,I.jsxs)(v.Z.Content,{style:{height:"100%"},children:[A,(0,I.jsx)("div",{style:{height:"calc(100% - ".concat(z,")"),overflow:"hidden",cursor:H},ref:this.volumeViewportRef}),(0,I.jsx)(ue.Z,{visible:this.state.isAnnotationModalVisible,title:"Configure annotations",onOk:this.handleAnnotationConfigurationCompletion,onCancel:this.handleAnnotationConfigurationCancellation,okText:"Select",children:(0,I.jsx)(re.Z,{align:"start",direction:"vertical",children:y})}),(0,I.jsx)(ue.Z,{visible:this.state.isSelectedRoiModalVisible,title:"Selected ROI",onCancel:this.handleRoiSelectionCancellation,maskClosable:!0,footer:null,children:(0,I.jsx)(re.Z,{align:"start",direction:"vertical",children:Y})}),(0,I.jsx)(ue.Z,{visible:this.state.isGoToModalVisible,title:"Go to slide position",onOk:this.handleSlidePositionSelection,onCancel:this.handleSlidePositionSelectionCancellation,okText:"Select",children:(0,I.jsxs)(re.Z,{align:"start",direction:"vertical",children:[(0,I.jsx)(he.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,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,I.jsx)(he.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,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,I.jsx)(he.Z,{placeholder:"[0 - 40]",prefix:"Magnification",onChange:this.handleMagnificationSelection,onPressEnter:this.handleMagnificationSelection,controls:!1,addonAfter:this.state.isSelectedMagnificationValid?(0,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})})]})}),(0,I.jsx)(ue.Z,{visible:this.state.isReportModalVisible,title:"Verify and save report",onOk:this.handleReportVerification,onCancel:this.handleReportCancellation,okText:"Save",children:s})]}),(0,I.jsx)(v.Z.Sider,{width:300,reverseArrow:!0,style:{borderLeft:"solid",borderLeftWidth:.25,overflow:"hidden",background:"none"},children:(0,I.jsxs)(f.Z,{mode:"inline",defaultOpenKeys:u,style:{height:"100%"},inlineIndent:14,forceSubMenuRender:!0,onOpenChange:function(){setTimeout((function(){null!=e.labelViewer&&e.labelViewer.resize()}),100)},children:[(0,I.jsx)(f.Z.SubMenu,{title:"Slide label",children:(0,I.jsx)(f.Z.Item,{style:{height:"100%"},children:(0,I.jsx)("div",{style:{height:"220px"},ref:this.labelViewportRef})},"image")},"label"),x,Z,U,O,(0,I.jsx)(f.Z.SubMenu,{title:"Annotations",children:l},"annotations"),E,0===c.length?(0,I.jsx)(I.Fragment,{}):(0,I.jsx)(f.Z.SubMenu,{title:"Annotation Categories",children:(0,I.jsx)(st,{annotations:c,onChange:this.handleAnnotationVisibilityChange,checkedAnnotationUids:this.state.visibleRoiUIDs,onStyleChange:this.handleRoiStyleChange,defaultAnnotationStyles:this.defaultAnnotationStyles})},"annotation-category"),j,M]})}),this.state.isHoveredRoiTooltipVisible&&this.state.hoveredRoiAttributes.length>0?(0,I.jsx)(lt,{xPosition:this.state.hoveredRoiTooltipX,yPosition:this.state.hoveredRoiTooltipY,attributes:this.state.hoveredRoiAttributes}):(0,I.jsx)(I.Fragment,{})]})}}]),n}(d.Component);const yt=it(gt);var St;!function(e){e.VOLUME="VOLUME",e.LABEL="LABEL",e.OVERVIEW="OVERVIEW",e.THUMBNAIL="THUMBNAIL"}(St||(St={}));var Ct=function(e,t){return e.ImageType[2]===t},It=function(e,t){return null!=e.AcquisitionUID&&e.AcquisitionUID===t.AcquisitionUID},bt=(0,r.Z)((function e(t){var n=this;(0,o.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&&$.onError(H,new q(N,'Value of option "images" have been non-zero length.'));var i=new Set([]),a=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),i.add(e.SeriesInstanceUID),e.OpticalPathSequence.forEach((function(e){r.add(e.OpticalPathIdentifier)})),null!=e.AcquisitionUID&&a.add(e.AcquisitionUID),Ct(e,St.VOLUME)||Ct(e,St.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,St.LABEL)?(l.LABEL.add(e.FrameOfReferenceUID),u.push(e)):Ct(e,St.OVERVIEW)&&(l.OVERVIEW.add(e.FrameOfReferenceUID),h.push(e))})),0===d.length)$.onError(H,new q(N,"At least one VOLUME image must be provided for a slide."));else{a.size>1&&$.onError(H,new q(N,"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&&$.onError(H,new q(N,"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,ie.Z)(i),this.opticalPathIdentifiers=(0,ie.Z)(r),1!==s.size&&$.onError(H,new q(N,"All images of a slide must have the same Container Identifier.")),this.containerIdentifier=(0,ie.Z)(s)[0],1!==l.VOLUME.size&&$.onError(H,new q(N,"All VOLUME images of a slide must have the same Frame of Reference UID.")),this.frameOfReferenceUID=(0,ie.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?$.onError(H,new q(N,'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,ie.Z)(c.VOLUME[e])[0]):$.onError(H,new q(N,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it.")):v&&$.onError(H,new q(N,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it."))})),a.size>1?$.onError(H,new q(N,"All VOLUME images of a slide must be part of the same acquisition and have the same Acquisition UID.")):1===a.size?this.acquisitionUID=(0,ie.Z)(a)[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,St.VOLUME)||Ct(e,St.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,St.LABEL)}));i=s.length>1?s.filter((function(e){return It(e,a)})):s;var l,c=e.filter((function(e){return Ct(e,St.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,ie.Z)(o)),(h=v.labelImages).push.apply(h,(0,ie.Z)(i)),(p=v.overviewImages).push.apply(p,(0,ie.Z)(l))}}}}));var n=t.map((function(e){return new bt({images:[].concat((0,ie.Z)(e.volumeImages),(0,ie.Z)(e.labelImages),(0,ie.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}))};function xt(e){var t,n=e.clients,i=e.slides,a=e.user,o=e.app,r=e.preload,s=e.enableAnnotationTools,l=e.annotations,c=(0,u.UO)(),d=c.studyInstanceUID,h=c.seriesInstanceUID,p=(0,u.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,I.jsx)(yt,{clients:n,studyInstanceUID:d,seriesInstanceUID:h,selectedPresentationStateUID:t,slide:v,preload:r,annotations:l,enableAnnotationTools:s,app:o,user:a})),f}const Zt=it(function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).state={slides:[],isLoading:!0},i.handleSeriesSelection=i.handleSeriesSelection.bind((0,s.Z)(i)),i}return(0,r.Z)(n,[{key:"componentDidMount",value:function(){var e=this;this.fetchImageMetadata().then((function(t){e.setState({slides:wt(t),isLoading:!1})})).catch((function(t){console.error(t),$.onError(H,new q(N,"Image metadata could not be retrieved or decoded.")),e.setState({isLoading:!1})}))}},{key:"fetchImageMetadata",value:function(){var e=(0,a.Z)((0,i.Z)().mark((function e(){var t,n,o,r,s=this;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],n=this.props.studyInstanceUID,console.info('search for series of study "'.concat(n,'"...')),o=this.props.clients[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],e.next=6,o.searchForSeries({queryParams:{Modality:"SM",StudyInstanceUID:n}});case 6:return r=e.sent,e.next=9,Promise.all(r.map(function(){var e=(0,a.Z)((0,i.Z)().mark((function e(n){var a,r,l,c,d;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g.metadata.formatMetadata(n),r=a.dataset,l=r,console.info('retrieve metadata of series "'.concat(l.SeriesInstanceUID,'"')),e.next=5,o.retrieveSeriesMetadata({studyInstanceUID:s.props.studyInstanceUID,seriesInstanceUID:l.SeriesInstanceUID});case 5:c=e.sent,d=[],c.forEach((function(e,t){if(null!=e["00080016"]){var n=e["00080016"].Value;if(null!=n)if(n[0]===M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE){var i=new g.metadata.VLWholeSlideMicroscopyImage({metadata:e});d.push(i)}}})),d.length>0&&t.push(d);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"handleSeriesSelection",value:function(e){var t=e.seriesInstanceUID;console.info('switch to series "'.concat(t,'"'));var n="/studies/".concat(this.props.studyInstanceUID)+"/series/".concat(t);this.props.location.pathname.includes("/projects/")&&(n=this.props.location.pathname,this.props.location.pathname.includes("/series/")?n=n.replace(/\/series\/[^/]+/,"/series/".concat(t)):n+="/series/".concat(t)),this.props.location.pathname.includes("/series/")&&null!=this.props.location.search&&(n+=this.props.location.search),this.props.navigate(n,{replace:!0})}},{key:"render",value:function(){if(this.state.isLoading)return null;if(0===this.state.slides.length)return null;var e=this.state.slides[0].volumeImages;if(0===e.length)return null;var t,n,i=e[0];if(this.props.location.pathname.includes("series/")){var a=this.props.location.pathname.split("series/")[1];t=a.includes("/")?a.split("/")[0]:a}else t=e[0].SeriesInstanceUID;return null!=i.ClinicalTrialSponsorName&&(n=(0,I.jsx)(f.Z.SubMenu,{title:"Clinical Trial",children:(0,I.jsx)(x,{metadata:i})},"clinical-trial")),(0,I.jsxs)(v.Z,{style:{height:"100%"},hasSider:!0,children:[(0,I.jsx)(v.Z.Sider,{width:300,style:{height:"100%",borderRight:"solid",borderRightWidth:.25,overflow:"hidden",background:"none"},children:(0,I.jsxs)(f.Z,{mode:"inline",defaultOpenKeys:["patient","study","clinical-trial","slides"],style:{height:"100%"},inlineIndent:14,children:[(0,I.jsx)(f.Z.SubMenu,{title:"Patient",children:(0,I.jsx)(O,{metadata:i})},"patient"),(0,I.jsx)(f.Z.SubMenu,{title:"Study",children:(0,I.jsx)(j,{metadata:i})},"study"),n,(0,I.jsx)(f.Z.SubMenu,{title:"Slides",children:(0,I.jsx)(te,{clients:this.props.clients,metadata:this.state.slides,selectedSeriesInstanceUID:t,onSeriesSelection:this.handleSeriesSelection})},"slides")]})}),(0,I.jsx)(u.Z5,{children:(0,I.jsx)(u.AW,{path:"/series/:seriesInstanceUID",element:(0,I.jsx)(xt,{clients:this.props.clients,slides:this.state.slides,preload:this.props.preload,annotations:this.props.annotations,enableAnnotationTools:this.props.enableAnnotationTools,app:this.props.app,user:this.props.user})})})]})}}]),n}(d.Component));var Dt=n(63),Vt=n(7382),Rt=n(2996),Ot=n(9529),jt=n(127),Mt=n(4541),Pt=n(161),Et=n(9761);const At=it(function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;(0,o.Z)(this,n),(i=t.call(this,e)).handleInfoButtonClick=function(){var e=(0,Et.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}),ue.Z.info({title:"About",width:600,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(S.Z,{title:"Application",column:1,children:[(0,I.jsx)(S.Z.Item,{label:"Name",children:i.props.app.name}),(0,I.jsx)(S.Z.Item,{label:"Version",children:i.props.app.version}),(0,I.jsx)(S.Z.Item,{label:"Homepage",children:i.props.app.homepage})]}),(0,I.jsxs)(S.Z,{title:"Browser",column:1,children:[(0,I.jsx)(S.Z.Item,{label:"Name",children:t.browser.name}),(0,I.jsx)(S.Z.Item,{label:"Version",children:t.browser.version})]}),(0,I.jsx)(S.Z,{title:"Operating System",column:1,children:(0,I.jsx)(S.Z.Item,{label:"Name",children:t.os.name})})]}),onOk:function(){}})},i.handleDebugButtonClick=function(){var e={Authentication:[],Communication:[],EncodingDecoding:[],Visualization:[]},t=i.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=(0,I.jsx)(f.Z,{items:i});n=(0,I.jsx)(Vt.Z,{overlay:a,trigger:["click"],children:(0,I.jsx)(je,{icon:Ot.Z,onClick:function(e){return e.preventDefault()},label:"".concat(this.props.user.name," (").concat(this.props.user.email,")")})})}this.props.showWorklistButton&&(e=(0,I.jsx)(h.OL,{to:"/",children:(0,I.jsx)(je,{icon:jt.Z,tooltip:"Go to worklist"})}));var o,r=(0,I.jsx)(je,{icon:Mt.Z,tooltip:"Get app info",onClick:this.handleInfoButtonClick}),s=(0,I.jsx)(Ze.Z,{count:this.state.errorObj.length,children:(0,I.jsx)(Ze.Z,{color:"green",count:this.state.warnings.length,children:(0,I.jsx)(je,{icon:De.Z,tooltip:"Debug info",onClick:this.handleDebugButtonClick})})});this.props.showServerSelectionButton&&(o=(0,I.jsx)(je,{icon:Pt.Z,tooltip:"Select server",onClick:this.handleServerSelectionButtonClick}));var l=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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(v.Z.Header,{style:{width:"100%",padding:"0 14px"},children:(0,I.jsxs)(ce.Z,{children:[(0,I.jsx)(be.Z,{children:(0,I.jsx)(re.Z,{align:"center",direction:"horizontal",children:(0,I.jsx)("img",{src:"https://imagingdatacommons.github.io/slim/logo.svg",alt:"",style:{height:"64px",margin:"-14px"}})})}),(0,I.jsx)(be.Z,{flex:"auto"}),(0,I.jsx)(be.Z,{children:(0,I.jsxs)(re.Z,{direction:"horizontal",children:[e,r,s,o,n]})})]})}),(0,I.jsx)(ue.Z,{visible:this.state.isServerSelectionModalVisible,title:"Select DICOMweb server",onOk:l,onCancel:function(){t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0})},children:(0,I.jsx)(Rt.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:l,addonAfter:this.state.isServerSelectionDisabled?(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}})})})]})}}]),n}(d.Component));var Ut=n(7063);const Tt=function(e){var t=e.title,n=e.message;return(0,I.jsx)("div",{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,I.jsx)(Ut.ZP,{title:t,subTitle:n})})};var kt=n(6019),Lt=n(1730);const _t=it(function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,o.Z)(this,n),(i=t.call(this,e)).defaultPageSize=20,i.handleSearch=function(e,t,n){t()},i.handleReset=function(e){e()},i.getColumnSearchProps=function(e){return{filterDropdown:function(t){var n=t.setSelectedKeys,a=t.selectedKeys,o=t.confirm,r=t.clearFilters;return(0,I.jsxs)("div",{style:{padding:8},children:[(0,I.jsx)(Rt.Z,{placeholder:"Search",value:a[0],onChange:function(e){return n(void 0!==e.target.value?[e.target.value]:[])},onPressEnter:function(){return i.handleSearch(a,o,e)},style:{width:188,marginBottom:8,display:"block"}}),(0,I.jsxs)(re.Z,{children:[(0,I.jsx)(le.Z,{type:"primary",onClick:function(){return i.handleSearch(a,o,e)},icon:(0,I.jsx)(Lt.Z,{}),size:"small",style:{width:90},children:"Search"}),(0,I.jsx)(le.Z,{onClick:function(){return i.handleReset(r)},size:"small",style:{width:90},children:"Reset"})]})]})},filterIcon:function(e){return(0,I.jsx)(Lt.Z,{style:{color:e?"#1890ff":void 0}})}}},i.fetchData=i.fetchData.bind((0,s.Z)(i)),i.handleClick=i.handleClick.bind((0,s.Z)(i)),i.handleChange=i.handleChange.bind((0,s.Z)(i)),i.state={studies:[],isLoading:!1,numStudies:0,pageSize:i.defaultPageSize},i}return(0,r.Z)(n,[{key:"searchForStudies",value:function(){var e=this,t={queryParams:{ModalitiesInStudy:"SM"}};this.props.clients[M.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 g.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),$.onError(B,new q(_,"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[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(l).then((function(e){t.setState({studies:e.map((function(e){return g.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),$.onError(B,new q(_,"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,P.Z)({title:"Accession Number",dataIndex:"AccessionNumber"},this.getColumnSearchProps("AccessionNumber")),(0,P.Z)({title:"Study ID",dataIndex:"StudyID"},this.getColumnSearchProps("StudyID")),{title:"Study Date",dataIndex:"StudyDate",render:function(e){return D(e)}},{title:"Study Time",dataIndex:"StudyTime",render:function(e){return V(e)}},(0,P.Z)({title:"Patient ID",dataIndex:"PatientID"},this.getColumnSearchProps("PatientID")),(0,P.Z)({title:"Patient's Name",dataIndex:"PatientName",render:function(e){return Z(e)}},this.getColumnSearchProps("PatientName")),{title:"Patient's Sex",dataIndex:"PatientSex",render:function(e){return R(e)}},{title:"Patient's Birthdate",dataIndex:"PatientBirthDate",render:function(e){return D(e)}},{title:"Referring Physician's Name",dataIndex:"ReferringPhysicianName",render:function(e){return Z(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,I.jsx)(kt.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}(d.Component));var Nt=n(5685),Gt=function(e,t){var n=t;return n.endsWith("/")||(n+="/"),new URL(e,n).toString()},qt=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"))},Ft=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};$.onError(X,new q(L,'Failed to obtain user "name" and "email".'))}else $.onError(X,new q(L,"Failed to obtain user profile."));return{name:void 0,email:void 0}},zt=(0,r.Z)((function e(t,n){var r=this;(0,o.Z)(this,e),this._oidc=void 0,this.signIn=function(){var e=(0,a.Z)((0,i.Z)().mark((function e(t){var n,a,o,s;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.onSignIn,a=function(e){var t=Ft(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")},!qt(window.location)){e.next=10;break}return console.info("obtaining authorization"),e.next=6,r._oidc.signinCallback();case 6:null!=(o=e.sent)&&(console.info("obtained user data: ",o),a(o)),e.next=21;break;case 10:return e.next=12,r._oidc.getUser();case 12:if(null!==(s=e.sent)&&!s.expired){e.next=19;break}return console.info("authenticating user"),e.next=17,r._oidc.signinRedirect();case 17:e.next=21;break;case 19:console.info("user has already been authenticated"),a(s);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.signOut=(0,a.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("signing out user and revoking authorization"),e.next=3,r._oidc.signoutRedirect();case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),this.getAuthorization=(0,a.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r._oidc.getUser().then((function(e){if(null!==e)return e.access_token;$.onError(X,new q(L,"Failed to obtain user profile."))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.getUser=(0,a.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r._oidc.getUser().then((function(e){return null===e&&$.onError(X,new q(L,"Failed to obtain user information.")),Ft(e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));var s="code";void 0!==n.grantType&&"implicit"===n.grantType&&(s="id_token token"),this._oidc=new Nt.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:s,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,r._oidc=new Nt.UserManager({authority:n.authority,client_id:n.clientId,redirect_uri:t,scope:n.scope,response_type:s,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)}))})),Bt=n(7659),Wt=n(9158);const Yt=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=Wt.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&&$.onError(H,new q(_,"Only one store is supported for now."))}return(0,r.Z)(e,[{key:"baseURL",get:function(){return this.stores[0].client.baseURL}},{key:"headers",get:function(){return this.stores[0].client.headers}}]),e}();function Xt(e){var t,n,i=e.clients,a=e.user,o=e.app,r=e.config,s=(0,u.UO)().studyInstanceUID,l=!(null!==(t=r.disableAnnotationTools)&&void 0!==t&&t),c=null!==(n=r.preload)&&void 0!==n&&n;return(0,I.jsx)(Zt,{clients:i,user:a,annotations:r.annotations,preload:c,app:o,enableAnnotationTools:l,studyInstanceUID:s})}function Kt(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(M).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 Ht({baseUri:t,settings:[e],onError:a})}})),o.default>1&&$.onError(H,new q(_,"Only one default server can be configured without specification of storage classes.")),o)"default"!==s&&o[s]>1&&$.onError(H,new q(_,"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 Ht({baseUri:t,settings:[e],onError:a});null!=e.storageClasses&&e.storageClasses.forEach((function(e){r[e]=n}))})),Object.values(M).forEach((function(e){e in r||(r[e]=r.default)})),r}const Jt=function(e){(0,l.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i,a;(0,o.Z)(this,n),(a=t.call(this,e)).auth=void 0,a.memoryMonitoringIntervalId=void 0,a.handleDICOMwebError=function(e,t){401===e.status?a.signIn():403===e.status&&$.onError(B,new q(_,"User is not authorized to access DICOMweb resources."));var n=function(){$.onError(B,new q(_,"An unexpected server error occured."))};void 0!==t.errorMessages?t.errorMessages.forEach((function(t){e.status===t.status?a.setState({error:{status:e.status,message:t.message}}):500===e.status&&n()})):500===e.status&&n()},a.handleSignIn=function(e){var t=e.user,n=e.authorization;for(var i in a.state.clients){a.state.clients[i].updateHeaders({Authorization:n})}var o=window.localStorage.getItem("slim_path"),r=window.localStorage.getItem("slim_search");if(null!=o&&o!==window.location.pathname){var s=o;null!=r&&(s+=r),window.location.href=s}window.localStorage.removeItem("slim_path"),window.localStorage.removeItem("slim_search"),a.setState({user:t})},console.info("instatiate app"),console.info('app is located at "'.concat(e.config.path,'"'));var r=window.location,l=r.protocol,c=r.host,d="".concat(l,"//").concat(c),u=Gt(e.config.path,d),h=e.config.oidc;return void 0!==h&&(console.info("app uses the following OIDC configuration: ",e.config.oidc),a.auth=new zt(u,h)),0===e.config.servers.length&&$.onError(H,new q(_,"One server needs to be configured.")),console.info("app uses the following DICOMweb server configuration: ",e.config.servers),a.handleServerSelection=a.handleServerSelection.bind((0,s.Z)(a)),p.ZP.config({duration:5}),a.addGcpSecondaryAnnotationServer(e.config),a.state={clients:Kt({baseUri:d,gcpBaseUrl:null!==(i=e.config.gcpBaseUrl)&&void 0!==i?i:"https://healthcare.googleapis.com/v1",settings:e.config.servers,onError:a.handleDICOMwebError}),isLoading:!0,wasAuthSuccessful:!1},a}return(0,r.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:[M.COMPREHENSIVE_SR,M.COMPREHENSIVE_3D_SR,M.SEGMENTATION,M.MICROSCOPY_BULK_SIMPLE_ANNOTATION,M.PARAMETRIC_MAP,M.ADVANCED_BLENDING_PRESENTATION_STATE,M.COLOR_SOFTCOPY_PRESENTATION_STATE,M.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,M.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE]})}},{key:"handleServerSelection",value:function(e){var t=e.url;console.info("select DICOMweb server: ",t);var n=new Ht({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),$.onError(X,new q(L,"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(),this.memoryMonitoringIntervalId=setInterval((0,a.Z)((0,i.Z)().mark((function e(){var t,n,a,o,r,s,l;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l=Math.round(((null===(t=performance)||void 0===t||null===(n=t.memory)||void 0===n?void 0:n.totalJSHeapSize)-(null===(a=performance)||void 0===a||null===(o=a.memory)||void 0===o?void 0:o.usedJSHeapSize))/1024/1024),console.log("Estimate of memory available:","".concat(l," MB")),console.log("Estimate of memory usage:","".concat(Math.round((null===(r=performance)||void 0===r||null===(s=r.memory)||void 0===s?void 0:s.usedJSHeapSize)/1024/1024)," MB"));case 3:case"end":return e.stop()}}),e)}))),2e3)}},{key:"componentWillUnmount",value:function(){clearInterval(this.memoryMonitoringIntervalId)}},{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,I.jsx)(_t,{clients:this.state.clients}):(0,I.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 c={height:"100vh"},d={height:"100%"};return void 0!==this.state.redirectTo?(0,I.jsx)(h.VK,{basename:this.props.config.path,children:(0,I.jsx)(u.Fg,{to:this.state.redirectTo,replace:!0})}):this.state.isLoading?(0,I.jsx)(h.VK,{basename:this.props.config.path,children:(0,I.jsxs)(v.Z,{style:c,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,showServerSelectionButton:!1}),(0,I.jsx)(v.Z.Content,{style:d,children:(0,I.jsx)(m.fCD,{})})]})}):this.state.wasAuthSuccessful?null!=this.state.error?(0,I.jsx)(Tt,{type:"error",message:this.state.error.message}):(0,I.jsx)(h.VK,{basename:this.props.config.path,children:(0,I.jsxs)(u.Z5,{children:[(0,I.jsx)(u.AW,{path:"/",element:(0,I.jsxs)(v.Z,{style:c,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(v.Z.Content,{style:d,children:n})]})}),(0,I.jsx)(u.AW,{path:"/studies/:studyInstanceUID/*",element:(0,I.jsxs)(v.Z,{style:c,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(v.Z.Content,{style:d,children:(0,I.jsx)(Xt,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,I.jsx)(u.AW,{path:"/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:studyInstanceUID/*",element:(0,I.jsxs)(v.Z,{style:c,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(v.Z.Content,{style:d,children:(0,I.jsx)(Xt,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,I.jsx)(u.AW,{path:"/logout",element:(0,I.jsxs)(v.Z,{style:c,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),"Logged out"]})})]})}):(0,I.jsx)(Tt,{type:"error",message:"Sign-in failed."})}}]),n}(d.Component)}}]); -//# sourceMappingURL=315.d56edf4f.chunk.js.map \ No newline at end of file +"use strict";(self.webpackChunkslim=self.webpackChunkslim||[]).push([[315],{2315:(e,t,n)=>{n.d(t,{Z:()=>Jt});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(4165),m=n(5861),f=n(6014),g=n(6658),y=n(4261),S=n(394),C=n(4970),I=n(184),b=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,y.Z)();return(0,I.jsx)(S.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,I.jsx)(this.props.icon,{})),(0,I.jsxs)(C.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,I.jsx)(S.Z,{column:1,size:"small",layout:e,bordered:!1,children:n}),this.props.children]})}}]),n}(l.Component);const w=b;const x=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,I.jsx)(w,{attributes:e})}}]),n}(l.Component);function Z(e){return"object"===typeof e&&null!==e&&void 0!==e&&void 0!==e.Alphabetic?e.Alphabetic.split("^").join(" "):""}function D(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 V(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 R(e){return null!==e&&void 0!==e?{F:"Female",M:"Male",O:"Other"}[e]:""}const O=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:Z(this.props.metadata.PatientName)},{name:"Gender",value:R(this.props.metadata.PatientSex)},{name:"Birthdate",value:D(this.props.metadata.PatientBirthDate)}];return(0,I.jsx)(w,{attributes:e})}}]),n}(l.Component);const j=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:D(this.props.metadata.StudyDate)},{name:"Time",value:V(this.props.metadata.StudyTime)}];return(0,I.jsx)(w,{attributes:e})}}]),n}(l.Component);var M,P=n(1413);!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"}(M||(M={}));var E=Symbol("subscriptions"),A=Symbol("lastSubscriptionId"),U=function(){function e(){(0,i.Z)(this,e),this[E]={},this[A]=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[E].hasOwnProperty(e)||(this[E][e]={});var n="sub".concat(this[A]++);this[E][e][n]=t}},{key:"unsubscribe",value:function(e,t){var n=this[E][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[E][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 g.viewer.OverviewImageViewer({client:this.props.clients[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:e,resizeFactor:1,errorInterceptor:function(e){$.onError(W,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,I.jsx)(p.fCD,{}):(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%"}},this.props),{},{children:(0,I.jsx)(w,{header:this.props.slide.containerIdentifier,attributes:e,selectable:!0,children:(0,I.jsx)("div",{style:{height:"100px"},ref:this.overviewViewportRef})})}),this.props.slide.seriesInstanceUIDs[0])}}]),n}(l.Component);const te=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,I.jsx)(p.dSq,{}),unCheckedChildren:(0,I.jsx)(p.tgn,{})})}),(0,I.jsx)(f.Z,{selectedKeys:(0,ie.Z)(this.props.selectedRoiUIDs.values()),onSelect:this.handleMenuItemSelection,onClick:this.handleMenuItemSelection,children:t})]})}}]),n}(l.Component);var be=n(914),we=n(6272),xe=n(3020),Ze=n(5594),De=n(2414),Ve=["annotationGroup","defaultStyle","isVisible","metadata","onVisibilityChange","onStyleChange"];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)).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 fe.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,I.jsx)(ae.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,I.jsx)(ae.Z.Option,{value:void 0,dropdownMatchSelectWidth:!1,size:"small",disabled:!this.props.isVisible},"-")),null!=this.state.currentStyle.color&&(t=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,I.jsx)(de.Z,{plain:!0})]})),l.length>0){if(null!=this.state.currentStyle.limitValues){n=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Values of interest"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!0,min:0,max:1e3,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Exploration"}),(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:8,children:"Measurement"}),(0,I.jsx)(be.Z,{span:16,children:(0,I.jsx)(ae.Z,{style:{minWidth:"65px",width:"90%"},onSelect:this.handleMeasurementSelection,defaultValue:void 0,children:c},"annotation-group-measurements")})]})]})}var d=(0,I.jsxs)("div",{children:[t,n,(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,v=this.props,m=(v.annotationGroup,v.defaultStyle,v.isVisible,v.metadata,v.onVisibilityChange,v.onStyleChange,(0,ye.Z)(v,Ve));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},m),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(p.dSq,{}),unCheckedChildren:(0,I.jsx)(p.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:d,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})}),(0,I.jsx)(Ze.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,I.jsx)(w,{header:this.props.annotationGroup.label,attributes:s,selectable:!0,hasLongValues:!0})})]})}),this.props.annotationGroup.uid)}}]),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(){var e=this,t=this.props.annotationGroups.map((function(t,n){var i=t.uid;return(0,I.jsx)(Re,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(l.Component);const je=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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{type:"vertical"}),this.props.label]})),n=null!==(e=this.props.isSelected)&&void 0!==e&&e?(0,I.jsx)(le.Z,{onClick:this.handleClick,icon:(0,I.jsx)(i,{}),type:"primary",style:{lineHeight:"1.0"},children:t}):(0,I.jsx)(le.Z,{onClick:this.handleClick,icon:(0,I.jsx)(i,{}),type:"default",style:{lineHeight:"1.0"},children:t}),void 0!==this.props.tooltip?(0,I.jsx)(se.Z,{title:this.props.tooltip,children:n}):n)}}]),n}(l.Component);const Me=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,I.jsx)(w,{attributes:e,hasLongValues:!0})}}]),n}(l.Component);var Pe=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},Ee=function(e,t){return e.ValueType===t},Ae=function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});1!==t.length&&$.onError(H,new q(N,'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=Pe({content:n.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=[];return i.forEach((function(e){var t,n=[],i=e,o=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"112040",schemeDesignator:"DCM",meaning:"Tracking Unique Identifier"})});0===o.length&&$.onError(H,new q(N,'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=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121071",schemeDesignator:"DCM",meaning:"Finding"})})).length&&$.onError(H,new q(N,'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=Pe({content:i.ContentSequence,name:new fe.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=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111003",schemeDesignator:"DCM",meaning:"Algorithm Version"})})).length){var l=o[0];n.push(l)}0===(o=Pe({content:i.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})})).length&&$.onError(H,new q(N,'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 g.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,ie.Z)(function(e){var t=e.content,n=[];return t.forEach((function(e){if(Ee(e,fe.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(Ee(e,fe.sr.valueTypes.ValueTypes.NUM)){var t=e;n.push(t)}})),n}({content:i.ContentSequence}),v=new g.roi.ROI({scoord3d:c,uid:(0,y.Z)(),properties:{trackingUID:r.UID,observerType:t,evaluations:n,measurements:p}});a.push(v)})),a},Ue=(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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121039",schemeDesignator:"DCM",meaning:"Specimen UID"})});0===n.length&&$.onError(H,new q(N,'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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen Identifier"})})).length&&$.onError(H,new q(N,'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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111700",schemeDesignator:"DCM",meaning:"Specimen Container Identifier"})})).length&&$.onError(H,new q(N,'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=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121008",schemeDesignator:"DCM",meaning:"Person Observer Name"})})).length){var s=n[0];this.PersonObserverName=s.PersonName}if(0!==(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"128774",schemeDesignator:"DCM",meaning:"Person Observer's Login Name"})})).length){var l=n[0];this.PersonObserverLoginName=l.TextValue}if((n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121012",schemeDesignator:"DCM",meaning:"Device Observer UID"})})).length>0){var c=n[0];this.DeviceObserverUID=c.UID}if(0!==(n=Pe({content:t.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121013",schemeDesignator:"DCM",meaning:"Device Observer Name"})})).length){var d=n[0];this.DeviceObserverName=d.TextValue}this.ROIs=Ae(t)}));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=new Ue(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===fe.sr.valueTypes.ValueTypes.CODE?i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.ConceptCodeSequence[0].CodeMeaning}):e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&i.push({name:e.ConceptNameCodeSequence[0].CodeMeaning,value:e.TextValue})})),(0,I.jsx)(w,{header:n,attributes:i},e.uid)}));return(0,I.jsxs)("div",{children:[(0,I.jsx)(de.Z,{orientation:"left",children:"Patient"}),(0,I.jsx)(O,{metadata:this.props.dataset}),(0,I.jsx)(de.Z,{orientation:"left",children:"Case"}),(0,I.jsx)(j,{metadata:this.props.dataset}),(0,I.jsx)(de.Z,{orientation:"left",children:"Slide"}),(0,I.jsx)(w,{attributes:t}),(0,I.jsx)(de.Z,{orientation:"left",children:"Specimen"}),(0,I.jsx)(w,{attributes:n}),(0,I.jsx)(de.Z,{orientation:"left",children:"Observer"}),(0,I.jsx)(w,{attributes:i}),(0,I.jsx)(de.Z,{orientation:"left",children:"Annotations"}),a]})}}]),n}(l.Component);var ke=n(2126);const Le=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,I.jsx)(w,{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,I.jsxs)(ke.ZP.Item,{children:[(0,I.jsx)(w,{header:e,attributes:this.props.attributes,hasLongValues:this.props.hasLongValues,children:t}),this.props.children]},this.props.uid)}}]),n}(l.Component);new fe.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),new fe.sr.coding.CodedConcept({value:"433465004",schemeDesignator:"SCT",meaning:"Sampling of tissue specimen"}),new fe.sr.coding.CodedConcept({value:"127790008",schemeDesignator:"SCT",meaning:"Specimen staining"}),new fe.sr.coding.CodedConcept({value:"9265001",schemeDesignator:"SCT",meaning:"Specimen processing"});var _e={FIXATIVE:new fe.sr.coding.CodedConcept({value:"430864009",schemeDesignator:"SCT",meaning:"Tissue fixative"}),EMBEDDING_MEDIUM:new fe.sr.coding.CodedConcept({value:"430863003",schemeDesignator:"SCT",meaning:"Embedding medium"})},Ne=(0,P.Z)({SPECIMEN_IDENTIFIER:new fe.sr.coding.CodedConcept({value:"121041",schemeDesignator:"DCM",meaning:"Specimen identifier"}),PARENT_SPECIMEN_IDENTIFIER:new fe.sr.coding.CodedConcept({value:"111705",schemeDesignator:"DCM",meaning:"Parent specimen identifier"}),PROCESSING_TYPE:new fe.sr.coding.CodedConcept({value:"111701",schemeDesignator:"DCM",meaning:"Processing type"}),DATETIME_OF_PROCESSING:new fe.sr.coding.CodedConcept({value:"111702",schemeDesignator:"DCM",meaning:"Datetime of processing"}),PROCESSING_STEP_DESCRIPTION:new fe.sr.coding.CodedConcept({value:"111703",schemeDesignator:"DCM",meaning:"Processing step description"}),COLLECTION_METHOD:new fe.sr.coding.CodedConcept({value:"17636008",schemeDesignator:"SCT",meaning:"Specimen collection"}),SAMPLING_METHOD:new fe.sr.coding.CodedConcept({value:"111704",schemeDesignator:"DCM",meaning:"Sampling method"}),STAIN:new fe.sr.coding.CodedConcept({value:"424361007",schemeDesignator:"SCT",meaning:"Using substance"})},_e);const Ge=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 fe.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===fe.sr.valueTypes.ValueTypes.CODE){var o=new fe.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});a.equals(Ne.PROCESSING_TYPE)||(a.equals(Ne.COLLECTION_METHOD)?i.push({name:"Collection method",value:o.CodeMeaning}):a.equals(Ne.FIXATIVE)?i.push({name:"Tissue fixative",value:o.CodeMeaning}):a.equals(Ne.EMBEDDING_MEDIUM)?i.push({name:"Tissue embedding medium",value:o.CodeMeaning}):a.equals(Ne.STAIN)&&t.props.showstain&&i.push({name:"Tissue stain",value:o.CodeMeaning}))}else e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&(a.equals(Ne.STAIN)&&t.props.showstain?i.push({name:"Tissue stain",value:e.TextValue}):a.equals(Ne.PARENT_SPECIMEN_IDENTIFIER)&&i.push({name:"Parent specimen",value:e.TextValue}))}))}));var o=n.SpecimenUID,r=n.SpecimenIdentifier;return(0,I.jsx)(Le,{uid:o,identifier:r,attributes:i,hasLongValues:!0},o)}}]),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,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,I.jsx)(Ge,{index:n,metadata:t.props.metadata,showstain:t.props.showstain},e.SpecimenUID)}));return(0,I.jsx)(ke.ZP,{style:{overflowY:"auto"},children:n})}}]),n}(l.Component);var Fe=n(681),ze=n(2622),Be=n(4215),We=n(8272),Ye=["defaultStyle","isRemovable","isVisible","metadata","onVisibilityChange","onStyleChange","onRemoval","opticalPath"];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)).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 fe.sr.coding.CodedConcept({value:e.ConceptNameCodeSequence[0].CodeValue,schemeDesignator:e.ConceptNameCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptNameCodeSequence[0].CodeMeaning});if(e.ValueType===fe.sr.valueTypes.ValueTypes.CODE){var a=new fe.sr.coding.CodedConcept({value:e.ConceptCodeSequence[0].CodeValue,schemeDesignator:e.ConceptCodeSequence[0].CodingSchemeDesignator,meaning:e.ConceptCodeSequence[0].CodeMeaning});n.equals(Ne.PROCESSING_TYPE)||n.equals(Ne.STAIN)&&i.push({name:"Tissue stain",value:a.CodeMeaning})}else e.ValueType===fe.sr.valueTypes.ValueTypes.TEXT&&(n.equals(Ne.PROCESSING_TYPE)||n.equals(Ne.STAIN)&&i.push({name:"Tissue stain",value:e.TextValue}))}))}))}))}catch(m){$.onError(Y,new q(N,m.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Values of interest"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:this.state.currentStyle.limitValues[1],size:"small",style:{width:"75px"},value:this.state.currentStyle.limitValues[0],onChange:this.handleLowerLimitChange})}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!0,min:0,max:s,step:1,value:[this.state.currentStyle.limitValues[0],this.state.currentStyle.limitValues[1]],onChange:this.handleLimitChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsxs)("div",{children:[d,c,(0,I.jsx)(de.Z,{plain:!0}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,I.jsx)(Ze.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,I.jsx)(w,{header:l,attributes:i,selectable:!0,hasLongValues:!0})})}else o=(0,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:1,size:"small",step:.1,style:{width:"60px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})}),r=(0,I.jsx)(w,{header:l,attributes:i,selectable:!0,hasLongValues:!0});var h=[];this.props.isRemovable&&h.push((0,I.jsx)(se.Z,{title:"Remove Optical Path",children:(0,I.jsx)(le.Z,{type:"default",shape:"circle",icon:(0,I.jsx)(ze.Z,{}),onClick:this.handleRemoval})}));var p=this.props,v=(p.defaultStyle,p.isRemovable,p.isVisible,p.metadata,p.onVisibilityChange,p.onStyleChange,p.onRemoval,p.opticalPath,(0,ye.Z)(p,Ye));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},v),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",checked:this.state.isVisible,onChange:this.handleVisibilityChange,checkedChildren:(0,I.jsx)(Be.Z,{}),unCheckedChildren:(0,I.jsx)(We.Z,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:o,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})}),h]})}),r]})}),this.props.opticalPath.identifier)}}]),n}(l.Component);var Xe=ae.Z.Option;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)).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,I.jsx)(He,{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,I.jsx)(Xe,{value:c,children:l},c))))}))})),n&&(t=(0,I.jsxs)(re.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,I.jsx)(ae.Z,{defaultValue:"",style:{width:200},onChange:this.handleItemSelectionChange,value:this.state.selectedOpticalPathIdentifier,allowClear:!0,children:a}),(0,I.jsx)(se.Z,{title:"Add",children:(0,I.jsx)(le.Z,{icon:(0,I.jsx)(Fe.Z,{}),type:"primary",onClick:this.handleItemAddition})})]})),(0,I.jsxs)(f.Z,{selectable:!1,children:[i,t]})}}]),n}(l.Component);var Je=["defaultStyle","isVisible","mapping","metadata","onVisibilityChange","onStyleChange"];const Qe=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,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,ye.Z)(n,Je));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsx)(re.Z,{direction:"vertical",align:"end",size:100,children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(p.dSq,{}),unCheckedChildren:(0,I.jsx)(p.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})})}),(0,I.jsx)(w,{header:this.props.mapping.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.mapping.uid)}}]),n}(l.Component);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=this,t=this.props.mappings.map((function(t,n){var i=t.uid;return(0,I.jsx)(Qe,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(l.Component);var et=["defaultStyle","isVisible","segment","metadata","onVisibilityChange","onStyleChange"];const 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)).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,I.jsx)("div",{children:(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.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,ye.Z)(n,et));return(0,I.jsx)(f.Z.Item,(0,P.Z)((0,P.Z)({style:{height:"100%",paddingLeft:"3px"}},i),{},{children:(0,I.jsxs)(re.Z,{align:"start",children:[(0,I.jsx)("div",{style:{paddingLeft:"14px"},children:(0,I.jsxs)(re.Z,{direction:"vertical",align:"end",children:[(0,I.jsx)(ge.Z,{size:"small",onChange:this.handleVisibilityChange,checked:this.props.isVisible,checkedChildren:(0,I.jsx)(p.dSq,{}),unCheckedChildren:(0,I.jsx)(p.tgn,{})}),(0,I.jsx)(xe.Z,{placement:"left",content:t,overlayStyle:{width:"350px"},title:"Display Settings",children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",icon:(0,I.jsx)(De.Z,{})})})]})}),(0,I.jsx)(w,{header:this.props.segment.label,attributes:e,selectable:!0,hasLongValues:!0})]})}),this.props.segment.uid)}}]),n}(l.Component);const nt=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,I.jsx)(tt,{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,I.jsx)(f.Z,{selectable:!1,children:t})}}]),n}(l.Component);function it(e){return function(t){var n=(0,c.TH)(),i=(0,c.s0)(),a=(0,c.UO)();return(0,I.jsx)(e,(0,P.Z)((0,P.Z)({},t),{},{location:n,navigate:i,params:a}))}}var at=n(4942);const ot=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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{plain:!0,children:"Color"}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Red"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[0],onChange:this.handleColorRChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Green"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[1],onChange:this.handleColorGChange})})]}),(0,I.jsxs)(ce.Z,{justify:"center",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:5,children:"Blue"}),(0,I.jsx)(be.Z,{span:14,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:255,step:1,value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})}),(0,I.jsx)(be.Z,{span:5,children:(0,I.jsx)(he.Z,{min:0,max:255,size:"small",style:{width:"65px"},value:this.state.currentStyle.color[2],onChange:this.handleColorBChange})})]}),(0,I.jsx)(de.Z,{plain:!0})]})),(0,I.jsxs)("div",{children:[e,(0,I.jsxs)(ce.Z,{justify:"start",align:"middle",gutter:[8,8],children:[(0,I.jsx)(be.Z,{span:6,children:"Opacity"}),(0,I.jsx)(be.Z,{span:12,children:(0,I.jsx)(we.Z,{range:!1,min:0,max:1,step:.01,value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})}),(0,I.jsx)(be.Z,{span:6,children:(0,I.jsx)(he.Z,{min:0,max:1,size:"small",step:.1,style:{width:"65px"},value:this.state.currentStyle.opacity,onChange:this.handleOpacityChange})})]})]})}}]),n}(l.Component);const rt=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,I.jsx)(f.Z.Item,{style:{height:"100%",paddingLeft:"3px"},children:(0,I.jsx)(re.Z,{align:"start",children:(0,I.jsxs)("div",{style:{paddingLeft:"14px",color:"black"},children:[(0,I.jsx)(re.Z,{direction:"vertical",align:"end",children:(0,I.jsxs)(oe.Z,{indeterminate:l,checked:s,onChange:function(e){var t=e.target.checked;r.forEach((function(e){c({type:e,isVisible:t})}))},children:[(0,I.jsx)(se.Z,{title:"".concat(t.CodeValue,":").concat(t.CodingSchemeDesignator),mouseEnterDelay:1,children:t.CodeMeaning}),(0,I.jsx)(xe.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,I.jsx)(ot,{annotationGroupsUIDs:r.reduce((function(e,t){return[].concat((0,ie.Z)(e),(0,ie.Z)(t.uids))}),[]),onStyleChange:a,defaultStyle:o[r[0].uids[0]]})},children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,I.jsx)(De.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,I.jsxs)("div",{style:{paddingLeft:"25px",width:"100%",display:"flex",flexDirection:"row"},children:[(0,I.jsx)(oe.Z,{indeterminate:h,checked:u,onChange:function(t){return c({type:e,isVisible:t.target.checked})}}),(0,I.jsxs)("div",{style:{paddingLeft:"5px"},children:[(0,I.jsx)(se.Z,{title:"".concat(r,":").concat(n),mouseEnterDelay:1,children:d}),(0,I.jsx)(xe.Z,{placement:"topLeft",overlayStyle:{width:"350px"},title:"Display Settings",content:function(){return(0,I.jsx)(ot,{annotationGroupsUIDs:e.uids,onStyleChange:a,defaultStyle:o[e.uids[0]]})},children:(0,I.jsx)(le.Z,{type:"primary",shape:"circle",style:{marginLeft:"10px"},icon:(0,I.jsx)(De.Z,{})})})]})]},"".concat(e.CodingSchemeDesignator,":").concat(e.CodeMeaning))}))]})})},t.CodeMeaning)};const st=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,P.Z)((0,P.Z)({},a),{},{types:{}}),d=null!==(i=c.types[l])&&void 0!==i?i:(0,P.Z)((0,P.Z)({},o),{},{uids:[]});return(0,P.Z)((0,P.Z)({},e),{},(0,at.Z)({},s,(0,P.Z)((0,P.Z)({},c),{},{types:(0,P.Z)((0,P.Z)({},c.types),{},(0,at.Z)({},l,(0,P.Z)((0,P.Z)({},d),{},{uids:[].concat((0,ie.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,I.jsx)(I.Fragment,{});var s=Object.keys(r).map((function(e){var t=r[e];return(0,I.jsx)(rt,{category:t,onChange:n,onStyleChange:i,defaultAnnotationStyles:a,checkedAnnotationUids:o},t.CodeMeaning)}));return(0,I.jsx)(f.Z,{selectable:!1,children:s})};const lt=function(e){var t=e.xPosition,n=e.yPosition,i=e.attributes;return(0,I.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,I.jsxs)("div",{children:[e.name,": ",(0,I.jsx)("span",{style:{fontWeight:500},children:e.value})]},e.name)}))})};var ct=[255,234,0],dt=[255,234,0,.2],ut=[0,0,0],ht=[[54,162,235],[181,65,98],[75,192,192],[255,158,64],[153,102,254],[255,205,86],[200,203,207]],pt=function(e){var t=e.CodingSchemeDesignator,n=e.CodeValue;return"".concat(t,"-").concat(n)},vt=function(e){var t=Pe({content:e.evaluations,name:new fe.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"})});if(0!==t.length){var n=t[0].ConceptCodeSequence[0];return pt(n)}console.warn("no finding found for ROI ".concat(e.uid))},mt=function(e){var t={color:ct,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:dt};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}}}},ft=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 g.viewer.VolumeImageViewer({clientMapping:t,metadata:n.volumeImages,controls:["overview","position"],preload:i,errorInterceptor:function(e){$.onError(W,e)}});return o.activateSelectInteraction({}),n.labelImages.length>0&&(console.info("instantiate viewer for LABEL image of slide "+'"'.concat(n.labelImages[0].ContainerIdentifier,'"')),a=new g.viewer.LabelImageViewer({client:t[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],metadata:n.labelImages[0],resizeFactor:1,orientation:"vertical",errorInterceptor:function(e){$.onError(W,e)}})),{volumeViewer:o,labelViewer:a}}catch(r){throw $.onError(H,new q(G,"Failed to instantiate viewer")),r}},gt=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:ct,width:2},fill:{color:dt},image:{circle:{fill:{color:ct},radius:5}}},a.roiStyles={},a.defaultAnnotationStyles={},a.selectionColor=[140,184,198],a.selectedRoiStyle={stroke:{color:[].concat((0,ie.Z)(a.selectionColor),[1]),width:3},fill:{color:[].concat((0,ie.Z)(a.selectionColor),[.2])},image:{circle:{radius:5,fill:{color:[].concat((0,ie.Z)(a.selectionColor),[1])}}}},a.loadPresentationStates=function(){console.info("search for Presentation State instances");var e=a.props.clients[M.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=g.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=fe.aT.DicomMessage.readFile(e),o=g.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){$.onError(H,new q(G,"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),$.onError(H,new q(G,"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 g.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[M.COMPREHENSIVE_3D_SR];e.searchForInstances({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"SR"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=g.metadata.formatMetadata(t).dataset;n.SOPClassUID===M.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=fe.aT.DicomMessage.readFile(e),n=g.metadata.formatMetadata(t.dict).dataset;(function(e){var t=e.ContentTemplateSequence;return t.length>0&&"1500"===t[0].TemplateIdentifier})(n)?!function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121024",schemeDesignator:"DCM",meaning:"Subject Class"})});if(0===t.length)return!1;var n=t[0].ConceptCodeSequence[0],i=new fe.sr.coding.CodedConcept({value:n.CodeValue,meaning:n.CodeMeaning,schemeDesignator:n.CodingSchemeDesignator}),a=new fe.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=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"126010",schemeDesignator:"DCM",meaning:"Imaging Measurements"})});if(0===t.length)return!1;var n=t[0],i=Pe({content:n.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"125007",schemeDesignator:"DCM",meaning:"Measurement Group"})}),a=!1;return i.forEach((function(e){var t=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"111030",schemeDesignator:"DCM",meaning:"Image Region"})});t.length>0&&t[0].ValueType===fe.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 Ue(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){$.onError(H,new q(G,"Segmentations cannot be displayed")),console.error("failed to add segments: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),$.onError(H,new q(G,"Retrieval of metadata of Segmentation instances failed."))}))}))})).catch((function(e){console.error(e),$.onError(H,new q(G,"Search for Segmentation instances failed."))}))},a.addParametricMaps=function(){console.info("search for Parametric Map instances");var e=a.props.clients[M.PARAMETRIC_MAP];e.searchForSeries({studyInstanceUID:a.props.studyInstanceUID,queryParams:{Modality:"OT"}}).then((function(t){null==t&&(t=[]),t.forEach((function(t){var n=g.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 g.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){$.onError(H,new q(G,"Parametric Map cannot be displayed")),console.error("failed to add mappings: ",n)}a.forceUpdate()}})).catch((function(e){console.error(e),$.onError(H,new q(G,"Retrieval of metadata of Parametric Map instances failed."))}))}))})).catch((function(e){console.error(e),$.onError(H,new q(G,"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 fe.sr.valueTypes.CodeContentItem({name:new fe.sr.coding.CodedConcept({value:"121071",meaning:"Finding",schemeDesignator:"DCM"}),value:n,relationshipType:"CONTAINS"});t.addEvaluation(o),i.forEach((function(e){var n=new fe.sr.valueTypes.CodeContentItem({name:e.name,value:e.value,relationshipType:"CONTAINS"});t.addEvaluation(n)}));var r=pt(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===fe.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===fe.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=vt(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;$.onError(H,new q(G,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===M.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&&$.onError(H,new q(G,"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 fe.sr.templates.PersonObserverIdentifyingAttributes({name:this.props.user.name,loginName:this.props.user.email}):(console.warn("no user information available"),a=new fe.sr.templates.PersonObserverIdentifyingAttributes({name:"ANONYMOUS"}));var r=new fe.sr.templates.ObservationContext({observerPersonContext:new fe.sr.templates.ObserverContext({observerType:new fe.sr.coding.CodedConcept({value:"121006",schemeDesignator:"DCM",meaning:"Person"}),observerIdentifyingAttributes:a}),observerDeviceContext:new fe.sr.templates.ObserverContext({observerType:new fe.sr.coding.CodedConcept({value:"121007",schemeDesignator:"DCM",meaning:"Device"}),observerIdentifyingAttributes:new fe.sr.templates.DeviceObserverIdentifyingAttributes({uid:this.props.app.uid,manufacturerName:"MGH Computational Pathology",modelName:this.props.app.name})}),subjectContext:new fe.sr.templates.SubjectContext({subjectClass:new fe.sr.coding.CodedConcept({value:"121027",schemeDesignator:"DCM",meaning:"Specimen"}),subjectClassSpecificContext:new fe.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,ie.Z)(this.volumeViewer.getAllROIs())),n.push.apply(n,(0,ie.Z)(this.volumeViewer.getAllSegments())),i.push.apply(i,(0,ie.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,ie.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===fe.sr.valueTypes.ValueTypes.CODE){var n=e.ConceptCodeSequence[0];"276214006"===t?i.category=(0,P.Z)({},n):"121071"===t&&(i.type=(0,P.Z)({},n))}})),(0,P.Z)((0,P.Z)({},i),{},{uid:t})}(e)})),u=["specimens","optical-paths","annotations","presentation-states"],v=this.state.generatedReport;void 0!==v&&(s=(0,I.jsx)(Te,{dataset:v})),t.length>0&&(c=(0,I.jsx)(Ie,{rois:t,selectedRoiUIDs:this.state.selectedRoiUIDs,visibleRoiUIDs:this.state.visibleRoiUIDs,onSelection:this.handleAnnotationSelection,onVisibilityChange:this.handleAnnotationVisibilityChange}));var m=this.findingOptions.map((function(e){return(0,I.jsx)(ae.Z.Option,{value:e.CodeValue,children:e.CodeMeaning},e.CodeValue)})),g={point:(0,I.jsx)(ae.Z.Option,{value:"point",children:"Point"},"point"),circle:(0,I.jsx)(ae.Z.Option,{value:"circle",children:"Circle"},"circle"),box:(0,I.jsx)(ae.Z.Option,{value:"box",children:"Box"},"box"),polygon:(0,I.jsx)(ae.Z.Option,{value:"polygon",children:"Polygon"},"polygon"),line:(0,I.jsx)(ae.Z.Option,{value:"line",children:"Line"},"line"),freehandpolygon:(0,I.jsx)(ae.Z.Option,{value:"freehandpolygon",children:"Polygon (freehand)"},"freehandpolygon"),freehandline:(0,I.jsx)(ae.Z.Option,{value:"freehandline",children:"Line (freehand)"},"freehandline")},y=[(0,I.jsx)(ae.Z,{style:{minWidth:130},onSelect:this.handleAnnotationFindingSelection,defaultActiveFirstOption:!0,children:m},"annotation-finding")],C=this.state.selectedFinding;if(void 0!==C){var b=pt(C);this.evaluationOptions[b].forEach((function(t){var n=t.values.map((function(e){return(0,I.jsx)(ae.Z.Option,{value:e.CodeValue,label:t.name,children:e.CodeMeaning},e.CodeValue)}));y.push((0,I.jsxs)(I.Fragment,{children:[t.name.CodeMeaning,(0,I.jsx)(ae.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 g[e]}));y.push((0,I.jsxs)(I.Fragment,{children:["ROI geometry type",(0,I.jsx)(ae.Z,{style:{minWidth:130},onSelect:this.handleAnnotationGeometryTypeSelection,children:w},"annotation-geometry-type")]})),y.push((0,I.jsx)(oe.Z,{onChange:this.handleAnnotationMeasurementActivation,children:"measure"},"annotation-measurement"))}var x=(0,I.jsx)(f.Z.SubMenu,{title:"Specimens",children:(0,I.jsx)(qe,{metadata:this.props.slide.volumeImages[0],showstain:!1})},"specimens"),Z=(0,I.jsx)(f.Z.SubMenu,{title:"Equipment",children:(0,I.jsx)(Me,{metadata:this.props.slide.volumeImages[0]})},"equipment"),D=this.volumeViewer.getAllOpticalPaths();D.sort((function(e,t){return 1===e.identifier.localeCompare(t.identifier)?1:1===t.identifier.localeCompare(e.identifier)?-1:0}));var V={},R={};D.forEach((function(t){var n=t.identifier,i=e.volumeViewer.getOpticalPathMetadata(n);R[n]=i;var a=(0,P.Z)({},e.volumeViewer.getOpticalPathStyle(n));V[n]=a}));var O,j,M,E,A,U=(0,I.jsx)(f.Z.SubMenu,{title:"Optical Paths",children:(0,I.jsx)(Ke,{metadata:R,opticalPaths:D,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,I.jsx)(ae.Z.Option,{value:e.SOPInstanceUID,dropdownMatchSelectWidth:!1,size:"small",children:e.ContentDescription},e.SOPInstanceUID))})),T.push((0,I.jsx)(ae.Z.Option,{value:null,dropdownMatchSelectWidth:!1,size:"small"},"default-presentation-state")),O=(0,I.jsx)(f.Z.SubMenu,{title:"Presentation States",children:(0,I.jsxs)(re.Z,{align:"center",size:20,style:{padding:"14px"},children:[(0,I.jsx)(ae.Z,{style:{minWidth:200,maxWidth:200},onSelect:this.handlePresentationStateSelection,value:this.state.selectedPresentationStateUID,children:T},"presentation-states"),(0,I.jsx)(se.Z,{title:"Reset",children:(0,I.jsx)(le.Z,{icon:(0,I.jsx)(pe.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)})),j=(0,I.jsx)(f.Z.SubMenu,{title:"Segmentations",children:(0,I.jsx)(nt,{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)})),M=(0,I.jsx)(f.Z.SubMenu,{title:"Parametric Maps",children:(0,I.jsx)($e,{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=vt(i),o=void 0!==e.roiStyles[a]?null===(n=e.roiStyles[a].stroke)||void 0===n?void 0:n.color.slice(0,3):ht[Object.keys(e.roiStyles).length%ht.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)})),E=(0,I.jsx)(f.Z.SubMenu,{title:"Annotation Groups",children:(0,I.jsx)(Oe,{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,I.jsx)(je,{tooltip:"Draw ROI [Alt+D]",icon:p.vuA,onClick:this.handleRoiDrawing,isSelected:this.state.isRoiDrawingActive},"draw-roi-button"),(0,I.jsx)(je,{tooltip:"Modify ROIs [Alt+M]",icon:p.eAi,onClick:this.handleRoiModification,isSelected:this.state.isRoiModificationActive},"modify-roi-button"),(0,I.jsx)(je,{tooltip:"Translate ROIs [Alt+T]",icon:p.Jd7,onClick:this.handleRoiTranslation,isSelected:this.state.isRoiTranslationActive},"translate-roi-button"),(0,I.jsx)(je,{tooltip:"Remove selected ROI [Alt+R]",onClick:this.handleRoiRemoval,icon:p.Xm5},"remove-roi-button"),(0,I.jsx)(je,{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,I.jsx)(je,{tooltip:"Save ROIs [Alt+S]",icon:p.TvB,onClick:this.handleReportGeneration},"generate-report-button")],W=[(0,I.jsx)(je,{tooltip:"Go to [Alt+G]",icon:p.Xe,onClick:this.handleGoTo},"go-to-slide-position-button")];this.props.enableAnnotationTools&&(A=(0,I.jsxs)(ce.Z,{justify:"start",children:[B.map((function(e,t){return(0,I.jsx)(l.Fragment,{children:e},t)})),W.map((function(e,t){return(0,I.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}],J=[];this.state.selectedRoi.evaluations.forEach((function(e){if("CODE"===e.ValueType){var t=e;J.push({name:t.ConceptNameCodeSequence[0].CodeMeaning,value:t.ConceptCodeSequence[0].CodeMeaning})}else{var n=e;J.push({name:n.ConceptNameCodeSequence[0].CodeMeaning,value:n.TextValue})}}));var Q={};this.state.selectedRoi.measurements.forEach((function(e){var t="default";if(null!=e.ContentSequence){var n=Pe({content:e.ContentSequence,name:new fe.sr.coding.CodedConcept({value:"121112",meaning:"Source of Measurement",schemeDesignator:"DCM"})});n.length>0&&(t=n[0].ReferencedSOPSequence[0].ReferencedOpticalPathIdentifier)}t in Q||(Q[t]=[]);var i=e.MeasuredValueSequence[0];Q[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,I.jsx)(S.Z.Item,{label:e.name,children:t},e.name)}))},ee=$(X),te=$(K),ne=$(J),ge=[];for(var ye in Q){var Se=$(Q[ye]);"default"===ye?ge.push(Se):ge.push((0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,dashed:!0,plain:!0,children:ye}),Se]}))}Y=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ee}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Spatial coordinates"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:te}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Evaluations"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ne}),(0,I.jsx)(de.Z,{orientation:"left",orientationMargin:0,children:"Measurements"}),(0,I.jsx)(S.Z,{layout:"horizontal",column:1,children:ge})]})}return(0,I.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,I.jsxs)(h.Z.Content,{style:{height:"100%"},children:[A,(0,I.jsx)("div",{style:{height:"calc(100% - ".concat(z,")"),overflow:"hidden",cursor:H},ref:this.volumeViewportRef}),(0,I.jsx)(ue.Z,{visible:this.state.isAnnotationModalVisible,title:"Configure annotations",onOk:this.handleAnnotationConfigurationCompletion,onCancel:this.handleAnnotationConfigurationCancellation,okText:"Select",children:(0,I.jsx)(re.Z,{align:"start",direction:"vertical",children:y})}),(0,I.jsx)(ue.Z,{visible:this.state.isSelectedRoiModalVisible,title:"Selected ROI",onCancel:this.handleRoiSelectionCancellation,maskClosable:!0,footer:null,children:(0,I.jsx)(re.Z,{align:"start",direction:"vertical",children:Y})}),(0,I.jsx)(ue.Z,{visible:this.state.isGoToModalVisible,title:"Go to slide position",onOk:this.handleSlidePositionSelection,onCancel:this.handleSlidePositionSelectionCancellation,okText:"Select",children:(0,I.jsxs)(re.Z,{align:"start",direction:"vertical",children:[(0,I.jsx)(he.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,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,I.jsx)(he.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,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})}),(0,I.jsx)(he.Z,{placeholder:"[0 - 40]",prefix:"Magnification",onChange:this.handleMagnificationSelection,onPressEnter:this.handleMagnificationSelection,controls:!1,addonAfter:this.state.isSelectedMagnificationValid?(0,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}})})]})}),(0,I.jsx)(ue.Z,{visible:this.state.isReportModalVisible,title:"Verify and save report",onOk:this.handleReportVerification,onCancel:this.handleReportCancellation,okText:"Save",children:s})]}),(0,I.jsx)(h.Z.Sider,{width:300,reverseArrow:!0,style:{borderLeft:"solid",borderLeftWidth:.25,overflow:"hidden",background:"none"},children:(0,I.jsxs)(f.Z,{mode:"inline",defaultOpenKeys:u,style:{height:"100%"},inlineIndent:14,forceSubMenuRender:!0,onOpenChange:function(){setTimeout((function(){null!=e.labelViewer&&e.labelViewer.resize()}),100)},children:[(0,I.jsx)(f.Z.SubMenu,{title:"Slide label",children:(0,I.jsx)(f.Z.Item,{style:{height:"100%"},children:(0,I.jsx)("div",{style:{height:"220px"},ref:this.labelViewportRef})},"image")},"label"),x,Z,U,O,(0,I.jsx)(f.Z.SubMenu,{title:"Annotations",children:c},"annotations"),E,0===d.length?(0,I.jsx)(I.Fragment,{}):(0,I.jsx)(f.Z.SubMenu,{title:"Annotation Categories",children:(0,I.jsx)(st,{annotations:d,onChange:this.handleAnnotationVisibilityChange,checkedAnnotationUids:this.state.visibleRoiUIDs,onStyleChange:this.handleRoiStyleChange,defaultAnnotationStyles:this.defaultAnnotationStyles})},"annotation-category"),j,M]})}),this.state.isHoveredRoiTooltipVisible&&this.state.hoveredRoiAttributes.length>0?(0,I.jsx)(lt,{xPosition:this.state.hoveredRoiTooltipX,yPosition:this.state.hoveredRoiTooltipY,attributes:this.state.hoveredRoiAttributes}):(0,I.jsx)(I.Fragment,{})]})}}]),n}(l.Component);const yt=it(gt);var St;!function(e){e.VOLUME="VOLUME",e.LABEL="LABEL",e.OVERVIEW="OVERVIEW",e.THUMBNAIL="THUMBNAIL"}(St||(St={}));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&&$.onError(H,new q(N,'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,St.VOLUME)||Ct(e,St.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,St.LABEL)?(l.LABEL.add(e.FrameOfReferenceUID),u.push(e)):Ct(e,St.OVERVIEW)&&(l.OVERVIEW.add(e.FrameOfReferenceUID),h.push(e))})),0===d.length)$.onError(H,new q(N,"At least one VOLUME image must be provided for a slide."));else{o.size>1&&$.onError(H,new q(N,"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&&$.onError(H,new q(N,"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,ie.Z)(a),this.opticalPathIdentifiers=(0,ie.Z)(r),1!==s.size&&$.onError(H,new q(N,"All images of a slide must have the same Container Identifier.")),this.containerIdentifier=(0,ie.Z)(s)[0],1!==l.VOLUME.size&&$.onError(H,new q(N,"All VOLUME images of a slide must have the same Frame of Reference UID.")),this.frameOfReferenceUID=(0,ie.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?$.onError(H,new q(N,'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,ie.Z)(c.VOLUME[e])[0]):$.onError(H,new q(N,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it.")):v&&$.onError(H,new q(N,'The VOLUME images for optical path "'.concat(e,'" ')+"lack the Pyramid UID, while the images for other optical paths contain it."))})),o.size>1?$.onError(H,new q(N,"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,ie.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,St.VOLUME)||Ct(e,St.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,St.LABEL)}));i=s.length>1?s.filter((function(e){return It(e,a)})):s;var l,c=e.filter((function(e){return Ct(e,St.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,ie.Z)(o)),(h=v.labelImages).push.apply(h,(0,ie.Z)(i)),(p=v.overviewImages).push.apply(p,(0,ie.Z)(l))}}}}));var n=t.map((function(e){return new bt({images:[].concat((0,ie.Z)(e.volumeImages),(0,ie.Z)(e.labelImages),(0,ie.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}))};function xt(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,I.jsx)(yt,{clients:n,studyInstanceUID:u,seriesInstanceUID:h,selectedPresentationStateUID:t,slide:v,preload:r,annotations:l,enableAnnotationTools:s,app:o,user:a})),f}const Zt=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)).state={slides:[],isLoading:!0},a.handleSeriesSelection=a.handleSeriesSelection.bind((0,o.Z)(a)),a}return(0,a.Z)(n,[{key:"componentDidMount",value:function(){var e=this;this.fetchImageMetadata().then((function(t){e.setState({slides:wt(t),isLoading:!1})})).catch((function(t){console.error(t),$.onError(H,new q(N,"Image metadata could not be retrieved or decoded.")),e.setState({isLoading:!1})}))}},{key:"fetchImageMetadata",value:function(){var e=(0,m.Z)((0,v.Z)().mark((function e(){var t,n,i,a,o=this;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],n=this.props.studyInstanceUID,console.info('search for series of study "'.concat(n,'"...')),i=this.props.clients[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],e.next=6,i.searchForSeries({queryParams:{Modality:"SM",StudyInstanceUID:n}});case 6:return a=e.sent,e.next=9,Promise.all(a.map(function(){var e=(0,m.Z)((0,v.Z)().mark((function e(n){var a,r,s,l,c;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g.metadata.formatMetadata(n),r=a.dataset,s=r,console.info('retrieve metadata of series "'.concat(s.SeriesInstanceUID,'"')),e.next=5,i.retrieveSeriesMetadata({studyInstanceUID:o.props.studyInstanceUID,seriesInstanceUID:s.SeriesInstanceUID});case 5:l=e.sent,c=[],l.forEach((function(e,t){if(null!=e["00080016"]){var n=e["00080016"].Value;if(null!=n)if(n[0]===M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE){var i=new g.metadata.VLWholeSlideMicroscopyImage({metadata:e});c.push(i)}}})),c.length>0&&t.push(c);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"handleSeriesSelection",value:function(e){var t=e.seriesInstanceUID;console.info('switch to series "'.concat(t,'"'));var n="/studies/".concat(this.props.studyInstanceUID)+"/series/".concat(t);this.props.location.pathname.includes("/projects/")&&(n=this.props.location.pathname,this.props.location.pathname.includes("/series/")?n=n.replace(/\/series\/[^/]+/,"/series/".concat(t)):n+="/series/".concat(t)),this.props.location.pathname.includes("/series/")&&null!=this.props.location.search&&(n+=this.props.location.search),this.props.navigate(n,{replace:!0})}},{key:"render",value:function(){if(this.state.isLoading)return null;if(0===this.state.slides.length)return null;var e=this.state.slides[0].volumeImages;if(0===e.length)return null;var t,n,i=e[0];if(this.props.location.pathname.includes("series/")){var a=this.props.location.pathname.split("series/")[1];t=a.includes("/")?a.split("/")[0]:a}else t=e[0].SeriesInstanceUID;return null!=i.ClinicalTrialSponsorName&&(n=(0,I.jsx)(f.Z.SubMenu,{title:"Clinical Trial",children:(0,I.jsx)(x,{metadata:i})},"clinical-trial")),(0,I.jsxs)(h.Z,{style:{height:"100%"},hasSider:!0,children:[(0,I.jsx)(h.Z.Sider,{width:300,style:{height:"100%",borderRight:"solid",borderRightWidth:.25,overflow:"hidden",background:"none"},children:(0,I.jsxs)(f.Z,{mode:"inline",defaultOpenKeys:["patient","study","clinical-trial","slides"],style:{height:"100%"},inlineIndent:14,children:[(0,I.jsx)(f.Z.SubMenu,{title:"Patient",children:(0,I.jsx)(O,{metadata:i})},"patient"),(0,I.jsx)(f.Z.SubMenu,{title:"Study",children:(0,I.jsx)(j,{metadata:i})},"study"),n,(0,I.jsx)(f.Z.SubMenu,{title:"Slides",children:(0,I.jsx)(te,{clients:this.props.clients,metadata:this.state.slides,selectedSeriesInstanceUID:t,onSeriesSelection:this.handleSeriesSelection})},"slides")]})}),(0,I.jsx)(c.Z5,{children:(0,I.jsx)(c.AW,{path:"/series/:seriesInstanceUID",element:(0,I.jsx)(xt,{clients:this.props.clients,slides:this.state.slides,preload:this.props.preload,annotations:this.props.annotations,enableAnnotationTools:this.props.enableAnnotationTools,app:this.props.app,user:this.props.user})})})]})}}]),n}(l.Component));var Dt=n(63),Vt=n(7382),Rt=n(2996),Ot=n(9529),jt=n(127),Mt=n(4541),Pt=n(161),Et=n(9761);const At=it(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,Et.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}),ue.Z.info({title:"About",width:600,content:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(S.Z,{title:"Application",column:1,children:[(0,I.jsx)(S.Z.Item,{label:"Name",children:a.props.app.name}),(0,I.jsx)(S.Z.Item,{label:"Version",children:a.props.app.version}),(0,I.jsx)(S.Z.Item,{label:"Homepage",children:a.props.app.homepage})]}),(0,I.jsxs)(S.Z,{title:"Browser",column:1,children:[(0,I.jsx)(S.Z.Item,{label:"Name",children:t.browser.name}),(0,I.jsx)(S.Z.Item,{label:"Version",children:t.browser.version})]}),(0,I.jsx)(S.Z,{title:"Operating System",column:1,children:(0,I.jsx)(S.Z.Item,{label:"Name",children:t.os.name})})]}),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=(0,I.jsx)(f.Z,{items:i});n=(0,I.jsx)(Vt.Z,{overlay:a,trigger:["click"],children:(0,I.jsx)(je,{icon:Ot.Z,onClick:function(e){return e.preventDefault()},label:"".concat(this.props.user.name," (").concat(this.props.user.email,")")})})}this.props.showWorklistButton&&(e=(0,I.jsx)(d.OL,{to:"/",children:(0,I.jsx)(je,{icon:jt.Z,tooltip:"Go to worklist"})}));var o,r=(0,I.jsx)(je,{icon:Mt.Z,tooltip:"Get app info",onClick:this.handleInfoButtonClick}),s=(0,I.jsx)(Ze.Z,{count:this.state.errorObj.length,children:(0,I.jsx)(Ze.Z,{color:"green",count:this.state.warnings.length,children:(0,I.jsx)(je,{icon:De.Z,tooltip:"Debug info",onClick:this.handleDebugButtonClick})})});this.props.showServerSelectionButton&&(o=(0,I.jsx)(je,{icon:Pt.Z,tooltip:"Select server",onClick:this.handleServerSelectionButtonClick}));var l=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,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h.Z.Header,{style:{width:"100%",padding:"0 14px"},children:(0,I.jsxs)(ce.Z,{children:[(0,I.jsx)(be.Z,{children:(0,I.jsx)(re.Z,{align:"center",direction:"horizontal",children:(0,I.jsx)("img",{src:"https://imagingdatacommons.github.io/slim/logo.svg",alt:"",style:{height:"64px",margin:"-14px"}})})}),(0,I.jsx)(be.Z,{flex:"auto"}),(0,I.jsx)(be.Z,{children:(0,I.jsxs)(re.Z,{direction:"horizontal",children:[e,r,s,o,n]})})]})}),(0,I.jsx)(ue.Z,{visible:this.state.isServerSelectionModalVisible,title:"Select DICOMweb server",onOk:l,onCancel:function(){t.setState({selectedServerUrl:void 0,isServerSelectionModalVisible:!1,isServerSelectionDisabled:!0})},children:(0,I.jsx)(Rt.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:l,addonAfter:this.state.isServerSelectionDisabled?(0,I.jsx)(me.Z,{style:{color:"rgba(0,0,0,.45)"}}):(0,I.jsx)(ve.Z,{style:{color:"rgba(0,0,0,.45)"}})})})]})}}]),n}(l.Component));var Ut=n(7063);const Tt=function(e){var t=e.title,n=e.message;return(0,I.jsx)("div",{style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,I.jsx)(Ut.ZP,{title:t,subTitle:n})})};var kt=n(6019),Lt=n(1730);const _t=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)).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,I.jsxs)("div",{style:{padding:8},children:[(0,I.jsx)(Rt.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,I.jsxs)(re.Z,{children:[(0,I.jsx)(le.Z,{type:"primary",onClick:function(){return a.handleSearch(i,o,e)},icon:(0,I.jsx)(Lt.Z,{}),size:"small",style:{width:90},children:"Search"}),(0,I.jsx)(le.Z,{onClick:function(){return a.handleReset(r)},size:"small",style:{width:90},children:"Reset"})]})]})},filterIcon:function(e){return(0,I.jsx)(Lt.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[M.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 g.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),$.onError(B,new q(_,"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[M.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE].searchForStudies(l).then((function(e){t.setState({studies:e.map((function(e){return g.metadata.formatMetadata(e).dataset}))})})).catch((function(e){console.error(e),$.onError(B,new q(_,"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,P.Z)({title:"Accession Number",dataIndex:"AccessionNumber"},this.getColumnSearchProps("AccessionNumber")),(0,P.Z)({title:"Study ID",dataIndex:"StudyID"},this.getColumnSearchProps("StudyID")),{title:"Study Date",dataIndex:"StudyDate",render:function(e){return D(e)}},{title:"Study Time",dataIndex:"StudyTime",render:function(e){return V(e)}},(0,P.Z)({title:"Patient ID",dataIndex:"PatientID"},this.getColumnSearchProps("PatientID")),(0,P.Z)({title:"Patient's Name",dataIndex:"PatientName",render:function(e){return Z(e)}},this.getColumnSearchProps("PatientName")),{title:"Patient's Sex",dataIndex:"PatientSex",render:function(e){return R(e)}},{title:"Patient's Birthdate",dataIndex:"PatientBirthDate",render:function(e){return D(e)}},{title:"Referring Physician's Name",dataIndex:"ReferringPhysicianName",render:function(e){return Z(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,I.jsx)(kt.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 Nt=n(5685),Gt=function(e,t){var n=t;return n.endsWith("/")||(n+="/"),new URL(e,n).toString()},qt=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"))},Ft=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};$.onError(X,new q(L,'Failed to obtain user "name" and "email".'))}else $.onError(X,new q(L,"Failed to obtain user profile."));return{name:void 0,email:void 0}},zt=(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,m.Z)((0,v.Z)().mark((function e(t){var n,i,o,r;return(0,v.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.onSignIn,i=function(e){var t=Ft(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")},!qt(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,m.Z)((0,v.Z)().mark((function e(){return(0,v.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,m.Z)((0,v.Z)().mark((function e(){return(0,v.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;$.onError(X,new q(L,"Failed to obtain user profile."))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.getUser=(0,m.Z)((0,v.Z)().mark((function e(){return(0,v.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&&$.onError(X,new q(L,"Failed to obtain user information.")),Ft(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 Nt.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 Nt.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)}))})),Bt=n(7659),Wt=n(9158);const Yt=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=Wt.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&&$.onError(H,new q(_,"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 Xt(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,I.jsx)(Zt,{clients:i,user:a,annotations:r.annotations,preload:d,app:o,enableAnnotationTools:l,studyInstanceUID:s})}function Kt(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(M).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 Ht({baseUri:t,settings:[e],onError:a})}})),o.default>1&&$.onError(H,new q(_,"Only one default server can be configured without specification of storage classes.")),o)"default"!==s&&o[s]>1&&$.onError(H,new q(_,"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 Ht({baseUri:t,settings:[e],onError:a});null!=e.storageClasses&&e.storageClasses.forEach((function(e){r[e]=n}))})),Object.values(M).forEach((function(e){e in r||(r[e]=r.default)})),r}const Jt=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.memoryMonitoringIntervalId=void 0,r.handleDICOMwebError=function(e,t){401===e.status?r.signIn():403===e.status&&$.onError(B,new q(_,"User is not authorized to access DICOMweb resources."));var n=function(){$.onError(B,new q(_,"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=Gt(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 zt(h,p)),0===e.config.servers.length&&$.onError(H,new q(_,"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:Kt({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:[M.COMPREHENSIVE_SR,M.COMPREHENSIVE_3D_SR,M.SEGMENTATION,M.MICROSCOPY_BULK_SIMPLE_ANNOTATION,M.PARAMETRIC_MAP,M.ADVANCED_BLENDING_PRESENTATION_STATE,M.COLOR_SOFTCOPY_PRESENTATION_STATE,M.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,M.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE]})}},{key:"handleServerSelection",value:function(e){var t=e.url;console.info("select DICOMweb server: ",t);var n=new Ht({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),$.onError(X,new q(L,"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(),this.memoryMonitoringIntervalId=setInterval((function(){var e,t,n,i,a,o,r=Math.round(((null===(e=performance)||void 0===e||null===(t=e.memory)||void 0===t?void 0:t.totalJSHeapSize)-(null===(n=performance)||void 0===n||null===(i=n.memory)||void 0===i?void 0:i.usedJSHeapSize))/1024/1024);console.log("Estimate of memory available:","".concat(r," MB")),console.log("Estimate of memory usage:","".concat(Math.round((null===(a=performance)||void 0===a||null===(o=a.memory)||void 0===o?void 0:o.usedJSHeapSize)/1024/1024)," MB"))}),2e3)}},{key:"componentWillUnmount",value:function(){clearInterval(this.memoryMonitoringIntervalId)}},{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,I.jsx)(_t,{clients:this.state.clients}):(0,I.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,I.jsx)(d.VK,{basename:this.props.config.path,children:(0,I.jsx)(c.Fg,{to:this.state.redirectTo,replace:!0})}):this.state.isLoading?(0,I.jsx)(d.VK,{basename:this.props.config.path,children:(0,I.jsxs)(h.Z,{style:u,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,showServerSelectionButton:!1}),(0,I.jsx)(h.Z.Content,{style:v,children:(0,I.jsx)(p.fCD,{})})]})}):this.state.wasAuthSuccessful?null!=this.state.error?(0,I.jsx)(Tt,{type:"error",message:this.state.error.message}):(0,I.jsx)(d.VK,{basename:this.props.config.path,children:(0,I.jsxs)(c.Z5,{children:[(0,I.jsx)(c.AW,{path:"/",element:(0,I.jsxs)(h.Z,{style:u,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(h.Z.Content,{style:v,children:n})]})}),(0,I.jsx)(c.AW,{path:"/studies/:studyInstanceUID/*",element:(0,I.jsxs)(h.Z,{style:u,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(h.Z.Content,{style:v,children:(0,I.jsx)(Xt,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,I.jsx)(c.AW,{path:"/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore/study/:studyInstanceUID/*",element:(0,I.jsxs)(h.Z,{style:u,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:o,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),(0,I.jsx)(h.Z.Content,{style:v,children:(0,I.jsx)(Xt,{clients:this.state.clients,user:this.state.user,config:this.props.config,app:a})})]})}),(0,I.jsx)(c.AW,{path:"/logout",element:(0,I.jsxs)(h.Z,{style:u,children:[(0,I.jsx)(At,{app:a,user:this.state.user,showWorklistButton:!1,onServerSelection:this.handleServerSelection,onUserLogout:l?s:void 0,showServerSelectionButton:r}),"Logged out"]})})]})}):(0,I.jsx)(Tt,{type:"error",message:"Sign-in failed."})}}]),n}(l.Component)}}]); +//# sourceMappingURL=315.df4e7f33.chunk.js.map \ No newline at end of file diff --git a/static/js/315.df4e7f33.chunk.js.map b/static/js/315.df4e7f33.chunk.js.map new file mode 100644 index 00000000..e7daadac --- /dev/null +++ b/static/js/315.df4e7f33.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/315.df4e7f33.chunk.js","mappings":"2SA4BMA,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,0BAE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lxB,KAAKiH,MAAMiqB,KACjB8P,mBAAoBkN,EACpBpM,kBAAmB9hC,KAAKyhC,sBACxBf,aAAc4N,EAAmBD,OAAWtuC,EAC5CwhC,0BAA2B6M,KAE7B,SAAC,YAAc,CAAC7lC,MAAOimC,EAAmB,UACxC,SAACxD,GAAsB,CACrBjjC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjB+Z,OAAQjrC,KAAKC,MAAMgrC,OACnBxZ,IAAKuc,YAMf,SAAC,KAAK,CACJvP,KAAK,UACLC,SACE,UAAC,IAAM,CAACn2B,MAAOgmC,EAAY,WACzB,SAAC,GAAM,CACL9c,IAAKuc,EACL9c,KAAMlxB,KAAKiH,MAAMiqB,KACjB8P,oBAAoB,EACpBc,kBAAmB9hC,KAAKyhC,sBACxBf,aAAc4N,EAAmBD,OAAWtuC,EAC5CwhC,0BAA2B6M,IAC3B,wBArFZ,SAAC,GAAQ,CAACtpC,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EA9ZM,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","components/CaseViewer.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
\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 {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(\n () => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n },\n 100\n )\n }}\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 React from 'react'\nimport { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport * as dmv from 'dicom-microscopy-viewer'\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, createSlides } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\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\ninterface ViewerState {\n slides: Slide[]\n isLoading: boolean\n}\n\nclass Viewer extends React.Component {\n state = {\n slides: [],\n isLoading: true\n }\n\n constructor (props: ViewerProps) {\n super(props)\n this.handleSeriesSelection = this.handleSeriesSelection.bind(this)\n }\n\n componentDidMount (): void {\n this.fetchImageMetadata().then(\n (metadata: dmv.metadata.VLWholeSlideMicroscopyImage[][]) => {\n this.setState({\n slides: createSlides(metadata),\n isLoading: false\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.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.')\n )\n this.setState({ isLoading: false })\n })\n }\n\n /**\n * Fetch metadata for VL Whole Slide Microscopy Image instances of the study.\n *\n * @returns Metadata of image instances of the study grouped per series\n */\n async fetchImageMetadata (): Promise {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n const studyInstanceUID = this.props.studyInstanceUID\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n const client = this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(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: this.props.studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item, index) => {\n if (item['00080016'] != null) {\n const values = item['00080016'].Value\n if (values != null) {\n const sopClassUID = values[0]\n if (sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n }\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n }))\n\n return images\n }\n\n handleSeriesSelection (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ): void {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${this.props.studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (this.props.location.pathname.includes('/projects/')) {\n urlPath = this.props.location.pathname\n if (!this.props.location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n this.props.location.pathname.includes('/series/') &&\n this.props.location.search != null\n ) {\n urlPath += this.props.location.search\n }\n\n this.props.navigate(urlPath, { replace: true })\n }\n\n render (): React.ReactNode {\n if (this.state.isLoading) {\n return null\n }\n\n if (this.state.slides.length === 0) {\n return null\n }\n const firstSlide = this.state.slides[0] as Slide\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 (this.props.location.pathname.includes('series/')) {\n const seriesFragment = this.props.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}\n\nexport default withRouter(Viewer)\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Menu,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\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'\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 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 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 = \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'\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'\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 const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\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 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 return await this.stores[0].client.retrieveStudyMetadata(options)\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveSeriesMetadata(options)\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 return await this.stores[0].client.retrieveInstance(options)\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 private memoryMonitoringIntervalId?: ReturnType\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 this.memoryMonitoringIntervalId = setInterval(() => {\n const performanceMemoryAvailable = Math.round(\n // @ts-expect-error\n (performance?.memory?.totalJSHeapSize -\n // @ts-expect-error\n performance?.memory?.usedJSHeapSize) /\n 1024 /\n 1024\n )\n console.log(\n 'Estimate of memory available:',\n `${performanceMemoryAvailable} MB`\n )\n console.log(\n 'Estimate of memory usage:',\n // @ts-expect-error\n `${Math.round(performance?.memory?.usedJSHeapSize / 1024 / 1024)} MB`\n )\n }, 2000)\n }\n\n componentWillUnmount (): void {\n clearInterval(this.memoryMonitoringIntervalId)\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","visible","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","ParametrizedSlideViewer","presentationStateUID","selectedSlide","get","viewer","handleSeriesSelection","fetchImageMetadata","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","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","overlay","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","flex","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","dataIndex","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","marginBottom","SearchOutlined","filterIcon","filtered","fetchData","handleChange","studies","numStudies","pageSize","searchOptions","ModalitiesInStudy","searchForStudies","study","limit","searchCriteria","fuzzymatching","pagination","filters","columns","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","dataSource","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","open","DicomWebManager","onError","stores","handleError","updateHeaders","fields","f","headers","reject","retrieveStudyMetadata","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","qidoPathPrefix","qidoURLPrefix","wadoPathPrefix","wadoURLPrefix","stowPathPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","memoryMonitoringIntervalId","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","setInterval","performanceMemoryAvailable","round","performance","memory","totalJSHeapSize","usedJSHeapSize","clearInterval","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.53b5e916.js b/static/js/main.424ef37e.js similarity index 99% rename from static/js/main.53b5e916.js rename to static/js/main.424ef37e.js index 8db8b0a6..2c157b40 100644 --- a/static/js/main.53b5e916.js +++ b/static/js/main.424ef37e.js @@ -1,3 +1,3 @@ -/*! For license information please see main.53b5e916.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),h=l((0,a.uA)({h:c(p,d,!0),s:s(p,d,!0),v:f(p,d,!0)}));n.push(h)}n.push(l(r));for(var v=1;v<=4;v+=1){var m=i(r),g=l((0,a.uA)({h:c(m,v),s:s(m,v),v:f(m,v)}));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"},h={},v={};Object.keys(p).forEach((function(e){h[e]=d(p[e]),h[e].primary=h[e][5],v[e]=d(p[e],{theme:"dark",backgroundColor:"#141414"}),v[e].primary=v[e][5]}));h.red,h.volcano,h.gold,h.orange,h.yellow,h.lime,h.green,h.cyan,h.blue,h.geekblue,h.purple,h.magenta,h.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),h=n(5561);function v(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,h.hq)(e,"@ant-design-icons",{prepend:!0,csp:t})}),[])}(),t=v(a),n="icon should be icon definiton, but got ".concat(a),(0,p.ZP)(t,"[@ant-design/icons] ".concat(n)),!v(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,h=e.tabIndex,v=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=h;void 0===S&&v&&(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:v,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:()=>h,WE:()=>c,Yt:()=>v,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,{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,h={};function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=p++,r=t;function a(){(r-=1)<=0?(e(),delete h[n]):h[n]=(0,d.Z)(a)}return h[n]=(0,d.Z)(a),n}v.cancel=function(e){void 0!==e&&(d.Z.cancel(h[e]),delete h[e])},v.ids=h;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),v.cancel(e.animationStartId),e.animationStart=!0,e.animationStartId=v((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),h=n(11),v=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),h=n(5501),v=n(2791),m=n(9613),g=n.n(m),y=n(4925),b=n(5207),w=n(9439),k=v.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=v.useState(s||o),p=(0,w.Z)(d,2),h=p[0],m=p[1];return v.useEffect((function(){(o||s)&&m(!0)}),[o,s]),h?v.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},v.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,h=d.headerClass,m=d.destroyInactivePanel,g=d.collapsible,y=null!==g&&void 0!==g?g:s,b={key:f,panelKey:f,header:p,headerClass:h,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]})),v.cloneElement(e,b))},r.getItems=function(){var e=r.props.children;return(0,h.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 v.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}(v.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=v.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=v.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 v.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):v.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,h.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=v.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 v.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),h=n(3085),v=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)),h&&(T=l.createElement(s,{locale:h,_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(v.E_.Provider,{value:Z},T)},L=function(e){return l.useEffect((function(){e.direction&&(p.ZP.config({rtl:"rtl"===e.direction}),h.Z.config({rtl:"rtl"===e.direction}))}),[e.direction]),l.createElement(f.Z,null,(function(t,n,a){return l.createElement(v.C,null,(function(t){return l.createElement(R,(0,r.Z)({parentContext:t,legacyLocale:a},e))}))}))};L.ConfigContext=v.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});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)}},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 h,v=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(h)t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:h});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){h?t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:h}):(h=e,t({prefixCls:u,rootPrefixCls:c,iconPrefixCls:s,instance:e}))}))}}var R={info:p,success:o.Z,error:i.Z,warning:l.Z,loading:v.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;h&&(h.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,h=null),void 0!==e.duration&&(P=e.duration),void 0!==e.prefixCls&&(N=e.prefixCls),void 0!==e.getContainer&&(x=e.getContainer,h=null),void 0!==e.transitionName&&(F=e.transitionName,h=null,_=!0),void 0!==e.maxCount&&(S=e.maxCount,h=null),void 0!==e.rtl&&(O=e.rtl)},destroy:function(e){if(h)if(e){(0,h.removeNotice)(e)}else{var t=h.destroy;t(),h=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),h=n(1694),v=n.n(h),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,h=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},h,{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],h=d||n;s.useEffect((function(){(l||n)&&p(n)}),[n,l]);var v=s.useState((function(){return A(o)})),g=(0,m.Z)(v,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]}(h&&!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(!h||!(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:v()("".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,h=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:h},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:v()(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,h=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(h?"".concat(h.x-e.left,"px ").concat(h.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:v()(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,h=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:v()("".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:v()("".concat(n,"-wrap"),p),ref:M,onClick:Y,style:(0,z.Z)((0,z.Z)({zIndex:r},d),{},{display:I?null:"none"})},h),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),h=n(2067),v=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,h.w6)(),p=s.getPrefixCls,v=s.getIconPrefixCls,m=p("notification",c||S),g=v(),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,v=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(h.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:v,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,v.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:()=>v,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),h=n(5501),v=n(632),m="RC_FORM_INTERNAL_HOOKS",g=function(){(0,v.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 h=new e(p);h.messages(i.messages),t.rule.options&&(t.rule.options.messages=i.messages,t.rule.options.error=i.error),h.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 ve=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,h,v,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 ve((0,i.Z)({},t,[s])),h=fe({},Y,o.validateMessages),p.messages(h),v=[],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&&(v=e.t0.errors.map((function(e,t){var n=e.message,a=n===ge?h.default:n;return r.isValidElement(a)?r.cloneElement(a,{key:"error_".concat(t)}):a})));case 17:if(v.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=v.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,h.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(),h=f.getInternalHooks,v=f.getFieldsValue,g=h(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=he(s.keys,e,t),o(he(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,v.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,v.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,v.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,h=void 0===p?"form":p,v=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),v)),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 h=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:{}),v={};if((0,d.Z)()){var m=document.createElement("div");v=m.style}var g={};function y(e){if(g[e])return g[e];var t=h[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,h=i.motionDeadline,v=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()),h>0&&(clearTimeout(te.current),te.current=setTimeout((function(){ae({deadline:!0})}),h))),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&&v&&!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 he=X;return le[_]&&fe===O&&(he=(0,a.Z)({transition:"none"},he)),[K,fe,he,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,h=e.forceRender,v=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(v)if(P!==S&&n(e)){var A,I;Z===_?I="prepare":z(Z)?I="active":Z===O&&(I="start"),M=v((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?v((0,a.Z)({},L),R):!p&&T.current?v((0,a.Z)((0,a.Z)({},L),{},{className:g}),R):h?v((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),h=n(5207),v=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(h.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(v.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:()=>h});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 h(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 v(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);v(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 h(e){var t=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&"object"===(0,l.Z)(t)&&(t.usingClientEntryPoint=e)}var v="__rc_react_root__";function m(e,t){a?function(e,t){h(!0);var n=t[v]||a(t);h(!1),n.render(e),t[v]=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[v])||void 0===e||e.unmount(),delete t[v]})));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,h=n?Symbol.for("react.suspense_list"):60120,v=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 v: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)===v}},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