diff --git a/static/js/687.f75f6841.chunk.js.map b/static/js/687.f75f6841.chunk.js.map index c4d210f..fc48fed 100644 --- a/static/js/687.f75f6841.chunk.js.map +++ b/static/js/687.f75f6841.chunk.js.map @@ -1 +1 @@ -{"version":3,"file":"static/js/687.f75f6841.chunk.js","mappings":"6QA4BMA,EAAW,qGAqDd,OArDc,8BACf,WACE,IAAIC,EAAoC,aACpCC,EAAkB,YAEWC,IAA7BC,KAAKC,MAAMC,eAA+BF,KAAKC,MAAMC,gBACvDL,EAAS,WACTC,EAAkB,QAEpB,IAAMK,EAAQH,KAAKC,MAAMG,WAAWC,KAAI,SAACC,EAAiBC,GACxD,IAAMC,GAAMC,EAAAA,EAAAA,KACZ,OACE,SAAC,SAAiB,CAEhBC,MAAOJ,EAAKK,KACZC,WAAY,CACVC,WAAYf,GAEdgB,aAAc,CACZC,WAAY,IACZC,WAAY,WACZH,WAjBkB,QAmBpBI,KAAM,EAAE,SAEPX,EAAKY,OAZDV,EAeX,IACIW,EAAO,KAIX,YAHwBpB,IAApBC,KAAKC,MAAMkB,OACbA,GAAO,cAAMlB,MAAMkB,KAAI,MAGvB,UAAC,IAAI,CACHC,MAAOpB,KAAKC,MAAMoB,OAClBC,MAAOH,EACPI,KAAK,QACLC,UAAWxB,KAAKC,MAAMwB,WACtBC,cAAgC3B,IAAtBC,KAAKC,MAAMoB,OACrBM,QAAS3B,KAAKC,MAAM2B,QAAQ,WAE5B,SAAC,IAAY,CACXC,OAAQ,EACRN,KAAK,QACL1B,OAAQA,EACR6B,UAAU,EAAM,SAEfvB,IAEFH,KAAKC,MAAM6B,WAGlB,KAAC,EArDc,CAASC,EAAAA,WAwD1B,UC/BA,QAxCmB,qGAqChB,OArCgB,8BACjB,WACE,IAAM3B,EAAa,GAkCnB,OAjCoD,MAAhDJ,KAAKC,MAAM+B,SAASC,0BAEtB7B,EAAW8B,KAAI,MAAf9B,EACK,CACD,CACEO,KAAM,eACNO,MAAOlB,KAAKC,MAAM+B,SAASC,0B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,OAAWv5C,EAC5C0tC,0BAA2B4L,KAE7B,SAAC,YAAc,CAAC9wC,MAAOkxC,EAAmB,UACxC,SAAC/C,GAAsB,CACrB3uC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjBylB,OAAQ32C,KAAKC,MAAM02C,OACnBllB,IAAKwnB,YAMf,SAAC,KAAK,CACJtZ,KAAK,6GACLC,SACE,UAAC,IAAM,CAACr3B,MAAOixC,EAAY,WACzB,SAAC,GAAM,CACL/nB,IAAKwnB,EACL/nB,KAAMlxB,KAAKiH,MAAMiqB,KACjB8b,mBAAoBmM,EACpBnL,kBAAmBhuC,KAAK2tC,sBACxBjB,aAAc6M,EAAmBD,OAAWv5C,EAC5C0tC,0BAA2B4L,KAE7B,SAAC,YAAc,CAAC9wC,MAAOkxC,EAAmB,UACxC,SAAC/C,GAAsB,CACrB3uC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjBylB,OAAQ32C,KAAKC,MAAM02C,OACnBllB,IAAKwnB,YAMf,SAAC,KAAK,CACJtZ,KAAK,UACLC,SACE,UAAC,IAAM,CAACr3B,MAAOixC,EAAY,WACzB,SAAC,GAAM,CACL/nB,IAAKwnB,EACL/nB,KAAMlxB,KAAKiH,MAAMiqB,KACjB8b,oBAAoB,EACpBgB,kBAAmBhuC,KAAK2tC,sBACxBjB,aAAc6M,EAAmBD,OAAWv5C,EAC5C0tC,0BAA2B4L,IAC3B,wBArFZ,SAAC,GAAQ,CAACv0C,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EAvYM,CAAShD,EAAAA,U","sources":["components/Description.tsx","components/ClinicalTrial.tsx","utils/values.ts","components/Patient.tsx","components/Study.tsx","data/uids.tsx","utils/PubSub.js","utils/CustomError.js","services/NotificationMiddleware.js","components/SlideItem.tsx","components/SlideList.tsx","components/AnnotationItem.tsx","components/AnnotationList.tsx","components/AnnotationGroupItem.tsx","components/AnnotationGroupList.tsx","components/Button.tsx","components/Equipment.tsx","utils/sr.tsx","components/Report.tsx","components/Item.tsx","data/specimens.tsx","components/SpecimenItem.tsx","components/SpecimenList.tsx","components/OpticalPathItem.tsx","components/OpticalPathList.tsx","components/MappingItem.tsx","components/MappingList.tsx","components/SegmentItem.tsx","components/SegmentList.tsx","utils/router.tsx","components/ColorSettingsMenu.tsx","components/AnnotationCategoryItem.tsx","components/AnnotationCategoryList.tsx","components/HoveredRoiTooltip.tsx","services/RoiToAnnotationAdapter.ts","components/SlideViewer.tsx","data/slides.tsx","services/fetchImageMetadata.ts","hooks/useSlides.ts","components/CaseViewer.tsx","components/DicomTagBrowser/dicomTagUtils.ts","utils/formatDicomDate.ts","utils/pubSubServiceInterface.ts","utils/createSeriesMetadata.ts","utils/createStudyMetadata.ts","services/DICOMMetadataStore.ts","hooks/useDebounce.ts","components/DicomTagBrowser/DicomTagBrowser.tsx","components/Header.tsx","components/InfoPage.tsx","components/Worklist.tsx","utils/url.tsx","auth/OidcManager.tsx","utils/xhrRetryHook.ts","DicomWebManager.ts","App.tsx"],"sourcesContent":["import React from 'react'\nimport { v4 as generateUUID } from 'uuid'\nimport { Card, Descriptions } from 'antd'\n\nexport interface Attribute {\n name: string\n value: any\n}\n\nexport interface AttributeGroup {\n name: string\n attributes: Attribute[]\n}\n\ninterface DescriptionProps {\n header?: string\n icon?: any\n attributes: Attribute[]\n selectable?: boolean\n hasLongValues?: boolean\n methods?: React.ReactNode[]\n children?: React.ReactNode\n}\n\n/**\n * React component for a description consisting of a header containing a\n * header and a body containing a list of name-value pairs.\n */\nclass Description extends React.Component {\n render (): React.ReactNode {\n let layout: 'horizontal' | 'vertical' = 'horizontal'\n let labelLineHeight = '14px'\n const contentLineHeight = '14px'\n if (this.props.hasLongValues !== undefined && this.props.hasLongValues) {\n layout = 'vertical'\n labelLineHeight = '20px'\n }\n const items = this.props.attributes.map((item: Attribute, index: number) => {\n const uid = generateUUID()\n return (\n \n {item.value}\n \n )\n })\n let icon = null\n if (this.props.icon !== undefined) {\n icon = \n }\n return (\n \n \n {items}\n \n {this.props.children}\n \n )\n }\n}\n\nexport default Description\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface ClinicalTrialProps {\n metadata: dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM ClinicalTrial Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass ClinicalTrial extends React.Component {\n render (): React.ReactNode {\n const attributes = []\n if (this.props.metadata.ClinicalTrialSponsorName != null) {\n // Attributes of Clinical Trial Subject module\n attributes.push(\n ...[\n {\n name: 'Sponsor Name',\n value: this.props.metadata.ClinicalTrialSponsorName\n },\n {\n name: 'Protocol ID',\n value: this.props.metadata.ClinicalTrialProtocolID\n },\n {\n name: 'Protocol Name',\n value: this.props.metadata.ClinicalTrialProtocolName\n },\n {\n name: 'Site Name',\n value: this.props.metadata.ClinicalTrialSiteName\n }\n ]\n )\n }\n if (this.props.metadata.ClinicalTrialTimePointID != null) {\n // Attributes of Clinical Trial Study module\n attributes.push(\n {\n name: 'Time Point ID',\n value: this.props.metadata.ClinicalTrialTimePointID\n }\n )\n }\n // Attributes of Clinical Trial Subject module\n return \n }\n}\n\nexport default ClinicalTrial\n","import * as dmv from 'dicom-microscopy-viewer'\n\nfunction parseName (value: dmv.metadata.PersonName|null|undefined): string {\n if (typeof value === 'object' && value !== null && value !== undefined) {\n if (value.Alphabetic !== undefined) {\n return value.Alphabetic.split('^').join(' ')\n }\n return ''\n }\n return ''\n}\n\nfunction parseDate (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n return `${year}-${month}-${day}`\n }\n return ''\n}\n\nfunction parseTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const hours = value.substring(0, 2)\n const minutes = value.substring(2, 4)\n const seconds = value.substring(4, 6)\n return `${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseDateTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n const hours = value.substring(8, 10)\n const minutes = value.substring(10, 12)\n const seconds = value.substring(12, 14)\n return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseSex (value: string|null|undefined): string {\n const lut: { [key: string]: string } = {\n F: 'Female',\n M: 'Male',\n O: 'Other'\n }\n if (value !== null && value !== undefined) {\n return lut[value]\n }\n return ''\n}\n\nexport { parseDate, parseDateTime, parseName, parseSex, parseTime }\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseName, parseSex, parseDate } from '../utils/values'\n\ninterface PatientProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Patient Information Entity that\n * displays common study-level, patient-related attributes of contained\n * DICOM Slide Microscopy images.\n */\nclass Patient extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'ID',\n value: this.props.metadata.PatientID\n },\n {\n name: 'Name',\n value: parseName(this.props.metadata.PatientName)\n },\n {\n name: 'Gender',\n value: parseSex(this.props.metadata.PatientSex)\n },\n {\n name: 'Birthdate',\n value: parseDate(this.props.metadata.PatientBirthDate)\n }\n ]\n return (\n \n )\n }\n}\n\nexport default Patient\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseDate, parseTime } from '../utils/values'\n\ninterface StudyProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Study Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass Study extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'Accession #',\n value: this.props.metadata.AccessionNumber\n },\n {\n name: 'ID',\n value: this.props.metadata.StudyID\n },\n {\n name: 'Date',\n value: parseDate(this.props.metadata.StudyDate)\n },\n {\n name: 'Time',\n value: parseTime(this.props.metadata.StudyTime)\n }\n ]\n return \n }\n}\n\nexport default Study\n","export enum StorageClasses {\n VL_WHOLE_SLIDE_MICROSCOPY_IMAGE = '1.2.840.10008.5.1.4.1.1.77.1.6',\n COMPREHENSIVE_SR = '1.2.840.10008.5.1.4.1.1.88.33',\n COMPREHENSIVE_3D_SR = '1.2.840.10008.5.1.4.1.1.88.34',\n SEGMENTATION = '1.2.840.10008.5.1.4.1.1.66.4',\n MICROSCOPY_BULK_SIMPLE_ANNOTATION = '1.2.840.10008.5.1.4.1.1.91.1',\n PARAMETRIC_MAP = '1.2.840.10008.5.1.4.1.1.30',\n ADVANCED_BLENDING_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.8',\n COLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.2',\n GRAYSCALE_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.1',\n PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.3'\n}\n","// Use symbols to prevent exposing private attributes\nconst _subscriptions = Symbol('subscriptions')\nconst _lastSubscriptionId = Symbol('lastSubscriptionId')\n\n/**\n * Class to enable implementation of publish/subscribe pattern\n * @class\n * @classdesc Enables publishing/subscribing\n */\nexport default class PubSub {\n constructor () {\n this[_subscriptions] = {}\n this[_lastSubscriptionId] = 0\n }\n\n /**\n * Adds a subscription callback to the provided event name\n * @param {string} eventName Event name that will trigger the callback\n * @param {Function} callback Function to be executed when event is published\n * @returns {void}\n */\n subscribe (eventName, callback) {\n if (eventName === undefined) {\n throw new Error('Trying to subscribe to an inexistent event')\n }\n\n if (typeof callback !== 'function') {\n throw new Error('The provided callback must be a function')\n }\n\n if (!this[_subscriptions].hasOwnProperty(eventName)) {\n this[_subscriptions][eventName] = {}\n }\n\n const subscriptionId = `sub${this[_lastSubscriptionId]++}`\n this[_subscriptions][eventName][subscriptionId] = callback\n }\n\n /**\n * Removes a subscription callback for the provided event name\n * @param {string} eventName Event name for the registerd callback\n * @param {Function} [callback] Function to have its subscription removed\n * @returns {void}\n */\n unsubscribe (eventName, callback) {\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n if (!callback) {\n delete callbacks[subscriptionId]\n } else if (callbacks[subscriptionId] === callback) {\n delete callbacks[subscriptionId]\n }\n }\n }\n\n /**\n * Trigger all registered subscription callbacks for a specific event name\n * @param {String} eventName Event name to trigger subscriptions from\n * @param {any} [payload] Payload that will be passed to the callback fuction\n * @returns {void}\n */\n publish (eventName, ...payload) {\n if (eventName === undefined) {\n throw new Error('Trying to publish an inexistent event')\n }\n\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n callbacks[subscriptionId](...payload)\n }\n }\n\n /**\n * Cleares all subscriptions for current instance\n * @returns {void}\n */\n unsubscribeFromAll () {\n for (const eventName in this[_subscriptions]) {\n const callbacks = this[_subscriptions][eventName]\n for (const subscriptionId in callbacks) {\n delete callbacks[subscriptionId]\n }\n }\n }\n}\n","const errorTypes = {\n AUTHENTICATION: 'Authentication',\n COMMUNICATION: 'Communication',\n ENCODINGANDDECODING: 'EncodingDecoding',\n VISUALIZATION: 'Visualization'\n}\n\nclass CustomError extends Error {\n constructor (type, message) {\n super()\n this.message = message\n this.stack = new Error().stack\n this.type = type\n }\n}\n\nexport { errorTypes, CustomError }\n","import PubSub from '../utils/PubSub'\nimport { notification } from 'antd'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nexport const NotificationMiddlewareEvents = {\n OnError: 'onError',\n OnWarning: 'onWarning'\n}\n\nexport const NotificationMiddlewareContext = {\n DICOMWEB: 'dicomweb-client',\n DMV: 'dicom-microscopy-viewer',\n DCMJS: 'dcmjs',\n SLIM: 'slim',\n AUTH: 'authentication'\n}\n\nconst NotificationType = {\n TOAST: 'toast',\n CONSOLE: 'console'\n}\n\n/* Sources of Error:\n 1. 'dicomweb-client': Error while requesting/fetching data, tagged as 'Communication'\n 2. 'slim' and 'dicom-microscopy-viewer' library: Error related to dicom data encoding/decoding,\n could directly/indirectly impact image-related visualization, tagged as 'Visualization' or\n 'Encoding/Decoding' accordingly\n 3. 'dcmjs' library: Data parsing error, tagged as 'DICOMError'\n 4. 'authentication': Error during user authentication, tagged as 'Authentication'\n */\nconst NotificationSourceDefinition = {\n sources: [\n {\n category: errorTypes.AUTHENTICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.COMMUNICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.VISUALIZATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.ENCODINGANDDECODING,\n notificationType: NotificationType.CONSOLE\n },\n {\n category: 'Warning',\n notificationType: NotificationType.TOAST\n }\n ]\n}\n\nclass NotificationMiddleware extends PubSub {\n constructor () {\n super()\n\n const outerContext = (args) => {\n this.publish(NotificationMiddlewareEvents.OnWarning, Array.from(args).join(' '))\n }\n\n (function () {\n const warn = console.warn\n console.warn = function () {\n if (!JSON.stringify(arguments).includes('request')) {\n outerContext(arguments)\n }\n warn.apply(this, Array.prototype.slice.call(arguments))\n }\n }())\n }\n\n /**\n * Error handling middleware function\n *\n * @param source - source of error - dicomweb-client, dmv, dcmjs or slim itself\n * @param error - error object\n */\n onError (source, error) {\n const errorCategory = error.type\n const sourceConfig = NotificationSourceDefinition.sources.find(\n s => s.category === errorCategory\n )\n\n const { notificationType } = sourceConfig\n\n this.publish(NotificationMiddlewareEvents.OnError, {\n source,\n error\n })\n\n let notificationMsg\n if (error instanceof CustomError) {\n notificationMsg = error.message\n } else {\n notificationMsg = String(error)\n }\n\n switch (notificationType) {\n case NotificationType.TOAST:\n console.error(`A ${errorCategory} error occurred: `, error)\n return notification.error({\n message: `${errorCategory} error`,\n description: notificationMsg,\n duration: 3\n })\n\n case NotificationType.CONSOLE:\n console.error(`A ${errorCategory} error occurred: `, error)\n break\n\n default:\n }\n }\n}\n\nexport default new NotificationMiddleware()\n","import React from 'react'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport Description from './Description'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\n\ninterface SlideItemProps {\n clients: { [key: string]: DicomWebManager }\n slide: Slide\n}\n\ninterface SlideItemState {\n isLoading: boolean\n}\n\n/**\n * React component representing a DICOM Series Information Entity that displays\n * common series-level attributes of contained DICOM Slide Microscopy images\n * as well as the OVERVIEW image (if available).\n * When selected a Slide Viewer instance is created for the display of the\n * contained images.\n */\nclass SlideItem extends React.Component {\n state = { isLoading: false }\n\n private readonly overviewViewportRef = React.createRef()\n\n private overviewViewer?: dmv.viewer.OverviewImageViewer\n\n constructor (props: SlideItemProps) {\n super(props)\n this.overviewViewer = undefined\n }\n\n componentDidMount (): void {\n this.setState({ isLoading: true })\n if (this.props.slide.overviewImages.length > 0) {\n const metadata = this.props.slide.overviewImages[0]\n if (this.overviewViewportRef.current !== null) {\n this.overviewViewportRef.current.innerHTML = ''\n console.info(\n 'instantiate viewer for OVERVIEW image of slide ' +\n `\"${metadata.ContainerIdentifier}\"`\n )\n this.overviewViewer = new dmv.viewer.OverviewImageViewer({\n client: this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ],\n metadata: metadata,\n resizeFactor: 1,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n this.overviewViewer.render({\n container: this.overviewViewportRef.current\n })\n }\n }\n\n this.setState({ isLoading: false })\n }\n\n render (): React.ReactNode {\n if (this.overviewViewer !== undefined) {\n this.overviewViewer.resize()\n }\n const attributes = []\n const description = this.props.slide.description\n if (description != null && description !== '') {\n attributes.push({\n name: 'Description',\n value: description\n })\n }\n if (this.state.isLoading) {\n return ()\n }\n\n /* Properties need to be propagated down to Menu.Item:\n * https://github.com/react-component/menu/issues/142\n */\n return (\n \n \n {(this.overviewViewportRef.current != null) &&
}\n \n \n )\n }\n}\n\nexport default SlideItem\n","import React from 'react'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport SlideItem from './SlideItem'\nimport { Slide } from '../data/slides'\n\ninterface SlideListProps {\n metadata: Slide[]\n clients: { [key: string]: DicomWebManager }\n selectedSeriesInstanceUID: string\n onSeriesSelection: (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ) => void\n}\n\ninterface SlideListState {\n selectedSeriesInstanceUID: string\n}\n\n/**\n * React component representing a list of DICOM Series Information Entities.\n */\nclass SlideList extends React.Component {\n state = {\n selectedSeriesInstanceUID: this.props.selectedSeriesInstanceUID\n }\n\n componentDidMount (): void {\n this.props.onSeriesSelection({\n seriesInstanceUID: this.state.selectedSeriesInstanceUID\n })\n }\n\n render (): React.ReactNode {\n const slideList = this.props.metadata\n const slideItemList = []\n for (let i = 0; i < slideList.length; ++i) {\n const slide = slideList[i]\n const slideItem = (\n \n )\n\n slideItemList.push(slideItem)\n }\n\n const handleMenuItemSelection = ({ key, keyPath, domEvent, selectedKeys }: {\n key: React.ReactText\n keyPath: React.ReactText[]\n domEvent: React.MouseEvent | React.KeyboardEvent\n selectedKeys?: React.ReactText[]\n }): void => {\n console.info(`select slide \"${key}\"`)\n this.setState({ selectedSeriesInstanceUID: key.toString() })\n this.props.onSeriesSelection({ seriesInstanceUID: key.toString() })\n }\n\n let selectedKeys\n if (this.state.selectedSeriesInstanceUID !== undefined &&\n this.state.selectedSeriesInstanceUID !== null) {\n selectedKeys = [this.state.selectedSeriesInstanceUID]\n }\n\n return (\n \n {slideItemList}\n \n )\n }\n}\n\nexport default SlideList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Menu, Space, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface AnnotationItemProps {\n roi: dmv.roi.ROI\n index: number\n isVisible: boolean\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n}\n\n/**\n * React component representing a Region of Interest (ROI) annotation.\n */\nclass AnnotationItem extends React.Component {\n constructor (props: AnnotationItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n roiUID: this.props.roi.uid,\n isVisible: checked\n })\n }\n\n render (): React.ReactNode {\n const identifier = `ROI ${this.props.index + 1}`\n const attributes: Array<{ name: string, value: string }> = []\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const { isVisible, onVisibilityChange, ...otherProps } = this.props\n this.props.roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n this.props.roi.measurements.forEach(item => {\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n const seq = item.MeasuredValueSequence[0]\n const value = seq.NumericValue.toPrecision(6)\n const unit = seq.MeasurementUnitsCodeSequence[0].CodeValue\n attributes.push({\n name: name,\n value: `${value} ${unit}`\n })\n })\n return (\n \n
\n }\n unCheckedChildren={}\n />\n
\n \n \n \n
\n )\n }\n}\n\nexport default AnnotationItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport AnnotationItem from './AnnotationItem'\n\ninterface AnnotationListProps {\n rois: dmv.roi.ROI[]\n selectedRoiUIDs: Set\n visibleRoiUIDs: Set\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n onSelection: ({ roiUID }: { roiUID: string }) => void\n}\n\n/**\n * React component representing a list of Region of Interest (ROI)\n * annotations.\n */\nclass AnnotationList extends React.Component {\n constructor (props: AnnotationListProps) {\n super(props)\n this.handleMenuItemSelection = this.handleMenuItemSelection.bind(this)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n if (checked) {\n this.props.rois.forEach(roi => {\n this.props.onVisibilityChange({ roiUID: roi.uid, isVisible: checked })\n })\n } else {\n this.props.visibleRoiUIDs.forEach(roiUID => {\n this.props.onVisibilityChange({ roiUID, isVisible: checked })\n })\n }\n }\n\n handleMenuItemSelection (object: any): void {\n this.props.onSelection({ roiUID: object.key })\n }\n\n render (): React.ReactNode {\n const items = this.props.rois.map((roi, index) => (\n \n ))\n\n return (\n <>\n
\n 0}\n checkedChildren={}\n unCheckedChildren={}\n />\n
\n \n {items}\n \n \n )\n }\n}\n\nexport default AnnotationList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Select,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Description from './Description'\n\ninterface AnnotationGroupItemProps {\n annotationGroup: dmv.annotation.AnnotationGroup\n isVisible: boolean\n metadata: dmv.metadata.MicroscopyBulkSimpleAnnotations\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\ninterface AnnotationGroupItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass AnnotationGroupItem extends React.Component {\n constructor (props: AnnotationGroupItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleMeasurementSelection = this.handleMeasurementSelection.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n annotationGroupUID: this.props.annotationGroup.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color,\n limitValues: this.state.currentStyle.limitValues\n }\n })\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { limitValues: values }\n })\n }\n\n handleMeasurementSelection (value?: string, option?: any): void {\n if (value != null && option.children != null) {\n const codeComponents = value.split('-')\n const measurement = new dcmjs.sr.coding.CodedConcept({\n value: codeComponents[1],\n schemeDesignator: codeComponents[0],\n meaning: option.children\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { measurement }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n measurement\n }\n }))\n } else {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n color: this.props.defaultStyle.color\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n color: this.props.defaultStyle.color,\n limitValues: undefined\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const index = this.props.metadata.AnnotationGroupSequence.findIndex(\n item => (item.AnnotationGroupUID === this.props.annotationGroup.uid)\n )\n const item = this.props.metadata.AnnotationGroupSequence[index]\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property type',\n value: this.props.annotationGroup.propertyType.CodeMeaning\n },\n {\n name: 'Property category',\n value: this.props.annotationGroup.propertyCategory.CodeMeaning\n },\n // {\n // name: 'Algorithm Name',\n // value: this.props.annotationGroup.algorithmName\n // },\n {\n name: 'Graphic type',\n value: item.GraphicType\n },\n {\n name: 'Annotation coordinate type',\n value: this.props.metadata.AnnotationCoordinateType\n }\n ]\n\n const measurementsSequence = item.MeasurementsSequence ?? []\n const measurementOptions = measurementsSequence.map((measurementItem, i) => {\n const name = measurementItem.ConceptNameCodeSequence[0]\n return (\n \n {name.CodeMeaning}\n \n )\n })\n measurementOptions.push(\n \n <>\n \n )\n\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n \n )\n }\n\n let windowSettings\n let explorationSettings\n if (measurementsSequence.length > 0) {\n if (this.state.currentStyle.limitValues != null) {\n // TODO: need to get default min/max values from viewer first\n const minValue = 0\n const maxValue = 1000\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n explorationSettings = (\n <>\n \n Exploration\n \n \n \n Measurement\n \n \n \n {measurementOptions}\n \n \n \n \n )\n }\n\n const settings = (\n
\n {colorSettings}\n {windowSettings}\n \n \n Opacity\n \n \n \n \n \n \n \n \n {explorationSettings}\n
\n )\n\n const color = this.getCurrentColor()\n const isBadgeVisible = (\n this.state.isVisible && this.state.currentStyle.measurement == null\n )\n const {\n annotationGroup,\n defaultStyle,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n \n \n
\n \n )\n }\n}\n\nexport default AnnotationGroupItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport AnnotationGroupItem from './AnnotationGroupItem'\n\ninterface AnnotationGroupListProps {\n annotationGroups: dmv.annotation.AnnotationGroup[]\n visibleAnnotationGroupUIDs: Set\n metadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n }\n defaultAnnotationGroupStyles: {\n [annotationGroupUID: string]: {\n opacity: number\n color: number[]\n }\n }\n onAnnotationGroupVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onAnnotationGroupStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\n/**\n * React component representing a list of Annotation Groups.\n */\nclass AnnotationGroupList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.annotationGroups.map((annotationGroup, index) => {\n const uid = annotationGroup.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default AnnotationGroupList\n","import React from 'react'\nimport { Button as Btn, Divider, Tooltip } from 'antd'\n\ninterface ButtonProps {\n icon: any\n tooltip?: string\n label?: string\n onClick?: (options: any) => void\n isSelected?: boolean\n}\n\n/**\n * React component for a button.\n */\nclass Button extends React.Component {\n constructor (props: ButtonProps) {\n super(props)\n this.handleClick = this.handleClick.bind(this)\n }\n\n handleClick (event: React.SyntheticEvent): void {\n if (this.props.onClick !== undefined) {\n this.props.onClick(event)\n }\n }\n\n render (): React.ReactNode {\n const Icon = this.props.icon\n if (Icon === undefined) {\n return null\n }\n\n let text\n if (this.props.label != null) {\n text = (\n <>\n \n {this.props.label}\n \n )\n }\n\n let button\n if (this.props.isSelected ?? false) {\n button = (\n }\n type='primary'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n } else {\n button = (\n }\n type='default'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n }\n\n if (this.props.tooltip !== undefined) {\n return (\n \n {button}\n \n )\n } else {\n return button\n }\n }\n}\n\nexport default Button\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface EquipmentProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n}\n\n/**\n * React component representing a list of DICOM Equipment Entities.\n */\nclass Equipment extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const attributes = [\n {\n name: 'Manufacturer',\n value: this.props.metadata.Manufacturer\n },\n {\n name: 'Model Name',\n value: this.props.metadata.ManufacturerModelName\n },\n {\n name: 'Device Serial Number',\n value: this.props.metadata.DeviceSerialNumber\n },\n {\n name: 'Software Versions',\n value: this.props.metadata.SoftwareVersions\n }\n ]\n if (this.props.metadata.InstitutionName != null) {\n attributes.push({\n name: 'Institution Name',\n value: this.props.metadata.InstitutionName\n })\n }\n return \n }\n}\n\nexport default Equipment\n","import * as dcmjs from 'dcmjs'\n\n/**\n * Check whether a DICOM SR content item has a given name.\n *\n * @param item - Content item\n * @param name - Coded name that should be compared\n * @returns Whether the content item has the given name\n */\nconst hasName = (\n item: dcmjs.sr.valueTypes.ContentItem,\n name: dcmjs.sr.coding.CodedConcept\n): boolean => {\n const concept = item.ConceptNameCodeSequence[0]\n return (\n concept.CodeValue === name.CodeValue &&\n concept.CodingSchemeDesignator === name.CodingSchemeDesignator\n )\n}\n\n/**\n * Check whether a DICOM SR content item has a given value type.\n *\n * @param item - Content item\n * @param valueType - Value Type\n * @returns Whether the content item has the given value type\n */\nconst hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: dcmjs.sr.valueTypes.ValueTypes\n): boolean => {\n console.log(item.ValueType, valueType)\n return item.ValueType === valueType\n}\n\n/**\n * Find content items in a DICOM SR document given their name.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param name - Coded name that should be compared\n * @returns Matched content items\n */\nexport const findContentItemsByName = (\n { content, name }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n name: dcmjs.sr.coding.CodedConcept\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasName(i, name)) {\n items.push(i)\n }\n })\n return items\n}\n\n/**\n * Find content items in a DICOM SR document given their value type.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param valueType - Value Type\n * @returns Matched content items\n */\nexport const findContentItemsByValueType = (\n { content, valueType }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n valueType: dcmjs.sr.valueTypes.ValueTypes\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, valueType)) {\n items.push(i)\n }\n })\n return items\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Divider } from 'antd'\nimport { v4 as generateUUID } from 'uuid'\n\nimport Description from './Description'\nimport Patient from './Patient'\nimport Study from './Study'\nimport { findContentItemsByName } from '../utils/sr'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nexport const hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: string\n): boolean => {\n return item.ValueType === valueType\n}\n\nconst findMeasurementItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.NumContentItem[] => {\n const items: dcmjs.sr.valueTypes.NumContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.NUM)) {\n const measurement = i as dcmjs.sr.valueTypes.NumContentItem\n items.push(measurement)\n }\n })\n return items\n}\n\nconst findEvaluationItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.CodeContentItem[] => {\n const items: dcmjs.sr.valueTypes.CodeContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.CODE)) {\n const evaluation = i as dcmjs.sr.valueTypes.CodeContentItem\n items.push(evaluation)\n }\n })\n return items\n}\n\nconst getROIs = (report: dmv.metadata.Comprehensive3DSR): dmv.roi.ROI[] => {\n // TID 1500 Measurement Report\n const matches = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (matches.length !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Imaging Measurements\" not found.' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\".'\n )\n )\n }\n const measurementsItem = matches[0] as dcmjs.sr.valueTypes.ContainerContentItem\n // TID 1410 Planar ROI Measurements and Qualitative Evaluations\n const measurementGroupItems = findContentItemsByName({\n content: measurementsItem.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n const rois: dmv.roi.ROI[] = []\n measurementGroupItems.forEach((item) => {\n const evaluations = []\n let observerType: string\n const group = item as dcmjs.sr.valueTypes.ContainerContentItem\n let items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '112040',\n schemeDesignator: 'DCM',\n meaning: 'Tracking Unique Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Tracking Unique Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const trackingUIDItem = items[0] as dcmjs.sr.valueTypes.UIDRefContentItem\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n schemeDesignator: 'DCM',\n meaning: 'Finding'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Finding\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111001',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Name'\n })\n })\n if (items.length !== 0) {\n const algorithmNameItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmNameItem)\n observerType = 'Device'\n } else {\n observerType = 'Person'\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111003',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Version'\n })\n })\n if (items.length !== 0) {\n const algorithmVersionItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmVersionItem)\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const regionItem = items[0] as dcmjs.sr.valueTypes.Scoord3DContentItem\n let scoord3d: any\n if (regionItem.GraphicType === 'POINT') {\n scoord3d = new dmv.scoord3d.Point({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: regionItem.GraphicData\n })\n } else {\n const coordinates: number[][] = []\n for (let i = 0; i < regionItem.GraphicData.length; i += 3) {\n coordinates.push(regionItem.GraphicData.slice(i, i + 3))\n }\n if (regionItem.GraphicType === 'POLYGON') {\n scoord3d = new dmv.scoord3d.Polygon({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'MULTIPOINT') {\n scoord3d = new dmv.scoord3d.MultiPoint({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'POLYLINE') {\n scoord3d = new dmv.scoord3d.Polyline({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSE') {\n scoord3d = new dmv.scoord3d.Ellipse({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSOID') {\n scoord3d = new dmv.scoord3d.Ellipsoid({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" has unknown graphic type ' +\n `\"${regionItem.GraphicType}\". ` +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n }\n\n evaluations.push(\n ...findEvaluationItems({ content: group.ContentSequence })\n )\n const measurements = findMeasurementItems({\n content: group.ContentSequence\n })\n\n const roi = new dmv.roi.ROI({\n scoord3d: scoord3d,\n uid: generateUUID(),\n properties: {\n trackingUID: trackingUIDItem.UID,\n observerType: observerType,\n evaluations: evaluations,\n measurements: measurements\n }\n })\n rois.push(roi)\n })\n return rois\n}\n\nclass MeasurementReport {\n public PersonObserverName?: string\n\n public PersonObserverLoginName?: string\n\n public DeviceObserverUID?: string\n\n public DeviceObserverName?: string\n\n public SpecimenUID: string\n\n public SpecimenIdentifier: string\n\n public ContainerIdentifier: string\n\n public ROIs: dmv.roi.ROI[] = []\n\n constructor (report: dmv.metadata.Comprehensive3DSR) {\n let items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121039',\n schemeDesignator: 'DCM',\n meaning: 'Specimen UID'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen UID\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.SpecimenUID = specimenUIDItem.UID\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.SpecimenIdentifier = specimenIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111700',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Container Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Container Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const containerIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.ContainerIdentifier = containerIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121008',\n schemeDesignator: 'DCM',\n meaning: 'Person Observer Name'\n })\n })\n if (items.length !== 0) {\n const personNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.PNameContentItem\n )\n this.PersonObserverName = personNameItem.PersonName\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '128774',\n schemeDesignator: 'DCM',\n meaning: \"Person Observer's Login Name\"\n })\n })\n if (items.length !== 0) {\n const personLoginNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.PersonObserverLoginName = personLoginNameItem.TextValue\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121012',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer UID'\n })\n })\n if (items.length > 0) {\n const deviceUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.DeviceObserverUID = deviceUIDItem.UID\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121013',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer Name'\n })\n })\n if (items.length !== 0) {\n const deviceNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.DeviceObserverName = deviceNameItem.TextValue\n }\n\n this.ROIs = getROIs(report)\n }\n}\n\ninterface ReportProps {\n dataset: dmv.metadata.Comprehensive3DSR\n}\n\n/**\n * React component representing a DICOM SR document that displays the\n * document content (a selected subset of content items).\n */\nclass Report extends React.Component {\n render (): React.ReactNode {\n const report = new MeasurementReport(this.props.dataset)\n const containerAttrs = [\n {\n name: 'ID',\n value: report.ContainerIdentifier\n }\n ]\n const specimenAttrs = [\n {\n name: 'ID',\n value: report.SpecimenIdentifier\n }\n ]\n const observerAttrs = [\n {\n name: 'Name',\n value: report.PersonObserverName\n }\n ]\n const annotations = report.ROIs.map(\n (roi, index): React.ReactNode => {\n const id = `Region ${index + 1}`\n const attrs: Array<{ name: string, value: string }> = []\n roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem\n )\n ) => {\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.ConceptCodeSequence[0].CodeMeaning\n })\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.TextValue\n })\n }\n })\n return \n }\n )\n\n return (\n
\n Patient\n \n Case\n \n Slide\n \n Specimen\n \n Observer\n \n Annotations\n {annotations}\n
\n )\n }\n}\n\nexport default Report\nexport { MeasurementReport }\n","import React from 'react'\nimport { List } from 'antd'\n\nimport Description, { Attribute, AttributeGroup } from './Description'\n\ninterface ItemProps {\n uid: string\n identifier: string\n attributes: Attribute[]\n groups?: AttributeGroup[]\n children?: React.ReactElement[]\n type?: string\n hasLongValues?: boolean\n}\n\n/**\n * React component for a list item that consists of a header element\n * containing an identifier and a body element containing a description list\n * of attributes rendered as name-value pairs.\n */\nclass Item extends React.Component {\n render (): React.ReactNode {\n let groups = null\n if (this.props.groups !== undefined) {\n groups = this.props.groups.map((item, index: number) => (\n \n ))\n }\n let title\n if (this.props.type !== undefined) {\n title = `${this.props.type}: ${this.props.identifier}`\n } else {\n title = this.props.identifier\n }\n return (\n \n \n {groups}\n
\n {this.props.children}\n \n )\n }\n}\n\nexport default Item\n","import * as dcmjs from 'dcmjs'\n\nexport const SpecimenPreparationTypes: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n COLLECTION: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING: new dcmjs.sr.coding.CodedConcept({\n value: '433465004',\n schemeDesignator: 'SCT',\n meaning: 'Sampling of tissue specimen'\n }),\n STAINING: new dcmjs.sr.coding.CodedConcept({\n value: '127790008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen staining'\n }),\n PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '9265001',\n schemeDesignator: 'SCT',\n meaning: 'Specimen processing'\n })\n}\n\nexport const SpecimenPreparationAdditives: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n FIXATIVE: new dcmjs.sr.coding.CodedConcept({\n value: '430864009',\n schemeDesignator: 'SCT',\n meaning: 'Tissue fixative'\n }),\n EMBEDDING_MEDIUM: new dcmjs.sr.coding.CodedConcept({\n value: '430863003',\n schemeDesignator: 'SCT',\n meaning: 'Embedding medium'\n })\n}\n\nexport const SpecimenPreparationStepItems: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen identifier'\n }),\n PARENT_SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '111705',\n schemeDesignator: 'DCM',\n meaning: 'Parent specimen identifier'\n }),\n PROCESSING_TYPE: new dcmjs.sr.coding.CodedConcept({\n value: '111701',\n schemeDesignator: 'DCM',\n meaning: 'Processing type'\n }),\n DATETIME_OF_PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '111702',\n schemeDesignator: 'DCM',\n meaning: 'Datetime of processing'\n }),\n PROCESSING_STEP_DESCRIPTION: new dcmjs.sr.coding.CodedConcept({\n value: '111703',\n schemeDesignator: 'DCM',\n meaning: 'Processing step description'\n }),\n COLLECTION_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '111704',\n schemeDesignator: 'DCM',\n meaning: 'Sampling method'\n }),\n STAIN: new dcmjs.sr.coding.CodedConcept({\n value: '424361007',\n schemeDesignator: 'SCT',\n meaning: 'Using substance'\n }),\n ...SpecimenPreparationAdditives\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Item from './Item'\nimport { Attribute } from './Description'\nimport { SpecimenPreparationStepItems } from '../data/specimens'\n\ninterface SpecimenItemProps {\n index: number\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a DICOM Specimen Information Entity and\n * displays specimen-related attributes of a DICOM Slide Microscopy image.\n */\nclass SpecimenItem extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const specimenDescription = this.props.metadata.SpecimenDescriptionSequence[\n this.props.index\n ]\n const attributes: Attribute[] = []\n if (specimenDescription.SpecimenShortDescription !== undefined) {\n attributes.push({\n name: 'Description',\n value: specimenDescription.SpecimenShortDescription\n })\n }\n if (specimenDescription.PrimaryAnatomicStructureSequence !== undefined) {\n if (specimenDescription.PrimaryAnatomicStructureSequence.length > 0) {\n const structures = specimenDescription.PrimaryAnatomicStructureSequence\n attributes.push({\n name: 'Anatomical structure',\n value: structures.map(item => item.CodeMeaning).join(', ')\n })\n }\n }\n\n // TID 8001 \"Specimen Preparation\"\n const preparationSteps: dmv.metadata.SpecimenPreparation[] = (\n specimenDescription.SpecimenPreparationSequence ?? []\n )\n preparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (\n name.equals(SpecimenPreparationStepItems.COLLECTION_METHOD)\n ) {\n attributes.push({\n name: 'Collection method',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.FIXATIVE)\n ) {\n attributes.push({\n name: 'Tissue fixative',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.EMBEDDING_MEDIUM)\n ) {\n attributes.push({\n name: 'Tissue embedding medium',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.PARENT_SPECIMEN_IDENTIFIER)\n ) {\n attributes.push({\n name: 'Parent specimen',\n value: item.TextValue\n })\n }\n }\n })\n }\n )\n const uid = specimenDescription.SpecimenUID\n const identifier = specimenDescription.SpecimenIdentifier\n return (\n \n )\n }\n}\n\nexport default SpecimenItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { List } from 'antd'\n\nimport SpecimenItem from './SpecimenItem'\n\ninterface SpecimenListProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a list of DICOM Specimen Information Entities.\n */\nclass SpecimenList extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n /*\n * Specimen Description Sequence is a type 1 attribute. However, it is\n * nevertheless missing in some data sets. This is a violation of the\n * standard, but it may be better to facilitate display of the data.\n */\n const descriptions = this.props.metadata.SpecimenDescriptionSequence ?? []\n const items = descriptions.map(\n (item: dmv.metadata.SpecimenDescription, index: number) => {\n return (\n \n )\n }\n )\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SpecimenList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch,\n Tooltip\n} from 'antd'\nimport {\n DeleteOutlined,\n EyeOutlined,\n EyeInvisibleOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport Description from './Description'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport { SpecimenPreparationStepItems } from '../data/specimens'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\ninterface OpticalPathItemProps {\n opticalPath: dmv.opticalPath.OpticalPath\n metadata: dmv.metadata.VLWholeSlideMicroscopyImage[]\n isVisible: boolean\n isRemovable: boolean\n defaultStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n onVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n }) => void\n onRemoval: (opticalPathIdentifier: string) => void\n}\n\ninterface OpticalPathItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n}\n\n/**\n * React component representing an optical path of a\n * multi-channel acquistion with control of visualization parameters.\n */\nclass OpticalPathItem extends React.Component {\n constructor (props: OpticalPathItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleLimitChange = this.handleLimitChange.bind(this)\n this.handleLowerLimitChange = this.handleLowerLimitChange.bind(this)\n this.handleUpperLimitChange = this.handleUpperLimitChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.handleRemoval = this.handleRemoval.bind(this)\n this.getCurrentColors = this.getCurrentColors.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color,\n paletteColorLookupTable: this.props.defaultStyle.paletteColorLookupTable,\n limitValues: this.props.defaultStyle.limitValues\n }\n }\n }\n\n componentDidUpdate (\n previousProps: OpticalPathItemProps,\n previousState: OpticalPathItemState\n ): void {\n if (this.props.defaultStyle !== previousProps.defaultStyle) {\n this.setState({\n currentStyle: this.props.defaultStyle\n })\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState({\n isVisible: checked\n })\n this.props.onVisibilityChange({\n opticalPathIdentifier: identifier,\n isVisible: checked\n })\n }\n\n handleOpacityChange (\n value: number | null\n ): void {\n if (value != null) {\n const identifier = this.props.opticalPath.identifier\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { opacity: value }\n })\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: value,\n limitValues: state.currentStyle.limitValues\n }\n }))\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColors (): string[] {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.props.defaultStyle.paletteColorLookupTable != null) {\n const colormap = this.props.defaultStyle.paletteColorLookupTable.data\n return colormap.map(values => rgb2hex(values))\n } else if (this.state.currentStyle.color != null) {\n return [\n '#000000',\n rgb2hex(this.state.currentStyle.color)\n ]\n } else {\n return ['white', 'white']\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { limitValues: values }\n })\n }\n\n handleRemoval (): void {\n const identifier = this.props.opticalPath.identifier\n this.props.onRemoval(identifier)\n }\n\n render (): React.ReactNode {\n const identifier = this.props.opticalPath.identifier\n const description = this.props.opticalPath.description\n const attributes: Array<{ name: string, value: string }> = []\n if (this.props.opticalPath.illuminationWaveLength !== undefined) {\n attributes.push(\n {\n name: 'Illumination wavelength',\n value: `${this.props.opticalPath.illuminationWaveLength} nm`\n }\n )\n }\n if (this.props.opticalPath.illuminationColor !== undefined) {\n attributes.push(\n {\n name: 'Illumination color',\n value: this.props.opticalPath.illuminationColor.CodeMeaning\n }\n )\n }\n\n // TID 8001 \"Specimen Preparation\"\n const specimenDescriptions: dmv.metadata.SpecimenDescription[] = (\n this.props.metadata[0].SpecimenDescriptionSequence ?? []\n )\n try {\n specimenDescriptions.forEach(description => {\n const specimenPreparationSteps: dmv.metadata.SpecimenPreparation[] =\n description.SpecimenPreparationSequence ?? []\n specimenPreparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n }\n }\n }\n })\n }\n )\n })\n } catch (error: any) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DCMJS,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n error.message\n )\n )\n }\n\n const maxValue = Math.pow(2, this.props.metadata[0].BitsAllocated) - 1\n\n const title = (\n description != null ? `${identifier}: ${description}` : identifier\n )\n let settings\n let item\n if (this.props.opticalPath.isMonochromatic) {\n // monochrome images that can be pseudo-colored\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n )\n } else {\n colorSettings = (\n <>\n \n Color\n \n Custom pseudo-coloring is disabled because pixels are colorized via\n a provided palette color lookup table.\n \n )\n }\n\n let windowSettings\n if (this.state.currentStyle.limitValues != null) {\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n settings = (\n
\n {windowSettings}\n {colorSettings}\n \n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n const colors = this.getCurrentColors()\n item = (\n \n \n \n )\n } else {\n // color images\n settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n item = (\n \n )\n }\n\n const buttons = []\n if (this.props.isRemovable) {\n buttons.push(\n \n }\n onClick={this.handleRemoval}\n />\n \n )\n }\n\n const {\n defaultStyle,\n isRemovable,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n onRemoval,\n opticalPath,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n {buttons}\n \n
\n {item}\n
\n \n )\n }\n}\n\nexport default OpticalPathItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Button as Btn, Menu, Select, Space, Tooltip } from 'antd'\nimport { AppstoreAddOutlined } from '@ant-design/icons'\n\nimport OpticalPathItem from './OpticalPathItem'\n\nconst { Option } = Select\n\ninterface OpticalPathListProps {\n opticalPaths: dmv.opticalPath.OpticalPath[]\n metadata: {\n [opticalPathIdentifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n }\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n defaultOpticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n }\n onOpticalPathVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onOpticalPathStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }) => void\n onOpticalPathActivityChange: ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }) => void\n selectedPresentationStateUID?: string\n}\n\ninterface OpticalPathListState {\n selectedOpticalPathIdentifier?: string\n}\n\n/**\n * React component representing a list of optical paths.\n */\nclass OpticalPathList extends React.Component {\n state = {\n selectedOpticalPathIdentifier: undefined\n }\n\n constructor (props: OpticalPathListProps) {\n super(props)\n this.handleItemAddition = this.handleItemAddition.bind(this)\n this.handleItemRemoval = this.handleItemRemoval.bind(this)\n this.handleItemSelectionChange = this.handleItemSelectionChange.bind(this)\n }\n\n /**\n * Handler that gets called when an optical path should be removed.\n */\n handleItemRemoval (opticalPathIdentifier: string): void {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier,\n isActive: false\n })\n }\n\n /**\n * Handler that gets called when the selection of an optical path should change.\n */\n handleItemSelectionChange (\n value: string\n ): void {\n this.setState({ selectedOpticalPathIdentifier: value })\n }\n\n /**\n * Handler that gets called when an optical path should be added.\n */\n handleItemAddition (): void {\n const identifier = this.state.selectedOpticalPathIdentifier\n if (identifier !== undefined) {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier: identifier,\n isActive: true\n })\n this.setState({ selectedOpticalPathIdentifier: undefined })\n }\n }\n\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n\n const isSelectable = this.props.opticalPaths.length > 1\n const opticalPathItems: React.ReactNode[] = []\n const optionItems: React.ReactNode[] = []\n this.props.opticalPaths.forEach(opticalPath => {\n const opticalPathIdentifier = opticalPath.identifier\n const images = this.props.metadata[opticalPathIdentifier]\n const seriesInstanceUID = images[0].SeriesInstanceUID\n images[0].OpticalPathSequence.forEach(opticalPathItem => {\n const id = opticalPathItem.OpticalPathIdentifier\n const description = opticalPathItem.OpticalPathDescription\n if (opticalPath.identifier === id) {\n if (this.props.activeOpticalPathIdentifiers.has(id)) {\n opticalPathItems.push(\n \n )\n } else {\n let title\n if (description !== '') {\n title = `${id} - ${description}`\n } else {\n title = `${id}`\n }\n optionItems.push(\n \n )\n }\n }\n })\n })\n\n let opticalPathSelector\n if (isSelectable) {\n opticalPathSelector = (\n \n \n {optionItems}\n \n \n }\n type='primary'\n onClick={this.handleItemAddition}\n />\n \n \n )\n }\n\n return (\n \n {opticalPathItems}\n {opticalPathSelector}\n \n )\n }\n}\n\nexport default OpticalPathList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface MappingItemProps {\n mapping: dmv.mapping.ParameterMapping\n metadata: dmv.metadata.ParametricMap[]\n isVisible: boolean\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\ninterface MappingItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Real World Value Mapping.\n */\nclass MappingItem extends React.Component {\n constructor (props: MappingItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n mappingUID: this.props.mapping.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n mappingUID: this.props.mapping.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: value\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Description',\n value: this.props.mapping.description\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n mapping,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n \n
\n \n
\n \n )\n }\n}\n\nexport default MappingItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport MappingItem from './MappingItem'\n\ninterface MappingListProps {\n mappings: dmv.mapping.ParameterMapping[]\n metadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n }\n visibleMappingUIDs: Set\n defaultMappingStyles: {\n [mappingUID: string]: { opacity: number }\n }\n onMappingVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onMappingStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Real World Value Mappings.\n */\nclass MappingList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.mappings.map((mapping, index) => {\n const uid = mapping.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default MappingList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface SegmentItemProps {\n segment: dmv.segment.Segment\n isVisible: boolean\n metadata: dmv.metadata.Segmentation[]\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\ninterface SegmentItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Segment.\n */\nclass SegmentItem extends React.Component {\n constructor (props: SegmentItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: { opacity: this.props.defaultStyle.opacity }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n segmentUID: this.props.segment.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n segmentUID: this.props.segment.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({ currentStyle: { opacity: value } })\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property Type',\n value: this.props.segment.propertyType.CodeMeaning\n },\n {\n name: 'Property Category',\n value: this.props.segment.propertyCategory.CodeMeaning\n },\n {\n name: 'Algorithm Name',\n value: this.props.segment.algorithmName\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n segment,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n
\n \n )\n }\n}\n\nexport default SegmentItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport SegmentItem from './SegmentItem'\n\ninterface SegmentListProps {\n segments: dmv.segment.Segment[]\n visibleSegmentUIDs: Set\n metadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n }\n defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n }\n onSegmentVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onSegmentStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Segments.\n */\nclass SegmentList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.segments.map((segment, index) => {\n const uid = segment.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SegmentList\n","import React from 'react'\nimport {\n NavigateFunction,\n Params,\n useLocation,\n useNavigate,\n useParams,\n Location\n} from 'react-router-dom'\n\nexport interface RouteComponentProps {\n location: Location\n navigate: NavigateFunction\n params: Params\n}\n\nexport function withRouter (Component: React.ComponentType): Function {\n function ComponentWithRouterProp (props: any): JSX.Element {\n const location = useLocation()\n const navigate = useNavigate()\n const params = useParams()\n return (\n \n )\n }\n return ComponentWithRouterProp\n}\n","import React from 'react'\nimport { Col, Divider, InputNumber, Row, Slider } from 'antd'\n\ninterface ColorSettingsMenuProps {\n annotationGroupsUIDs: string[]\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onStyleChange: Function\n}\n\ninterface ColorSettingsMenuState {\n currentStyle: {\n opacity: number\n color?: number[]\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass ColorSettingsMenu extends React.Component<\nColorSettingsMenuProps,\nColorSettingsMenuState\n> {\n constructor (props: ColorSettingsMenuProps) {\n super(props)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: this.state.currentStyle.color,\n opacity: value\n }\n })\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color\n }\n })\n }\n }\n\n handleColorRChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorGChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorBChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n render (): React.ReactNode {\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n Color\n \n Red\n \n \n \n \n \n \n \n\n \n Green\n \n \n \n \n \n \n \n\n \n Blue\n \n \n \n \n \n \n \n \n \n )\n }\n\n return (\n
\n {colorSettings}\n \n Opacity\n \n \n \n \n \n \n \n
\n )\n }\n}\n\nexport default ColorSettingsMenu\n","import React from 'react'\nimport { Menu, Space, Checkbox, Tooltip, Popover, Button } from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { Category, Type } from './AnnotationCategoryList'\nimport ColorSettingsMenu from './ColorSettingsMenu'\n\nconst AnnotationCategoryItem = ({\n category,\n onChange,\n checkedAnnotationUids,\n onStyleChange,\n defaultAnnotationStyles\n}: {\n category: Category\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const { types } = category\n\n const onCheckCategoryChange = (e: any): void => {\n const isVisible = e.target.checked\n types.forEach((type: Type) => {\n handleChangeCheckedType({ type, isVisible })\n })\n }\n\n const checkAll = types.every((type: Type) =>\n type.uids.every((uid: string) => checkedAnnotationUids.has(uid))\n )\n const indeterminate =\n !checkAll &&\n types.some((type: Type) =>\n type.uids.some((uid: string) => checkedAnnotationUids.has(uid))\n )\n\n const handleChangeCheckedType = ({\n type,\n isVisible\n }: {\n type: Type\n isVisible: boolean\n }): void => {\n type.uids.forEach((uid: string) => {\n onChange({ roiUID: uid, isVisible })\n })\n }\n\n return (\n \n \n
\n \n \n \n {category.CodeMeaning}\n \n (\n {\n return [...acc, ...type.uids]\n },\n []\n )}\n onStyleChange={onStyleChange}\n defaultStyle={\n defaultAnnotationStyles[types[0].uids[0]]\n }\n />\n )}\n >\n }\n />\n \n \n \n {types.map((type: Type) => {\n const { CodeMeaning, CodingSchemeDesignator, CodeValue, uids } =\n type\n const shortenedCodeMeaning = CodeMeaning.slice(0, 22)\n const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`\n const isChecked = uids.every((uid: string) =>\n checkedAnnotationUids.has(uid)\n )\n const indeterminateType =\n !isChecked &&\n uids.some((uid: string) => checkedAnnotationUids.has(uid))\n return (\n \n \n handleChangeCheckedType({\n type,\n isVisible: e.target.checked\n })}\n />\n
\n \n {displayCodeMeaning}\n \n (\n \n )}\n >\n }\n />\n \n
\n
\n )\n })}\n
\n \n \n )\n}\n\nexport default AnnotationCategoryItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport AnnotationCategoryItem from './AnnotationCategoryItem'\n\nexport interface AnnotationCategoryAndType {\n uid: string\n type: Omit\n category: Omit\n}\nexport interface Type {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n uids: string[]\n}\nexport interface Category {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n types: Type[]\n}\n\nconst getCategories = (annotations: any): Record => {\n const categories = annotations?.reduce(\n (\n categoriesAcc: Record }>,\n annotation: AnnotationCategoryAndType\n ) => {\n const { category, type, uid } = annotation\n const categoryKey = category.CodeMeaning\n const typeKey = type.CodeMeaning\n\n const oldCategory = categoriesAcc[categoryKey] ?? {\n ...category,\n types: {}\n }\n const oldType = oldCategory.types[typeKey] ?? {\n ...type,\n uids: []\n }\n\n return {\n ...categoriesAcc,\n [categoryKey]: {\n ...oldCategory,\n types: {\n ...oldCategory.types,\n [typeKey]: { ...oldType, uids: [...oldType.uids, uid] }\n }\n }\n }\n },\n {}\n )\n\n // Normalizing types so that it's an array instead of an object:\n Object.keys(categories).forEach((categoryKey: string) => {\n const category = categories[categoryKey]\n const { types } = category\n const typesArr = Object.keys(types).map(\n (typeKey: string) => types[typeKey]\n )\n categories[categoryKey].types = typesArr\n })\n\n return categories\n}\n\nconst AnnotationCategoryList = ({\n annotations,\n onChange,\n onStyleChange,\n defaultAnnotationStyles,\n checkedAnnotationUids\n}: {\n annotations: AnnotationCategoryAndType[]\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const categories: Record = getCategories(annotations)\n\n if (Object.keys(categories).length === 0) {\n return <>\n }\n\n const items = Object.keys(categories).map((categoryKey: any) => {\n const category = categories[categoryKey]\n return (\n \n )\n })\n\n return {items}\n}\nexport default AnnotationCategoryList\n","const HoveredRoiTooltip = ({\n xPosition,\n yPosition,\n attributes\n}: {\n xPosition: number\n yPosition: number\n attributes: Array<{ name: string, value: string }>\n}): JSX.Element => {\n return (\n \n {attributes.map((attr) => (\n
\n {attr.name}: {attr.value}\n
\n ))}\n \n )\n}\n\nexport default HoveredRoiTooltip\n","import * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { AnnotationCategoryAndType } from '../components/AnnotationCategoryList'\n\nexport const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndType => {\n const { uid, evaluations } = roi\n\n const result = {\n category: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n },\n type: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n }\n }\n\n evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = codeContentItem.ConceptCodeSequence[0]\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n result.category = { ...value }\n } else if (nameValue === '121071') {\n result.type = { ...value }\n }\n }\n })\n\n return {\n ...result,\n uid\n }\n}\n","import React from 'react'\nimport {\n FaCrosshairs,\n FaDrawPolygon,\n FaEye,\n FaEyeSlash,\n FaHandPaper,\n FaHandPointer,\n FaTrash,\n FaSave\n} from 'react-icons/fa'\nimport {\n Button as Btn,\n Checkbox,\n Descriptions,\n Divider,\n InputNumber,\n message,\n Menu,\n Modal,\n Layout,\n Row,\n Select,\n Space,\n Tooltip\n} from 'antd'\nimport { UndoOutlined, CheckOutlined, StopOutlined } from '@ant-design/icons'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport * as dwc from 'dicomweb-client'\n\nimport DicomWebManager from '../DicomWebManager'\nimport AnnotationList from './AnnotationList'\nimport AnnotationGroupList from './AnnotationGroupList'\nimport Button from './Button'\nimport Equipment from './Equipment'\nimport Report, { MeasurementReport } from './Report'\nimport SpecimenList from './SpecimenList'\nimport OpticalPathList from './OpticalPathList'\nimport MappingList from './MappingList'\nimport SegmentList from './SegmentList'\nimport { AnnotationSettings } from '../AppConfig'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { findContentItemsByName } from '../utils/sr'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport AnnotationCategoryList from './AnnotationCategoryList'\nimport HoveredRoiTooltip from './HoveredRoiTooltip'\nimport { adaptRoiToAnnotation } from '../services/RoiToAnnotationAdapter'\n\nconst DEFAULT_ROI_STROKE_COLOR: number[] = [255, 234, 0] // [0, 126, 163]\nconst DEFAULT_ROI_FILL_COLOR: number[] = [255, 234, 0, 0.2] // [0, 126, 163, 0.2]\nconst DEFAULT_ROI_STROKE_WIDTH: number = 2\nconst DEFAULT_ROI_RADIUS: number = 5\n\nconst DEFAULT_ANNOTATION_OPACITY = 0.4\nconst DEFAULT_ANNOTATION_STROKE_COLOR = [0, 0, 0]\nconst DEFAULT_ANNOTATION_COLOR_PALETTE = [\n [54, 162, 235],\n [181, 65, 98],\n [75, 192, 192],\n [255, 158, 64],\n [153, 102, 254],\n [255, 205, 86],\n [200, 203, 207]\n]\n\nconst _buildKey = (concept: {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n CodingSchemeVersion?: string\n}): string => {\n const codingScheme = concept.CodingSchemeDesignator\n const codeValue = concept.CodeValue\n return `${codingScheme}-${codeValue}`\n}\n\nconst _getRoiKey = (roi: dmv.roi.ROI): string | undefined => {\n const matches = findContentItemsByName({\n content: roi.evaluations,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n })\n })\n if (matches.length === 0) {\n console.warn(`no finding found for ROI ${roi.uid}`)\n return\n }\n const finding = matches[0] as dcmjs.sr.valueTypes.CodeContentItem\n const findingName = finding.ConceptCodeSequence[0]\n return _buildKey(findingName)\n}\n\nconst _areROIsEqual = (a: dmv.roi.ROI, b: dmv.roi.ROI): boolean => {\n if (a.scoord3d.graphicType !== b.scoord3d.graphicType) {\n return false\n }\n if (a.scoord3d.frameOfReferenceUID !== b.scoord3d.frameOfReferenceUID) {\n return false\n }\n if (a.scoord3d.graphicData.length !== b.scoord3d.graphicData.length) {\n return false\n }\n\n const decimals = 6\n for (let i = 0; i < a.scoord3d.graphicData.length; ++i) {\n if (a.scoord3d.graphicType === 'POINT') {\n const s1 = a.scoord3d as dmv.scoord3d.Point\n const s2 = b.scoord3d as dmv.scoord3d.Point\n const c1 = s1.graphicData[i].toPrecision(decimals)\n const c2 = s2.graphicData[i].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n } else {\n const s1 = a.scoord3d as dmv.scoord3d.Polygon\n const s2 = b.scoord3d as dmv.scoord3d.Polygon\n for (let j = 0; j < s1.graphicData[i].length; ++j) {\n const c1 = s1.graphicData[i][j].toPrecision(decimals)\n const c2 = s2.graphicData[i][j].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n }\n }\n }\n return true\n}\n\nconst _formatRoiStyle = (style: {\n stroke?: {\n color?: number[]\n width?: number\n }\n fill?: {\n color?: number[]\n }\n radius?: number\n}): dmv.viewer.ROIStyleOptions => {\n const stroke = {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n }\n if (style.stroke != null) {\n if (style.stroke.color != null) {\n stroke.color = style.stroke.color\n }\n if (style.stroke.width != null) {\n stroke.width = style.stroke.width\n }\n }\n const fill = {\n color: DEFAULT_ROI_FILL_COLOR\n }\n if (style.fill != null) {\n if (style.fill.color != null) {\n fill.color = style.fill.color\n }\n }\n return {\n stroke,\n fill,\n image: {\n circle: {\n radius: style.radius != null\n ? style.radius\n : Math.max(5 - stroke.width, 1),\n stroke,\n fill\n }\n }\n }\n}\n\nconst _constructViewers = ({ clients, slide, preload }: {\n clients: { [key: string]: dwc.api.DICOMwebClient }\n slide: Slide\n preload?: boolean\n}): {\n volumeViewer: dmv.viewer.VolumeImageViewer\n labelViewer?: dmv.viewer.LabelImageViewer\n} => {\n console.info(\n 'instantiate viewer for VOLUME images of slide ' +\n `\"${slide.volumeImages[0].ContainerIdentifier}\"`\n )\n try {\n const volumeViewer = new dmv.viewer.VolumeImageViewer({\n clientMapping: clients,\n metadata: slide.volumeImages,\n controls: ['overview', 'position'],\n preload: preload,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV, error\n )\n }\n })\n volumeViewer.activateSelectInteraction({})\n\n let labelViewer\n if (slide.labelImages.length > 0) {\n console.info(\n 'instantiate viewer for LABEL image of slide ' +\n `\"${slide.labelImages[0].ContainerIdentifier}\"`\n )\n labelViewer = new dmv.viewer.LabelImageViewer({\n client: clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],\n metadata: slide.labelImages[0],\n resizeFactor: 1,\n orientation: 'vertical',\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n }\n\n return { volumeViewer, labelViewer }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to instantiate viewer'\n )\n )\n throw error\n }\n}\n\n/*\n * Check whether the report is structured according to template\n * TID 1500 \"MeasurementReport\".\n */\nconst _implementsTID1500 = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const templateSeq = report.ContentTemplateSequence\n if (templateSeq.length > 0) {\n const tid = templateSeq[0].TemplateIdentifier\n if (tid === '1500') {\n return true\n }\n }\n return false\n}\n\n/*\n * Check whether the subject described in the report is a specimen as compared\n * to a patient, fetus, or device.\n */\nconst _describesSpecimenSubject = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121024',\n schemeDesignator: 'DCM',\n meaning: 'Subject Class'\n })\n })\n if (items.length === 0) {\n return false\n }\n const subjectClassItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n const subjectClassValue = subjectClassItem.ConceptCodeSequence[0]\n const retrievedConcept = new dcmjs.sr.coding.CodedConcept({\n value: subjectClassValue.CodeValue,\n meaning: subjectClassValue.CodeMeaning,\n schemeDesignator: subjectClassValue.CodingSchemeDesignator\n })\n const expectedConcept = new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n meaning: 'Specimen',\n schemeDesignator: 'DCM'\n })\n if (retrievedConcept.equals(expectedConcept)) {\n return true\n }\n return false\n}\n\n/*\n * Check whether the report contains appropriate graphic ROI annotations.\n */\nconst _containsROIAnnotations = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const measurements = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (measurements.length === 0) {\n return false\n }\n const container = measurements[0] as dcmjs.sr.valueTypes.ContainerContentItem\n const measurementGroups = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n let foundRegion = false\n measurementGroups.forEach((group) => {\n const container = group as dcmjs.sr.valueTypes.ContainerContentItem\n const regions = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (regions.length > 0) {\n if (regions[0].ValueType === dcmjs.sr.valueTypes.ValueTypes.SCOORD3D) {\n foundRegion = true\n }\n }\n })\n\n return foundRegion\n}\n\ninterface EvaluationOptions {\n name: dcmjs.sr.coding.CodedConcept\n values: dcmjs.sr.coding.CodedConcept[]\n}\n\ninterface Evaluation {\n name: dcmjs.sr.coding.CodedConcept\n value: dcmjs.sr.coding.CodedConcept\n}\n\ninterface Measurement {\n name: dcmjs.sr.coding.CodedConcept\n value?: number\n unit: dcmjs.sr.coding.CodedConcept\n}\n\ninterface SlideViewerProps extends RouteComponentProps {\n slide: Slide\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n seriesInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload?: boolean\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n user?: {\n name: string\n email: string\n }\n selectedPresentationStateUID?: string\n}\n\ninterface SlideViewerState {\n visibleRoiUIDs: Set\n visibleSegmentUIDs: Set\n visibleMappingUIDs: Set\n visibleAnnotationGroupUIDs: Set\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n presentationStates: dmv.metadata.AdvancedBlendingPresentationState[]\n selectedPresentationStateUID?: string\n selectedFinding?: dcmjs.sr.coding.CodedConcept\n selectedEvaluations: Evaluation[]\n selectedGeometryType?: string\n selectedMarkup?: string\n selectedRoi?: dmv.roi.ROI\n selectedRoiUIDs: Set\n generatedReport?: dmv.metadata.Comprehensive3DSR\n isLoading: boolean\n isAnnotationModalVisible: boolean\n isSelectedRoiModalVisible: boolean\n isHoveredRoiTooltipVisible: boolean\n hoveredRoi?: dmv.roi.ROI\n hoveredRoiAttributes: Array<{ name: string, value: string }>\n hoveredRoiTooltipX: number\n hoveredRoiTooltipY: number\n isReportModalVisible: boolean\n isRoiDrawingActive: boolean\n isRoiModificationActive: boolean\n isRoiTranslationActive: boolean\n isGoToModalVisible: boolean\n isSelectedMagnificationValid: boolean\n isSelectedXCoordinateValid: boolean\n isSelectedYCoordinateValid: boolean\n selectedXCoordinate?: number\n validXCoordinateRange: number[]\n selectedYCoordinate?: number\n validYCoordinateRange: number[]\n selectedMagnification?: number\n areRoisHidden: boolean\n pixelDataStatistics: {\n [opticalPathIdentifier: string]: {\n min: number\n max: number\n numFramesSampled: number\n }\n }\n loadingFrames: Set\n}\n\n/**\n * React component for interactive viewing of an individual digital slide,\n * which corresponds to one DICOM Series of DICOM Slide Microscopy images and\n * potentially one or more associated DICOM Series of DICOM SR documents.\n */\nclass SlideViewer extends React.Component {\n private readonly findingOptions: dcmjs.sr.coding.CodedConcept[] = []\n\n private readonly evaluationOptions: { [key: string]: EvaluationOptions[] } = {}\n\n private readonly measurements: Measurement[] = []\n\n private readonly geometryTypeOptions: { [key: string]: string[] } = {}\n\n private readonly volumeViewportRef: React.RefObject\n\n private readonly labelViewportRef: React.RefObject\n\n private volumeViewer: dmv.viewer.VolumeImageViewer\n\n private labelViewer?: dmv.viewer.LabelImageViewer\n\n private readonly defaultRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n },\n fill: {\n color: DEFAULT_ROI_FILL_COLOR\n },\n image: {\n circle: {\n fill: {\n color: DEFAULT_ROI_STROKE_COLOR\n },\n radius: DEFAULT_ROI_RADIUS\n }\n }\n }\n\n private roiStyles: {[key: string]: dmv.viewer.ROIStyleOptions} = {}\n\n private defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n\n private readonly selectionColor: number[] = [140, 184, 198]\n\n private readonly selectedRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: { color: [...this.selectionColor, 1], width: 3 },\n fill: { color: [...this.selectionColor, 0.2] },\n image: {\n circle: {\n radius: 5,\n fill: { color: [...this.selectionColor, 1] }\n }\n }\n }\n\n constructor (props: SlideViewerProps) {\n super(props)\n console.info(\n `view slide \"${this.props.slide.containerIdentifier}\": `,\n this.props.slide\n )\n const geometryTypeOptions = [\n 'point',\n 'circle',\n 'box',\n 'polygon',\n 'line',\n 'freehandpolygon',\n 'freehandline'\n ]\n props.annotations.forEach((annotation: AnnotationSettings) => {\n const finding = new dcmjs.sr.coding.CodedConcept(annotation.finding)\n this.findingOptions.push(finding)\n const key = _buildKey(finding)\n if (annotation.geometryTypes !== undefined) {\n this.geometryTypeOptions[key] = annotation.geometryTypes\n } else {\n this.geometryTypeOptions[key] = geometryTypeOptions\n }\n this.evaluationOptions[key] = []\n if (annotation.evaluations !== undefined) {\n annotation.evaluations.forEach(evaluation => {\n this.evaluationOptions[key].push({\n name: new dcmjs.sr.coding.CodedConcept(evaluation.name),\n values: evaluation.values.map(value => {\n return new dcmjs.sr.coding.CodedConcept(value)\n })\n })\n })\n }\n if (annotation.measurements !== undefined) {\n annotation.measurements.forEach(measurement => {\n this.measurements.push({\n name: new dcmjs.sr.coding.CodedConcept(measurement.name),\n value: undefined,\n unit: new dcmjs.sr.coding.CodedConcept(measurement.unit)\n })\n })\n }\n if (annotation.style != null) {\n this.roiStyles[key] = _formatRoiStyle(annotation.style)\n } else {\n this.roiStyles[key] = this.defaultRoiStyle\n }\n })\n\n this.componentSetup = this.componentSetup.bind(this)\n this.componentCleanup = this.componentCleanup.bind(this)\n\n this.onWindowResize = this.onWindowResize.bind(this)\n this.handleRoiDrawing = this.handleRoiDrawing.bind(this)\n this.handleRoiTranslation = this.handleRoiTranslation.bind(this)\n this.handleRoiModification = this.handleRoiModification.bind(this)\n this.handleRoiVisibilityChange = this.handleRoiVisibilityChange.bind(this)\n this.handleRoiRemoval = this.handleRoiRemoval.bind(this)\n this.handleRoiSelectionCancellation = this.handleRoiSelectionCancellation.bind(this)\n this.handleAnnotationConfigurationCancellation = this.handleAnnotationConfigurationCancellation.bind(this)\n this.handleAnnotationGeometryTypeSelection = this.handleAnnotationGeometryTypeSelection.bind(this)\n this.handleAnnotationMeasurementActivation = this.handleAnnotationMeasurementActivation.bind(this)\n this.handleAnnotationFindingSelection = this.handleAnnotationFindingSelection.bind(this)\n this.handleAnnotationEvaluationSelection = this.handleAnnotationEvaluationSelection.bind(this)\n this.handleAnnotationEvaluationClearance = this.handleAnnotationEvaluationClearance.bind(this)\n this.handleAnnotationConfigurationCompletion = this.handleAnnotationConfigurationCompletion.bind(this)\n this.handleAnnotationSelection = this.handleAnnotationSelection.bind(this)\n this.handleAnnotationVisibilityChange = this.handleAnnotationVisibilityChange.bind(this)\n this.handleAnnotationGroupVisibilityChange = this.handleAnnotationGroupVisibilityChange.bind(this)\n this.handleAnnotationGroupStyleChange = this.handleAnnotationGroupStyleChange.bind(this)\n this.handleRoiStyleChange = this.handleRoiStyleChange.bind(this)\n this.handleGoTo = this.handleGoTo.bind(this)\n this.handleXCoordinateSelection = this.handleXCoordinateSelection.bind(this)\n this.handleYCoordinateSelection = this.handleYCoordinateSelection.bind(this)\n this.handleMagnificationSelection = this.handleMagnificationSelection.bind(this)\n this.handleSlidePositionSelection = this.handleSlidePositionSelection.bind(this)\n this.handleSlidePositionSelectionCancellation = this.handleSlidePositionSelectionCancellation.bind(this)\n this.handleReportGeneration = this.handleReportGeneration.bind(this)\n this.handleReportVerification = this.handleReportVerification.bind(this)\n this.handleReportCancellation = this.handleReportCancellation.bind(this)\n this.handleSegmentVisibilityChange = this.handleSegmentVisibilityChange.bind(this)\n this.handleSegmentStyleChange = this.handleSegmentStyleChange.bind(this)\n this.handleMappingVisibilityChange = this.handleMappingVisibilityChange.bind(this)\n this.handleMappingStyleChange = this.handleMappingStyleChange.bind(this)\n this.handleOpticalPathVisibilityChange = this.handleOpticalPathVisibilityChange.bind(this)\n this.handleOpticalPathStyleChange = this.handleOpticalPathStyleChange.bind(this)\n this.handleOpticalPathActivityChange = this.handleOpticalPathActivityChange.bind(this)\n this.handlePresentationStateSelection = this.handlePresentationStateSelection.bind(this)\n this.handlePresentationStateReset = this.handlePresentationStateReset.bind(this)\n\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n this.volumeViewportRef = React.createRef()\n this.labelViewportRef = React.createRef()\n\n /**\n * Deactivate all optical paths. Visibility will be set later, potentially\n * using based on available presentation state instances.\n */\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n this.volumeViewer.deactivateOpticalPath(opticalPath.identifier)\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.state = {\n selectedRoiUIDs: new Set(),\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers: new Set(),\n activeOpticalPathIdentifiers: new Set(),\n presentationStates: [],\n selectedFinding: undefined,\n selectedEvaluations: [],\n generatedReport: undefined,\n isLoading: false,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isHoveredRoiTooltipVisible: false,\n hoveredRoiTooltipX: 0,\n hoveredRoiTooltipY: 0,\n hoveredRoiAttributes: [],\n isSelectedMagnificationValid: false,\n isReportModalVisible: false,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n selectedXCoordinate: undefined,\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n selectedYCoordinate: undefined,\n validYCoordinateRange: [offset[1], offset[1] + size[1]],\n selectedMagnification: undefined,\n areRoisHidden: false,\n pixelDataStatistics: {},\n selectedPresentationStateUID: this.props.selectedPresentationStateUID,\n loadingFrames: new Set()\n }\n }\n\n componentDidUpdate (\n previousProps: SlideViewerProps,\n previousState: SlideViewerState\n ): void {\n /** Fetch data and update the viewports if the route has changed (\n * i.e., if another series has been selected) or if the client has changed.\n */\n if (\n this.props.location.pathname !== previousProps.location.pathname ||\n this.props.studyInstanceUID !== previousProps.studyInstanceUID ||\n this.props.seriesInstanceUID !== previousProps.seriesInstanceUID ||\n this.props.slide !== previousProps.slide ||\n this.props.clients !== previousProps.clients\n ) {\n if (this.volumeViewportRef.current != null) {\n this.volumeViewportRef.current.innerHTML = ''\n }\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n if (this.labelViewportRef.current != null) {\n this.labelViewportRef.current.innerHTML = ''\n }\n this.labelViewer.cleanup()\n }\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n\n const activeOpticalPathIdentifiers: Set = new Set()\n const visibleOpticalPathIdentifiers: Set = new Set()\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n const identifier = opticalPath.identifier\n if (this.volumeViewer.isOpticalPathVisible(identifier)) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n if (this.volumeViewer.isOpticalPathActive(identifier)) {\n activeOpticalPathIdentifiers.add(identifier)\n }\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.setState({\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers,\n activeOpticalPathIdentifiers,\n presentationStates: [],\n loadingFrames: new Set(),\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n validYCoordinateRange: [offset[1], offset[1] + size[1]]\n })\n this.populateViewports()\n }\n }\n\n /**\n * Retrieve Presentation State instances that reference the any images of\n * the currently selected series.\n */\n loadPresentationStates = (): void => {\n console.info('search for Presentation State instances')\n const client = this.props.clients[\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE\n ]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'PR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach((rawInstance, index) => {\n const { dataset } = dmv.metadata.formatMetadata(rawInstance)\n const instance = dataset as dmv.metadata.Instance\n console.info(`retrieve PR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n if (this.props.slide.areVolumeImagesMonochrome) {\n const presentationState = (\n dataset as\n unknown as\n dmv.metadata.AdvancedBlendingPresentationState\n )\n let doesMatch = false\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n doesMatch = this.props.slide.seriesInstanceUIDs.includes(\n blendingItem.SeriesInstanceUID\n )\n }\n )\n if (doesMatch) {\n console.info(\n 'include Advanced Blending Presentation State instance ' +\n `\"${presentationState.SOPInstanceUID}\"`\n )\n if (\n index === 0 &&\n this.props.selectedPresentationStateUID == null\n ) {\n this.setPresentationState(presentationState)\n } else {\n if (\n presentationState.SOPInstanceUID ===\n this.props.selectedPresentationStateUID\n ) {\n this.setPresentationState(presentationState)\n }\n }\n this.setState(state => {\n const mapping: {\n [sopInstanceUID: string]:\n dmv.metadata.AdvancedBlendingPresentationState\n } = {}\n state.presentationStates.forEach(instance => {\n mapping[instance.SOPInstanceUID] = instance\n })\n mapping[presentationState.SOPInstanceUID] = presentationState\n return { presentationStates: Object.values(mapping) }\n })\n }\n } else {\n console.info(\n `ignore presentation state \"${instance.SOPInstanceUID}\", ` +\n 'application of presentation states for color images ' +\n 'has not (yet) been implemented'\n )\n }\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n console.error(\n 'failed to load presentation state ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n })\n }\n\n /**\n * Set presentation state as specified by a DICOM Presentation State instance.\n */\n setPresentationState = (\n presentationState: dmv.metadata.AdvancedBlendingPresentationState\n ): void => {\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n console.info(\n `apply Presentation State instance \"${presentationState.SOPInstanceUID}\"`\n )\n const opticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n } | null\n } = {}\n opticalPaths.forEach(opticalPath => {\n // First, deactivate and hide all optical paths and reset style\n const identifier = opticalPath.identifier\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n /**\n * Referenced Instance Sequence should be used instead of Referenced\n * Image Sequence, but that's easy to mix up and we have encountered\n * implementations that get it wrong.\n */\n let refInstanceItems = blendingItem.ReferencedInstanceSequence\n if (refInstanceItems === undefined) {\n refInstanceItems = blendingItem.ReferencedImageSequence\n }\n if (refInstanceItems === undefined) {\n return\n }\n refInstanceItems.forEach(imageItem => {\n const isReferenced = opticalPath.sopInstanceUIDs.includes(\n imageItem.ReferencedSOPInstanceUID\n ) as boolean\n if (isReferenced) {\n let paletteColorLUT\n if (blendingItem.PaletteColorLookupTableSequence != null) {\n const cpLUTItem = blendingItem.PaletteColorLookupTableSequence[0]\n paletteColorLUT = new dmv.color.PaletteColorLookupTable({\n uid: (\n cpLUTItem.PaletteColorLookupTableUID != null\n ? cpLUTItem.PaletteColorLookupTableUID\n : ''\n ),\n redDescriptor:\n cpLUTItem.RedPaletteColorLookupTableDescriptor,\n greenDescriptor:\n cpLUTItem.GreenPaletteColorLookupTableDescriptor,\n blueDescriptor:\n cpLUTItem.BluePaletteColorLookupTableDescriptor,\n redData: (\n (cpLUTItem.RedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.RedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenData: (\n (cpLUTItem.GreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.GreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueData: (\n (cpLUTItem.BluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.BluePaletteColorLookupTableData\n )\n : undefined\n ),\n redSegmentedData: (\n (cpLUTItem.SegmentedRedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedRedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenSegmentedData: (\n (cpLUTItem.SegmentedGreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedGreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueSegmentedData: (\n (cpLUTItem.SegmentedBluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedBluePaletteColorLookupTableData\n )\n : undefined\n )\n })\n }\n\n let limitValues\n if (blendingItem.SoftcopyVOILUTSequence != null) {\n const voiLUTItem = blendingItem.SoftcopyVOILUTSequence[0]\n const windowCenter = voiLUTItem.WindowCenter\n const windowWidth = voiLUTItem.WindowWidth\n limitValues = [\n windowCenter - windowWidth * 0.5,\n windowCenter + windowWidth * 0.5\n ]\n }\n\n opticalPathStyles[identifier] = {\n opacity: 1,\n paletteColorLookupTable: paletteColorLUT,\n limitValues: limitValues\n }\n }\n })\n })\n })\n\n const selectedOpticalPathIdentifiers: Set = new Set()\n Object.keys(opticalPathStyles).forEach(identifier => {\n const styleOptions = opticalPathStyles[identifier]\n if (styleOptions != null) {\n this.volumeViewer.setOpticalPathStyle(identifier, styleOptions)\n this.volumeViewer.activateOpticalPath(identifier)\n this.volumeViewer.showOpticalPath(identifier)\n selectedOpticalPathIdentifiers.add(identifier)\n } else {\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n }\n })\n const searchParams = new URLSearchParams(this.props.location.search)\n searchParams.set('state', presentationState.SOPInstanceUID)\n this.props.navigate(\n {\n pathname: this.props.location.pathname,\n search: searchParams.toString()\n },\n { replace: true }\n )\n this.setState(state => ({\n activeOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n visibleOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n selectedPresentationStateUID: presentationState.SOPInstanceUID\n }))\n }\n\n getRoiStyle = (key?: string): dmv.viewer.ROIStyleOptions => {\n if (key == null) {\n return this.defaultRoiStyle\n }\n if (this.roiStyles[key] !== undefined) {\n return this.roiStyles[key]\n }\n return this.defaultRoiStyle\n }\n\n /**\n * Retrieve Structured Report instances that contain regions of interests\n * with 3D spatial coordinates defined in the same frame of reference as the\n * currently selected series and add them to the VOLUME image viewer.\n */\n addAnnotations = (): void => {\n console.info('search for Comprehensive 3D SR instances')\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach(i => {\n const { dataset } = dmv.metadata.formatMetadata(i)\n const instance = dataset as dmv.metadata.Instance\n if (instance.SOPClassUID === StorageClasses.COMPREHENSIVE_3D_SR) {\n console.info(`retrieve SR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n const report = dataset as unknown as dmv.metadata.Comprehensive3DSR\n /*\n * Perform a couple of checks to ensure the document content of the\n * report fullfils the requirements of the application.\n */\n if (!_implementsTID1500(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it is not structured according to template ' +\n 'TID 1500 \"MeasurementReport\"'\n )\n return\n }\n if (!_describesSpecimenSubject(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not describe a specimen subject'\n )\n return\n }\n if (!_containsROIAnnotations(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not contain any suitable ROI annotations'\n )\n return\n }\n\n const content = new MeasurementReport(report)\n content.ROIs.forEach(roi => {\n console.info(`add ROI \"${roi.uid}\"`)\n const scoord3d = roi.scoord3d\n const image = this.props.slide.volumeImages[0]\n if (scoord3d.frameOfReferenceUID === image.FrameOfReferenceUID) {\n /*\n * ROIs may get assigned new UIDs upon re-rendering of the\n * page and we need to ensure that we don't add them twice.\n * The same ROI may be stored in multiple SR documents and\n * we don't want them to show up twice.\n * TODO: We should probably either \"merge\" measurements and\n * quantitative evaluations or pick the ROI from the \"best\"\n * available report (COMPLETE and VERIFIED).\n */\n const doesROIExist = this.volumeViewer.getAllROIs().some(\n (otherROI: dmv.roi.ROI): boolean => {\n return _areROIsEqual(otherROI, roi)\n }\n )\n if (!doesROIExist) {\n try {\n // Add ROI without style such that it won't be visible.\n this.volumeViewer.addROI(roi, {})\n } catch {\n console.error(`could not add ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(`skip already existing ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(\n `skip ROI \"${roi.uid}\" ` +\n `of SR document \"${report.SOPInstanceUID}\"` +\n 'because it is defined in another frame of reference'\n )\n }\n })\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n console.error(\n 'failed to load ROIs ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n /*\n * React is not aware of the fact that ROIs have been added via the\n * viewer (the viewport is a ref object) and won't show the\n * annotations in the user interface unless an update is forced.\n */\n this.forceUpdate()\n }\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n })\n }\n\n /**\n * Retrieve Microscopy Bulk Simple Annotations instances that contain\n * annotation groups defined in the same frame of reference as the currently\n * selected series and add them to the VOLUME image viewer.\n */\n addAnnotationGroups = (): void => {\n console.info('search for Microscopy Bulk Simple Annotations instances')\n const client = this.props.clients[\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION\n ]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'ANN'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const annotations: dmv.metadata.MicroscopyBulkSimpleAnnotations[] = retrievedMetadata.map(metadata => {\n return new dmv.metadata.MicroscopyBulkSimpleAnnotations({\n metadata\n })\n })\n // annotations = annotations.filter(ann => {\n // const refImage = this.props.slide.volumeImages[0]\n // return (\n // ann.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n // ann.ContainerIdentifier === refImage.ContainerIdentifier\n // )\n // })\n annotations.forEach(ann => {\n try {\n this.volumeViewer.addAnnotationGroups(ann)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Microscopy Bulk Simple Annotations cannot be displayed.'\n )\n )\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n console.error('failed to add annotation groups:', error)\n }\n ann.AnnotationGroupSequence.forEach(item => {\n const annotationGroupUID = item.AnnotationGroupUID\n const finding = item.AnnotationPropertyTypeCodeSequence[0]\n const key = _buildKey(finding)\n const style = this.roiStyles[key]\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (style != null && style.fill != null) {\n this.volumeViewer.setAnnotationGroupStyle(\n annotationGroupUID,\n { color: style.fill.color }\n )\n }\n })\n })\n /*\n * React is not aware of the fact that annotation groups have been\n * added via the viewer (the underlying HTML viewport element is a\n * ref object) and won't show the annotation groups in the user\n * interface unless an update is forced.\n */\n this.forceUpdate()\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Microscopy Bulk Simple Annotations ' +\n 'instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Microscopy Bulk Simple Annotations instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Segmentation instances that contain segments defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addSegmentations = (): void => {\n console.info('search for Segmentation instances')\n const client = this.props.clients[StorageClasses.SEGMENTATION]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SEG'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach((s, i) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const segmentations: dmv.metadata.Segmentation[] = []\n retrievedMetadata.forEach(metadata => {\n const seg = new dmv.metadata.Segmentation({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n seg.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n seg.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n segmentations.push(seg)\n }\n })\n if (segmentations.length > 0) {\n try {\n this.volumeViewer.addSegments(segmentations)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Segmentations cannot be displayed'\n )\n )\n console.error('failed to add segments: ', error)\n }\n /*\n * React is not aware of the fact that segments have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the segments in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Segmentation instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Segmentation instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Parametric Map instances that contain mappings defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addParametricMaps = (): void => {\n console.info('search for Parametric Map instances')\n const client = this.props.clients[StorageClasses.PARAMETRIC_MAP]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'OT'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const parametricMaps: dmv.metadata.ParametricMap[] = []\n retrievedMetadata.forEach(metadata => {\n const pm = new dmv.metadata.ParametricMap({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n pm.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n pm.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n parametricMaps.push(pm)\n } else {\n console.warn(\n `skip Parametric Map instance \"${pm.SOPInstanceUID}\"`\n )\n }\n })\n if (parametricMaps.length > 0) {\n try {\n this.volumeViewer.addParameterMappings(parametricMaps)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Parametric Map cannot be displayed'\n )\n )\n console.error('failed to add mappings: ', error)\n }\n /*\n * React is not aware of the fact that mappings have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the mappings in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Parametric Map instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Parametric Map instances failed.'\n )\n )\n })\n }\n\n /**\n * Populate viewports of the VOLUME and LABEL image viewers.\n */\n populateViewports = (): void => {\n console.info('populate viewports...')\n this.setState({\n isLoading: true,\n presentationStates: []\n })\n\n if (this.volumeViewportRef.current != null) {\n this.volumeViewer.render({ container: this.volumeViewportRef.current })\n }\n if (\n this.labelViewportRef.current != null &&\n this.labelViewer != null\n ) {\n this.labelViewer.render({ container: this.labelViewportRef.current })\n }\n\n // State update will also ensure that the component is re-rendered.\n this.setState({ isLoading: false })\n\n this.setDefaultPresentationState()\n this.loadPresentationStates()\n\n this.addAnnotations()\n this.addAnnotationGroups()\n this.addSegmentations()\n this.addParametricMaps()\n }\n\n onRoiModified = (event: CustomEventInit): void => {\n // Update state to trigger rendering\n this.setState(state => ({\n visibleRoiUIDs: new Set(state.visibleRoiUIDs)\n }))\n }\n\n onWindowResize = (event: Event): void => {\n console.info('resize viewports')\n this.volumeViewer.resize()\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }\n\n onRoiDrawn = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n const selectedFinding = this.state.selectedFinding\n const selectedEvaluations = this.state.selectedEvaluations\n if (roi !== undefined && selectedFinding !== undefined) {\n console.debug(`add ROI \"${roi.uid}\"`)\n const findingItem = new dcmjs.sr.valueTypes.CodeContentItem({\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n }),\n value: selectedFinding,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(findingItem)\n selectedEvaluations.forEach((evaluation: Evaluation) => {\n const item = new dcmjs.sr.valueTypes.CodeContentItem({\n name: evaluation.name,\n value: evaluation.value,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(item)\n })\n const key = _buildKey(selectedFinding)\n const style = this.getRoiStyle(key)\n this.volumeViewer.addROI(roi, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.debug(`could not add ROI \"${roi.uid}\"`)\n }\n }\n\n onRoiDoubleClicked = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n this.setState({\n isSelectedRoiModalVisible: true\n })\n } else {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n }\n\n setHoveredRoiAttributes = (hoveredRoi: dmv.roi.ROI): void => {\n const attributes: Array<{ name: string, value: string }> = []\n hoveredRoi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n\n this.setState({ hoveredRoiAttributes: attributes })\n }\n\n onPointerMove = (event: CustomEventInit): void => {\n const { feature: hoveredRoi, event: evt } = event.detail.payload\n if (hoveredRoi != null) {\n const originalEvent = evt.originalEvent\n this.setHoveredRoiAttributes(hoveredRoi)\n this.setState({\n isHoveredRoiTooltipVisible: true,\n hoveredRoi,\n hoveredRoiTooltipX: originalEvent.clientX,\n hoveredRoiTooltipY: originalEvent.clientY\n })\n } else {\n this.setState({\n isHoveredRoiTooltipVisible: false\n })\n }\n }\n\n onRoiSelected = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n console.debug(`selected ROI \"${selectedRoi.uid}\"`)\n this.volumeViewer.setROIStyle(selectedRoi.uid, this.selectedRoiStyle)\n const key = _getRoiKey(selectedRoi)\n this.volumeViewer.getAllROIs().forEach((roi) => {\n if (roi.uid !== selectedRoi.uid) {\n this.volumeViewer.setROIStyle(roi.uid, this.getRoiStyle(key))\n }\n })\n this.setState({\n selectedRoiUIDs: new Set([selectedRoi.uid]),\n selectedRoi: selectedRoi\n })\n } else {\n this.setState({\n selectedRoiUIDs: new Set(),\n selectedRoi: undefined\n })\n }\n }\n\n handleRoiSelectionCancellation (): void {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n\n onLoadingStarted = (event: CustomEventInit): void => {\n this.setState({ isLoading: true })\n }\n\n onLoadingEnded = (event: CustomEventInit): void => {\n this.setState({ isLoading: false })\n }\n\n onFrameLoadingStarted = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n } = event.detail.payload\n const key: string = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.add(key)\n return state\n })\n }\n\n onFrameLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load frame')\n }\n\n onLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load data')\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const message = (event.detail?.payload?.message === null ? 'Failed to load data' : event.detail?.payload?.message) as string\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n message\n ) as any\n )\n }\n\n onFrameLoadingEnded = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n pixelArray: Uint8Array|Uint16Array|Float32Array|null\n } = event.detail.payload\n const key = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.delete(key)\n let isLoading: boolean = false\n if (state.loadingFrames.size > 0) {\n isLoading = true\n }\n return {\n isLoading,\n loadingFrames: state.loadingFrames\n }\n })\n if (\n frameInfo.sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE &&\n this.props.slide.areVolumeImagesMonochrome\n ) {\n const opticalPathIdentifier = frameInfo.channelIdentifier\n if (\n !(opticalPathIdentifier in this.state.pixelDataStatistics) &&\n frameInfo.pixelArray != null\n ) {\n /*\n * There are limits on the number of arguments Math.min and Math.max\n * functions can accept. Therefore, we compute values in smaller chunks.\n */\n const size = 2 ** 16\n const chunks = Math.ceil(frameInfo.pixelArray.length / size)\n let offset = 0\n const minValues: number[] = []\n const maxValues: number[] = []\n for (let i = 0; i < chunks; i++) {\n offset = i * size\n const pixels = frameInfo.pixelArray.slice(offset, offset + size)\n minValues.push(Math.min(...pixels))\n maxValues.push(Math.max(...pixels))\n }\n const min = Math.min(...minValues)\n const max = Math.max(...maxValues)\n this.setState(state => {\n const stats = state.pixelDataStatistics\n if (stats[opticalPathIdentifier] != null) {\n stats[opticalPathIdentifier] = {\n min: Math.min(stats[opticalPathIdentifier].min, min),\n max: Math.max(stats[opticalPathIdentifier].max, max),\n numFramesSampled: stats[opticalPathIdentifier].numFramesSampled + 1\n }\n } else {\n stats[opticalPathIdentifier] = {\n min: min,\n max: max,\n numFramesSampled: 1\n }\n }\n if (state.selectedPresentationStateUID == null) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(opticalPathIdentifier)\n }\n style.limitValues = [\n stats[opticalPathIdentifier].min,\n stats[opticalPathIdentifier].max\n ]\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, style)\n }\n return state\n })\n }\n }\n }\n\n onRoiRemoved = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n console.debug(`removed ROI \"${roi.uid}\"`)\n }\n\n componentCleanup (): void {\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.removeEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.removeEventListener('resize', this.onWindowResize)\n\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n /*\n * FIXME: React appears to not clean the content of referenced\n * HTMLDivElement objects when the page is reloaded. As a consequence,\n * optical paths and other display items cannot be toggled or updated after\n * a manual page reload. I have tried using ref callbacks and passing the\n * ref objects from the parent component via the props. Both didn't work\n * either.\n */\n }\n\n onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiModificationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiTranslationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.activateSelectInteraction({})\n }\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else if (event.altKey) {\n if (event.code === 'KeyD') {\n this.handleRoiDrawing()\n } else if (event.code === 'KeyM') {\n this.handleRoiModification()\n } else if (event.code === 'KeyT') {\n this.handleRoiTranslation()\n } else if (event.code === 'KeyR') {\n this.handleRoiRemoval()\n } else if (event.code === 'KeyV') {\n this.handleRoiVisibilityChange()\n } else if (event.code === 'KeyS') {\n this.handleReportGeneration()\n } else if (event.code === 'KeyG') {\n this.handleGoTo()\n }\n }\n }\n\n componentWillUnmount (): void {\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n window.removeEventListener('beforeunload', this.componentCleanup)\n }\n\n componentSetup (): void {\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_error',\n this.onLoadingError\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_error',\n this.onFrameLoadingError\n )\n document.body.addEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.addEventListener('beforeunload', this.componentCleanup)\n window.addEventListener('resize', this.onWindowResize)\n }\n\n componentDidMount (): void {\n this.componentSetup()\n this.populateViewports()\n\n if (!this.props.slide.areVolumeImagesMonochrome) {\n let hasICCProfile = false\n const image = this.props.slide.volumeImages[0]\n const metadataItem = image.OpticalPathSequence[0]\n if (metadataItem.ICCProfile == null) {\n if ('OpticalPathSequence' in image.bulkdataReferences) {\n // @ts-expect-error\n const bulkdataItem = image.bulkdataReferences.OpticalPathSequence[0]\n if ('ICCProfile' in bulkdataItem) {\n hasICCProfile = true\n }\n }\n } else {\n hasICCProfile = true\n }\n if (!hasICCProfile) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No ICC Profile was found for color images')\n }\n }\n }\n\n /**\n * Handler that gets called when a finding has been selected for annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationFindingSelection (\n value: string,\n option: any\n ): void {\n this.findingOptions.forEach(finding => {\n if (finding.CodeValue === value) {\n console.info(`selected finding \"${finding.CodeMeaning}\"`)\n this.setState({\n selectedFinding: finding,\n selectedEvaluations: []\n })\n }\n })\n }\n\n /**\n * Handler that gets called when a geometry type has been selected for\n * annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationGeometryTypeSelection (value: string, option: any): void {\n this.setState({ selectedGeometryType: value })\n }\n\n /**\n * Handler that gets called when measurements have been selected for\n * annotation.\n */\n handleAnnotationMeasurementActivation (event: any): void {\n const active: boolean = event.target.checked\n if (active) {\n this.setState({ selectedMarkup: 'measurement' })\n } else {\n this.setState({ selectedMarkup: undefined })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been selected for an\n * annotation.\n *\n * @param value - Code value of the coded evaluation that got selected\n * @param option - Option that got selected\n */\n handleAnnotationEvaluationSelection (\n value: string,\n option: any\n ): void {\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n const name = option.label\n this.evaluationOptions[key].forEach(evaluation => {\n if (\n evaluation.name.CodeValue === name.CodeValue &&\n evaluation.name.CodingSchemeDesignator === name.CodingSchemeDesignator\n ) {\n evaluation.values.forEach(code => {\n if (code.CodeValue === value) {\n const filteredEvaluations = this.state.selectedEvaluations.filter(\n (item: Evaluation) => item.name !== evaluation.name\n )\n this.setState({\n selectedEvaluations: [\n ...filteredEvaluations,\n { name: name, value: code }\n ]\n })\n }\n })\n }\n })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been cleared for an\n * annotation.\n */\n handleAnnotationEvaluationClearance (): void {\n this.setState({\n selectedEvaluations: []\n })\n }\n\n handleXCoordinateSelection (value: any): void {\n if (value != null) {\n const x = Number(value)\n const start = this.state.validXCoordinateRange[0]\n const end = this.state.validXCoordinateRange[1]\n if (x >= start && x <= end) {\n this.setState({\n selectedXCoordinate: x,\n isSelectedXCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedXCoordinate: undefined,\n isSelectedXCoordinateValid: false\n })\n }\n\n handleYCoordinateSelection (value: any): void {\n if (value != null) {\n const y = Number(value)\n const start = this.state.validYCoordinateRange[0]\n const end = this.state.validYCoordinateRange[1]\n if (y >= start && y <= end) {\n this.setState({\n selectedYCoordinate: y,\n isSelectedYCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedYCoordinate: undefined,\n isSelectedYCoordinateValid: false\n })\n }\n\n handleMagnificationSelection (value: any): void {\n if (value != null) {\n if (value > 0 && value <= 40) {\n this.setState({\n selectedMagnification: Number(value),\n isSelectedMagnificationValid: true\n })\n return\n }\n }\n this.setState({\n selectedMagnification: undefined,\n isSelectedMagnificationValid: false\n })\n }\n\n /**\n * Handler that gets called when the selection of slide position was\n * completed.\n */\n handleSlidePositionSelection (): void {\n if (\n this.state.isSelectedXCoordinateValid &&\n this.state.isSelectedYCoordinateValid &&\n this.state.isSelectedMagnificationValid &&\n this.state.selectedXCoordinate != null &&\n this.state.selectedYCoordinate != null &&\n this.state.selectedMagnification != null\n ) {\n console.info(\n 'select slide position ' +\n `(${this.state.selectedXCoordinate}, ` +\n `${this.state.selectedYCoordinate}) ` +\n `at ${this.state.selectedMagnification}x magnification`\n )\n\n const factor = this.state.selectedMagnification\n /**\n * On an optical microscope an objective with 1x magnification\n * corresponds to approximately 10 micrometer pixel spacing\n * (due to the ocular).\n */\n const targetPixelSpacing = 0.01 / factor\n const diffs = []\n for (let i = 0; i < this.volumeViewer.numLevels; i++) {\n const actualPixelSpacing = this.volumeViewer.getPixelSpacing(i)[0]\n diffs.push(Math.abs(targetPixelSpacing - actualPixelSpacing))\n }\n const level = diffs.indexOf(Math.min(...diffs))\n this.volumeViewer.navigate({\n position: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate\n ],\n level: level\n })\n const point = new dmv.scoord3d.Point({\n coordinates: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate,\n 0\n ],\n frameOfReferenceUID: this.volumeViewer.frameOfReferenceUID\n })\n const roi = new dmv.roi.ROI({ scoord3d: point })\n this.volumeViewer.addROI(roi, this.defaultRoiStyle)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return {\n visibleRoiUIDs,\n isGoToModalVisible: false\n }\n })\n }\n }\n\n /**\n * Handler that gets called when the selection of a slide position was\n * canceled.\n */\n handleSlidePositionSelectionCancellation (): void {\n console.log('cancel slide position selection')\n this.setState({\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n isSelectedMagnificationValid: false,\n selectedXCoordinate: undefined,\n selectedYCoordinate: undefined,\n selectedMagnification: undefined\n })\n }\n\n /**\n * Handler that gets called when annotation configuration has been completed.\n */\n handleAnnotationConfigurationCompletion (): void {\n console.debug('complete annotation configuration')\n const finding = this.state.selectedFinding\n const geometryType = this.state.selectedGeometryType\n const markup = this.state.selectedMarkup\n if (geometryType !== undefined && finding !== undefined) {\n this.volumeViewer.activateDrawInteraction({ geometryType, markup })\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: true\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Could not complete annotation configuration'\n )\n )\n }\n }\n\n /**\n * Handler that gets called when annotation configuration has been cancelled.\n */\n handleAnnotationConfigurationCancellation (): void {\n console.debug('cancel annotation configuration')\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that gets called when a report should be generated for the current\n * set of annotations.\n */\n handleReportGeneration (): void {\n console.info('save ROIs')\n const rois = this.volumeViewer.getAllROIs()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n const metadata = this.volumeViewer.getOpticalPathMetadata(\n opticalPaths[0].identifier\n )\n // Metadata should be sorted such that the image with the highest\n // resolution is the last item in the array.\n const refImage = metadata[metadata.length - 1]\n // We assume that there is only one specimen (tissue section) per\n // ontainer (slide). Only the tissue section is tracked with a unique\n // identifier, even if the section may be composed of different biological\n // samples.\n if (refImage.SpecimenDescriptionSequence.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'More than one specimen has been described for the slide'\n )\n )\n }\n const refSpecimen = refImage.SpecimenDescriptionSequence[0]\n\n console.debug('create Observation Context')\n let observer\n if (this.props.user !== undefined) {\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: this.props.user.name,\n loginName: this.props.user.email\n })\n } else {\n console.warn('no user information available')\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: 'ANONYMOUS'\n })\n }\n const observationContext = new dcmjs.sr.templates.ObservationContext({\n observerPersonContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121006',\n schemeDesignator: 'DCM',\n meaning: 'Person'\n }),\n observerIdentifyingAttributes: observer\n }),\n observerDeviceContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121007',\n schemeDesignator: 'DCM',\n meaning: 'Device'\n }),\n observerIdentifyingAttributes:\n new dcmjs.sr.templates.DeviceObserverIdentifyingAttributes({\n uid: this.props.app.uid,\n manufacturerName: 'MGH Computational Pathology',\n modelName: this.props.app.name\n })\n }),\n subjectContext: new dcmjs.sr.templates.SubjectContext({\n subjectClass: new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n schemeDesignator: 'DCM',\n meaning: 'Specimen'\n }),\n subjectClassSpecificContext:\n new dcmjs.sr.templates.SubjectContextSpecimen({\n uid: refSpecimen.SpecimenUID,\n identifier: refSpecimen.SpecimenIdentifier,\n containerIdentifier: refImage.ContainerIdentifier\n })\n })\n })\n\n console.debug('encode Imaging Measurements')\n const imagingMeasurements: dcmjs.sr.valueTypes.ContainerContentItem[] = []\n for (let i = 0; i < rois.length; i++) {\n const roi = rois[i]\n if (!this.state.visibleRoiUIDs.has(roi.uid)) {\n continue\n }\n let findingType = roi.evaluations.find(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue === '121071'\n }\n )\n if (findingType === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `No finding type was specified for ROI \"${roi.uid}\"`\n )\n )\n }\n findingType = findingType as dcmjs.sr.valueTypes.CodeContentItem\n const group = new dcmjs.sr.templates.PlanarROIMeasurementsAndQualitativeEvaluations({\n trackingIdentifier: new dcmjs.sr.templates.TrackingIdentifier({\n uid: roi.properties.trackingUID ?? roi.uid,\n identifier: `ROI #${i + 1}`\n }),\n referencedRegion: new dcmjs.sr.contentItems.ImageRegion3D({\n graphicType: roi.scoord3d.graphicType,\n graphicData: roi.scoord3d.graphicData,\n frameOfReferenceUID: roi.scoord3d.frameOfReferenceUID\n }),\n findingType: new dcmjs.sr.coding.CodedConcept({\n value: findingType.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n findingType.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: findingType.ConceptCodeSequence[0].CodeMeaning\n }),\n qualitativeEvaluations: roi.evaluations.filter(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue !== '121071'\n }\n ),\n measurements: roi.measurements\n })\n const measurements = group as dcmjs.sr.valueTypes.ContainerContentItem[]\n measurements[0].ContentTemplateSequence = [{\n MappingResource: 'DCMR',\n TemplateIdentifier: '1410'\n }]\n imagingMeasurements.push(...measurements)\n }\n\n console.debug('create Measurement Report document content')\n const measurementReport = new dcmjs.sr.templates.MeasurementReport({\n languageOfContentItemAndDescendants: new dcmjs.sr.templates.LanguageOfContentItemAndDescendants({}),\n observationContext: observationContext,\n procedureReported: new dcmjs.sr.coding.CodedConcept({\n value: '112703',\n schemeDesignator: 'DCM',\n meaning: 'Whole Slide Imaging'\n }),\n imagingMeasurements: imagingMeasurements\n })\n\n console.info('create Comprehensive 3D SR document')\n const dataset = new dcmjs.sr.documents.Comprehensive3DSR({\n content: measurementReport[0],\n evidence: [refImage],\n seriesInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n seriesNumber: 1,\n seriesDescription: 'Annotation',\n sopInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n instanceNumber: 1,\n manufacturer: 'MGH Computational Pathology',\n previousVersions: undefined // TODO\n })\n\n this.setState({\n isReportModalVisible: true,\n generatedReport: dataset as dmv.metadata.Comprehensive3DSR\n })\n }\n\n /**\n * Handler that gets called when a report should be verified. The current\n * list of annotations will be presented to the user together with other\n * pertinent metadata about the patient, study, and specimen.\n */\n handleReportVerification (): void {\n console.info('verfied report')\n\n const report = this.state.generatedReport\n if (report !== undefined) {\n const dataset = report as unknown as dmv.metadata.Comprehensive3DSR\n console.debug('create File Meta Information')\n const fileMetaInformationVersionArray = new Uint8Array(2)\n fileMetaInformationVersionArray[1] = 1\n const fileMeta = {\n // FileMetaInformationVersion\n '00020001': {\n Value: [fileMetaInformationVersionArray.buffer],\n vr: 'OB'\n },\n // MediaStorageSOPClassUID\n '00020002': {\n Value: [dataset.SOPClassUID],\n vr: 'UI'\n },\n // MediaStorageSOPInstanceUID\n '00020003': {\n Value: [dataset.SOPInstanceUID],\n vr: 'UI'\n },\n // TransferSyntaxUID\n '00020010': {\n Value: ['1.2.840.10008.1.2.1'],\n vr: 'UI'\n },\n // ImplementationClassUID\n '00020012': {\n Value: [this.props.app.uid],\n vr: 'UI'\n }\n }\n\n console.info('store Comprehensive 3D SR document')\n const writer = new dcmjs.data.DicomDict(fileMeta)\n writer.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset)\n const buffer = writer.write()\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.storeInstances({ datasets: [buffer] }).then(\n (response: any) => message.info('Annotations were saved.')\n ).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Annotations could not be saved'\n )\n )\n })\n }\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when report generation has been cancelled.\n */\n handleReportCancellation (): void {\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when an annotation has been selected from the\n * current list of annotations.\n */\n handleAnnotationSelection ({ roiUID }: { roiUID: string }): void {\n console.log(`selected ROI ${roiUID}`)\n this.setState({ selectedRoiUIDs: new Set([roiUID]) })\n this.volumeViewer.getAllROIs().forEach((roi) => {\n let style = {}\n if (roi.uid === roiUID) {\n style = this.selectedRoiStyle\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n if (this.state.visibleRoiUIDs.has(roi.uid)) {\n const key = _getRoiKey(roi)\n style = this.getRoiStyle(key)\n }\n }\n this.volumeViewer.setROIStyle(roi.uid, style)\n })\n }\n\n /**\n * Handle toggling of annotation visibility, i.e., whether a given\n * annotation should be either displayed or hidden by the viewer.\n */\n handleAnnotationVisibilityChange ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }): void {\n if (isVisible) {\n console.info(`show ROI ${roiUID}`)\n const roi = this.volumeViewer.getROI(roiUID)\n const key = _getRoiKey(roi)\n const style = this.getRoiStyle(key)\n this.volumeViewer.setROIStyle(roi.uid, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.info(`hide ROI ${roiUID}`)\n this.setState(state => {\n const selectedRoiUIDs = state.selectedRoiUIDs\n selectedRoiUIDs.delete(roiUID)\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.delete(roiUID)\n return { visibleRoiUIDs, selectedRoiUIDs }\n })\n this.volumeViewer.setROIStyle(roiUID, {})\n }\n }\n\n /**\n * Handle toggling of annotation group visibility, i.e., whether a given\n * annotation group should be either displayed or hidden by the viewer.\n */\n handleAnnotationGroupVisibilityChange ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of annotation group ${annotationGroupUID}`)\n if (isVisible) {\n console.info(`show annotation group ${annotationGroupUID}`)\n try {\n this.volumeViewer.showAnnotationGroup(annotationGroupUID)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to show annotation group.'\n )\n )\n throw error\n }\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.add(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n } else {\n console.info(`hide annotation group ${annotationGroupUID}`)\n this.volumeViewer.hideAnnotationGroup(annotationGroupUID)\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.delete(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n }\n }\n\n /**\n * Handle change of annotation group style.\n */\n handleAnnotationGroupStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }): void {\n console.log(`change style of annotation group ${uid}`)\n try {\n this.volumeViewer.setAnnotationGroupStyle(\n uid,\n styleOptions\n )\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of annotation group.'\n )\n )\n throw error\n }\n }\n\n generateRoiStyle (\n styleOptions: {\n opacity?: number\n color?: number[]\n }): dmv.viewer.ROIStyleOptions {\n const opacity = styleOptions.opacity ?? DEFAULT_ANNOTATION_OPACITY\n const strokeColor = styleOptions.color ?? DEFAULT_ANNOTATION_STROKE_COLOR\n const fillColor = strokeColor.map((c) => Math.min(c + 25, 255))\n const style = _formatRoiStyle({\n fill: { color: [...fillColor, opacity] },\n stroke: { color: [...strokeColor, opacity] },\n radius: this.defaultRoiStyle.stroke?.width\n })\n return style\n }\n\n handleRoiStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity: number\n color: number[]\n }\n }): void {\n console.log(`change style of ROI ${uid}`)\n try {\n this.defaultAnnotationStyles[uid] = styleOptions\n const style = this.generateRoiStyle(styleOptions)\n\n const roi = this.volumeViewer.getROI(uid)\n const key = _getRoiKey(roi) as string\n this.roiStyles[key] = style\n this.volumeViewer.setROIStyle(uid, style)\n this.state.visibleRoiUIDs.add(uid)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of ROI.'\n )\n )\n throw error\n }\n }\n\n /**\n * Handle toggling of segment visibility, i.e., whether a given\n * segment should be either displayed or hidden by the viewer.\n */\n handleSegmentVisibilityChange ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of segment ${segmentUID}`)\n if (isVisible) {\n console.info(`show segment ${segmentUID}`)\n this.volumeViewer.showSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.add(segmentUID)\n return { visibleSegmentUIDs }\n })\n } else {\n console.info(`hide segment ${segmentUID}`)\n this.volumeViewer.hideSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.delete(segmentUID)\n return { visibleSegmentUIDs }\n })\n }\n }\n\n /**\n * Handle change of segment style.\n */\n handleSegmentStyleChange ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of segment ${segmentUID}`)\n this.volumeViewer.setSegmentStyle(segmentUID, styleOptions)\n }\n\n /**\n * Handle toggling of mapping visibility, i.e., whether a given\n * mapping should be either displayed or hidden by the viewer.\n */\n handleMappingVisibilityChange ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of mapping ${mappingUID}`)\n if (isVisible) {\n console.info(`show mapping ${mappingUID}`)\n this.volumeViewer.showParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.add(mappingUID)\n return { visibleMappingUIDs }\n })\n } else {\n console.info(`hide mapping ${mappingUID}`)\n this.volumeViewer.hideParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.delete(mappingUID)\n return { visibleMappingUIDs }\n })\n }\n }\n\n /**\n * Handle change of mapping style.\n */\n handleMappingStyleChange ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of mapping ${mappingUID}`)\n this.volumeViewer.setParameterMappingStyle(mappingUID, styleOptions)\n }\n\n /**\n * Handle toggling of optical path visibility, i.e., whether a given\n * optical path should be either displayed or hidden by the viewer.\n */\n handleOpticalPathVisibilityChange ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of optical path ${opticalPathIdentifier}`)\n if (isVisible) {\n console.info(`show optical path ${opticalPathIdentifier}`)\n this.volumeViewer.showOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n } else {\n console.info(`hide optical path ${opticalPathIdentifier}`)\n this.volumeViewer.hideOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Handle change of optical path style.\n */\n handleOpticalPathStyleChange ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }): void {\n console.log(`change style of optical path ${opticalPathIdentifier}`)\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, styleOptions)\n }\n\n /**\n * Handle toggling of optical path activity, i.e., whether a given\n * optical path should be either added or removed from the viewport.\n */\n handleOpticalPathActivityChange ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }): void {\n console.log(`change activity of optical path ${opticalPathIdentifier}`)\n if (isActive) {\n console.info(`activate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.activateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n } else {\n console.info(`deactivate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.deactivateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Set default presentation state that is either defined by metadata included\n * in the DICOM Slide Microscopy instance or by the viewer.\n */\n setDefaultPresentationState (): void {\n const visibleOpticalPathIdentifiers: Set = new Set()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n if (item.isMonochromatic) {\n /*\n * If the image metadata contains a palette color lookup table for the\n * optical path, then it will be displayed by default.\n */\n if (item.paletteColorLookupTableUID != null) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n } else {\n /* Color images will always be displayed by default. */\n visibleOpticalPathIdentifiers.add(identifier)\n }\n })\n\n /*\n * If no optical paths have been selected for visualization so far, select\n * first n optical paths and set a default value of interest (VOI) window\n * (using pre-computed pixel data statistics) and a default color.\n */\n if (visibleOpticalPathIdentifiers.size === 0) {\n const defaultColors = [\n [255, 255, 255]\n ]\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n if (item.isMonochromatic) {\n const numVisible = visibleOpticalPathIdentifiers.size\n if (numVisible < defaultColors.length) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n const index = numVisible\n style.color = defaultColors[index]\n const stats = this.state.pixelDataStatistics[item.identifier]\n if (stats != null) {\n style.limitValues = [stats.min, stats.max]\n }\n this.volumeViewer.setOpticalPathStyle(item.identifier, style)\n visibleOpticalPathIdentifiers.add(item.identifier)\n }\n }\n })\n }\n\n console.info(\n `selected n=${visibleOpticalPathIdentifiers.size} optical paths ` +\n 'for visualization'\n )\n visibleOpticalPathIdentifiers.forEach(identifier => {\n this.volumeViewer.showOpticalPath(identifier)\n })\n this.setState(state => ({\n activeOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers),\n visibleOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers)\n }))\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateReset (): void {\n this.setState({ selectedPresentationStateUID: undefined })\n const urlPath = this.props.location.pathname\n this.props.navigate(urlPath)\n this.setDefaultPresentationState()\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateSelection (\n value?: string,\n option?: any\n ): void {\n if (value != null) {\n console.info(`select Presentation State instance \"${value}\"`)\n let presentationState\n this.state.presentationStates.forEach(instance => {\n if (instance.SOPInstanceUID === value) {\n presentationState = instance\n }\n })\n if (presentationState != null) {\n let urlPath = this.props.location.pathname\n urlPath += `?state=${value}`\n this.props.navigate(urlPath)\n this.setPresentationState(presentationState)\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be found'\n )\n )\n console.log(\n 'failed to handle section of presentation state: ' +\n `could not find instance \"${value}\"`\n )\n }\n } else {\n this.handlePresentationStateReset()\n }\n this.setState({ selectedPresentationStateUID: value })\n }\n\n /**\n * Handler that will toggle the ROI drawing tool, i.e., either activate or\n * de-activate it, depending on its current state.\n */\n handleRoiDrawing (): void {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else {\n console.info('activate drawing of ROIs')\n this.setState({\n isAnnotationModalVisible: true,\n isSelectedRoiModalVisible: false,\n isRoiDrawingActive: true,\n isRoiModificationActive: false,\n isRoiTranslationActive: false,\n isGoToModalVisible: false\n })\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n }\n }\n\n /**\n * Handler that will toggle the ROI modification tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiModification (): void {\n console.info('toggle modification of ROIs')\n if (this.volumeViewer.isModifyInteractionActive) {\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiModificationActive: true,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false\n })\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateSnapInteraction({})\n this.volumeViewer.activateModifyInteraction({})\n }\n }\n\n /**\n * Handler that will toggle the ROI translation tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiTranslation (): void {\n console.info('toggle translation of ROIs')\n if (this.volumeViewer.isTranslateInteractionActive) {\n this.volumeViewer.deactivateTranslateInteraction()\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiTranslationActive: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateTranslateInteraction({})\n }\n }\n\n handleGoTo (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.setState({\n isGoToModalVisible: true,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isReportModalVisible: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that will toggle the ROI removal tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiRemoval (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n if (this.state.selectedRoiUIDs.size > 0) {\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No annotation was selected for removal')\n return\n }\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.info('Annotation was removed')\n })\n this.setState({\n selectedRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.state.visibleRoiUIDs.forEach(uid => {\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n })\n this.setState({\n visibleRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n }\n this.volumeViewer.activateSelectInteraction({})\n }\n\n /**\n * Handler that will toggle the ROI visibility tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiVisibilityChange (): void {\n console.info('toggle visibility of ROIs')\n if (this.volumeViewer.areROIsVisible) {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.hideROIs()\n this.setState({\n areRoisHidden: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isRoiTranslationActive: false\n })\n } else {\n this.volumeViewer.showROIs()\n this.volumeViewer.activateSelectInteraction({})\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid !== undefined) {\n this.volumeViewer.setROIStyle(uid, this.selectedRoiStyle)\n }\n })\n this.setState({ areRoisHidden: false })\n }\n }\n\n render (): React.ReactNode {\n const rois: dmv.roi.ROI[] = []\n const segments: dmv.segment.Segment[] = []\n const mappings: dmv.mapping.ParameterMapping[] = []\n const annotationGroups: dmv.annotation.AnnotationGroup[] = []\n rois.push(...this.volumeViewer.getAllROIs())\n segments.push(...this.volumeViewer.getAllSegments())\n mappings.push(...this.volumeViewer.getAllParameterMappings())\n const allAnnotationGroups = this.volumeViewer.getAllAnnotationGroups()\n const filteredAnnotationGroups = allAnnotationGroups?.filter((annotationGroup) =>\n annotationGroup.referencedSeriesInstanceUID === this.props.seriesInstanceUID\n )\n annotationGroups.push(...filteredAnnotationGroups)\n\n const annotations = rois.map(roi => adaptRoiToAnnotation(roi))\n\n const openSubMenuItems = [\n 'specimens', 'optical-paths', 'annotations', 'presentation-states'\n ]\n\n let report: React.ReactNode\n const dataset = this.state.generatedReport\n if (dataset !== undefined) {\n report = \n }\n\n let annotationMenuItems: React.ReactNode\n if (rois.length > 0) {\n annotationMenuItems = (\n \n )\n }\n\n const findingOptions = this.findingOptions.map(finding => {\n return (\n \n {finding.CodeMeaning}\n \n )\n })\n\n const geometryTypeOptionsMapping: { [key: string]: React.ReactNode } = {\n point: Point,\n circle: Circle,\n box: Box,\n polygon: Polygon,\n line: Line,\n freehandpolygon: (\n \n Polygon (freehand)\n \n ),\n freehandline: (\n \n Line (freehand)\n \n )\n }\n\n const annotationConfigurations: React.ReactNode[] = [\n (\n \n {findingOptions}\n \n )\n ]\n\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n this.evaluationOptions[key].forEach(evaluation => {\n const evaluationOptions = evaluation.values.map(code => {\n return (\n \n {code.CodeMeaning}\n \n )\n })\n annotationConfigurations.push(\n <>\n {evaluation.name.CodeMeaning}\n \n {evaluationOptions}\n \n \n )\n })\n const geometryTypeOptions = this.geometryTypeOptions[key].map(name => {\n return geometryTypeOptionsMapping[name]\n })\n annotationConfigurations.push(\n <>\n ROI geometry type\n \n {geometryTypeOptions}\n \n \n )\n annotationConfigurations.push(\n \n measure\n \n )\n }\n\n const specimenMenu = (\n \n \n \n )\n\n const equipmentMenu = (\n \n \n \n )\n\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n const opticalPathStyles: {\n [identifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n } = {}\n const opticalPathMetadata: {\n [identifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n } = {}\n opticalPaths.forEach(opticalPath => {\n const identifier = opticalPath.identifier\n const metadata = this.volumeViewer.getOpticalPathMetadata(identifier)\n opticalPathMetadata[identifier] = metadata\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n opticalPathStyles[identifier] = style\n })\n const opticalPathMenu = (\n \n \n \n )\n\n let presentationStateMenu\n if (this.state.presentationStates.length > 0) {\n const presentationStateOptions = []\n this.state.presentationStates.forEach(instance => {\n presentationStateOptions.push(\n \n {instance.ContentDescription}\n \n )\n })\n presentationStateOptions.push(\n \n <>\n \n )\n presentationStateMenu = (\n \n \n \n {presentationStateOptions}\n \n \n }\n type='primary'\n onClick={this.handlePresentationStateReset}\n />\n \n \n \n )\n }\n\n let segmentationMenu\n if (segments.length > 0) {\n const defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n } = {}\n const segmentMetadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n } = {}\n const segments = this.volumeViewer.getAllSegments()\n segments.forEach(segment => {\n defaultSegmentStyles[segment.uid] = this.volumeViewer.getSegmentStyle(\n segment.uid\n )\n segmentMetadata[segment.uid] = this.volumeViewer.getSegmentMetadata(\n segment.uid\n )\n })\n segmentationMenu = (\n \n \n \n )\n openSubMenuItems.push('segmentations')\n }\n\n let parametricMapMenu\n if (mappings.length > 0) {\n const defaultMappingStyles: {\n [mappingUID: string]: {\n opacity: number\n }\n } = {}\n const mappingMetadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n } = {}\n mappings.forEach(mapping => {\n defaultMappingStyles[mapping.uid] = this.volumeViewer.getParameterMappingStyle(\n mapping.uid\n )\n mappingMetadata[mapping.uid] = this.volumeViewer.getParameterMappingMetadata(\n mapping.uid\n )\n })\n parametricMapMenu = (\n \n \n \n )\n openSubMenuItems.push('parametric-maps')\n }\n\n let annotationGroupMenu\n\n if (annotations.length > 0) {\n annotations.forEach((annotation) => {\n const roi = this.volumeViewer.getROI(annotation.uid)\n const key = _getRoiKey(roi) as string\n const color = this.roiStyles[key] !== undefined\n ? this.roiStyles[key].stroke?.color.slice(0, 3)\n : DEFAULT_ANNOTATION_COLOR_PALETTE[\n Object.keys(this.roiStyles).length % DEFAULT_ANNOTATION_COLOR_PALETTE.length\n ]\n this.defaultAnnotationStyles[annotation.uid] = {\n color,\n opacity: DEFAULT_ANNOTATION_OPACITY\n } as any\n\n this.roiStyles[key] = this.generateRoiStyle(\n this.defaultAnnotationStyles[annotation.uid]\n )\n })\n }\n\n if (annotationGroups.length > 0) {\n const annotationGroupMetadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n } = {}\n const defaultAnnotationGroupStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n annotationGroups.forEach(annotationGroup => {\n defaultAnnotationGroupStyles[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupStyle(\n annotationGroup.uid\n )\n annotationGroupMetadata[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupMetadata(\n annotationGroup.uid\n )\n })\n annotationGroupMenu = (\n \n \n \n )\n openSubMenuItems.push('annotationGroups')\n }\n\n let toolbar\n let toolbarHeight = '0px'\n const annotationTools = [\n ,\n ,\n ,\n ,\n ,\n \n ]\n const controlTools = [\n \n ]\n if (this.props.enableAnnotationTools) {\n toolbar = (\n \n {annotationTools.map((item, i) => {\n return {item}\n })}\n {controlTools.map((item, i) => {\n return {item}\n })}\n \n )\n toolbarHeight = '50px'\n }\n\n let cursor = 'default'\n if (this.state.isLoading) {\n cursor = 'progress'\n }\n\n let selectedRoiInformation\n if (this.state.selectedRoi != null) {\n const roiAttributes: Array<{\n name: string\n value: string\n unit?: string\n }> = [\n {\n name: 'UID',\n value: this.state.selectedRoi.uid\n }\n ]\n const roiScoordAttributes: Array<{\n name: string\n value: string\n }> = [\n {\n name: 'Graphic type',\n value: this.state.selectedRoi.scoord3d.graphicType\n }\n ]\n const roiEvaluationAttributes: Array<{\n name: string\n value: string\n }> = []\n this.state.selectedRoi.evaluations.forEach(item => {\n if (item.ValueType === 'CODE') {\n const codeItem = item as dcmjs.sr.valueTypes.CodeContentItem\n roiEvaluationAttributes.push({\n name: codeItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: codeItem.ConceptCodeSequence[0].CodeMeaning\n })\n } else {\n const textItem = item as dcmjs.sr.valueTypes.TextContentItem\n roiEvaluationAttributes.push({\n name: textItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: textItem.TextValue\n })\n }\n })\n const roiMeasurmentAttributesPerOpticalPath: {\n [identifier: string]: Array<{\n name: string\n value: string\n unit?: string\n }>\n } = {}\n this.state.selectedRoi.measurements.forEach(item => {\n let identifier = 'default'\n if (item.ContentSequence != null) {\n const refItems = findContentItemsByName({\n content: item.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121112',\n meaning: 'Source of Measurement',\n schemeDesignator: 'DCM'\n })\n })\n if (refItems.length > 0) {\n identifier = (\n refItems[0]\n // @ts-expect-error\n .ReferencedSOPSequence[0]\n .ReferencedOpticalPathIdentifier\n )\n }\n }\n if (!(identifier in roiMeasurmentAttributesPerOpticalPath)) {\n roiMeasurmentAttributesPerOpticalPath[identifier] = []\n }\n const measuredValueItem = item.MeasuredValueSequence[0]\n roiMeasurmentAttributesPerOpticalPath[identifier].push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: measuredValueItem.NumericValue.toString(),\n unit: measuredValueItem.MeasurementUnitsCodeSequence[0].CodeMeaning\n })\n })\n const createRoiDescription = (\n attributes: Array<{ name: string, value: string, unit?: string }>\n ): React.ReactNode[] => {\n return attributes.map(item => {\n let value\n if (item.unit != null) {\n value = `${item.value} [${item.unit}]`\n } else {\n value = item.value\n }\n return (\n \n {value}\n \n )\n })\n }\n const roiDescriptions = createRoiDescription(roiAttributes)\n const roiScoordDescriptions = createRoiDescription(\n roiScoordAttributes\n )\n const roiEvaluationDescriptions = createRoiDescription(\n roiEvaluationAttributes\n )\n const roiMeasurementDescriptions = []\n for (const identifier in roiMeasurmentAttributesPerOpticalPath) {\n const descriptions = createRoiDescription(\n roiMeasurmentAttributesPerOpticalPath[identifier]\n )\n if (identifier === 'default') {\n roiMeasurementDescriptions.push(descriptions)\n } else {\n roiMeasurementDescriptions.push(\n <>\n \n {identifier}\n \n {descriptions}\n \n )\n }\n }\n selectedRoiInformation = (\n <>\n \n {roiDescriptions}\n \n \n Spatial coordinates\n \n \n {roiScoordDescriptions}\n \n \n Evaluations\n \n \n {roiEvaluationDescriptions}\n \n \n Measurements\n \n \n {roiMeasurementDescriptions}\n \n \n )\n }\n\n return (\n \n \n {toolbar}\n\n \n\n \n \n {annotationConfigurations}\n \n \n\n \n \n {selectedRoiInformation}\n \n \n\n \n \n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n \n\n \n {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(() => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }, 100)\n }}\n >\n {this.labelViewportRef.current != null && (\n \n \n \n \n \n )}\n {specimenMenu}\n {equipmentMenu}\n {opticalPathMenu}\n {presentationStateMenu}\n \n {annotationMenuItems}\n \n {annotationGroupMenu}\n {annotations.length === 0\n ? (\n <>\n )\n : (\n \n \n \n )}\n {segmentationMenu}\n {parametricMapMenu}\n \n \n {this.state.isHoveredRoiTooltipVisible &&\n this.state.hoveredRoiAttributes.length > 0\n ? (\n \n )\n : (\n <>\n )}\n \n )\n }\n}\n\nexport default withRouter(SlideViewer)\n","import * as dmv from 'dicom-microscopy-viewer'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nenum ImageFlavors {\n VOLUME = 'VOLUME',\n LABEL = 'LABEL',\n OVERVIEW = 'OVERVIEW',\n THUMBNAIL = 'THUMBNAIL'\n}\n\nconst hasImageFlavor = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n imageFlavor: ImageFlavors\n): boolean => {\n return image.ImageType[2] === imageFlavor\n}\n\nconst areSameAcquisition = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n refImage: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean => {\n if (image.AcquisitionUID != null) {\n return image.AcquisitionUID === refImage.AcquisitionUID\n }\n return false\n}\n\ninterface SlideImageCollection {\n acquisitionUID?: string\n frameOfReferenceUID: string\n containerIdentifier: string\n volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n}\n\ninterface SlideOptions {\n images: dmv.metadata.VLWholeSlideMicroscopyImage[]\n description?: string\n}\n\n/**\n * Slide - collection of images with the same Frame of Reference UID and\n * Container Identifier.\n */\nclass Slide {\n readonly description: string\n readonly acquisitionUID: string | null | undefined\n readonly frameOfReferenceUID: string\n readonly containerIdentifier: string\n readonly seriesInstanceUIDs: string[]\n readonly opticalPathIdentifiers: string[]\n readonly pyramidUIDs: string[] = []\n readonly areVolumeImagesMonochrome: boolean\n readonly volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n\n /**\n * @param options\n * @param options.images - Metadata of images associated with the slide\n * @param options.description - Description of the slide\n */\n constructor (\n options: SlideOptions\n ) {\n if (options.images.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Value of option \"images\" have been non-zero length.'\n )\n )\n }\n\n const seriesInstanceUIDs = new Set([] as string[])\n const acquisitionUIDs = new Set([] as string[])\n const opticalPathIdentifiers = new Set([] as string[])\n const containerIdentifiers = new Set([] as string[])\n const frameOfReferenceUIDs = {\n VOLUME: new Set([] as string[]),\n LABEL: new Set([] as string[]),\n OVERVIEW: new Set([] as string[])\n }\n const pyramidUIDs: {\n [key: string]: { [opticalPathIdentifier: string]: Set }\n } = {\n VOLUME: {}\n }\n const volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n options.images.forEach((image) => {\n containerIdentifiers.add(image.ContainerIdentifier)\n seriesInstanceUIDs.add(image.SeriesInstanceUID)\n image.OpticalPathSequence.forEach(item => {\n opticalPathIdentifiers.add(item.OpticalPathIdentifier)\n })\n if (image.AcquisitionUID != null) {\n acquisitionUIDs.add(image.AcquisitionUID)\n }\n if (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n ) {\n frameOfReferenceUIDs.VOLUME.add(image.FrameOfReferenceUID)\n if (image.PyramidUID != null) {\n for (const identifier in opticalPathIdentifiers) {\n pyramidUIDs.VOLUME[identifier].add(image.PyramidUID)\n }\n }\n volumeImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.LABEL)) {\n frameOfReferenceUIDs.LABEL.add(image.FrameOfReferenceUID)\n labelImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.OVERVIEW)) {\n frameOfReferenceUIDs.OVERVIEW.add(image.FrameOfReferenceUID)\n overviewImages.push(image)\n }\n })\n if (volumeImages.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'At least one VOLUME image must be provided for a slide.'\n )\n )\n } else {\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const samplesPerPixel = new Set([] as number[])\n volumeImages.forEach((image) => {\n samplesPerPixel.add(image.SamplesPerPixel)\n })\n if (samplesPerPixel.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const isNotResampled = volumeImages.filter(image => {\n return image.ImageType[3] !== 'RESAMPLED'\n })\n if (isNotResampled.length > opticalPathIdentifiers.size) {\n console.warn(\n 'the set of VOLUME images of a slide must contain only a single ' +\n 'image that has not been resampled per optical path'\n )\n }\n }\n this.volumeImages = volumeImages\n this.labelImages = labelImages\n this.overviewImages = overviewImages\n\n this.seriesInstanceUIDs = [...seriesInstanceUIDs]\n this.opticalPathIdentifiers = [...opticalPathIdentifiers]\n\n if (containerIdentifiers.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All images of a slide must have the same Container Identifier.'\n )\n )\n }\n this.containerIdentifier = [...containerIdentifiers][0]\n\n if (frameOfReferenceUIDs.VOLUME.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have ' +\n 'the same Frame of Reference UID.'\n )\n )\n }\n this.frameOfReferenceUID = [...frameOfReferenceUIDs.VOLUME][0]\n\n let requirePyramidUID = false\n if (Object.keys(pyramidUIDs.VOLUME).length > 0) {\n requirePyramidUID = true\n }\n this.opticalPathIdentifiers.forEach(identifier => {\n if (pyramidUIDs.VOLUME[identifier] != null) {\n if (pyramidUIDs.VOLUME[identifier].size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `All VOLUME images for optical path \"${identifier}\"` +\n 'must be part of the same multi-resolution pyramid.'\n )\n )\n } else if (pyramidUIDs.VOLUME[identifier].size === 1) {\n this.pyramidUIDs.push([...pyramidUIDs.VOLUME[identifier]][0])\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n } else {\n if (requirePyramidUID) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n }\n })\n\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must be part of the same ' +\n 'acquisition and have the same Acquisition UID.'\n )\n )\n } else if (acquisitionUIDs.size === 1) {\n this.acquisitionUID = [...acquisitionUIDs][0]\n } else {\n this.acquisitionUID = null\n }\n\n this.areVolumeImagesMonochrome = (\n this.volumeImages[0].SamplesPerPixel === 1 &&\n this.volumeImages[0].PhotometricInterpretation === 'MONOCHROME2'\n )\n\n this.description = (\n options.description !== undefined ? options.description : ''\n )\n }\n}\n\n/**\n * Create slides.\n *\n * @param imagesPerSeries - Image instances grouped per series\n * @param referenceSeriesInstanceUID - Unique identifier of the series that serves as a reference for the slide\n * @returns Slides\n */\nconst createSlides = (\n images: dmv.metadata.VLWholeSlideMicroscopyImage[][]\n): Slide[] => {\n const slideMetadata: SlideImageCollection[] = []\n images.forEach((series) => {\n if (series.length > 0) {\n const volumeImages = series.filter((image) => {\n return (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n )\n })\n if (volumeImages.length > 0) {\n const refImage = volumeImages[0]\n const filteredVolumeImages = volumeImages.filter((image) => {\n return refImage.SamplesPerPixel === image.SamplesPerPixel\n })\n const slideMetadataIndex = slideMetadata.findIndex((slide) => {\n return _doesImageBelongToSlide(slide, refImage)\n })\n\n const labelImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.LABEL)\n })\n let filteredLabelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (labelImages.length > 1) {\n filteredLabelImages = labelImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredLabelImages = labelImages\n }\n const overviewImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.OVERVIEW)\n })\n let filteredOverviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (overviewImages.length > 1) {\n filteredOverviewImages = overviewImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredOverviewImages = overviewImages\n }\n\n if (slideMetadataIndex === -1) {\n const slideMetadataItem: SlideImageCollection = {\n acquisitionUID: refImage.AcquisitionUID,\n frameOfReferenceUID: refImage.FrameOfReferenceUID,\n containerIdentifier: refImage.ContainerIdentifier,\n volumeImages: filteredVolumeImages,\n labelImages: filteredLabelImages,\n overviewImages: filteredOverviewImages\n }\n slideMetadata.push(slideMetadataItem)\n } else {\n const slideMetadataItem = slideMetadata[slideMetadataIndex]\n slideMetadataItem.volumeImages.push(...filteredVolumeImages)\n slideMetadataItem.labelImages.push(...filteredLabelImages)\n slideMetadataItem.overviewImages.push(...filteredOverviewImages)\n }\n }\n }\n })\n\n let slides: Slide[] = slideMetadata.map((item) => {\n return new Slide({\n images: [\n ...item.volumeImages,\n ...item.labelImages,\n ...item.overviewImages\n ]\n })\n })\n slides = slides.sort((a, b) => {\n const imgA = a.volumeImages[0]\n const imgB = b.volumeImages[0]\n if (imgA.ContainerIdentifier != null && imgB.ContainerIdentifier != null) {\n return Number(imgA.ContainerIdentifier) - Number(imgB.ContainerIdentifier)\n } else {\n return 0\n }\n })\n\n return slides\n}\n\n/**\n * Check if instance belongs to the slide.\n *\n * Compares values of Frame of Reference UID and Container Identifier attributes.\n *\n * @param slide - Slide metadata object\n * @param image - Metadata of VOLUME, LABEL or OVERVIEW image instance\n */\nfunction _doesImageBelongToSlide (\n slide: SlideImageCollection,\n image: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean {\n if (\n slide.frameOfReferenceUID === image.FrameOfReferenceUID &&\n slide.containerIdentifier === image.ContainerIdentifier &&\n slide.acquisitionUID === image.AcquisitionUID\n ) {\n return true\n }\n return false\n}\n\nexport { Slide, createSlides }\n","import * as dmv from 'dicom-microscopy-viewer'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { StorageClasses } from '../data/uids'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './NotificationMiddleware'\nimport { createSlides, Slide } from '../data/slides'\n\ninterface FetchImageMetadataParams {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n onSuccess: (slides: Slide[]) => void\n onError: (error: Error) => void\n}\n\nexport const fetchImageMetadata = async ({\n clients,\n studyInstanceUID,\n onSuccess,\n onError\n}: FetchImageMetadataParams): Promise => {\n try {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n\n const client = clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(\n matchedSeries.map(async (s) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const loadingSeries = dataset as dmv.metadata.Series\n console.info(\n `retrieve metadata of series \"${loadingSeries.SeriesInstanceUID}\"`\n )\n const retrievedMetadata = await client.retrieveSeriesMetadata({\n studyInstanceUID: studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item) => {\n if (\n item['00080016']?.Value?.[0] ===\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n })\n )\n const newSlides = createSlides(images)\n onSuccess(newSlides)\n } catch (err) {\n console.error(err)\n const customError = new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.'\n )\n onError(customError)\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n customError\n )\n }\n}\n","import { useState, useEffect } from 'react'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { Slide } from '../data/slides'\nimport { fetchImageMetadata } from '../services/fetchImageMetadata'\n\ninterface UseSlidesProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\ninterface UseSlidesReturn {\n slides: Slide[]\n isLoading: boolean\n error: Error | null\n}\n\nconst slidesCache = new Map()\nconst pendingRequests = new Map>()\n\n/**\n * Hook to fetch and manage whole slide microscopy images for a given study.\n * Values are cached so they can be reused if props are not provided.\n *\n * @param props - Hook configuration props\n * @param props.clients - Map of DICOM web clients keyed by storage class\n */\nexport const useSlides = ({ clients, studyInstanceUID }: UseSlidesProps): UseSlidesReturn => {\n const [slides, setSlides] = useState([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState(null)\n\n useEffect(() => {\n if (studyInstanceUID === undefined) {\n setSlides([])\n setIsLoading(false)\n return\n }\n\n const cachedData = slidesCache.get(studyInstanceUID)\n if (cachedData !== undefined) {\n setSlides(cachedData)\n setIsLoading(false)\n return\n }\n\n setIsLoading(true)\n\n const fetchSlides = async (): Promise => {\n // Check if there's already a pending request for this study\n let pendingRequest = pendingRequests.get(studyInstanceUID)\n\n if (pendingRequest === undefined) {\n // Create a new promise for this request\n pendingRequest = new Promise((resolve, reject): void => {\n fetchImageMetadata({\n clients,\n studyInstanceUID,\n onSuccess: (newSlides) => {\n slidesCache.set(studyInstanceUID, newSlides)\n resolve(newSlides)\n },\n onError: (err) => {\n reject(err)\n }\n }).catch((err) => {\n reject(err)\n })\n })\n pendingRequests.set(studyInstanceUID, pendingRequest)\n }\n\n try {\n const newSlides = await pendingRequest\n setSlides(newSlides)\n setError(null)\n } catch (err) {\n setError(err as Error)\n setSlides([])\n } finally {\n pendingRequests.delete(studyInstanceUID)\n setIsLoading(false)\n }\n }\n\n void fetchSlides()\n }, [clients, studyInstanceUID])\n\n return { slides, isLoading, error }\n}\n","import { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport { AnnotationSettings } from '../AppConfig'\nimport ClinicalTrial from './ClinicalTrial'\nimport DicomWebManager from '../DicomWebManager'\nimport Patient from './Patient'\nimport Study from './Study'\nimport SlideList from './SlideList'\nimport SlideViewer from './SlideViewer'\n\nimport { User } from '../auth'\nimport { Slide } from '../data/slides'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { useSlides } from '../hooks/useSlides'\n\nfunction ParametrizedSlideViewer ({\n clients,\n slides,\n user,\n app,\n preload,\n enableAnnotationTools,\n annotations\n}: {\n clients: { [key: string]: DicomWebManager }\n slides: Slide[]\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload: boolean\n enableAnnotationTools: boolean\n annotations: AnnotationSettings[]\n}): JSX.Element | null {\n const { studyInstanceUID, seriesInstanceUID } = useParams()\n const location = useLocation()\n\n const selectedSlide = slides.find((slide: Slide) => {\n return slide.seriesInstanceUIDs.find((uid: string) => {\n return uid === seriesInstanceUID\n })\n })\n const searchParams = new URLSearchParams(location.search)\n let presentationStateUID: string | null | undefined\n if (!searchParams.has('access_token')) {\n presentationStateUID = searchParams.get('state')\n if (presentationStateUID === null) {\n presentationStateUID = undefined\n }\n }\n let viewer = null\n if (selectedSlide != null) {\n viewer = (\n \n )\n }\n return viewer\n}\n\ninterface ViewerProps extends RouteComponentProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n preload: boolean\n user?: {\n name: string\n email: string\n }\n}\n\nfunction Viewer (props: ViewerProps): JSX.Element | null {\n const { clients, studyInstanceUID, location, navigate } = props\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n\n const handleSeriesSelection = ({ seriesInstanceUID }: { seriesInstanceUID: string }): void => {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (location.pathname.includes('/projects/')) {\n urlPath = location.pathname\n if (!location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n location.pathname.includes('/series/') &&\n location.search != null\n ) {\n urlPath += location.search\n }\n\n navigate(urlPath, { replace: true })\n }\n\n if (isLoading) {\n return null\n }\n\n if (slides.length === 0) {\n return null\n }\n\n const firstSlide = slides[0]\n const volumeInstances = firstSlide.volumeImages\n if (volumeInstances.length === 0) {\n return null\n }\n const refImage = volumeInstances[0]\n\n /* If a series is encoded in the path, route the viewer to this series.\n * Otherwise select the first series correspondent to\n * the first slide contained in the study.\n */\n let selectedSeriesInstanceUID: string\n if (location.pathname.includes('series/')) {\n const seriesFragment = location.pathname.split('series/')[1]\n selectedSeriesInstanceUID = seriesFragment.includes('/') ? seriesFragment.split('/')[0] : seriesFragment\n } else {\n selectedSeriesInstanceUID = volumeInstances[0].SeriesInstanceUID\n }\n\n let clinicalTrialMenu\n if (refImage.ClinicalTrialSponsorName != null) {\n clinicalTrialMenu = (\n \n \n \n )\n }\n\n return (\n \n \n \n \n \n \n \n \n \n {clinicalTrialMenu}\n \n \n \n \n \n\n \n \n }\n />\n \n \n )\n}\n\nexport default withRouter(Viewer)\n","import dcmjs from 'dcmjs'\n\nconst { DicomMetaDictionary } = dcmjs.data\n\ninterface TagInfo {\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TagInfo[]\n level: number\n}\n\nexport interface DicomTag {\n name: string\n vr: string\n Value?: any[]\n [key: string]: any\n}\n\nconst formatValue = (val: any): string => {\n if (typeof val === 'object' && val !== null) {\n return JSON.stringify(val)\n }\n return String(val)\n}\n\nexport const formatTagValue = (tag: DicomTag): string => {\n if (tag.Value == null) return ''\n\n if (Array.isArray(tag.Value)) {\n return tag.Value.map(formatValue).join(', ')\n }\n\n return formatValue(tag.Value)\n}\n\n/**\n * Processes DICOM metadata and returns a flattened array of tag information\n * @param metadata - The DICOM metadata object to process\n * @param depth - The current depth level for nested sequences (default: 0)\n * @returns Array of processed tag information\n */\nexport function getRows (metadata: Record, depth = 0): TagInfo[] {\n if (metadata === undefined || metadata === null) return []\n const keywords = Object.keys(metadata).filter(key => key !== '_vrMap')\n\n return keywords.flatMap(keyword => {\n // @ts-expect-error\n const tagInfo = DicomMetaDictionary.nameMap[keyword] as TagInfo | undefined\n let value = metadata[keyword]\n\n // Handle private or unknown tags\n if (tagInfo === undefined) {\n const regex = /[0-9A-Fa-f]{6}/g\n if (keyword.match(regex) == null) return []\n\n return [{\n tag: `(${keyword.substring(0, 4)},${keyword.substring(4, 8)})`,\n vr: '',\n keyword: 'Private Tag',\n value: value?.toString() ?? '',\n level: depth\n }]\n }\n\n // Handle sequence values (SQ VR)\n if (tagInfo.vr === 'SQ' && value !== undefined) {\n const sequenceItems = Array.isArray(value) ? value : [value]\n\n // Create a parent sequence node\n const sequenceNode: TagInfo = {\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword,\n value: `Sequence with ${sequenceItems.length} item(s)`,\n level: depth,\n children: []\n }\n\n // Create individual nodes for each sequence item\n sequenceNode.children = sequenceItems.map((item, index) => {\n const itemNode: TagInfo = {\n tag: `${tagInfo.tag}.${index + 1}`,\n vr: 'Item',\n keyword: `Item ${index + 1}`,\n value: `Sequence Item ${index + 1}`,\n level: depth + 1,\n children: getRows(item, depth + 2)\n }\n return itemNode\n })\n\n return [sequenceNode]\n }\n\n // Handle array values\n if (Array.isArray(value)) {\n value = value.map(formatValue).join('\\\\')\n } else if (typeof value === 'object' && value !== null) {\n value = formatValue(value)\n }\n\n return [{\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword: keyword.replace('RETIRED_', ''),\n value: value?.toString() ?? '',\n level: depth\n }]\n })\n}\n\n/**\n * Sorts DICOM tags alphabetically by tag value\n * @param metadata - The DICOM metadata object to process\n * @returns Sorted array of tag information\n */\nexport function getSortedTags (metadata: Record): TagInfo[] {\n const tagList = getRows(metadata)\n return tagList.sort((a, b) => a.tag.localeCompare(b.tag))\n}\n","/**\n * Formats a DICOM datetime string (YYYYMMDD:HHmmss) into a human-readable format\n *\n * @param dateStr - DICOM datetime string in format \"YYYYMMDD:HHmmss\"\n * @returns Formatted date string (e.g., \"Mon, Jan 1 2024\")\n * @example\n * formatDicomDate(\"20240101:120000\") // Returns \"Mon, Jan 1 2024\"\n * formatDicomDate(\"invalid\") // Returns \"invalid\"\n */\nexport const formatDicomDate = (dateStr: string): string => {\n // Parse YYYYMMDD:HHmmss format\n const match = dateStr.match(/^(\\d{4})(\\d{2})(\\d{2}):(\\d{2})(\\d{2})(\\d{2})/)\n if (match == null) return dateStr\n\n const [, year, month, day, hour, minute, second] = match\n\n // Validate month and day\n const monthNum = parseInt(month)\n const dayNum = parseInt(day)\n if (monthNum < 1 || monthNum > 12 || dayNum < 1 || dayNum > 31) {\n return dateStr\n }\n\n const date = new Date(\n parseInt(year),\n monthNum - 1, // months are 0-based\n dayNum,\n parseInt(hour),\n parseInt(minute),\n parseInt(second)\n )\n\n // Check if the date is invalid or if the month/day combination is invalid\n // This catches cases like February 31st where the date rolls over to March\n if (\n date.getMonth() !== monthNum - 1 || // month rolled over\n date.getDate() !== dayNum // day rolled over\n ) {\n return dateStr\n }\n\n // Format parts separately to avoid the extra comma\n const weekday = date.toLocaleDateString('en-US', { weekday: 'short' })\n const monthName = date.toLocaleDateString('en-US', { month: 'short' })\n const dayFormatted = date.getDate()\n const yearNum = date.getFullYear()\n\n return `${weekday}, ${monthName} ${dayFormatted} ${yearNum}`\n}\n","import { v4 as generateUUID } from 'uuid'\n\n/**\n * Consumer must implement:\n * this.listeners = {}\n * this.EVENTS = { \"EVENT_KEY\": \"EVENT_VALUE\" }\n */\nconst pubSubInterface = {\n subscribe,\n _broadcastEvent,\n _unsubscribe,\n _isValidEvent\n}\n\nexport default pubSubInterface\n\n/**\n * Subscribe to updates.\n *\n * @param {string} eventName The name of the event\n * @param {Function} callback Events callback\n * @return {Object} Observable object with actions\n */\nfunction subscribe (this: PubSubService, eventName: string, callback: Function): { unsubscribe: () => any } {\n if (this._isValidEvent(eventName)) {\n const listenerId = generateUUID()\n const subscription = { id: listenerId, callback }\n\n // console.info(`Subscribing to '${eventName}'.`);\n if (Array.isArray(this.listeners[eventName])) {\n this.listeners[eventName].push(subscription)\n } else {\n this.listeners[eventName] = [subscription]\n }\n\n return {\n unsubscribe: () => this._unsubscribe(eventName, listenerId)\n }\n } else {\n throw new Error(`Event ${eventName} not supported.`)\n }\n}\n\n/**\n * Unsubscribe to measurement updates.\n *\n * @param {string} eventName The name of the event\n * @param {string} listenerId The listeners id\n * @return void\n */\nfunction _unsubscribe (this: PubSubService, eventName: string, listenerId: string): void {\n if (this.listeners[eventName] === undefined) {\n return\n }\n\n const listeners = this.listeners[eventName]\n if (Array.isArray(listeners)) {\n this.listeners[eventName] = listeners.filter(({ id }) => id !== listenerId)\n } else {\n this.listeners[eventName] = []\n }\n}\n\n/**\n * Check if a given event is valid.\n *\n * @param {string} eventName The name of the event\n * @return {boolean} Event name validation\n */\nfunction _isValidEvent (this: PubSubService, eventName: string): boolean {\n return Object.values(this.EVENTS).includes(eventName)\n}\n\n/**\n * Broadcasts changes.\n *\n * @param {string} eventName - The event name\n * @param {func} callbackProps - Properties to pass callback\n * @return void\n */\nfunction _broadcastEvent (this: PubSubService, eventName: string, callbackProps: any): void {\n const hasListeners = Object.keys(this.listeners).length > 0\n const hasCallbacks = Array.isArray(this.listeners[eventName])\n\n if (hasListeners && hasCallbacks) {\n this.listeners[eventName].forEach((listener: { id: string, callback: Function }) => {\n listener.callback(callbackProps)\n })\n }\n}\n\n/** Export a PubSubService class to be used instead of the individual items */\nexport class PubSubService {\n EVENTS: any\n subscribe: (\n eventName: string,\n callback: Function\n ) => { unsubscribe: () => any }\n\n _broadcastEvent: (eventName: string, callbackProps: any) => void\n _unsubscribe: (eventName: string, listenerId: string) => void\n _isValidEvent: (eventName: string) => boolean\n listeners: { [key: string]: Array<{ id: string, callback: Function }> }\n unsubscriptions: any[]\n constructor (EVENTS: Record) {\n this.EVENTS = EVENTS\n this.subscribe = subscribe\n this._broadcastEvent = _broadcastEvent\n this._unsubscribe = _unsubscribe\n this._isValidEvent = _isValidEvent\n this.listeners = {}\n this.unsubscriptions = []\n }\n\n reset (): void {\n this.unsubscriptions.forEach((unsub) => unsub())\n this.unsubscriptions = []\n }\n\n /**\n * Creates an event that records whether or not someone\n * has consumed it. Call eventData.consume() to consume the event.\n * Check eventData.isConsumed to see if it is consumed or not.\n * @param props - to include in the event\n */\n protected createConsumableEvent (props: Record): Record {\n return {\n ...props,\n isConsumed: false,\n consume: function Consume () {\n this.isConsumed = true\n }\n }\n }\n}\n","import { Instance, Series } from '../services/DICOMMetadataStore'\n\nfunction createSeriesMetadata (SeriesInstanceUID: string, defaultInstances?: Instance[]): Series {\n const instances: Instance[] = []\n const instancesMap = new Map()\n\n return {\n SeriesInstanceUID,\n Modality: '',\n SeriesNumber: 0,\n SeriesDescription: '',\n SeriesDate: '',\n SeriesTime: '',\n ...defaultInstances?.[0],\n instances,\n addInstance: function (newInstance: Instance) {\n this.addInstances([newInstance])\n },\n addInstances: function (newInstances: Instance[]) {\n for (let i = 0, len = newInstances.length; i < len; i++) {\n const instance = newInstances[i]\n\n if (!instancesMap.has(instance.SOPInstanceUID)) {\n instancesMap.set(instance.SOPInstanceUID, instance)\n instances.push(instance)\n }\n }\n },\n getInstance: function (SOPInstanceUID: string) {\n return instancesMap.get(SOPInstanceUID)\n }\n }\n}\n\nexport default createSeriesMetadata\n","import createSeriesMetadata from './createSeriesMetadata'\n\nimport { Study, Series, Instance } from '../services/DICOMMetadataStore'\n\nfunction createStudyMetadata (StudyInstanceUID: string): Study {\n return {\n StudyInstanceUID,\n StudyDescription: '',\n PatientID: '',\n PatientName: '',\n StudyDate: '',\n AccessionNumber: '',\n NumInstances: 0,\n ModalitiesInStudy: [],\n isLoaded: false,\n series: [] as Series[],\n /**\n * @param {object} instance\n */\n addInstanceToSeries: function (instance: Instance) {\n this.addInstancesToSeries([instance])\n },\n /**\n * @param {object[]} instances\n * @param {string} instances[].SeriesInstanceUID\n * @param {string} instances[].StudyDescription\n */\n addInstancesToSeries: function (instances: Instance[]) {\n const { SeriesInstanceUID } = instances[0]\n\n if (this.StudyDescription !== '' && this.StudyDescription !== undefined) {\n this.StudyDescription = instances[0].StudyDescription\n }\n\n let series = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n series = createSeriesMetadata(SeriesInstanceUID, instances)\n this.series.push(series)\n }\n\n series.addInstances(instances)\n },\n\n setSeriesMetadata: function (\n SeriesInstanceUID: string,\n seriesMetadata: any\n ) {\n let existingSeries = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (existingSeries != null) {\n existingSeries = Object.assign(existingSeries, seriesMetadata)\n } else {\n const series = createSeriesMetadata(SeriesInstanceUID)\n this.series.push(Object.assign(series, seriesMetadata))\n }\n }\n }\n}\n\nexport default createStudyMetadata\n","import dcmjs from 'dcmjs'\n\nimport pubSubServiceInterface from '../utils/pubSubServiceInterface'\nimport createStudyMetadata from '../utils/createStudyMetadata'\n\nexport const EVENTS = {\n STUDY_ADDED: 'event::dicomMetadataStore:studyAdded',\n INSTANCES_ADDED: 'event::dicomMetadataStore:instancesAdded',\n SERIES_ADDED: 'event::dicomMetadataStore:seriesAdded',\n SERIES_UPDATED: 'event::dicomMetadataStore:seriesUpdated'\n}\n\nexport interface Instance {\n SOPInstanceUID: string\n SOPClassUID: string\n Rows: number\n Columns: number\n PatientSex: string\n Modality: string\n InstanceNumber: string\n imageId?: string\n [key: string]: any // For dynamic metadata properties\n}\n\nexport interface Series {\n Modality: string\n SeriesInstanceUID: string\n SeriesNumber: number\n SeriesDate: string\n SeriesTime: string\n SeriesDescription: string\n instances: Instance[]\n addInstance: (newInstance: Instance) => void\n addInstances: (newInstances: Instance[]) => void\n getInstance: (SOPInstanceUID: string) => Instance | undefined\n}\n\nexport interface Study {\n StudyInstanceUID: string\n StudyDescription: string\n PatientID: string\n PatientName: string\n StudyDate: string\n AccessionNumber: string\n NumInstances: number\n ModalitiesInStudy: any[]\n NumberOfStudyRelatedSeries?: number\n isLoaded: boolean\n series: Series[]\n addInstanceToSeries: (instance: Instance) => void\n addInstancesToSeries: (instances: Instance[]) => void\n setSeriesMetadata: (SeriesInstanceUID: string, metadata: any) => void\n}\n\ninterface Model {\n studies: Study[]\n}\n\nconst _model: Model = {\n studies: []\n}\n\nfunction _getStudyInstanceUIDs (): string[] {\n return _model.studies.map((aStudy) => aStudy.StudyInstanceUID)\n}\n\nfunction _getStudy (StudyInstanceUID: string): Study | undefined {\n return _model.studies.find(\n (aStudy) => aStudy.StudyInstanceUID === StudyInstanceUID\n )\n}\n\nfunction _getSeries (StudyInstanceUID: string, SeriesInstanceUID: string): Series | undefined {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n return study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n}\n\nfunction _getInstance (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n SOPInstanceUID: string\n): Instance | undefined {\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n\n if (series == null) {\n return\n }\n\n return series.getInstance(SOPInstanceUID)\n}\n\nfunction _getInstanceByImageId (imageId: string): Instance | undefined {\n for (const study of _model.studies) {\n for (const series of study.series) {\n for (const instance of series.instances) {\n if (instance.imageId === imageId) {\n return instance\n }\n }\n }\n }\n}\n\n/**\n * Update the metadata of a specific series\n * @param {*} StudyInstanceUID\n * @param {*} SeriesInstanceUID\n * @param {*} metadata metadata inform of key value pairs\n * @returns\n */\nfunction _updateMetadataForSeries (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n metadata: Record\n): void {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n const series = study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n return\n }\n\n const { instances } = series\n instances.forEach((instance) => {\n Object.keys(metadata).forEach((key) => {\n if (typeof metadata[key] === 'object') {\n instance[key] = { ...instance[key], ...metadata[key] }\n } else {\n instance[key] = metadata[key]\n }\n })\n })\n}\n\ninterface BaseImplementationType {\n EVENTS: typeof EVENTS\n listeners: Record\n addInstance: (dicomJSONDatasetOrP10ArrayBuffer: ArrayBuffer | Record) => void\n addInstances: (instances: Instance[], madeInClient?: boolean) => void\n updateSeriesMetadata: (seriesMetadata: Record) => void\n addSeriesMetadata: (seriesSummaryMetadata: Array>, madeInClient?: boolean) => void\n addStudy: (study: Record) => void\n getStudyInstanceUIDs: typeof _getStudyInstanceUIDs\n getStudy: typeof _getStudy\n getSeries: typeof _getSeries\n getInstance: typeof _getInstance\n getInstanceByImageId: typeof _getInstanceByImageId\n updateMetadataForSeries: typeof _updateMetadataForSeries\n _broadcastEvent: (eventName: string, data: any) => void\n}\n\nconst BaseImplementation: BaseImplementationType = {\n EVENTS,\n listeners: {},\n addInstance (dicomJSONDatasetOrP10ArrayBuffer) {\n let dicomJSONDataset\n\n // If Arraybuffer, parse to DICOMJSON before naturalizing.\n if (dicomJSONDatasetOrP10ArrayBuffer instanceof ArrayBuffer) {\n const dicomData = dcmjs.data.DicomMessage.readFile(\n dicomJSONDatasetOrP10ArrayBuffer\n )\n\n dicomJSONDataset = dicomData.dict\n } else {\n dicomJSONDataset = dicomJSONDatasetOrP10ArrayBuffer\n }\n\n let naturalizedDataset: Instance\n\n if (!('SeriesInstanceUID' in dicomJSONDataset)) {\n naturalizedDataset =\n dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomJSONDataset) as Instance\n } else {\n naturalizedDataset = dicomJSONDataset as unknown as Instance\n }\n\n const { StudyInstanceUID } = naturalizedDataset\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstanceToSeries(naturalizedDataset)\n },\n addInstances (instances, madeInClient = false) {\n const { StudyInstanceUID, SeriesInstanceUID } = instances[0]\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstancesToSeries(instances)\n\n // Broadcast an event even if we used cached data.\n // This is because the mode needs to listen to instances that are added to build up its active displaySets.\n // It will see there are cached displaySets and end early if this Series has already been fired in this\n // Mode session for some reason.\n this._broadcastEvent(EVENTS.INSTANCES_ADDED, {\n StudyInstanceUID,\n SeriesInstanceUID,\n madeInClient\n })\n },\n updateSeriesMetadata (seriesMetadata) {\n const { StudyInstanceUID, SeriesInstanceUID } = seriesMetadata\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n if (series == null) {\n return\n }\n\n const study = _getStudy(StudyInstanceUID)\n if (study != null) {\n study.setSeriesMetadata(SeriesInstanceUID, seriesMetadata)\n }\n },\n addSeriesMetadata (seriesSummaryMetadata, madeInClient = false) {\n if (\n seriesSummaryMetadata === undefined ||\n seriesSummaryMetadata.length === 0 ||\n seriesSummaryMetadata[0] === undefined\n ) {\n return\n }\n\n const { StudyInstanceUID } = seriesSummaryMetadata[0]\n let study = _getStudy(StudyInstanceUID)\n if (study == null) {\n study = createStudyMetadata(StudyInstanceUID)\n // Will typically be undefined with a compliant DICOMweb server, reset later\n study.StudyDescription = seriesSummaryMetadata[0].StudyDescription\n seriesSummaryMetadata?.forEach((item) => {\n if (study !== undefined && !study.ModalitiesInStudy?.includes(item.Modality)) {\n study.ModalitiesInStudy?.push(item.Modality)\n }\n })\n study.NumberOfStudyRelatedSeries = seriesSummaryMetadata.length\n _model.studies.push(study)\n }\n\n seriesSummaryMetadata.forEach((series) => {\n const { SeriesInstanceUID } = series\n study?.setSeriesMetadata(SeriesInstanceUID, series)\n })\n\n this._broadcastEvent(EVENTS.SERIES_ADDED, {\n StudyInstanceUID,\n seriesSummaryMetadata,\n madeInClient\n })\n },\n addStudy (study) {\n const { StudyInstanceUID } = study\n\n const existingStudy = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (existingStudy == null) {\n const newStudy = createStudyMetadata(StudyInstanceUID)\n\n newStudy.PatientID = study.PatientID\n newStudy.PatientName = study.PatientName\n newStudy.StudyDate = study.StudyDate\n newStudy.ModalitiesInStudy = study.ModalitiesInStudy\n newStudy.StudyDescription = study.StudyDescription\n newStudy.AccessionNumber = study.AccessionNumber\n newStudy.NumInstances = study.NumInstances // todo: Correct naming?\n\n _model.studies.push(newStudy)\n }\n },\n getStudyInstanceUIDs: _getStudyInstanceUIDs,\n getStudy: _getStudy,\n getSeries: _getSeries,\n getInstance: _getInstance,\n getInstanceByImageId: _getInstanceByImageId,\n updateMetadataForSeries: _updateMetadataForSeries,\n _broadcastEvent (eventName: string, data: any): void {\n }\n}\n\ninterface DicomMetadataStoreType extends BaseImplementationType {\n subscribe: (event: string, callback: (data: any) => void) => { unsubscribe: () => any }\n unsubscribe: (event: string, callback: (data: any) => void) => void\n}\n\nconst DicomMetadataStore = Object.assign(\n {},\n BaseImplementation,\n pubSubServiceInterface\n) as unknown as DicomMetadataStoreType\n\nexport { DicomMetadataStore }\nexport default DicomMetadataStore\n","import { useState, useEffect } from 'react'\n\n/**\n * A hook that delays updating a value for the specified time\n * @param value The value to debounce\n * @param delay The delay time in milliseconds\n * @returns The debounced value\n * @example\n * const debouncedSearchTerm = useDebounce(searchTerm, 300)\n */\nexport const useDebounce = (value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n} ","import { useState, useMemo, useEffect } from 'react'\nimport { Select, Input, Slider, Typography, Table } from 'antd'\nimport { SearchOutlined } from '@ant-design/icons'\n\nimport DicomWebManager from '../../DicomWebManager'\nimport './DicomTagBrowser.css'\nimport { useSlides } from '../../hooks/useSlides'\nimport { getSortedTags } from './dicomTagUtils'\nimport { formatDicomDate } from '../../utils/formatDicomDate'\nimport DicomMetadataStore, { Series, Study } from '../../services/DICOMMetadataStore'\nimport { useDebounce } from '../../hooks/useDebounce'\n\nconst { Option } = Select\n\ninterface DisplaySet {\n displaySetInstanceUID: number\n SeriesDate?: string\n SeriesTime?: string\n SeriesNumber: string\n SeriesDescription?: string\n Modality: string\n images: any[]\n}\n\ninterface TableDataItem {\n key: string\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TableDataItem[]\n}\n\ninterface DicomTagBrowserProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\nconst DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): JSX.Element => {\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n const [study, setStudy] = useState(undefined)\n\n const [displaySets, setDisplaySets] = useState([])\n const [selectedDisplaySetInstanceUID, setSelectedDisplaySetInstanceUID] = useState(0)\n const [instanceNumber, setInstanceNumber] = useState(1)\n const [filterValue, setFilterValue] = useState('')\n const [expandedKeys, setExpandedKeys] = useState([])\n const [searchInput, setSearchInput] = useState('')\n\n const debouncedSearchValue = useDebounce(searchInput, 300)\n\n useEffect(() => {\n setFilterValue(debouncedSearchValue)\n }, [debouncedSearchValue])\n\n useEffect(() => {\n const handler = (event: any): void => {\n const study: Study | undefined = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n }\n const seriesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.SERIES_ADDED, handler)\n const instancesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.INSTANCES_ADDED, handler)\n\n const study = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n\n return () => {\n seriesAddedSubscription.unsubscribe()\n instancesAddedSubscription.unsubscribe()\n }\n }, [studyInstanceUID])\n\n useEffect(() => {\n let displaySets: DisplaySet[] = []\n let derivedDisplaySets: DisplaySet[] = []\n const processedSeries: string[] = []\n let index = 0\n\n if (slides.length > 0) {\n displaySets = slides\n .map((slide): DisplaySet | null => {\n const { volumeImages } = slide\n if (volumeImages?.[0] === undefined) return null\n\n const {\n SeriesDate,\n SeriesTime,\n SeriesNumber,\n SeriesInstanceUID,\n SeriesDescription,\n Modality\n } = volumeImages[0]\n\n processedSeries.push(SeriesInstanceUID)\n\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate,\n SeriesTime,\n SeriesInstanceUID,\n // @ts-expect-error\n SeriesNumber,\n SeriesDescription,\n Modality,\n images: volumeImages\n }\n index++\n return ds\n })\n .filter((set): set is DisplaySet => set !== null)\n }\n\n if (study !== undefined && study.series?.length > 0) {\n derivedDisplaySets = study.series.filter(s => !processedSeries.includes(s.SeriesInstanceUID))\n .map((series: Series): DisplaySet => {\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate: series.SeriesDate,\n SeriesTime: series.SeriesTime,\n // @ts-expect-error\n SeriesNumber: series.SeriesNumber,\n SeriesDescription: series.SeriesDescription,\n SeriesInstanceUID: series.SeriesInstanceUID,\n Modality: series.Modality,\n images: series?.instances?.length > 0 ? series.instances : [series]\n }\n index++\n return ds\n })\n }\n\n setDisplaySets([...displaySets, ...derivedDisplaySets])\n }, [slides, study])\n\n const displaySetList = useMemo(() => {\n displaySets.sort((a, b) => Number(a.SeriesNumber) - Number(b.SeriesNumber))\n return displaySets.map((displaySet, index) => {\n const {\n SeriesDate = '',\n SeriesTime = '',\n SeriesNumber = '',\n SeriesDescription = '',\n Modality = ''\n } = displaySet\n\n const dateStr = `${SeriesDate}:${SeriesTime}`.split('.')[0]\n const displayDate = formatDicomDate(dateStr)\n\n return {\n value: index,\n label: `${SeriesNumber} (${Modality}): ${SeriesDescription}`,\n description: displayDate\n }\n })\n }, [displaySets])\n\n const showInstanceList =\n displaySets[selectedDisplaySetInstanceUID]?.images.length > 1\n\n console.debug('displaySets:', displaySets)\n\n const instanceSliderMarks = useMemo(() => {\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return {}\n const totalInstances = displaySets[selectedDisplaySetInstanceUID].images.length\n\n // Create marks for first, middle, and last instances\n const marks: Record = {\n 1: '1', // First\n [Math.ceil(totalInstances / 2)]: String(Math.ceil(totalInstances / 2)), // Middle\n [totalInstances]: String(totalInstances) // Last\n }\n\n return marks\n }, [selectedDisplaySetInstanceUID, displaySets])\n\n const columns = [\n {\n title: 'Tag',\n dataIndex: 'tag',\n key: 'tag',\n width: '30%'\n },\n {\n title: 'VR',\n dataIndex: 'vr',\n key: 'vr',\n width: '5%'\n },\n {\n title: 'Keyword',\n dataIndex: 'keyword',\n key: 'keyword',\n width: '30%'\n },\n {\n title: 'Value',\n dataIndex: 'value',\n key: 'value',\n width: '40%'\n }\n ]\n\n const tableData = useMemo(() => {\n const transformTagsToTableData = (tags: any[], parentKey = ''): TableDataItem[] => {\n return tags.map((tag, index) => {\n // Create a unique key using tag value if available, otherwise use index\n const keyBase: string = tag.tag !== '' ? tag.tag.replace(/[(),]/g, '') : index.toString()\n const currentKey: string = parentKey !== '' ? `${parentKey}-${keyBase}` : keyBase\n\n const item: TableDataItem = {\n key: currentKey,\n tag: tag.tag,\n vr: tag.vr,\n keyword: tag.keyword,\n value: tag.value\n }\n\n if (tag.children !== undefined && tag.children.length > 0) {\n item.children = transformTagsToTableData(tag.children, currentKey)\n }\n\n return item\n })\n }\n\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return []\n const metadata = displaySets[selectedDisplaySetInstanceUID]?.images[instanceNumber - 1]\n const tags = getSortedTags(metadata)\n return transformTagsToTableData(tags)\n }, [instanceNumber, selectedDisplaySetInstanceUID, displaySets])\n\n // Reset expanded keys when search value changes\n useEffect(() => {\n setExpandedKeys([])\n }, [filterValue])\n\n const filteredData = useMemo(() => {\n if (filterValue === undefined || filterValue === '') return tableData\n\n const searchLower = filterValue.toLowerCase()\n\n const nodeMatches = (node: TableDataItem): boolean => {\n return (\n (node.tag?.toLowerCase() ?? '').includes(searchLower) ||\n (node.vr?.toLowerCase() ?? '').includes(searchLower) ||\n (node.keyword?.toLowerCase() ?? '').includes(searchLower) ||\n (node.value?.toString().toLowerCase() ?? '').includes(searchLower)\n )\n }\n\n const findMatchingNodes = (nodes: TableDataItem[]): TableDataItem[] => {\n const results: TableDataItem[] = []\n\n const searchNode = (node: TableDataItem): void => {\n if (nodeMatches(node)) {\n // Create a new matching node with its original structure\n const matchingNode: TableDataItem = {\n key: node.key,\n tag: node.tag,\n vr: node.vr,\n keyword: node.keyword,\n value: node.value\n }\n\n // If the node has children, preserve them for expansion\n matchingNode.children = node?.children?.map((child): TableDataItem => ({\n key: child.key,\n tag: child.tag,\n vr: child.vr,\n keyword: child.keyword,\n value: child.value,\n children: child.children\n }))\n\n results.push(matchingNode)\n }\n\n // Continue searching through children\n node?.children?.forEach(searchNode)\n }\n\n nodes.forEach(searchNode)\n return results\n }\n\n return findMatchingNodes(tableData)\n }, [tableData, filterValue])\n\n if (isLoading) {\n return
Loading...
\n }\n\n return (\n
\n \n
\n
\n Slides\n {\n setSelectedDisplaySetInstanceUID(value)\n setInstanceNumber(1)\n }}\n optionLabelProp='label'\n optionFilterProp='label'\n >\n {displaySetList.map((item) => (\n
\n \n ))}\n \n
\n\n {showInstanceList && (\n
\n \n Instance Number: {instanceNumber}\n \n setInstanceNumber(value)}\n marks={instanceSliderMarks}\n tooltip={{\n formatter: (value: number | undefined) => value !== undefined ? `Instance ${value}` : ''\n }}\n />\n
\n )}\n
\n\n }\n onChange={(e) => setSearchInput(e.target.value)}\n value={searchInput}\n />\n\n setExpandedKeys(keys as string[])\n }}\n size='small'\n scroll={{ y: 500 }}\n />\n \n \n )\n}\n\nexport default DicomTagBrowser\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\n FileSearchOutlined,\n UnorderedListOutlined,\n UserOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport { detect } from 'detect-browser'\n\nimport Button from './Button'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport NotificationMiddleware, { NotificationMiddlewareEvents } from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\nimport { v4 as uuidv4 } from 'uuid'\nimport DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser'\nimport DicomWebManager from '../DicomWebManager'\n\ninterface HeaderProps extends RouteComponentProps {\n app: {\n name: string\n version: string\n homepage: string\n uid: string\n organization?: string\n }\n user?: {\n name: string\n email: string\n }\n clients: { [key: string]: DicomWebManager }\n showWorklistButton: boolean\n onServerSelection: ({ url }: { url: string }) => void\n onUserLogout?: () => void\n showServerSelectionButton: boolean\n}\n\ninterface ExtendedCustomError extends CustomError {\n source: string\n}\n\ninterface HeaderState {\n selectedServerUrl?: string\n isServerSelectionModalVisible: boolean\n isServerSelectionDisabled: boolean\n errorObj: ExtendedCustomError[]\n errorCategory: string[]\n warnings: string[]\n}\n\n/**\n * React component for the application header.\n */\nclass Header extends React.Component {\n constructor (props: HeaderProps) {\n super(props)\n this.state = {\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n }\n\n const onErrorHandler = ({ source, error }: {\n source: string\n error: CustomError\n }): void => {\n this.setState(state => ({\n ...state,\n errorObj: [...state.errorObj, { ...error, source }],\n errorCategory: [...state.errorCategory, error.type]\n }))\n }\n\n const onWarningHandler = (warning: string): void => {\n this.setState(state => ({\n ...state,\n warnings: [...state.warnings, warning]\n }))\n }\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnError,\n onErrorHandler\n )\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnWarning,\n onWarningHandler\n )\n }\n\n componentDidUpdate (prevProps: Readonly, prevState: Readonly): void {\n if (((prevState.warnings.length > 0) || (prevState.errorObj.length > 0)) && this.props.location.pathname !== prevProps.location.pathname) {\n this.setState({\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n })\n }\n }\n\n handleInfoButtonClick = (): void => {\n const browser = detect()\n const environment: {\n browser: {\n name?: string\n version?: string\n }\n os: {\n name?: string\n }\n } = {\n browser: {},\n os: {}\n }\n if (browser != null) {\n environment.browser = {\n name: browser.name != null ? browser.name : undefined,\n version: browser.version != null ? browser.version : undefined\n }\n environment.os = {\n name: browser.os != null ? browser.os : undefined\n }\n }\n\n Modal.info({\n title: 'About',\n width: 600,\n content: (\n <>\n \n \n {this.props.app.name}\n \n \n {this.props.app.version}\n \n \n {this.props.app.homepage}\n \n \n \n \n {environment.browser.name}\n \n \n {environment.browser.version}\n \n \n \n \n {environment.os.name}\n \n \n \n ),\n onOk (): void {}\n })\n }\n\n handleDicomTagBrowserButtonClick = (): void => {\n const width = window.innerWidth - 200\n Modal.info({\n title: 'DICOM Tag Browser',\n width,\n content: ,\n onOk (): void {}\n })\n }\n\n handleDebugButtonClick = (): void => {\n const errorMsgs: {\n Authentication: string[]\n Communication: string[]\n EncodingDecoding: string[]\n Visualization: string[]\n } = {\n Authentication: [],\n Communication: [],\n EncodingDecoding: [],\n Visualization: []\n }\n\n type ObjectKey = keyof typeof errorMsgs\n const errorNum = this.state.errorObj.length\n\n if (errorNum > 0) {\n for (let i = 0; i < errorNum; i++) {\n const category = this.state.errorCategory[i] as ObjectKey\n errorMsgs[category].push(`${this.state.errorObj[i].message as string} (Source: ${this.state.errorObj[i].source})`)\n }\n }\n\n const { Panel } = Collapse\n\n const showErrorCount = (errcount: number): JSX.Element => (\n \n )\n\n const showWarningCount = (warncount: number): JSX.Element => (\n \n )\n\n Modal.info({\n title: 'Debug Information\\n (Check console for more information)',\n width: 800,\n content: (\n \n \n
    \n {errorMsgs.Communication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.EncodingDecoding.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Visualization.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Authentication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {this.state.warnings.map(warning => (\n
  1. {warning}
  2. \n ))}\n
\n \n
\n ),\n onOk (): void {}\n })\n }\n\n handleServerSelectionButtonClick = (): void => {\n this.setState({ isServerSelectionModalVisible: true })\n }\n\n render (): React.ReactNode {\n let user = null\n if (this.props.user !== undefined) {\n const userMenuItems = []\n if (this.props.onUserLogout !== undefined) {\n userMenuItems.push(\n {\n label: 'Logout',\n key: 'user-logout',\n onClick: () => {\n if (this.props.onUserLogout !== undefined) {\n this.props.onUserLogout()\n }\n }\n }\n )\n }\n const userMenu = { items: userMenuItems }\n user = (\n \n e.preventDefault()}\n label={`${this.props.user.name} (${this.props.user.email})`}\n />\n \n )\n }\n\n let worklistButton\n if (this.props.showWorklistButton) {\n worklistButton = (\n \n \n this.handleReset(clearFilters)}\n size='small'\n style={{ width: 90 }}\n >\n Reset\n \n \n \n ),\n filterIcon: (filtered: boolean) => (\n \n )\n })\n}\n\nexport default withRouter(Worklist)\n","/**\n * Join a URI with a path to form a full URL.\n *\n * @param path - Path component\n * @param uri - Base URI to which the path component should be added\n */\nexport const joinUrl = (path: string, uri: string): string => {\n let baseUri = uri\n if (!baseUri.endsWith('/')) {\n baseUri += '/'\n }\n const url = new URL(path, baseUri)\n return url.toString()\n}\n\n/**\n * Check whether a URL contains an OAuth 2.0 authorization code.\n *\n * @param location - URL components (JavaScript location object)\n * @returns Whether the URL contains a code\n */\nexport const isAuthorizationCodeInUrl = (location: {\n search: string\n hash: string\n}): boolean => {\n const searchParams = new URLSearchParams(location.search)\n const hashParams = new URLSearchParams(location.hash.replace('#', '?'))\n\n return Boolean(\n searchParams.get('code') ??\n searchParams.get('id_token') ??\n searchParams.get('session_state') ??\n hashParams.get('code') ??\n hashParams.get('id_token') ??\n hashParams.get('session_state')\n )\n}\n","import { UserManager, User as UserData } from 'oidc-client'\n\nimport { OidcSettings } from '../AppConfig'\nimport { isAuthorizationCodeInUrl } from '../utils/url'\nimport { User, AuthManager, SignInCallback } from './'\nimport NotificationMiddleware,\n{ NotificationMiddlewareContext } from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nconst createUser = (userData: UserData | null): User => {\n let profile\n if (userData !== null) {\n profile = userData.profile\n }\n\n if (profile !== undefined) {\n if (profile.name === undefined || profile.email === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user \"name\" and \"email\".'\n )\n )\n } else {\n return {\n name: profile.name,\n email: profile.email\n }\n }\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n return {\n name: undefined,\n email: undefined\n }\n}\n\nexport default class OidcManager implements AuthManager {\n private _oidc: UserManager\n\n constructor (baseUri: string, settings: OidcSettings) {\n let responseType = 'code'\n if (settings.grantType !== undefined) {\n if (settings.grantType === 'implicit') {\n responseType = 'id_token token'\n }\n }\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`\n })\n if (settings.endSessionEndpoint != null) {\n /*\n * Unfortunately, the end session endpoint alone cannot be provided to\n * the construction of UserManager and the other metadata parameters\n * would need to be provided as well. However, configuring all of them\n * individually would not be desirable and they will be automatically\n * determined anyways. Therefore, we first construct an object, get the\n * metadata, update the metadata, and then reconstruct an object with the\n * updated metadata.\n */\n this._oidc.metadataService.getMetadata().then(metadata => {\n if (settings.endSessionEndpoint != null) {\n metadata.end_session_endpoint = settings.endSessionEndpoint\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`,\n metadata\n })\n }\n }).catch((error) => {\n console.error(\n 'failed to get metadata from authorization server: ',\n error\n )\n })\n }\n }\n\n /**\n * Sign-in to authenticate the user and obtain authorization.\n */\n signIn = async ({ onSignIn }: {\n onSignIn?: SignInCallback\n }): Promise => {\n const handleSignIn = (userData: UserData): void => {\n const user = createUser(userData)\n const authorization = `${userData.token_type} ${userData.access_token}`\n if (onSignIn != null) {\n console.info('handling sign-in using provided callback function')\n onSignIn({ user: user, authorization: authorization })\n } else {\n console.warn('no callback function was provided to handle sign-in')\n }\n }\n\n if (isAuthorizationCodeInUrl(window.location)) {\n /* Handle the callback from the authorization server: extract the code\n * from the callback URL, obtain user information and the access token\n * for the DICOMweb server.\n */\n console.info('obtaining authorization')\n const userData = await this._oidc.signinCallback()\n if (userData != null) {\n console.info('obtained user data: ', userData)\n handleSignIn(userData)\n }\n } else {\n /* Redirect to the authorization server to authenticate the user\n * and authorize the application to obtain user information and access\n * the DICOMweb server.\n */\n const userData = await this._oidc.getUser()\n if (userData === null || userData.expired) {\n console.info('authenticating user')\n await this._oidc.signinRedirect()\n } else {\n console.info('user has already been authenticated')\n handleSignIn(userData)\n }\n }\n }\n\n /**\n * Sign-out to revoke authorization.\n */\n signOut = async (): Promise => {\n console.log('signing out user and revoking authorization')\n return await this._oidc.signoutRedirect()\n }\n\n /**\n * Get authorization. Requires prior sign-in.\n */\n getAuthorization = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData !== null) {\n return userData.access_token\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n })\n }\n\n /**\n * Get user information. Requires prior sign-in.\n */\n getUser = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData === null) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user information.'\n )\n )\n }\n return createUser(userData)\n })\n }\n}\n","import retry from 'retry'\n\nimport {\n RetryRequestSettings,\n DICOMwebClientRequestHookMetadata\n} from '../AppConfig'\n\ntype RequestHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n) => XMLHttpRequest\n\n/**\n * Returns a configured retry request hook function\n * that can be used to add retry functionality to XHR request.\n *\n * Default options:\n * retries: 5\n * factor: 3\n * minTimeout: 1 * 1000\n * maxTimeout: 60 * 1000\n * randomize: true\n *\n * @param options\n * @param options.retires - Number of retries\n * @param options.factor - Factor\n * @param options.minTimeout - Min number of seconds to wait before next retry\n * @param options.maxTimeout - Max number of seconds to wait before next retry\n * @param options.randomize - Whether randomization should be applied\n * @param options.retryableStatusCodes HTTP status codes that can trigger a retry\n * @returns Configured retry request function\n */\nexport const getXHRRetryHook = (options: RetryRequestSettings = {\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n retryableStatusCodes: [429, 500]\n}): RequestHook => {\n const retryOptions = options\n\n if (options.retries != null) {\n retryOptions.retries = options.retries\n }\n\n if (options.factor != null) {\n retryOptions.factor = options.factor\n }\n\n if (options.minTimeout != null) {\n retryOptions.minTimeout = options.minTimeout\n }\n\n if (options.maxTimeout != null) {\n retryOptions.maxTimeout = options.maxTimeout\n }\n\n if (options.randomize != null) {\n retryOptions.randomize = options.randomize\n }\n\n if (options.retryableStatusCodes != null) {\n retryOptions.retryableStatusCodes = options.retryableStatusCodes\n }\n\n /**\n * Request hook used to add retry functionality to XHR requests.\n *\n * @param request - XHR request instance\n * @param metadata - Metadata about the request\n * @param metadata.url - URL\n * @param metadata.method - HTTP method\n * @returns - XHR request instance (potentially modified)\n */\n const xhrRetryHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n ): XMLHttpRequest => {\n const { url, method } = metadata\n\n function faultTolerantRequestSend (...args: any): void {\n const operation = retry.operation(retryOptions)\n\n operation.attempt(function operationAttempt (currentAttempt) {\n const originalOnReadyStateChange = request.onreadystatechange\n\n /** Overriding/extending XHR function */\n request.onreadystatechange = function onReadyStateChange (...args: any): void {\n if (originalOnReadyStateChange != null) {\n originalOnReadyStateChange.apply(request, args)\n }\n\n if (retryOptions.retryableStatusCodes.includes(request.status)) {\n const errorMessage = `Attempt to request ${url} failed.`\n const attemptFailedError = new Error(errorMessage)\n operation.retry(attemptFailedError)\n }\n }\n\n /** Call open only on retry (after headers and other things were set in the xhr instance) */\n if (currentAttempt > 1) {\n console.warn(`Requesting ${url}... (attempt: ${currentAttempt})`)\n request.open(method, url, true)\n }\n })\n\n originalRequestSend.apply(request, args)\n }\n\n /** Overriding/extending XHR function */\n const originalRequestSend = request.send\n request.send = faultTolerantRequestSend\n\n return request\n }\n\n return xhrRetryHook\n}\n\nexport default getXHRRetryHook\n","import * as dwc from 'dicomweb-client'\nimport * as dcmjs from 'dcmjs'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport { ServerSettings, DicomWebManagerErrorHandler } from './AppConfig'\nimport { joinUrl } from './utils/url'\nimport getXHRRetryHook from './utils/xhrRetryHook'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\nimport DicomMetadataStore, { Instance } from './services/DICOMMetadataStore'\n\nconst { naturalizeDataset } = dcmjs.data.DicomMetaDictionary\n\ninterface Store {\n id: string\n read: boolean\n write: boolean\n client: dwc.api.DICOMwebClient\n}\n\nexport default class DicomWebManager implements dwc.api.DICOMwebClient {\n private readonly stores: Store[] = []\n\n private readonly handleError: DicomWebManagerErrorHandler\n\n constructor ({ baseUri, settings, onError }: {\n baseUri: string\n settings: ServerSettings[]\n onError?: DicomWebManagerErrorHandler\n }) {\n if (onError != null) {\n this.handleError = onError\n } else {\n this.handleError = (error, serverSettings) => {\n console.error(error, serverSettings)\n }\n }\n\n settings.forEach(serverSettings => {\n if (serverSettings === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'At least one server needs to be configured.'\n )\n )\n }\n\n let serviceUrl\n if (serverSettings.url !== undefined) {\n serviceUrl = serverSettings.url\n } else if (serverSettings.path !== undefined) {\n serviceUrl = joinUrl(serverSettings.path, baseUri)\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Either path or full URL needs to be configured for server.'\n )\n )\n }\n\n const hasHttpsUrl = (url?: string): boolean => url?.startsWith('https') ?? false\n\n const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\n }\n\n const shouldUpgradeInsecure = serverSettings.upgradeInsecureRequests === true && [\n serviceUrl,\n serverSettings.qidoPathPrefix,\n serverSettings.wadoPathPrefix,\n serverSettings.stowPathPrefix\n ].some(hasHttpsUrl)\n\n if (serverSettings.qidoPathPrefix !== undefined) {\n clientSettings.qidoURLPrefix = serverSettings.qidoPathPrefix\n }\n if (serverSettings.wadoPathPrefix !== undefined) {\n clientSettings.wadoURLPrefix = serverSettings.wadoPathPrefix\n }\n if (serverSettings.stowPathPrefix !== undefined) {\n clientSettings.stowURLPrefix = serverSettings.stowPathPrefix\n }\n\n if (shouldUpgradeInsecure) {\n clientSettings.headers = {\n ...clientSettings.headers,\n 'Content-Security-Policy': 'upgrade-insecure-requests'\n }\n }\n\n if (serverSettings.retry !== undefined) {\n clientSettings.requestHooks = [getXHRRetryHook(serverSettings.retry)]\n }\n\n clientSettings.errorInterceptor = (error: dwc.api.DICOMwebClientError) => {\n this.handleError(error, serverSettings)\n }\n\n this.stores.push({\n id: serverSettings.id,\n write: serverSettings.write ?? false,\n read: serverSettings.read ?? true,\n client: new dwc.api.DICOMwebClient(clientSettings)\n })\n })\n\n if (this.stores.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one store is supported for now.'\n )\n )\n }\n }\n\n get baseURL (): string {\n return this.stores[0].client.baseURL\n }\n\n updateHeaders = (fields: { [name: string]: string }): void => {\n for (const f in fields) {\n this.stores[0].client.headers[f] = fields[f]\n }\n }\n\n get headers (): { [name: string]: string } {\n return this.stores[0].client.headers\n }\n\n storeInstances = async (\n options: dwc.api.StoreInstancesOptions\n ): Promise => {\n if (this.stores[0].write) {\n return await this.stores[0].client.storeInstances(options)\n } else {\n return await Promise.reject(\n new Error('Store is not writable.')\n )\n }\n }\n\n searchForStudies = async (\n options: dwc.api.SearchForStudiesOptions\n ): Promise => {\n return await this.stores[0].client.searchForStudies(options)\n }\n\n searchForSeries = async (\n options: dwc.api.SearchForSeriesOptions\n ): Promise => {\n return await this.stores[0].client.searchForSeries(options)\n }\n\n searchForInstances = async (\n options: dwc.api.SearchForInstancesOptions\n ): Promise => {\n return await this.stores[0].client.searchForInstances(options)\n }\n\n retrieveStudyMetadata = async (\n options: dwc.api.RetrieveStudyMetadataOptions\n ): Promise => {\n const studySummaryMetadata = await this.stores[0].client.retrieveStudyMetadata(options)\n const naturalized = naturalizeDataset(studySummaryMetadata)\n DicomMetadataStore.addStudy(naturalized)\n return studySummaryMetadata\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n const seriesSummaryMetadata = await this.stores[0].client.retrieveSeriesMetadata(options)\n console.debug('seriesSummaryMetadata:', seriesSummaryMetadata)\n const naturalized = seriesSummaryMetadata.map(naturalizeDataset)\n console.debug('naturalized:', naturalized)\n DicomMetadataStore.addSeriesMetadata(naturalized, true)\n return seriesSummaryMetadata\n }\n\n retrieveInstanceMetadata = async (\n options: dwc.api.RetrieveInstanceMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceMetadata(options)\n }\n\n retrieveInstance = async (\n options: dwc.api.RetrieveInstanceOptions\n ): Promise => {\n const instance = await this.stores[0].client.retrieveInstance(options)\n const data = dcmjs.data.DicomMessage.readFile(instance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n DicomMetadataStore.addInstances([dataset as Instance])\n return instance\n }\n\n retrieveInstanceFrames = async (\n options: dwc.api.RetrieveInstanceFramesOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFrames(options)\n }\n\n retrieveInstanceRendered = async (\n options: dwc.api.RetrieveInstanceRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceRendered(options)\n }\n\n retrieveInstanceFramesRendered = async (\n options: dwc.api.RetrieveInstanceFramesRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFramesRendered(options)\n }\n\n retrieveBulkData = async (\n options: dwc.api.RetrieveBulkDataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveBulkData(options)\n }\n}\n","import React from 'react'\nimport {\n BrowserRouter,\n Navigate,\n Route,\n Routes,\n useParams\n} from 'react-router-dom'\nimport { Layout, message } from 'antd'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dwc from 'dicomweb-client'\n\nimport AppConfig, { ServerSettings, ErrorMessageSettings } from './AppConfig'\nimport CaseViewer from './components/CaseViewer'\nimport Header from './components/Header'\nimport InfoPage from './components/InfoPage'\nimport Worklist from './components/Worklist'\n\nimport { User, AuthManager } from './auth'\nimport OidcManager from './auth/OidcManager'\nimport { StorageClasses } from './data/uids'\nimport DicomWebManager from './DicomWebManager'\nimport { joinUrl } from './utils/url'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\n\nfunction ParametrizedCaseViewer ({ clients, user, app, config }: {\n clients: { [key: string]: DicomWebManager }\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n config: AppConfig\n}): JSX.Element {\n const { studyInstanceUID } = useParams()\n\n const enableAnnotationTools = !(config.disableAnnotationTools ?? false)\n const preload = config.preload ?? false\n return (\n \n )\n}\n\nfunction _createClientMapping ({ baseUri, gcpBaseUrl, settings, onError }: {\n baseUri: string\n gcpBaseUrl: string\n settings: ServerSettings[]\n onError: (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ) => void\n}): { [sopClassUID: string]: DicomWebManager } {\n const storageClassMapping: { [key: string]: number } = { default: 0 }\n const clientMapping: { [sopClassUID: string]: DicomWebManager } = {}\n\n settings.forEach(serverSettings => {\n if (serverSettings.storageClasses != null) {\n serverSettings.storageClasses.forEach(sopClassUID => {\n if (Object.values(StorageClasses).includes(sopClassUID)) {\n if (sopClassUID in storageClassMapping) {\n storageClassMapping[sopClassUID] += 1\n } else {\n storageClassMapping[sopClassUID] = 1\n }\n } else {\n console.warn(\n `unknown storage class \"${sopClassUID}\" specified ` +\n `for configured server \"${serverSettings.id}\"`\n )\n }\n })\n } else {\n if (window.location.pathname.includes('/projects/')) {\n const pathname = window.location.pathname.split('/study/')[0]\n const pathUrl = `${gcpBaseUrl}${pathname}/dicomWeb`\n serverSettings.url = pathUrl\n }\n\n storageClassMapping.default += 1\n clientMapping.default = new DicomWebManager({\n baseUri,\n settings: [serverSettings],\n onError\n })\n }\n })\n\n if (storageClassMapping.default > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one default server can be configured without specification ' +\n 'of storage classes.'\n )\n )\n }\n\n for (const key in storageClassMapping) {\n if (key === 'default') {\n continue\n }\n if (storageClassMapping[key] > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one configured server can specify a given storage class. ' +\n `Storage class \"${key}\" is specified by more than one ` +\n 'of the configured servers.'\n )\n )\n }\n }\n\n if (Object.keys(storageClassMapping).length > 1) {\n settings.forEach(server => {\n const client = new DicomWebManager({\n baseUri,\n settings: [server],\n onError\n })\n if (server.storageClasses != null) {\n server.storageClasses.forEach(sopClassUID => {\n clientMapping[sopClassUID] = client\n })\n }\n })\n }\n\n Object.values(StorageClasses).forEach(sopClassUID => {\n if (!(sopClassUID in clientMapping)) {\n clientMapping[sopClassUID] = clientMapping.default\n }\n })\n return clientMapping\n}\n\ninterface AppProps {\n name: string\n homepage: string\n version: string\n config: AppConfig\n}\n\ninterface AppState {\n clients: { [sopClassUID: string]: DicomWebManager }\n user?: User\n isLoading: boolean\n redirectTo?: string\n wasAuthSuccessful: boolean\n error?: ErrorMessageSettings\n}\n\nclass App extends React.Component {\n private readonly auth?: AuthManager\n\n private readonly handleDICOMwebError = (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ): void => {\n if (error.status === 401) {\n this.signIn()\n } else if (error.status === 403) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'User is not authorized to access DICOMweb resources.')\n )\n }\n\n const logServerError = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'An unexpected server error occured.'\n )\n )\n }\n\n if (serverSettings.errorMessages !== undefined) {\n serverSettings.errorMessages.forEach((setting: ErrorMessageSettings) => {\n if (error.status === setting.status) {\n this.setState({\n error: {\n status: error.status,\n message: setting.message\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n }\n\n constructor (props: AppProps) {\n super(props)\n\n console.info('instatiate app')\n console.info(`app is located at \"${props.config.path}\"`)\n const { protocol, host } = window.location\n const baseUri = `${protocol}//${host}`\n const appUri = joinUrl(props.config.path, baseUri)\n\n const oidcSettings = props.config.oidc\n if (oidcSettings !== undefined) {\n console.info(\n 'app uses the following OIDC configuration: ',\n props.config.oidc\n )\n this.auth = new OidcManager(appUri, oidcSettings)\n }\n\n if (props.config.servers.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'One server needs to be configured.')\n )\n }\n console.info(\n 'app uses the following DICOMweb server configuration: ',\n props.config.servers\n )\n\n this.handleServerSelection = this.handleServerSelection.bind(this)\n\n message.config({ duration: 5 })\n this.addGcpSecondaryAnnotationServer(props.config)\n\n this.state = {\n clients: _createClientMapping({\n baseUri,\n gcpBaseUrl: props.config.gcpBaseUrl ?? 'https://healthcare.googleapis.com/v1',\n settings: props.config.servers,\n onError: this.handleDICOMwebError\n }),\n isLoading: true,\n wasAuthSuccessful: false\n }\n }\n\n addGcpSecondaryAnnotationServer (config: AppProps['config']): void {\n const serverId = 'gcp_secondary_annotation_server'\n const urlParams = new URLSearchParams(window.location.search)\n const url = urlParams.get('gcp')\n const gcpSecondaryAnnotationServer = config.servers.find(\n (server) => server.id === serverId\n )\n if (gcpSecondaryAnnotationServer === undefined && typeof url === 'string') {\n config.servers.push({\n id: serverId,\n write: true,\n url,\n storageClasses: [\n StorageClasses.COMPREHENSIVE_SR,\n StorageClasses.COMPREHENSIVE_3D_SR,\n StorageClasses.SEGMENTATION,\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION,\n StorageClasses.PARAMETRIC_MAP,\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE,\n StorageClasses.COLOR_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE\n ]\n })\n }\n }\n\n handleServerSelection ({ url }: { url: string }): void {\n console.info('select DICOMweb server: ', url)\n const tmpClient = new DicomWebManager({\n baseUri: '',\n settings: [{\n id: 'tmp',\n url,\n read: true,\n write: false\n }],\n onError: this.handleDICOMwebError\n })\n tmpClient.updateHeaders(this.state.clients.default.headers)\n /**\n * Use the newly created client for all storage classes. We may want to\n * make this more sophisticated in the future to allow users to override\n * the entire server configuration.\n */\n this.setState(state => {\n const clients: { [key: string]: DicomWebManager } = {}\n for (const key in state.clients) {\n clients[key] = tmpClient\n }\n return { clients }\n })\n }\n\n /**\n * Handle successful authentication event.\n *\n * Authorizes the DICOMweb client to access the DICOMweb server and directs\n * the user back to the App.\n *\n * @param user - Information about the user\n * @param authorization - Value of the \"Authorization\" HTTP header field\n */\n handleSignIn = ({ user, authorization }: {\n user: User\n authorization: string\n }): void => {\n for (const key in this.state.clients) {\n const client = this.state.clients[key]\n client.updateHeaders({ Authorization: authorization })\n }\n const storedPath = window.localStorage.getItem('slim_path')\n const storedSearch = window.localStorage.getItem('slim_search')\n if (storedPath != null) {\n const currentPath = window.location.pathname\n if (storedPath !== currentPath) {\n let path = storedPath\n if (storedSearch != null) {\n path += storedSearch\n }\n window.location.href = path\n }\n }\n window.localStorage.removeItem('slim_path')\n window.localStorage.removeItem('slim_search')\n this.setState({ user: user })\n }\n\n signIn (): void {\n if (this.auth !== undefined) {\n console.info('try to sign in user')\n this.auth.signIn({ onSignIn: this.handleSignIn }).then(() => {\n console.info('sign-in was successful')\n this.setState({\n isLoading: false,\n wasAuthSuccessful: true\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Could not sign-in user.')\n )\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: false\n })\n })\n } else {\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: true\n })\n }\n }\n\n componentDidMount (): void {\n const path = window.localStorage.getItem('slim_path')\n if (path == null) {\n window.localStorage.setItem('slim_path', window.location.pathname)\n window.localStorage.setItem('slim_search', window.location.search)\n }\n this.signIn()\n }\n\n render (): React.ReactNode {\n const appInfo = {\n name: this.props.name,\n version: this.props.version,\n homepage: this.props.homepage,\n uid: '1.2.826.0.1.3680043.9.7433.1.5',\n organization: this.props.config.organization\n }\n\n const enableWorklist = !(\n this.props.config.disableWorklist ?? false\n )\n const enableServerSelection = (\n this.props.config.enableServerSelection ?? false\n )\n\n let worklist\n if (enableWorklist) {\n worklist = \n } else {\n worklist =
Worklist has been disabled.
\n }\n\n let isLogoutPossible = false\n let onLogout: () => void\n if (\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n this.props.config.oidc != null &&\n this.props.config.oidc.endSessionEndpoint != null\n ) {\n onLogout = (): void => {\n if (this.auth != null) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.auth.signOut()\n }\n }\n isLogoutPossible = true\n } else {\n onLogout = () => {}\n isLogoutPossible = false\n }\n\n const layoutStyle = { height: '100vh' }\n const layoutContentStyle = { height: '100%' }\n\n if (this.state.redirectTo !== undefined) {\n return (\n \n \n \n )\n } else if (this.state.isLoading) {\n return (\n \n \n \n \n \n \n \n \n )\n } else if (!this.state.wasAuthSuccessful) {\n return (\n \n )\n } else if (this.state.error != null) {\n return (\n \n )\n } else {\n return (\n \n \n \n \n \n {worklist}\n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n Logged out\n \n }\n />\n \n \n )\n }\n }\n}\n\nexport default App\n"],"names":["Description","layout","labelLineHeight","undefined","this","props","hasLongValues","items","attributes","map","item","index","uid","generateUUID","label","name","labelStyle","lineHeight","contentStyle","fontWeight","whiteSpace","span","value","icon","title","header","extra","size","hoverable","selectable","bordered","actions","methods","column","children","React","metadata","ClinicalTrialSponsorName","push","ClinicalTrialProtocolID","ClinicalTrialProtocolName","ClinicalTrialSiteName","ClinicalTrialTimePointID","parseName","Alphabetic","split","join","parseDate","year","substring","month","day","parseTime","hours","minutes","seconds","parseSex","F","M","O","PatientID","PatientName","PatientSex","PatientBirthDate","AccessionNumber","StudyID","StudyDate","StudyTime","StorageClasses","_subscriptions","Symbol","_lastSubscriptionId","PubSub","eventName","callback","Error","hasOwnProperty","subscriptionId","callbacks","payload","errorTypes","CustomError","type","message","stack","NotificationMiddlewareEvents","NotificationMiddlewareContext","NotificationType","NotificationSourceDefinition","sources","category","notificationType","outerContext","args","publish","Array","from","warn","console","JSON","stringify","arguments","includes","apply","prototype","slice","call","source","error","notificationMsg","errorCategory","find","s","String","notification","description","duration","state","isLoading","overviewViewportRef","overviewViewer","setState","slide","overviewImages","length","current","innerHTML","info","ContainerIdentifier","dmv","client","clients","VL_WHOLE_SLIDE_MICROSCOPY_IMAGE","resizeFactor","errorInterceptor","NotificationMiddleware","render","container","resize","style","height","containerIdentifier","ref","seriesInstanceUIDs","selectedSeriesInstanceUID","onSeriesSelection","seriesInstanceUID","slideList","slideItemList","i","slideItem","selectedKeys","width","onSelect","key","keyPath","domEvent","toString","mode","inlineIndent","handleVisibilityChange","bind","checked","event","onVisibilityChange","roiUID","roi","isVisible","identifier","otherProps","evaluations","forEach","nameValue","ConceptNameCodeSequence","CodeValue","nameMeaning","CodeMeaning","ValueType","dcmjs","valueMeaning","ConceptCodeSequence","textContentItem","TextValue","measurements","seq","MeasuredValueSequence","NumericValue","toPrecision","unit","MeasurementUnitsCodeSequence","align","paddingLeft","onChange","checkedChildren","unCheckedChildren","handleMenuItemSelection","rois","visibleRoiUIDs","object","onSelection","has","paddingTop","paddingBottom","selectedRoiUIDs","values","onClick","handleMeasurementSelection","handleOpacityChange","handleColorRChange","handleColorGChange","handleColorBChange","getCurrentColor","currentStyle","opacity","defaultStyle","color","annotationGroupUID","annotationGroup","onStyleChange","styleOptions","limitValues","isArray","option","codeComponents","measurement","schemeDesignator","meaning","colorSettings","windowSettings","explorationSettings","AnnotationGroupSequence","findIndex","AnnotationGroupUID","propertyType","propertyCategory","GraphicType","AnnotationCoordinateType","measurementsSequence","MeasurementsSequence","measurementOptions","measurementItem","CodingSchemeDesignator","dropdownMatchSelectWidth","disabled","plain","justify","gutter","range","min","max","step","handleLowerLimitChange","handleLimitChange","handleUpperLimitChange","minWidth","defaultValue","settings","isBadgeVisible","direction","placement","content","overlayStyle","shape","SettingOutlined","offset","count","borderStyle","borderWidth","borderColor","visibility","backgroundImage","annotationGroups","visibleAnnotationGroupUIDs","defaultAnnotationGroupStyles","onAnnotationGroupVisibilityChange","onAnnotationGroupStyleChange","handleClick","text","button","Icon","isSelected","tooltip","Manufacturer","ManufacturerModelName","DeviceSerialNumber","SoftwareVersions","InstitutionName","findContentItemsByName","concept","hasName","hasValueType","valueType","getROIs","report","matches","ContentSequence","measurementsItem","measurementGroupItems","observerType","group","trackingUIDItem","algorithmNameItem","algorithmVersionItem","scoord3d","regionItem","frameOfReferenceUID","ReferencedFrameOfReferenceUID","coordinates","GraphicData","evaluation","findEvaluationItems","findMeasurementItems","properties","trackingUID","UID","MeasurementReport","PersonObserverName","PersonObserverLoginName","DeviceObserverUID","DeviceObserverName","SpecimenUID","SpecimenIdentifier","ROIs","specimenUIDItem","specimenIdItem","containerIdItem","personNameItem","PersonName","personLoginNameItem","deviceUIDItem","deviceNameItem","dataset","containerAttrs","specimenAttrs","observerAttrs","annotations","id","attrs","orientation","groups","SpecimenPreparationAdditives","FIXATIVE","EMBEDDING_MEDIUM","SpecimenPreparationStepItems","SPECIMEN_IDENTIFIER","PARENT_SPECIMEN_IDENTIFIER","PROCESSING_TYPE","DATETIME_OF_PROCESSING","PROCESSING_STEP_DESCRIPTION","COLLECTION_METHOD","SAMPLING_METHOD","STAIN","specimenDescription","SpecimenDescriptionSequence","SpecimenShortDescription","PrimaryAnatomicStructureSequence","structures","SpecimenPreparationSequence","SpecimenPreparationStepContentItemSequence","equals","showstain","overflowY","handleRemoval","getCurrentColors","paletteColorLookupTable","previousProps","previousState","opticalPath","opticalPathIdentifier","rgb2hex","data","onRemoval","illuminationWaveLength","illuminationColor","specimenDescriptions","maxValue","Math","pow","BitsAllocated","isMonochromatic","colors","buttons","isRemovable","DeleteOutlined","EyeOutlined","EyeInvisibleOutlined","Option","Select","selectedOpticalPathIdentifier","handleItemAddition","handleItemRemoval","handleItemSelectionChange","onOpticalPathActivityChange","isActive","opticalPathSelector","isSelectable","opticalPaths","opticalPathItems","optionItems","images","SeriesInstanceUID","OpticalPathSequence","opticalPathItem","OpticalPathIdentifier","OpticalPathDescription","activeOpticalPathIdentifiers","visibleOpticalPathIdentifiers","defaultOpticalPathStyles","onOpticalPathVisibilityChange","onOpticalPathStyleChange","padding","allowClear","AppstoreAddOutlined","mappingUID","mapping","mappings","visibleMappingUIDs","defaultMappingStyles","onMappingVisibilityChange","onMappingStyleChange","segmentUID","segment","algorithmName","segments","visibleSegmentUIDs","defaultSegmentStyles","onSegmentVisibilityChange","onSegmentStyleChange","withRouter","Component","location","useLocation","navigate","useNavigate","params","useParams","annotationGroupsUIDs","checkedAnnotationUids","defaultAnnotationStyles","types","checkAll","every","uids","indeterminate","some","handleChangeCheckedType","e","target","mouseEnterDelay","reduce","acc","marginLeft","shortenedCodeMeaning","displayCodeMeaning","isChecked","indeterminateType","display","flexDirection","categories","categoriesAcc","annotation","categoryKey","typeKey","oldCategory","oldType","Object","keys","typesArr","getCategories","xPosition","yPosition","position","top","left","backgroundColor","minHeight","pointerEvents","attr","DEFAULT_ROI_STROKE_COLOR","DEFAULT_ROI_FILL_COLOR","DEFAULT_ANNOTATION_STROKE_COLOR","DEFAULT_ANNOTATION_COLOR_PALETTE","_buildKey","codingScheme","codeValue","_getRoiKey","findingName","_formatRoiStyle","stroke","fill","image","circle","radius","_constructViewers","preload","volumeImages","labelViewer","volumeViewer","clientMapping","controls","activateSelectInteraction","labelImages","SlideViewer","findingOptions","evaluationOptions","geometryTypeOptions","volumeViewportRef","labelViewportRef","defaultRoiStyle","roiStyles","selectionColor","selectedRoiStyle","loadPresentationStates","ADVANCED_BLENDING_PRESENTATION_STATE","searchForInstances","studyInstanceUID","queryParams","Modality","then","matchedInstances","rawInstance","instance","SOPInstanceUID","retrieveInstance","sopInstanceUID","retrievedInstance","dict","areVolumeImagesMonochrome","presentationState","doesMatch","AdvancedBlendingSequence","blendingItem","selectedPresentationStateUID","setPresentationState","presentationStates","catch","getAllOpticalPaths","opticalPathStyles","hideOpticalPath","deactivateOpticalPath","getOpticalPathDefaultStyle","setOpticalPathStyle","refInstanceItems","ReferencedInstanceSequence","ReferencedImageSequence","imageItem","sopInstanceUIDs","ReferencedSOPInstanceUID","paletteColorLUT","PaletteColorLookupTableSequence","cpLUTItem","PaletteColorLookupTableUID","redDescriptor","RedPaletteColorLookupTableDescriptor","greenDescriptor","GreenPaletteColorLookupTableDescriptor","blueDescriptor","BluePaletteColorLookupTableDescriptor","redData","RedPaletteColorLookupTableData","Uint16Array","greenData","GreenPaletteColorLookupTableData","blueData","BluePaletteColorLookupTableData","redSegmentedData","SegmentedRedPaletteColorLookupTableData","greenSegmentedData","SegmentedGreenPaletteColorLookupTableData","blueSegmentedData","SegmentedBluePaletteColorLookupTableData","SoftcopyVOILUTSequence","voiLUTItem","windowCenter","WindowCenter","windowWidth","WindowWidth","selectedOpticalPathIdentifiers","Set","activateOpticalPath","showOpticalPath","add","searchParams","URLSearchParams","search","set","pathname","replace","getRoiStyle","addAnnotations","COMPREHENSIVE_3D_SR","SOPClassUID","templateSeq","ContentTemplateSequence","TemplateIdentifier","_implementsTID1500","subjectClassValue","retrievedConcept","expectedConcept","_describesSpecimenSubject","debug","measurementGroups","foundRegion","regions","_containsROIAnnotations","FrameOfReferenceUID","doesROIExist","getAllROIs","otherROI","a","b","graphicType","graphicData","s1","s2","j","_areROIsEqual","addROI","forceUpdate","addAnnotationGroups","MICROSCOPY_BULK_SIMPLE_ANNOTATION","searchForSeries","matchedSeries","series","retrieveSeriesMetadata","retrievedMetadata","ann","finding","AnnotationPropertyTypeCodeSequence","setAnnotationGroupStyle","addSegmentations","SEGMENTATION","segmentations","seg","refImage","addSegments","addParametricMaps","PARAMETRIC_MAP","parametricMaps","pm","addParameterMappings","populateViewports","setDefaultPresentationState","onRoiModified","onWindowResize","onRoiDrawn","detail","selectedFinding","selectedEvaluations","findingItem","relationshipType","addEvaluation","onRoiDoubleClicked","isSelectedRoiModalVisible","setHoveredRoiAttributes","hoveredRoi","hoveredRoiAttributes","onPointerMove","feature","evt","originalEvent","isHoveredRoiTooltipVisible","hoveredRoiTooltipX","clientX","hoveredRoiTooltipY","clientY","onRoiSelected","selectedRoi","setROIStyle","onLoadingStarted","onLoadingEnded","onFrameLoadingStarted","frameInfo","frameNumber","loadingFrames","onFrameLoadingError","onLoadingError","onFrameLoadingEnded","delete","sopClassUID","channelIdentifier","pixelDataStatistics","pixelArray","chunks","ceil","minValues","maxValues","pixels","stats","numFramesSampled","getOpticalPathStyle","onRoiRemoved","onKeyUp","isRoiDrawingActive","deactivateDrawInteraction","isRoiModificationActive","deactivateModifyInteraction","isRoiTranslationActive","deactivateTranslateInteraction","isAnnotationModalVisible","isGoToModalVisible","altKey","code","handleRoiDrawing","handleRoiModification","handleRoiTranslation","handleRoiRemoval","handleRoiVisibilityChange","handleReportGeneration","handleGoTo","geometryTypes","componentSetup","componentCleanup","handleRoiSelectionCancellation","handleAnnotationConfigurationCancellation","handleAnnotationGeometryTypeSelection","handleAnnotationMeasurementActivation","handleAnnotationFindingSelection","handleAnnotationEvaluationSelection","handleAnnotationEvaluationClearance","handleAnnotationConfigurationCompletion","handleAnnotationSelection","handleAnnotationVisibilityChange","handleAnnotationGroupVisibilityChange","handleAnnotationGroupStyleChange","handleRoiStyleChange","handleXCoordinateSelection","handleYCoordinateSelection","handleMagnificationSelection","handleSlidePositionSelection","handleSlidePositionSelectionCancellation","handleReportVerification","handleReportCancellation","handleSegmentVisibilityChange","handleSegmentStyleChange","handleMappingVisibilityChange","handleMappingStyleChange","handleOpticalPathVisibilityChange","handleOpticalPathStyleChange","handleOpticalPathActivityChange","handlePresentationStateSelection","handlePresentationStateReset","boundingBox","generatedReport","isSelectedMagnificationValid","isReportModalVisible","isSelectedXCoordinateValid","isSelectedYCoordinateValid","selectedXCoordinate","validXCoordinateRange","selectedYCoordinate","validYCoordinateRange","selectedMagnification","areRoisHidden","cleanup","isOpticalPathVisible","isOpticalPathActive","document","body","removeEventListener","window","addEventListener","hasICCProfile","ICCProfile","bulkdataReferences","selectedGeometryType","selectedMarkup","filteredEvaluations","filter","x","Number","start","end","y","targetPixelSpacing","diffs","numLevels","actualPixelSpacing","getPixelSpacing","abs","level","indexOf","point","log","geometryType","markup","activateDrawInteraction","getOpticalPathMetadata","observer","refSpecimen","user","loginName","email","observationContext","observerPersonContext","observerIdentifyingAttributes","observerDeviceContext","app","manufacturerName","modelName","subjectContext","subjectClass","subjectClassSpecificContext","imagingMeasurements","findingType","trackingIdentifier","referencedRegion","qualitativeEvaluations","MappingResource","measurementReport","languageOfContentItemAndDescendants","procedureReported","evidence","seriesNumber","seriesDescription","instanceNumber","manufacturer","previousVersions","fileMetaInformationVersionArray","Uint8Array","fileMeta","Value","buffer","vr","writer","write","storeInstances","datasets","response","getROI","showAnnotationGroup","hideAnnotationGroup","strokeColor","fillColor","c","generateRoiStyle","showSegment","hideSegment","setSegmentStyle","showParameterMapping","hideParameterMapping","setParameterMappingStyle","sort","localeCompare","paletteColorLookupTableUID","defaultColors","numVisible","urlPath","deactivateSelectInteraction","deactivateSnapInteraction","isModifyInteractionActive","activateSnapInteraction","activateModifyInteraction","isTranslateInteractionActive","activateTranslateInteraction","removeROI","areROIsVisible","hideROIs","showROIs","getAllSegments","getAllParameterMappings","allAnnotationGroups","getAllAnnotationGroups","filteredAnnotationGroups","referencedSeriesInstanceUID","annotationMenuItems","result","adaptRoiToAnnotation","openSubMenuItems","geometryTypeOptionsMapping","box","polygon","line","freehandpolygon","freehandline","annotationConfigurations","defaultActiveFirstOption","onClear","specimenMenu","equipmentMenu","opticalPathMetadata","presentationStateMenu","segmentationMenu","parametricMapMenu","annotationGroupMenu","toolbar","opticalPathMenu","presentationStateOptions","ContentDescription","maxWidth","UndoOutlined","segmentMetadata","getSegmentStyle","getSegmentMetadata","mappingMetadata","getParameterMappingStyle","getParameterMappingMetadata","annotationGroupMetadata","getAnnotationGroupStyle","getAnnotationGroupMetadata","toolbarHeight","annotationTools","FaDrawPolygon","FaHandPointer","FaHandPaper","FaTrash","FaEye","FaEyeSlash","FaSave","controlTools","FaCrosshairs","enableAnnotationTools","selectedRoiInformation","cursor","roiAttributes","roiScoordAttributes","roiEvaluationAttributes","codeItem","textItem","roiMeasurmentAttributesPerOpticalPath","refItems","ReferencedSOPSequence","ReferencedOpticalPathIdentifier","measuredValueItem","createRoiDescription","roiDescriptions","roiScoordDescriptions","roiEvaluationDescriptions","roiMeasurementDescriptions","descriptions","orientationMargin","dashed","hasSider","overflow","open","onOk","onCancel","okText","maskClosable","footer","placeholder","prefix","onPressEnter","addonAfter","CheckOutlined","StopOutlined","reverseArrow","borderLeft","borderLeftWidth","background","defaultOpenKeys","forceSubMenuRender","onOpenChange","setTimeout","ImageFlavors","hasImageFlavor","imageFlavor","ImageType","areSameAcquisition","AcquisitionUID","Slide","options","acquisitionUID","opticalPathIdentifiers","pyramidUIDs","acquisitionUIDs","containerIdentifiers","frameOfReferenceUIDs","VOLUME","LABEL","OVERVIEW","THUMBNAIL","PyramidUID","samplesPerPixel","SamplesPerPixel","requirePyramidUID","PhotometricInterpretation","createSlides","slideMetadata","filteredLabelImages","filteredVolumeImages","slideMetadataIndex","_doesImageBelongToSlide","filteredOverviewImages","slideMetadataItem","slides","imgA","imgB","fetchImageMetadata","onSuccess","onError","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","newSlides","customError","slidesCache","Map","pendingRequests","useSlides","useState","setSlides","setIsLoading","setError","useEffect","cachedData","get","fetchSlides","pendingRequest","resolve","reject","err","ParametrizedSlideViewer","presentationStateUID","selectedSlide","viewer","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","DicomMetaDictionary","formatValue","val","getRows","depth","keywords","flatMap","keyword","tagInfo","nameMap","match","tag","sequenceItems","sequenceNode","getSortedTags","subscribe","_broadcastEvent","_unsubscribe","_isValidEvent","listenerId","subscription","listeners","unsubscribe","EVENTS","callbackProps","hasListeners","hasCallbacks","listener","defaultInstances","instances","instancesMap","SeriesNumber","SeriesDescription","SeriesDate","SeriesTime","addInstance","newInstance","addInstances","newInstances","len","getInstance","StudyDescription","NumInstances","ModalitiesInStudy","isLoaded","addInstanceToSeries","addInstancesToSeries","createSeriesMetadata","setSeriesMetadata","seriesMetadata","existingSeries","assign","STUDY_ADDED","INSTANCES_ADDED","SERIES_ADDED","SERIES_UPDATED","_model","studies","_getStudy","aStudy","_getSeries","study","aSeries","BaseImplementation","dicomJSONDatasetOrP10ArrayBuffer","dicomJSONDataset","naturalizedDataset","ArrayBuffer","createStudyMetadata","madeInClient","updateSeriesMetadata","addSeriesMetadata","seriesSummaryMetadata","NumberOfStudyRelatedSeries","addStudy","existingStudy","newStudy","getStudyInstanceUIDs","getStudy","getSeries","getInstanceByImageId","imageId","updateMetadataForSeries","pubSubServiceInterface","setStudy","displaySets","setDisplaySets","selectedDisplaySetInstanceUID","setSelectedDisplaySetInstanceUID","setInstanceNumber","filterValue","setFilterValue","expandedKeys","setExpandedKeys","searchInput","setSearchInput","debouncedSearchValue","delay","debouncedValue","setDebouncedValue","timer","clearTimeout","useDebounce","handler","DicomMetadataStore","seriesAddedSubscription","instancesAddedSubscription","derivedDisplaySets","processedSeries","ds","displaySetInstanceUID","displaySetList","useMemo","displaySet","displayDate","dateStr","hour","minute","second","monthNum","parseInt","dayNum","date","Date","getMonth","getDate","weekday","toLocaleDateString","monthName","dayFormatted","yearNum","getFullYear","formatDicomDate","showInstanceList","instanceSliderMarks","totalInstances","tableData","transformTagsToTableData","tags","parentKey","keyBase","currentKey","filteredData","searchLower","toLowerCase","nodes","results","searchNode","node","nodeMatches","matchingNode","child","findMatchingNodes","className","gap","marginBottom","flex","strong","optionLabelProp","optionFilterProp","fontSize","marks","formatter","SearchOutlined","columns","dataIndex","dataSource","pagination","expandable","expandedRowKeys","onExpandedRowsChange","scroll","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","handleDicomTagBrowserButtonClick","innerWidth","handleDebugButtonClick","errorMsgs","Authentication","Communication","EncodingDecoding","Visualization","errorNum","errorObj","warncount","Panel","Collapse","showErrorCount","errcount","uuidv4","warnings","warning","handleServerSelectionButtonClick","isServerSelectionModalVisible","isServerSelectionDisabled","prevProps","prevState","worklistButton","userMenuItems","onUserLogout","userMenu","menu","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","dicomTagBrowserButton","FileSearchOutlined","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","filterIcon","filtered","fetchData","handleChange","numStudies","pageSize","searchOptions","searchForStudies","limit","searchCriteria","fuzzymatching","filters","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","onRow","loading","joinUrl","uri","baseUri","endsWith","isAuthorizationCodeInUrl","hashParams","hash","Boolean","createUser","userData","profile","OidcManager","_oidc","signIn","onSignIn","handleSignIn","authorization","token_type","access_token","signinCallback","getUser","expired","signinRedirect","signOut","signoutRedirect","getAuthorization","responseType","grantType","UserManager","authority","client_id","clientId","redirect_uri","scope","response_type","loadUserInfo","automaticSilentRenew","revokeAccessTokenOnSignout","post_logout_redirect_uri","endSessionEndpoint","metadataService","getMetadata","end_session_endpoint","retries","factor","minTimeout","maxTimeout","randomize","retryableStatusCodes","retryOptions","xhrRetryHook","request","method","originalRequestSend","send","operation","retry","attempt","currentAttempt","originalOnReadyStateChange","onreadystatechange","status","errorMessage","attemptFailedError","naturalizeDataset","DicomWebManager","stores","handleError","updateHeaders","fields","f","headers","retrieveStudyMetadata","studySummaryMetadata","naturalized","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","shouldUpgradeInsecure","upgradeInsecureRequests","qidoPathPrefix","wadoPathPrefix","stowPathPrefix","qidoURLPrefix","wadoURLPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","handleDICOMwebError","logServerError","errorMessages","setting","Authorization","storedPath","localStorage","getItem","storedSearch","href","removeItem","host","appUri","oidcSettings","oidc","servers","addGcpSecondaryAnnotationServer","wasAuthSuccessful","serverId","COMPREHENSIVE_SR","COLOR_SOFTCOPY_PRESENTATION_STATE","GRAYSCALE_SOFTCOPY_PRESENTATION_STATE","PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE","tmpClient","redirectTo","setItem","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"static/js/687.f75f6841.chunk.js","mappings":"6QA4BMA,EAAW,qGAqDd,OArDc,8BACf,WACE,IAAIC,EAAoC,aACpCC,EAAkB,YAEWC,IAA7BC,KAAKC,MAAMC,eAA+BF,KAAKC,MAAMC,gBACvDL,EAAS,WACTC,EAAkB,QAEpB,IAAMK,EAAQH,KAAKC,MAAMG,WAAWC,KAAI,SAACC,EAAiBC,GACxD,IAAMC,GAAMC,EAAAA,EAAAA,KACZ,OACE,SAAC,SAAiB,CAEhBC,MAAOJ,EAAKK,KACZC,WAAY,CACVC,WAAYf,GAEdgB,aAAc,CACZC,WAAY,IACZC,WAAY,WACZH,WAjBkB,QAmBpBI,KAAM,EAAE,SAEPX,EAAKY,OAZDV,EAeX,IACIW,EAAO,KAIX,YAHwBpB,IAApBC,KAAKC,MAAMkB,OACbA,GAAO,cAAMlB,MAAMkB,KAAI,MAGvB,UAAC,IAAI,CACHC,MAAOpB,KAAKC,MAAMoB,OAClBC,MAAOH,EACPI,KAAK,QACLC,UAAWxB,KAAKC,MAAMwB,WACtBC,cAAgC3B,IAAtBC,KAAKC,MAAMoB,OACrBM,QAAS3B,KAAKC,MAAM2B,QAAQ,WAE5B,SAAC,IAAY,CACXC,OAAQ,EACRN,KAAK,QACL1B,OAAQA,EACR6B,UAAU,EAAM,SAEfvB,IAEFH,KAAKC,MAAM6B,WAGlB,KAAC,EArDc,CAASC,EAAAA,WAwD1B,UC/BA,QAxCmB,qGAqChB,OArCgB,8BACjB,WACE,IAAM3B,EAAa,GAkCnB,OAjCoD,MAAhDJ,KAAKC,MAAM+B,SAASC,0BAEtB7B,EAAW8B,KAAI,MAAf9B,EACK,CACD,CACEO,KA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mBhuC,KAAK2tC,sBACxBjB,aAAc6M,EAAmBD,OAAWv5C,EAC5C0tC,0BAA2B4L,KAE7B,SAAC,YAAc,CAAC9wC,MAAOkxC,EAAmB,UACxC,SAAC/C,GAAsB,CACrB3uC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjBylB,OAAQ32C,KAAKC,MAAM02C,OACnBllB,IAAKwnB,YAMf,SAAC,KAAK,CACJtZ,KAAK,6GACLC,SACE,UAAC,IAAM,CAACr3B,MAAOixC,EAAY,WACzB,SAAC,GAAM,CACL/nB,IAAKwnB,EACL/nB,KAAMlxB,KAAKiH,MAAMiqB,KACjB8b,mBAAoBmM,EACpBnL,kBAAmBhuC,KAAK2tC,sBACxBjB,aAAc6M,EAAmBD,OAAWv5C,EAC5C0tC,0BAA2B4L,KAE7B,SAAC,YAAc,CAAC9wC,MAAOkxC,EAAmB,UACxC,SAAC/C,GAAsB,CACrB3uC,QAAS/H,KAAKiH,MAAMc,QACpBmpB,KAAMlxB,KAAKiH,MAAMiqB,KACjBylB,OAAQ32C,KAAKC,MAAM02C,OACnBllB,IAAKwnB,YAMf,SAAC,KAAK,CACJtZ,KAAK,UACLC,SACE,UAAC,IAAM,CAACr3B,MAAOixC,EAAY,WACzB,SAAC,GAAM,CACL/nB,IAAKwnB,EACL/nB,KAAMlxB,KAAKiH,MAAMiqB,KACjB8b,oBAAoB,EACpBgB,kBAAmBhuC,KAAK2tC,sBACxBjB,aAAc6M,EAAmBD,OAAWv5C,EAC5C0tC,0BAA2B4L,IAC3B,wBArFZ,SAAC,GAAQ,CAACv0C,KAAK,QAAQC,QAAQ,mBA8FrC,KAAC,EAvYM,CAAShD,EAAAA,U","sources":["components/Description.tsx","components/ClinicalTrial.tsx","utils/values.ts","components/Patient.tsx","components/Study.tsx","data/uids.tsx","utils/PubSub.js","utils/CustomError.js","services/NotificationMiddleware.js","components/SlideItem.tsx","components/SlideList.tsx","components/AnnotationItem.tsx","components/AnnotationList.tsx","components/AnnotationGroupItem.tsx","components/AnnotationGroupList.tsx","components/Button.tsx","components/Equipment.tsx","utils/sr.tsx","components/Report.tsx","components/Item.tsx","data/specimens.tsx","components/SpecimenItem.tsx","components/SpecimenList.tsx","components/OpticalPathItem.tsx","components/OpticalPathList.tsx","components/MappingItem.tsx","components/MappingList.tsx","components/SegmentItem.tsx","components/SegmentList.tsx","utils/router.tsx","components/ColorSettingsMenu.tsx","components/AnnotationCategoryItem.tsx","components/AnnotationCategoryList.tsx","components/HoveredRoiTooltip.tsx","services/RoiToAnnotationAdapter.ts","components/SlideViewer.tsx","data/slides.tsx","services/fetchImageMetadata.ts","hooks/useSlides.ts","components/CaseViewer.tsx","components/DicomTagBrowser/dicomTagUtils.ts","utils/formatDicomDate.ts","utils/pubSubServiceInterface.ts","utils/createSeriesMetadata.ts","utils/createStudyMetadata.ts","services/DICOMMetadataStore.ts","hooks/useDebounce.ts","components/DicomTagBrowser/DicomTagBrowser.tsx","components/Header.tsx","components/InfoPage.tsx","components/Worklist.tsx","utils/url.tsx","auth/OidcManager.tsx","utils/xhrRetryHook.ts","DicomWebManager.ts","App.tsx"],"sourcesContent":["import React from 'react'\nimport { v4 as generateUUID } from 'uuid'\nimport { Card, Descriptions } from 'antd'\n\nexport interface Attribute {\n name: string\n value: any\n}\n\nexport interface AttributeGroup {\n name: string\n attributes: Attribute[]\n}\n\ninterface DescriptionProps {\n header?: string\n icon?: any\n attributes: Attribute[]\n selectable?: boolean\n hasLongValues?: boolean\n methods?: React.ReactNode[]\n children?: React.ReactNode\n}\n\n/**\n * React component for a description consisting of a header containing a\n * header and a body containing a list of name-value pairs.\n */\nclass Description extends React.Component {\n render (): React.ReactNode {\n let layout: 'horizontal' | 'vertical' = 'horizontal'\n let labelLineHeight = '14px'\n const contentLineHeight = '14px'\n if (this.props.hasLongValues !== undefined && this.props.hasLongValues) {\n layout = 'vertical'\n labelLineHeight = '20px'\n }\n const items = this.props.attributes.map((item: Attribute, index: number) => {\n const uid = generateUUID()\n return (\n \n {item.value}\n \n )\n })\n let icon = null\n if (this.props.icon !== undefined) {\n icon = \n }\n return (\n \n \n {items}\n \n {this.props.children}\n \n )\n }\n}\n\nexport default Description\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface ClinicalTrialProps {\n metadata: dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM ClinicalTrial Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass ClinicalTrial extends React.Component {\n render (): React.ReactNode {\n const attributes = []\n if (this.props.metadata.ClinicalTrialSponsorName != null) {\n // Attributes of Clinical Trial Subject module\n attributes.push(\n ...[\n {\n name: 'Sponsor Name',\n value: this.props.metadata.ClinicalTrialSponsorName\n },\n {\n name: 'Protocol ID',\n value: this.props.metadata.ClinicalTrialProtocolID\n },\n {\n name: 'Protocol Name',\n value: this.props.metadata.ClinicalTrialProtocolName\n },\n {\n name: 'Site Name',\n value: this.props.metadata.ClinicalTrialSiteName\n }\n ]\n )\n }\n if (this.props.metadata.ClinicalTrialTimePointID != null) {\n // Attributes of Clinical Trial Study module\n attributes.push(\n {\n name: 'Time Point ID',\n value: this.props.metadata.ClinicalTrialTimePointID\n }\n )\n }\n // Attributes of Clinical Trial Subject module\n return \n }\n}\n\nexport default ClinicalTrial\n","import * as dmv from 'dicom-microscopy-viewer'\n\nfunction parseName (value: dmv.metadata.PersonName|null|undefined): string {\n if (typeof value === 'object' && value !== null && value !== undefined) {\n if (value.Alphabetic !== undefined) {\n return value.Alphabetic.split('^').join(' ')\n }\n return ''\n }\n return ''\n}\n\nfunction parseDate (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n return `${year}-${month}-${day}`\n }\n return ''\n}\n\nfunction parseTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const hours = value.substring(0, 2)\n const minutes = value.substring(2, 4)\n const seconds = value.substring(4, 6)\n return `${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseDateTime (value: string|null|undefined): string {\n if (value !== null && value !== undefined) {\n const year = value.substring(0, 4)\n const month = value.substring(4, 6)\n const day = value.substring(6, 8)\n const hours = value.substring(8, 10)\n const minutes = value.substring(10, 12)\n const seconds = value.substring(12, 14)\n return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`\n }\n return ''\n}\n\nfunction parseSex (value: string|null|undefined): string {\n const lut: { [key: string]: string } = {\n F: 'Female',\n M: 'Male',\n O: 'Other'\n }\n if (value !== null && value !== undefined) {\n return lut[value]\n }\n return ''\n}\n\nexport { parseDate, parseDateTime, parseName, parseSex, parseTime }\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseName, parseSex, parseDate } from '../utils/values'\n\ninterface PatientProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Patient Information Entity that\n * displays common study-level, patient-related attributes of contained\n * DICOM Slide Microscopy images.\n */\nclass Patient extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'ID',\n value: this.props.metadata.PatientID\n },\n {\n name: 'Name',\n value: parseName(this.props.metadata.PatientName)\n },\n {\n name: 'Gender',\n value: parseSex(this.props.metadata.PatientSex)\n },\n {\n name: 'Birthdate',\n value: parseDate(this.props.metadata.PatientBirthDate)\n }\n ]\n return (\n \n )\n }\n}\n\nexport default Patient\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\nimport { parseDate, parseTime } from '../utils/values'\n\ninterface StudyProps {\n metadata: dmv.metadata.Study|dmv.metadata.SOPClass\n}\n\n/**\n * React component representing a DICOM Study Information Entity that displays\n * common study-level attributes of contained DICOM Slide Microscopy images.\n */\nclass Study extends React.Component {\n render (): React.ReactNode {\n const attributes = [\n {\n name: 'Accession #',\n value: this.props.metadata.AccessionNumber\n },\n {\n name: 'ID',\n value: this.props.metadata.StudyID\n },\n {\n name: 'Date',\n value: parseDate(this.props.metadata.StudyDate)\n },\n {\n name: 'Time',\n value: parseTime(this.props.metadata.StudyTime)\n }\n ]\n return \n }\n}\n\nexport default Study\n","export enum StorageClasses {\n VL_WHOLE_SLIDE_MICROSCOPY_IMAGE = '1.2.840.10008.5.1.4.1.1.77.1.6',\n COMPREHENSIVE_SR = '1.2.840.10008.5.1.4.1.1.88.33',\n COMPREHENSIVE_3D_SR = '1.2.840.10008.5.1.4.1.1.88.34',\n SEGMENTATION = '1.2.840.10008.5.1.4.1.1.66.4',\n MICROSCOPY_BULK_SIMPLE_ANNOTATION = '1.2.840.10008.5.1.4.1.1.91.1',\n PARAMETRIC_MAP = '1.2.840.10008.5.1.4.1.1.30',\n ADVANCED_BLENDING_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.8',\n COLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.2',\n GRAYSCALE_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.1',\n PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE = '1.2.840.10008.5.1.4.1.1.11.3'\n}\n","// Use symbols to prevent exposing private attributes\nconst _subscriptions = Symbol('subscriptions')\nconst _lastSubscriptionId = Symbol('lastSubscriptionId')\n\n/**\n * Class to enable implementation of publish/subscribe pattern\n * @class\n * @classdesc Enables publishing/subscribing\n */\nexport default class PubSub {\n constructor () {\n this[_subscriptions] = {}\n this[_lastSubscriptionId] = 0\n }\n\n /**\n * Adds a subscription callback to the provided event name\n * @param {string} eventName Event name that will trigger the callback\n * @param {Function} callback Function to be executed when event is published\n * @returns {void}\n */\n subscribe (eventName, callback) {\n if (eventName === undefined) {\n throw new Error('Trying to subscribe to an inexistent event')\n }\n\n if (typeof callback !== 'function') {\n throw new Error('The provided callback must be a function')\n }\n\n if (!this[_subscriptions].hasOwnProperty(eventName)) {\n this[_subscriptions][eventName] = {}\n }\n\n const subscriptionId = `sub${this[_lastSubscriptionId]++}`\n this[_subscriptions][eventName][subscriptionId] = callback\n }\n\n /**\n * Removes a subscription callback for the provided event name\n * @param {string} eventName Event name for the registerd callback\n * @param {Function} [callback] Function to have its subscription removed\n * @returns {void}\n */\n unsubscribe (eventName, callback) {\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n if (!callback) {\n delete callbacks[subscriptionId]\n } else if (callbacks[subscriptionId] === callback) {\n delete callbacks[subscriptionId]\n }\n }\n }\n\n /**\n * Trigger all registered subscription callbacks for a specific event name\n * @param {String} eventName Event name to trigger subscriptions from\n * @param {any} [payload] Payload that will be passed to the callback fuction\n * @returns {void}\n */\n publish (eventName, ...payload) {\n if (eventName === undefined) {\n throw new Error('Trying to publish an inexistent event')\n }\n\n const callbacks = this[_subscriptions][eventName] || {}\n for (const subscriptionId in callbacks) {\n callbacks[subscriptionId](...payload)\n }\n }\n\n /**\n * Cleares all subscriptions for current instance\n * @returns {void}\n */\n unsubscribeFromAll () {\n for (const eventName in this[_subscriptions]) {\n const callbacks = this[_subscriptions][eventName]\n for (const subscriptionId in callbacks) {\n delete callbacks[subscriptionId]\n }\n }\n }\n}\n","const errorTypes = {\n AUTHENTICATION: 'Authentication',\n COMMUNICATION: 'Communication',\n ENCODINGANDDECODING: 'EncodingDecoding',\n VISUALIZATION: 'Visualization'\n}\n\nclass CustomError extends Error {\n constructor (type, message) {\n super()\n this.message = message\n this.stack = new Error().stack\n this.type = type\n }\n}\n\nexport { errorTypes, CustomError }\n","import PubSub from '../utils/PubSub'\nimport { notification } from 'antd'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nexport const NotificationMiddlewareEvents = {\n OnError: 'onError',\n OnWarning: 'onWarning'\n}\n\nexport const NotificationMiddlewareContext = {\n DICOMWEB: 'dicomweb-client',\n DMV: 'dicom-microscopy-viewer',\n DCMJS: 'dcmjs',\n SLIM: 'slim',\n AUTH: 'authentication'\n}\n\nconst NotificationType = {\n TOAST: 'toast',\n CONSOLE: 'console'\n}\n\n/* Sources of Error:\n 1. 'dicomweb-client': Error while requesting/fetching data, tagged as 'Communication'\n 2. 'slim' and 'dicom-microscopy-viewer' library: Error related to dicom data encoding/decoding,\n could directly/indirectly impact image-related visualization, tagged as 'Visualization' or\n 'Encoding/Decoding' accordingly\n 3. 'dcmjs' library: Data parsing error, tagged as 'DICOMError'\n 4. 'authentication': Error during user authentication, tagged as 'Authentication'\n */\nconst NotificationSourceDefinition = {\n sources: [\n {\n category: errorTypes.AUTHENTICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.COMMUNICATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.VISUALIZATION,\n notificationType: NotificationType.TOAST\n },\n {\n category: errorTypes.ENCODINGANDDECODING,\n notificationType: NotificationType.CONSOLE\n },\n {\n category: 'Warning',\n notificationType: NotificationType.TOAST\n }\n ]\n}\n\nclass NotificationMiddleware extends PubSub {\n constructor () {\n super()\n\n const outerContext = (args) => {\n this.publish(NotificationMiddlewareEvents.OnWarning, Array.from(args).join(' '))\n }\n\n (function () {\n const warn = console.warn\n console.warn = function () {\n if (!JSON.stringify(arguments).includes('request')) {\n outerContext(arguments)\n }\n warn.apply(this, Array.prototype.slice.call(arguments))\n }\n }())\n }\n\n /**\n * Error handling middleware function\n *\n * @param source - source of error - dicomweb-client, dmv, dcmjs or slim itself\n * @param error - error object\n */\n onError (source, error) {\n const errorCategory = error.type\n const sourceConfig = NotificationSourceDefinition.sources.find(\n s => s.category === errorCategory\n )\n\n const { notificationType } = sourceConfig\n\n this.publish(NotificationMiddlewareEvents.OnError, {\n source,\n error\n })\n\n let notificationMsg\n if (error instanceof CustomError) {\n notificationMsg = error.message\n } else {\n notificationMsg = String(error)\n }\n\n switch (notificationType) {\n case NotificationType.TOAST:\n console.error(`A ${errorCategory} error occurred: `, error)\n return notification.error({\n message: `${errorCategory} error`,\n description: notificationMsg,\n duration: 3\n })\n\n case NotificationType.CONSOLE:\n console.error(`A ${errorCategory} error occurred: `, error)\n break\n\n default:\n }\n }\n}\n\nexport default new NotificationMiddleware()\n","import React from 'react'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport Description from './Description'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\n\ninterface SlideItemProps {\n clients: { [key: string]: DicomWebManager }\n slide: Slide\n}\n\ninterface SlideItemState {\n isLoading: boolean\n}\n\n/**\n * React component representing a DICOM Series Information Entity that displays\n * common series-level attributes of contained DICOM Slide Microscopy images\n * as well as the OVERVIEW image (if available).\n * When selected a Slide Viewer instance is created for the display of the\n * contained images.\n */\nclass SlideItem extends React.Component {\n state = { isLoading: false }\n\n private readonly overviewViewportRef = React.createRef()\n\n private overviewViewer?: dmv.viewer.OverviewImageViewer\n\n constructor (props: SlideItemProps) {\n super(props)\n this.overviewViewer = undefined\n }\n\n componentDidMount (): void {\n this.setState({ isLoading: true })\n if (this.props.slide.overviewImages.length > 0) {\n const metadata = this.props.slide.overviewImages[0]\n if (this.overviewViewportRef.current !== null) {\n this.overviewViewportRef.current.innerHTML = ''\n console.info(\n 'instantiate viewer for OVERVIEW image of slide ' +\n `\"${metadata.ContainerIdentifier}\"`\n )\n this.overviewViewer = new dmv.viewer.OverviewImageViewer({\n client: this.props.clients[\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ],\n metadata: metadata,\n resizeFactor: 1,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n this.overviewViewer.render({\n container: this.overviewViewportRef.current\n })\n }\n }\n\n this.setState({ isLoading: false })\n }\n\n render (): React.ReactNode {\n if (this.overviewViewer !== undefined) {\n this.overviewViewer.resize()\n }\n const attributes = []\n const description = this.props.slide.description\n if (description != null && description !== '') {\n attributes.push({\n name: 'Description',\n value: description\n })\n }\n if (this.state.isLoading) {\n return ()\n }\n\n /* Properties need to be propagated down to Menu.Item:\n * https://github.com/react-component/menu/issues/142\n */\n return (\n \n \n {(this.overviewViewportRef.current != null) &&
}\n \n \n )\n }\n}\n\nexport default SlideItem\n","import React from 'react'\nimport { Menu } from 'antd'\n\nimport DicomWebManager from '../DicomWebManager'\nimport SlideItem from './SlideItem'\nimport { Slide } from '../data/slides'\n\ninterface SlideListProps {\n metadata: Slide[]\n clients: { [key: string]: DicomWebManager }\n selectedSeriesInstanceUID: string\n onSeriesSelection: (\n { seriesInstanceUID }: { seriesInstanceUID: string }\n ) => void\n}\n\ninterface SlideListState {\n selectedSeriesInstanceUID: string\n}\n\n/**\n * React component representing a list of DICOM Series Information Entities.\n */\nclass SlideList extends React.Component {\n state = {\n selectedSeriesInstanceUID: this.props.selectedSeriesInstanceUID\n }\n\n componentDidMount (): void {\n this.props.onSeriesSelection({\n seriesInstanceUID: this.state.selectedSeriesInstanceUID\n })\n }\n\n render (): React.ReactNode {\n const slideList = this.props.metadata\n const slideItemList = []\n for (let i = 0; i < slideList.length; ++i) {\n const slide = slideList[i]\n const slideItem = (\n \n )\n\n slideItemList.push(slideItem)\n }\n\n const handleMenuItemSelection = ({ key, keyPath, domEvent, selectedKeys }: {\n key: React.ReactText\n keyPath: React.ReactText[]\n domEvent: React.MouseEvent | React.KeyboardEvent\n selectedKeys?: React.ReactText[]\n }): void => {\n console.info(`select slide \"${key}\"`)\n this.setState({ selectedSeriesInstanceUID: key.toString() })\n this.props.onSeriesSelection({ seriesInstanceUID: key.toString() })\n }\n\n let selectedKeys\n if (this.state.selectedSeriesInstanceUID !== undefined &&\n this.state.selectedSeriesInstanceUID !== null) {\n selectedKeys = [this.state.selectedSeriesInstanceUID]\n }\n\n return (\n \n {slideItemList}\n \n )\n }\n}\n\nexport default SlideList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Menu, Space, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface AnnotationItemProps {\n roi: dmv.roi.ROI\n index: number\n isVisible: boolean\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n}\n\n/**\n * React component representing a Region of Interest (ROI) annotation.\n */\nclass AnnotationItem extends React.Component {\n constructor (props: AnnotationItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n roiUID: this.props.roi.uid,\n isVisible: checked\n })\n }\n\n render (): React.ReactNode {\n const identifier = `ROI ${this.props.index + 1}`\n const attributes: Array<{ name: string, value: string }> = []\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const { isVisible, onVisibilityChange, ...otherProps } = this.props\n this.props.roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n this.props.roi.measurements.forEach(item => {\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n const seq = item.MeasuredValueSequence[0]\n const value = seq.NumericValue.toPrecision(6)\n const unit = seq.MeasurementUnitsCodeSequence[0].CodeValue\n attributes.push({\n name: name,\n value: `${value} ${unit}`\n })\n })\n return (\n \n
\n }\n unCheckedChildren={}\n />\n
\n \n \n \n
\n )\n }\n}\n\nexport default AnnotationItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu, Switch } from 'antd'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport AnnotationItem from './AnnotationItem'\n\ninterface AnnotationListProps {\n rois: dmv.roi.ROI[]\n selectedRoiUIDs: Set\n visibleRoiUIDs: Set\n onVisibilityChange: ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }) => void\n onSelection: ({ roiUID }: { roiUID: string }) => void\n}\n\n/**\n * React component representing a list of Region of Interest (ROI)\n * annotations.\n */\nclass AnnotationList extends React.Component {\n constructor (props: AnnotationListProps) {\n super(props)\n this.handleMenuItemSelection = this.handleMenuItemSelection.bind(this)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n if (checked) {\n this.props.rois.forEach(roi => {\n this.props.onVisibilityChange({ roiUID: roi.uid, isVisible: checked })\n })\n } else {\n this.props.visibleRoiUIDs.forEach(roiUID => {\n this.props.onVisibilityChange({ roiUID, isVisible: checked })\n })\n }\n }\n\n handleMenuItemSelection (object: any): void {\n this.props.onSelection({ roiUID: object.key })\n }\n\n render (): React.ReactNode {\n const items = this.props.rois.map((roi, index) => (\n \n ))\n\n return (\n <>\n
\n 0}\n checkedChildren={}\n unCheckedChildren={}\n />\n
\n \n {items}\n \n \n )\n }\n}\n\nexport default AnnotationList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Select,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Description from './Description'\n\ninterface AnnotationGroupItemProps {\n annotationGroup: dmv.annotation.AnnotationGroup\n isVisible: boolean\n metadata: dmv.metadata.MicroscopyBulkSimpleAnnotations\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\ninterface AnnotationGroupItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass AnnotationGroupItem extends React.Component {\n constructor (props: AnnotationGroupItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleMeasurementSelection = this.handleMeasurementSelection.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n annotationGroupUID: this.props.annotationGroup.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color,\n limitValues: this.state.currentStyle.limitValues\n }\n })\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { limitValues: values }\n })\n }\n\n handleMeasurementSelection (value?: string, option?: any): void {\n if (value != null && option.children != null) {\n const codeComponents = value.split('-')\n const measurement = new dcmjs.sr.coding.CodedConcept({\n value: codeComponents[1],\n schemeDesignator: codeComponents[0],\n meaning: option.children\n })\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: { measurement }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n measurement\n }\n }))\n } else {\n this.props.onStyleChange({\n uid: this.props.annotationGroup.uid,\n styleOptions: {\n color: this.props.defaultStyle.color\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: state.currentStyle.opacity,\n color: this.props.defaultStyle.color,\n limitValues: undefined\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const index = this.props.metadata.AnnotationGroupSequence.findIndex(\n item => (item.AnnotationGroupUID === this.props.annotationGroup.uid)\n )\n const item = this.props.metadata.AnnotationGroupSequence[index]\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property type',\n value: this.props.annotationGroup.propertyType.CodeMeaning\n },\n {\n name: 'Property category',\n value: this.props.annotationGroup.propertyCategory.CodeMeaning\n },\n // {\n // name: 'Algorithm Name',\n // value: this.props.annotationGroup.algorithmName\n // },\n {\n name: 'Graphic type',\n value: item.GraphicType\n },\n {\n name: 'Annotation coordinate type',\n value: this.props.metadata.AnnotationCoordinateType\n }\n ]\n\n const measurementsSequence = item.MeasurementsSequence ?? []\n const measurementOptions = measurementsSequence.map((measurementItem, i) => {\n const name = measurementItem.ConceptNameCodeSequence[0]\n return (\n \n {name.CodeMeaning}\n \n )\n })\n measurementOptions.push(\n \n <>\n \n )\n\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n \n )\n }\n\n let windowSettings\n let explorationSettings\n if (measurementsSequence.length > 0) {\n if (this.state.currentStyle.limitValues != null) {\n // TODO: need to get default min/max values from viewer first\n const minValue = 0\n const maxValue = 1000\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n explorationSettings = (\n <>\n \n Exploration\n \n \n \n Measurement\n \n \n \n {measurementOptions}\n \n \n \n \n )\n }\n\n const settings = (\n
\n {colorSettings}\n {windowSettings}\n \n \n Opacity\n \n \n \n \n \n \n \n \n {explorationSettings}\n
\n )\n\n const color = this.getCurrentColor()\n const isBadgeVisible = (\n this.state.isVisible && this.state.currentStyle.measurement == null\n )\n const {\n annotationGroup,\n defaultStyle,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n \n \n
\n \n )\n }\n}\n\nexport default AnnotationGroupItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport AnnotationGroupItem from './AnnotationGroupItem'\n\ninterface AnnotationGroupListProps {\n annotationGroups: dmv.annotation.AnnotationGroup[]\n visibleAnnotationGroupUIDs: Set\n metadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n }\n defaultAnnotationGroupStyles: {\n [annotationGroupUID: string]: {\n opacity: number\n color: number[]\n }\n }\n onAnnotationGroupVisibilityChange: ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }) => void\n onAnnotationGroupStyleChange: ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }) => void\n}\n\n/**\n * React component representing a list of Annotation Groups.\n */\nclass AnnotationGroupList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.annotationGroups.map((annotationGroup, index) => {\n const uid = annotationGroup.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default AnnotationGroupList\n","import React from 'react'\nimport { Button as Btn, Divider, Tooltip } from 'antd'\n\ninterface ButtonProps {\n icon: any\n tooltip?: string\n label?: string\n onClick?: (options: any) => void\n isSelected?: boolean\n}\n\n/**\n * React component for a button.\n */\nclass Button extends React.Component {\n constructor (props: ButtonProps) {\n super(props)\n this.handleClick = this.handleClick.bind(this)\n }\n\n handleClick (event: React.SyntheticEvent): void {\n if (this.props.onClick !== undefined) {\n this.props.onClick(event)\n }\n }\n\n render (): React.ReactNode {\n const Icon = this.props.icon\n if (Icon === undefined) {\n return null\n }\n\n let text\n if (this.props.label != null) {\n text = (\n <>\n \n {this.props.label}\n \n )\n }\n\n let button\n if (this.props.isSelected ?? false) {\n button = (\n }\n type='primary'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n } else {\n button = (\n }\n type='default'\n style={{ lineHeight: '1.0' }}\n >\n {text}\n \n )\n }\n\n if (this.props.tooltip !== undefined) {\n return (\n \n {button}\n \n )\n } else {\n return button\n }\n }\n}\n\nexport default Button\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport Description from './Description'\n\ninterface EquipmentProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n}\n\n/**\n * React component representing a list of DICOM Equipment Entities.\n */\nclass Equipment extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const attributes = [\n {\n name: 'Manufacturer',\n value: this.props.metadata.Manufacturer\n },\n {\n name: 'Model Name',\n value: this.props.metadata.ManufacturerModelName\n },\n {\n name: 'Device Serial Number',\n value: this.props.metadata.DeviceSerialNumber\n },\n {\n name: 'Software Versions',\n value: this.props.metadata.SoftwareVersions\n }\n ]\n if (this.props.metadata.InstitutionName != null) {\n attributes.push({\n name: 'Institution Name',\n value: this.props.metadata.InstitutionName\n })\n }\n return \n }\n}\n\nexport default Equipment\n","import * as dcmjs from 'dcmjs'\n\n/**\n * Check whether a DICOM SR content item has a given name.\n *\n * @param item - Content item\n * @param name - Coded name that should be compared\n * @returns Whether the content item has the given name\n */\nconst hasName = (\n item: dcmjs.sr.valueTypes.ContentItem,\n name: dcmjs.sr.coding.CodedConcept\n): boolean => {\n const concept = item.ConceptNameCodeSequence[0]\n return (\n concept.CodeValue === name.CodeValue &&\n concept.CodingSchemeDesignator === name.CodingSchemeDesignator\n )\n}\n\n/**\n * Check whether a DICOM SR content item has a given value type.\n *\n * @param item - Content item\n * @param valueType - Value Type\n * @returns Whether the content item has the given value type\n */\nconst hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: dcmjs.sr.valueTypes.ValueTypes\n): boolean => {\n console.log(item.ValueType, valueType)\n return item.ValueType === valueType\n}\n\n/**\n * Find content items in a DICOM SR document given their name.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param name - Coded name that should be compared\n * @returns Matched content items\n */\nexport const findContentItemsByName = (\n { content, name }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n name: dcmjs.sr.coding.CodedConcept\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasName(i, name)) {\n items.push(i)\n }\n })\n return items\n}\n\n/**\n * Find content items in a DICOM SR document given their value type.\n *\n * Only finds content items at the root level, but not any nested content items.\n *\n * @param content - Document content, i.e., sequence of content items\n * @param valueType - Value Type\n * @returns Matched content items\n */\nexport const findContentItemsByValueType = (\n { content, valueType }: {\n content: dcmjs.sr.valueTypes.ContentItem[]\n valueType: dcmjs.sr.valueTypes.ValueTypes\n }\n): dcmjs.sr.valueTypes.ContentItem[] => {\n const items: dcmjs.sr.valueTypes.ContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, valueType)) {\n items.push(i)\n }\n })\n return items\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { Divider } from 'antd'\nimport { v4 as generateUUID } from 'uuid'\n\nimport Description from './Description'\nimport Patient from './Patient'\nimport Study from './Study'\nimport { findContentItemsByName } from '../utils/sr'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nexport const hasValueType = (\n item: dcmjs.sr.valueTypes.ContentItem,\n valueType: string\n): boolean => {\n return item.ValueType === valueType\n}\n\nconst findMeasurementItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.NumContentItem[] => {\n const items: dcmjs.sr.valueTypes.NumContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.NUM)) {\n const measurement = i as dcmjs.sr.valueTypes.NumContentItem\n items.push(measurement)\n }\n })\n return items\n}\n\nconst findEvaluationItems = (\n { content }: { content: dcmjs.sr.valueTypes.ContentItem[] }\n): dcmjs.sr.valueTypes.CodeContentItem[] => {\n const items: dcmjs.sr.valueTypes.CodeContentItem[] = []\n content.forEach(i => {\n if (hasValueType(i, dcmjs.sr.valueTypes.ValueTypes.CODE)) {\n const evaluation = i as dcmjs.sr.valueTypes.CodeContentItem\n items.push(evaluation)\n }\n })\n return items\n}\n\nconst getROIs = (report: dmv.metadata.Comprehensive3DSR): dmv.roi.ROI[] => {\n // TID 1500 Measurement Report\n const matches = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (matches.length !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Imaging Measurements\" not found.' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\".'\n )\n )\n }\n const measurementsItem = matches[0] as dcmjs.sr.valueTypes.ContainerContentItem\n // TID 1410 Planar ROI Measurements and Qualitative Evaluations\n const measurementGroupItems = findContentItemsByName({\n content: measurementsItem.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n const rois: dmv.roi.ROI[] = []\n measurementGroupItems.forEach((item) => {\n const evaluations = []\n let observerType: string\n const group = item as dcmjs.sr.valueTypes.ContainerContentItem\n let items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '112040',\n schemeDesignator: 'DCM',\n meaning: 'Tracking Unique Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Tracking Unique Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const trackingUIDItem = items[0] as dcmjs.sr.valueTypes.UIDRefContentItem\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n schemeDesignator: 'DCM',\n meaning: 'Finding'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Finding\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111001',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Name'\n })\n })\n if (items.length !== 0) {\n const algorithmNameItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmNameItem)\n observerType = 'Device'\n } else {\n observerType = 'Person'\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111003',\n schemeDesignator: 'DCM',\n meaning: 'Algorithm Version'\n })\n })\n if (items.length !== 0) {\n const algorithmVersionItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n evaluations.push(algorithmVersionItem)\n }\n\n items = findContentItemsByName({\n content: group.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n const regionItem = items[0] as dcmjs.sr.valueTypes.Scoord3DContentItem\n let scoord3d: any\n if (regionItem.GraphicType === 'POINT') {\n scoord3d = new dmv.scoord3d.Point({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: regionItem.GraphicData\n })\n } else {\n const coordinates: number[][] = []\n for (let i = 0; i < regionItem.GraphicData.length; i += 3) {\n coordinates.push(regionItem.GraphicData.slice(i, i + 3))\n }\n if (regionItem.GraphicType === 'POLYGON') {\n scoord3d = new dmv.scoord3d.Polygon({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'MULTIPOINT') {\n scoord3d = new dmv.scoord3d.MultiPoint({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'POLYLINE') {\n scoord3d = new dmv.scoord3d.Polyline({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSE') {\n scoord3d = new dmv.scoord3d.Ellipse({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else if (regionItem.GraphicType === 'ELLIPSOID') {\n scoord3d = new dmv.scoord3d.Ellipsoid({\n frameOfReferenceUID: regionItem.ReferencedFrameOfReferenceUID,\n coordinates: coordinates\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Image Region\" has unknown graphic type ' +\n `\"${regionItem.GraphicType}\". ` +\n 'Content of Comprehensive 3D SR document is not structured ' +\n 'based on TID 1500 \"Measurement Report\" -> ' +\n 'TID 1410 \"Planar ROI Measurements and Qualitative Evaluations\".'\n )\n )\n }\n }\n\n evaluations.push(\n ...findEvaluationItems({ content: group.ContentSequence })\n )\n const measurements = findMeasurementItems({\n content: group.ContentSequence\n })\n\n const roi = new dmv.roi.ROI({\n scoord3d: scoord3d,\n uid: generateUUID(),\n properties: {\n trackingUID: trackingUIDItem.UID,\n observerType: observerType,\n evaluations: evaluations,\n measurements: measurements\n }\n })\n rois.push(roi)\n })\n return rois\n}\n\nclass MeasurementReport {\n public PersonObserverName?: string\n\n public PersonObserverLoginName?: string\n\n public DeviceObserverUID?: string\n\n public DeviceObserverName?: string\n\n public SpecimenUID: string\n\n public SpecimenIdentifier: string\n\n public ContainerIdentifier: string\n\n public ROIs: dmv.roi.ROI[] = []\n\n constructor (report: dmv.metadata.Comprehensive3DSR) {\n let items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121039',\n schemeDesignator: 'DCM',\n meaning: 'Specimen UID'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen UID\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.SpecimenUID = specimenUIDItem.UID\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const specimenIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.SpecimenIdentifier = specimenIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111700',\n schemeDesignator: 'DCM',\n meaning: 'Specimen Container Identifier'\n })\n })\n if (items.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Content item \"Specimen Container Identifier\" not found. ' +\n 'Content of Comprehensive 3D SR document is not structured based on ' +\n 'TID 1500 \"Measurement Report\" -> TID 1001 \"Observation Context\" -> ' +\n 'TID 1006 \"Subject Context\" -> TID 1009 \"Subject Context, Specimen\".'\n )\n )\n }\n const containerIdItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.ContainerIdentifier = containerIdItem.TextValue\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121008',\n schemeDesignator: 'DCM',\n meaning: 'Person Observer Name'\n })\n })\n if (items.length !== 0) {\n const personNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.PNameContentItem\n )\n this.PersonObserverName = personNameItem.PersonName\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '128774',\n schemeDesignator: 'DCM',\n meaning: \"Person Observer's Login Name\"\n })\n })\n if (items.length !== 0) {\n const personLoginNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.PersonObserverLoginName = personLoginNameItem.TextValue\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121012',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer UID'\n })\n })\n if (items.length > 0) {\n const deviceUIDItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.UIDRefContentItem\n )\n this.DeviceObserverUID = deviceUIDItem.UID\n }\n\n items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121013',\n schemeDesignator: 'DCM',\n meaning: 'Device Observer Name'\n })\n })\n if (items.length !== 0) {\n const deviceNameItem = (\n items[0] as unknown as dcmjs.sr.valueTypes.TextContentItem\n )\n this.DeviceObserverName = deviceNameItem.TextValue\n }\n\n this.ROIs = getROIs(report)\n }\n}\n\ninterface ReportProps {\n dataset: dmv.metadata.Comprehensive3DSR\n}\n\n/**\n * React component representing a DICOM SR document that displays the\n * document content (a selected subset of content items).\n */\nclass Report extends React.Component {\n render (): React.ReactNode {\n const report = new MeasurementReport(this.props.dataset)\n const containerAttrs = [\n {\n name: 'ID',\n value: report.ContainerIdentifier\n }\n ]\n const specimenAttrs = [\n {\n name: 'ID',\n value: report.SpecimenIdentifier\n }\n ]\n const observerAttrs = [\n {\n name: 'Name',\n value: report.PersonObserverName\n }\n ]\n const annotations = report.ROIs.map(\n (roi, index): React.ReactNode => {\n const id = `Region ${index + 1}`\n const attrs: Array<{ name: string, value: string }> = []\n roi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem\n )\n ) => {\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.ConceptCodeSequence[0].CodeMeaning\n })\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n attrs.push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: item.TextValue\n })\n }\n })\n return \n }\n )\n\n return (\n
\n Patient\n \n Case\n \n Slide\n \n Specimen\n \n Observer\n \n Annotations\n {annotations}\n
\n )\n }\n}\n\nexport default Report\nexport { MeasurementReport }\n","import React from 'react'\nimport { List } from 'antd'\n\nimport Description, { Attribute, AttributeGroup } from './Description'\n\ninterface ItemProps {\n uid: string\n identifier: string\n attributes: Attribute[]\n groups?: AttributeGroup[]\n children?: React.ReactElement[]\n type?: string\n hasLongValues?: boolean\n}\n\n/**\n * React component for a list item that consists of a header element\n * containing an identifier and a body element containing a description list\n * of attributes rendered as name-value pairs.\n */\nclass Item extends React.Component {\n render (): React.ReactNode {\n let groups = null\n if (this.props.groups !== undefined) {\n groups = this.props.groups.map((item, index: number) => (\n \n ))\n }\n let title\n if (this.props.type !== undefined) {\n title = `${this.props.type}: ${this.props.identifier}`\n } else {\n title = this.props.identifier\n }\n return (\n \n \n {groups}\n
\n {this.props.children}\n \n )\n }\n}\n\nexport default Item\n","import * as dcmjs from 'dcmjs'\n\nexport const SpecimenPreparationTypes: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n COLLECTION: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING: new dcmjs.sr.coding.CodedConcept({\n value: '433465004',\n schemeDesignator: 'SCT',\n meaning: 'Sampling of tissue specimen'\n }),\n STAINING: new dcmjs.sr.coding.CodedConcept({\n value: '127790008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen staining'\n }),\n PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '9265001',\n schemeDesignator: 'SCT',\n meaning: 'Specimen processing'\n })\n}\n\nexport const SpecimenPreparationAdditives: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n FIXATIVE: new dcmjs.sr.coding.CodedConcept({\n value: '430864009',\n schemeDesignator: 'SCT',\n meaning: 'Tissue fixative'\n }),\n EMBEDDING_MEDIUM: new dcmjs.sr.coding.CodedConcept({\n value: '430863003',\n schemeDesignator: 'SCT',\n meaning: 'Embedding medium'\n })\n}\n\nexport const SpecimenPreparationStepItems: {\n [key: string]: dcmjs.sr.coding.CodedConcept\n} = {\n SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '121041',\n schemeDesignator: 'DCM',\n meaning: 'Specimen identifier'\n }),\n PARENT_SPECIMEN_IDENTIFIER: new dcmjs.sr.coding.CodedConcept({\n value: '111705',\n schemeDesignator: 'DCM',\n meaning: 'Parent specimen identifier'\n }),\n PROCESSING_TYPE: new dcmjs.sr.coding.CodedConcept({\n value: '111701',\n schemeDesignator: 'DCM',\n meaning: 'Processing type'\n }),\n DATETIME_OF_PROCESSING: new dcmjs.sr.coding.CodedConcept({\n value: '111702',\n schemeDesignator: 'DCM',\n meaning: 'Datetime of processing'\n }),\n PROCESSING_STEP_DESCRIPTION: new dcmjs.sr.coding.CodedConcept({\n value: '111703',\n schemeDesignator: 'DCM',\n meaning: 'Processing step description'\n }),\n COLLECTION_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '17636008',\n schemeDesignator: 'SCT',\n meaning: 'Specimen collection'\n }),\n SAMPLING_METHOD: new dcmjs.sr.coding.CodedConcept({\n value: '111704',\n schemeDesignator: 'DCM',\n meaning: 'Sampling method'\n }),\n STAIN: new dcmjs.sr.coding.CodedConcept({\n value: '424361007',\n schemeDesignator: 'SCT',\n meaning: 'Using substance'\n }),\n ...SpecimenPreparationAdditives\n}\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport Item from './Item'\nimport { Attribute } from './Description'\nimport { SpecimenPreparationStepItems } from '../data/specimens'\n\ninterface SpecimenItemProps {\n index: number\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a DICOM Specimen Information Entity and\n * displays specimen-related attributes of a DICOM Slide Microscopy image.\n */\nclass SpecimenItem extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n const specimenDescription = this.props.metadata.SpecimenDescriptionSequence[\n this.props.index\n ]\n const attributes: Attribute[] = []\n if (specimenDescription.SpecimenShortDescription !== undefined) {\n attributes.push({\n name: 'Description',\n value: specimenDescription.SpecimenShortDescription\n })\n }\n if (specimenDescription.PrimaryAnatomicStructureSequence !== undefined) {\n if (specimenDescription.PrimaryAnatomicStructureSequence.length > 0) {\n const structures = specimenDescription.PrimaryAnatomicStructureSequence\n attributes.push({\n name: 'Anatomical structure',\n value: structures.map(item => item.CodeMeaning).join(', ')\n })\n }\n }\n\n // TID 8001 \"Specimen Preparation\"\n const preparationSteps: dmv.metadata.SpecimenPreparation[] = (\n specimenDescription.SpecimenPreparationSequence ?? []\n )\n preparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (\n name.equals(SpecimenPreparationStepItems.COLLECTION_METHOD)\n ) {\n attributes.push({\n name: 'Collection method',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.FIXATIVE)\n ) {\n attributes.push({\n name: 'Tissue fixative',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.EMBEDDING_MEDIUM)\n ) {\n attributes.push({\n name: 'Tissue embedding medium',\n value: value.CodeMeaning\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (\n name.equals(SpecimenPreparationStepItems.STAIN) &&\n this.props.showstain\n ) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n } else if (\n name.equals(SpecimenPreparationStepItems.PARENT_SPECIMEN_IDENTIFIER)\n ) {\n attributes.push({\n name: 'Parent specimen',\n value: item.TextValue\n })\n }\n }\n })\n }\n )\n const uid = specimenDescription.SpecimenUID\n const identifier = specimenDescription.SpecimenIdentifier\n return (\n \n )\n }\n}\n\nexport default SpecimenItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { List } from 'antd'\n\nimport SpecimenItem from './SpecimenItem'\n\ninterface SpecimenListProps {\n metadata?: dmv.metadata.VLWholeSlideMicroscopyImage\n showstain: boolean\n}\n\n/**\n * React component representing a list of DICOM Specimen Information Entities.\n */\nclass SpecimenList extends React.Component {\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n /*\n * Specimen Description Sequence is a type 1 attribute. However, it is\n * nevertheless missing in some data sets. This is a violation of the\n * standard, but it may be better to facilitate display of the data.\n */\n const descriptions = this.props.metadata.SpecimenDescriptionSequence ?? []\n const items = descriptions.map(\n (item: dmv.metadata.SpecimenDescription, index: number) => {\n return (\n \n )\n }\n )\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SpecimenList\n","import React from 'react'\nimport {\n Badge,\n Button,\n Col,\n Divider,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch,\n Tooltip\n} from 'antd'\nimport {\n DeleteOutlined,\n EyeOutlined,\n EyeInvisibleOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport Description from './Description'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\n\nimport { SpecimenPreparationStepItems } from '../data/specimens'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\ninterface OpticalPathItemProps {\n opticalPath: dmv.opticalPath.OpticalPath\n metadata: dmv.metadata.VLWholeSlideMicroscopyImage[]\n isVisible: boolean\n isRemovable: boolean\n defaultStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n onVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n }) => void\n onRemoval: (opticalPathIdentifier: string) => void\n}\n\ninterface OpticalPathItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n color?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n }\n}\n\n/**\n * React component representing an optical path of a\n * multi-channel acquistion with control of visualization parameters.\n */\nclass OpticalPathItem extends React.Component {\n constructor (props: OpticalPathItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleLimitChange = this.handleLimitChange.bind(this)\n this.handleLowerLimitChange = this.handleLowerLimitChange.bind(this)\n this.handleUpperLimitChange = this.handleUpperLimitChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.handleRemoval = this.handleRemoval.bind(this)\n this.getCurrentColors = this.getCurrentColors.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color,\n paletteColorLookupTable: this.props.defaultStyle.paletteColorLookupTable,\n limitValues: this.props.defaultStyle.limitValues\n }\n }\n }\n\n componentDidUpdate (\n previousProps: OpticalPathItemProps,\n previousState: OpticalPathItemState\n ): void {\n if (this.props.defaultStyle !== previousProps.defaultStyle) {\n this.setState({\n currentStyle: this.props.defaultStyle\n })\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState({\n isVisible: checked\n })\n this.props.onVisibilityChange({\n opticalPathIdentifier: identifier,\n isVisible: checked\n })\n }\n\n handleOpacityChange (\n value: number | null\n ): void {\n if (value != null) {\n const identifier = this.props.opticalPath.identifier\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { opacity: value }\n })\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: value,\n limitValues: state.currentStyle.limitValues\n }\n }))\n }\n }\n\n handleColorRChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorGChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n handleColorBChange (\n value: number | number[] | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState(state => ({\n currentStyle: {\n color: color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { color: color }\n })\n }\n }\n\n getCurrentColors (): string[] {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.props.defaultStyle.paletteColorLookupTable != null) {\n const colormap = this.props.defaultStyle.paletteColorLookupTable.data\n return colormap.map(values => rgb2hex(values))\n } else if (this.state.currentStyle.color != null) {\n return [\n '#000000',\n rgb2hex(this.state.currentStyle.color)\n ]\n } else {\n return ['white', 'white']\n }\n }\n\n handleLowerLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [value, state.currentStyle.limitValues[1]]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n value,\n this.state.currentStyle.limitValues[1]\n ]\n }\n })\n }\n }\n\n handleUpperLimitChange (\n value: number | null\n ): void {\n const identifier = this.props.opticalPath.identifier\n if (value != null && this.state.currentStyle.limitValues !== undefined) {\n this.setState(state => {\n if (state.currentStyle.limitValues !== undefined) {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: [state.currentStyle.limitValues[0], value]\n }\n }\n } else {\n return {\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: state.currentStyle.limitValues\n }\n }\n }\n })\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: {\n limitValues: [\n this.state.currentStyle.limitValues[0],\n value\n ]\n }\n })\n }\n }\n\n handleLimitChange (\n values: number[]\n ): void {\n const identifier = this.props.opticalPath.identifier\n this.setState(state => ({\n currentStyle: {\n color: state.currentStyle.color,\n paletteColorLookupTable: state.currentStyle.paletteColorLookupTable,\n opacity: state.currentStyle.opacity,\n limitValues: values\n }\n }))\n this.props.onStyleChange({\n opticalPathIdentifier: identifier,\n styleOptions: { limitValues: values }\n })\n }\n\n handleRemoval (): void {\n const identifier = this.props.opticalPath.identifier\n this.props.onRemoval(identifier)\n }\n\n render (): React.ReactNode {\n const identifier = this.props.opticalPath.identifier\n const description = this.props.opticalPath.description\n const attributes: Array<{ name: string, value: string }> = []\n if (this.props.opticalPath.illuminationWaveLength !== undefined) {\n attributes.push(\n {\n name: 'Illumination wavelength',\n value: `${this.props.opticalPath.illuminationWaveLength} nm`\n }\n )\n }\n if (this.props.opticalPath.illuminationColor !== undefined) {\n attributes.push(\n {\n name: 'Illumination color',\n value: this.props.opticalPath.illuminationColor.CodeMeaning\n }\n )\n }\n\n // TID 8001 \"Specimen Preparation\"\n const specimenDescriptions: dmv.metadata.SpecimenDescription[] = (\n this.props.metadata[0].SpecimenDescriptionSequence ?? []\n )\n try {\n specimenDescriptions.forEach(description => {\n const specimenPreparationSteps: dmv.metadata.SpecimenPreparation[] =\n description.SpecimenPreparationSequence ?? []\n specimenPreparationSteps.forEach(\n (step: dmv.metadata.SpecimenPreparation, index: number): void => {\n step.SpecimenPreparationStepContentItemSequence.forEach((\n item: (\n dcmjs.sr.valueTypes.CodeContentItem |\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.UIDRefContentItem |\n dcmjs.sr.valueTypes.PNameContentItem |\n dcmjs.sr.valueTypes.DateTimeContentItem\n ),\n index: number\n ) => {\n const name = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptNameCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptNameCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptNameCodeSequence[0].CodeMeaning\n })\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n item = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = new dcmjs.sr.coding.CodedConcept({\n value: item.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n item.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: item.ConceptCodeSequence[0].CodeMeaning\n })\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: value.CodeMeaning\n })\n }\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n item = item as dcmjs.sr.valueTypes.TextContentItem\n if (!name.equals(SpecimenPreparationStepItems.PROCESSING_TYPE)) {\n if (name.equals(SpecimenPreparationStepItems.STAIN)) {\n attributes.push({\n name: 'Tissue stain',\n value: item.TextValue\n })\n }\n }\n }\n })\n }\n )\n })\n } catch (error: any) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DCMJS,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n error.message\n )\n )\n }\n\n const maxValue = Math.pow(2, this.props.metadata[0].BitsAllocated) - 1\n\n const title = (\n description != null ? `${identifier}: ${description}` : identifier\n )\n let settings\n let item\n if (this.props.opticalPath.isMonochromatic) {\n // monochrome images that can be pseudo-colored\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n \n Color\n \n \n \n Red\n \n \n \n \n \n \n \n \n\n \n \n Green\n \n \n \n \n \n \n \n \n\n \n \n Blue\n \n \n \n \n \n \n \n \n \n )\n } else {\n colorSettings = (\n <>\n \n Color\n \n Custom pseudo-coloring is disabled because pixels are colorized via\n a provided palette color lookup table.\n \n )\n }\n\n let windowSettings\n if (this.state.currentStyle.limitValues != null) {\n windowSettings = (\n <>\n \n Values of interest\n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n }\n settings = (\n
\n {windowSettings}\n {colorSettings}\n \n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n const colors = this.getCurrentColors()\n item = (\n \n \n \n )\n } else {\n // color images\n settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n item = (\n \n )\n }\n\n const buttons = []\n if (this.props.isRemovable) {\n buttons.push(\n \n }\n onClick={this.handleRemoval}\n />\n \n )\n }\n\n const {\n defaultStyle,\n isRemovable,\n isVisible,\n metadata,\n onVisibilityChange,\n onStyleChange,\n onRemoval,\n opticalPath,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n {buttons}\n \n
\n {item}\n
\n \n )\n }\n}\n\nexport default OpticalPathItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Button as Btn, Menu, Select, Space, Tooltip } from 'antd'\nimport { AppstoreAddOutlined } from '@ant-design/icons'\n\nimport OpticalPathItem from './OpticalPathItem'\n\nconst { Option } = Select\n\ninterface OpticalPathListProps {\n opticalPaths: dmv.opticalPath.OpticalPath[]\n metadata: {\n [opticalPathIdentifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n }\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n defaultOpticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n }\n onOpticalPathVisibilityChange: ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }) => void\n onOpticalPathStyleChange: ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }) => void\n onOpticalPathActivityChange: ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }) => void\n selectedPresentationStateUID?: string\n}\n\ninterface OpticalPathListState {\n selectedOpticalPathIdentifier?: string\n}\n\n/**\n * React component representing a list of optical paths.\n */\nclass OpticalPathList extends React.Component {\n state = {\n selectedOpticalPathIdentifier: undefined\n }\n\n constructor (props: OpticalPathListProps) {\n super(props)\n this.handleItemAddition = this.handleItemAddition.bind(this)\n this.handleItemRemoval = this.handleItemRemoval.bind(this)\n this.handleItemSelectionChange = this.handleItemSelectionChange.bind(this)\n }\n\n /**\n * Handler that gets called when an optical path should be removed.\n */\n handleItemRemoval (opticalPathIdentifier: string): void {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier,\n isActive: false\n })\n }\n\n /**\n * Handler that gets called when the selection of an optical path should change.\n */\n handleItemSelectionChange (\n value: string\n ): void {\n this.setState({ selectedOpticalPathIdentifier: value })\n }\n\n /**\n * Handler that gets called when an optical path should be added.\n */\n handleItemAddition (): void {\n const identifier = this.state.selectedOpticalPathIdentifier\n if (identifier !== undefined) {\n this.props.onOpticalPathActivityChange({\n opticalPathIdentifier: identifier,\n isActive: true\n })\n this.setState({ selectedOpticalPathIdentifier: undefined })\n }\n }\n\n render (): React.ReactNode {\n if (this.props.metadata === undefined) {\n return null\n }\n\n const isSelectable = this.props.opticalPaths.length > 1\n const opticalPathItems: React.ReactNode[] = []\n const optionItems: React.ReactNode[] = []\n this.props.opticalPaths.forEach(opticalPath => {\n const opticalPathIdentifier = opticalPath.identifier\n const images = this.props.metadata[opticalPathIdentifier]\n const seriesInstanceUID = images[0].SeriesInstanceUID\n images[0].OpticalPathSequence.forEach(opticalPathItem => {\n const id = opticalPathItem.OpticalPathIdentifier\n const description = opticalPathItem.OpticalPathDescription\n if (opticalPath.identifier === id) {\n if (this.props.activeOpticalPathIdentifiers.has(id)) {\n opticalPathItems.push(\n \n )\n } else {\n let title\n if (description !== '') {\n title = `${id} - ${description}`\n } else {\n title = `${id}`\n }\n optionItems.push(\n \n )\n }\n }\n })\n })\n\n let opticalPathSelector\n if (isSelectable) {\n opticalPathSelector = (\n \n \n {optionItems}\n \n \n }\n type='primary'\n onClick={this.handleItemAddition}\n />\n \n \n )\n }\n\n return (\n \n {opticalPathItems}\n {opticalPathSelector}\n \n )\n }\n}\n\nexport default OpticalPathList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface MappingItemProps {\n mapping: dmv.mapping.ParameterMapping\n metadata: dmv.metadata.ParametricMap[]\n isVisible: boolean\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\ninterface MappingItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Real World Value Mapping.\n */\nclass MappingItem extends React.Component {\n constructor (props: MappingItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: {\n opacity: this.props.defaultStyle.opacity\n }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n mappingUID: this.props.mapping.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n mappingUID: this.props.mapping.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState(state => ({\n currentStyle: {\n opacity: value\n }\n }))\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Description',\n value: this.props.mapping.description\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n mapping,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n \n
\n \n
\n \n )\n }\n}\n\nexport default MappingItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport MappingItem from './MappingItem'\n\ninterface MappingListProps {\n mappings: dmv.mapping.ParameterMapping[]\n metadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n }\n visibleMappingUIDs: Set\n defaultMappingStyles: {\n [mappingUID: string]: { opacity: number }\n }\n onMappingVisibilityChange: ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }) => void\n onMappingStyleChange: ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Real World Value Mappings.\n */\nclass MappingList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.mappings.map((mapping, index) => {\n const uid = mapping.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default MappingList\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport {\n Button,\n Col,\n InputNumber,\n Menu,\n Popover,\n Row,\n Slider,\n Space,\n Switch\n} from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { FaEye, FaEyeSlash } from 'react-icons/fa'\n\nimport Description from './Description'\n\ninterface SegmentItemProps {\n segment: dmv.segment.Segment\n isVisible: boolean\n metadata: dmv.metadata.Segmentation[]\n defaultStyle: {\n opacity: number\n }\n onVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\ninterface SegmentItemState {\n isVisible: boolean\n currentStyle: {\n opacity: number\n }\n}\n\n/**\n * React component representing a Segment.\n */\nclass SegmentItem extends React.Component {\n constructor (props: SegmentItemProps) {\n super(props)\n this.handleVisibilityChange = this.handleVisibilityChange.bind(this)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.state = {\n isVisible: this.props.isVisible,\n currentStyle: { opacity: this.props.defaultStyle.opacity }\n }\n }\n\n handleVisibilityChange (\n checked: boolean,\n event: React.MouseEvent\n ): void {\n this.props.onVisibilityChange({\n segmentUID: this.props.segment.uid,\n isVisible: checked\n })\n this.setState({ isVisible: checked })\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.onStyleChange({\n segmentUID: this.props.segment.uid,\n styleOptions: {\n opacity: value\n }\n })\n this.setState({ currentStyle: { opacity: value } })\n }\n }\n\n render (): React.ReactNode {\n const attributes: Array<{ name: string, value: string }> = [\n {\n name: 'Property Type',\n value: this.props.segment.propertyType.CodeMeaning\n },\n {\n name: 'Property Category',\n value: this.props.segment.propertyCategory.CodeMeaning\n },\n {\n name: 'Algorithm Name',\n value: this.props.segment.algorithmName\n }\n ]\n\n const settings = (\n
\n \n \n Opacity\n \n \n \n \n \n \n \n \n
\n )\n\n /**\n * This hack is required for Menu.Item to work properly:\n * https://github.com/react-component/menu/issues/142\n */\n const {\n defaultStyle,\n isVisible,\n segment,\n metadata,\n onVisibilityChange,\n onStyleChange,\n ...otherProps\n } = this.props\n return (\n \n \n
\n \n }\n unCheckedChildren={}\n />\n \n }\n />\n \n \n
\n \n
\n \n )\n }\n}\n\nexport default SegmentItem\n","import React from 'react'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport { Menu } from 'antd'\n\nimport SegmentItem from './SegmentItem'\n\ninterface SegmentListProps {\n segments: dmv.segment.Segment[]\n visibleSegmentUIDs: Set\n metadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n }\n defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n }\n onSegmentVisibilityChange: ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }) => void\n onSegmentStyleChange: ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity: number\n }\n }) => void\n}\n\n/**\n * React component representing a list of Segments.\n */\nclass SegmentList extends React.Component {\n render (): React.ReactNode {\n const items = this.props.segments.map((segment, index) => {\n const uid = segment.uid\n return (\n \n )\n })\n\n return (\n \n {items}\n \n )\n }\n}\n\nexport default SegmentList\n","import React from 'react'\nimport {\n NavigateFunction,\n Params,\n useLocation,\n useNavigate,\n useParams,\n Location\n} from 'react-router-dom'\n\nexport interface RouteComponentProps {\n location: Location\n navigate: NavigateFunction\n params: Params\n}\n\nexport function withRouter (Component: React.ComponentType): Function {\n function ComponentWithRouterProp (props: any): JSX.Element {\n const location = useLocation()\n const navigate = useNavigate()\n const params = useParams()\n return (\n \n )\n }\n return ComponentWithRouterProp\n}\n","import React from 'react'\nimport { Col, Divider, InputNumber, Row, Slider } from 'antd'\n\ninterface ColorSettingsMenuProps {\n annotationGroupsUIDs: string[]\n defaultStyle: {\n opacity: number\n color: number[]\n }\n onStyleChange: Function\n}\n\ninterface ColorSettingsMenuState {\n currentStyle: {\n opacity: number\n color?: number[]\n }\n}\n\n/**\n * React component representing an Annotation Group.\n */\nclass ColorSettingsMenu extends React.Component<\nColorSettingsMenuProps,\nColorSettingsMenuState\n> {\n constructor (props: ColorSettingsMenuProps) {\n super(props)\n this.handleOpacityChange = this.handleOpacityChange.bind(this)\n this.handleColorRChange = this.handleColorRChange.bind(this)\n this.handleColorGChange = this.handleColorGChange.bind(this)\n this.handleColorBChange = this.handleColorBChange.bind(this)\n this.getCurrentColor = this.getCurrentColor.bind(this)\n this.state = {\n currentStyle: {\n opacity: this.props.defaultStyle.opacity,\n color: this.props.defaultStyle.color\n }\n }\n }\n\n handleOpacityChange (value: number | null): void {\n if (value != null) {\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: this.state.currentStyle.color,\n opacity: value\n }\n })\n })\n this.setState({\n currentStyle: {\n opacity: value,\n color: this.state.currentStyle.color\n }\n })\n }\n }\n\n handleColorRChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[1],\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorGChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n Array.isArray(value) ? value[0] : value,\n this.state.currentStyle.color[2]\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n handleColorBChange (value: number | number[] | null): void {\n if (value != null && this.state.currentStyle.color !== undefined) {\n const color = [\n this.state.currentStyle.color[0],\n this.state.currentStyle.color[1],\n Array.isArray(value) ? value[0] : value\n ]\n this.setState((state) => ({\n currentStyle: {\n color: color,\n opacity: state.currentStyle.opacity\n }\n }))\n\n this.props.annotationGroupsUIDs.forEach((uid) => {\n this.props.onStyleChange({\n uid,\n styleOptions: {\n color: color,\n opacity: this.state.currentStyle.opacity\n }\n })\n })\n }\n }\n\n getCurrentColor (): string {\n const rgb2hex = (values: number[]): string => {\n const r = values[0]\n const g = values[1]\n const b = values[2]\n return '#' + (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1)\n }\n\n if (this.state.currentStyle.color != null) {\n return rgb2hex(this.state.currentStyle.color)\n } else {\n return 'white'\n }\n }\n\n render (): React.ReactNode {\n let colorSettings\n if (this.state.currentStyle.color != null) {\n colorSettings = (\n <>\n Color\n \n Red\n \n \n \n \n \n \n \n\n \n Green\n \n \n \n \n \n \n \n\n \n Blue\n \n \n \n \n \n \n \n \n \n )\n }\n\n return (\n
\n {colorSettings}\n \n Opacity\n \n \n \n \n \n \n \n
\n )\n }\n}\n\nexport default ColorSettingsMenu\n","import React from 'react'\nimport { Menu, Space, Checkbox, Tooltip, Popover, Button } from 'antd'\nimport { SettingOutlined } from '@ant-design/icons'\nimport { Category, Type } from './AnnotationCategoryList'\nimport ColorSettingsMenu from './ColorSettingsMenu'\n\nconst AnnotationCategoryItem = ({\n category,\n onChange,\n checkedAnnotationUids,\n onStyleChange,\n defaultAnnotationStyles\n}: {\n category: Category\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const { types } = category\n\n const onCheckCategoryChange = (e: any): void => {\n const isVisible = e.target.checked\n types.forEach((type: Type) => {\n handleChangeCheckedType({ type, isVisible })\n })\n }\n\n const checkAll = types.every((type: Type) =>\n type.uids.every((uid: string) => checkedAnnotationUids.has(uid))\n )\n const indeterminate =\n !checkAll &&\n types.some((type: Type) =>\n type.uids.some((uid: string) => checkedAnnotationUids.has(uid))\n )\n\n const handleChangeCheckedType = ({\n type,\n isVisible\n }: {\n type: Type\n isVisible: boolean\n }): void => {\n type.uids.forEach((uid: string) => {\n onChange({ roiUID: uid, isVisible })\n })\n }\n\n return (\n \n \n
\n \n \n \n {category.CodeMeaning}\n \n (\n {\n return [...acc, ...type.uids]\n },\n []\n )}\n onStyleChange={onStyleChange}\n defaultStyle={\n defaultAnnotationStyles[types[0].uids[0]]\n }\n />\n )}\n >\n }\n />\n \n \n \n {types.map((type: Type) => {\n const { CodeMeaning, CodingSchemeDesignator, CodeValue, uids } =\n type\n const shortenedCodeMeaning = CodeMeaning.slice(0, 22)\n const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`\n const isChecked = uids.every((uid: string) =>\n checkedAnnotationUids.has(uid)\n )\n const indeterminateType =\n !isChecked &&\n uids.some((uid: string) => checkedAnnotationUids.has(uid))\n return (\n \n \n handleChangeCheckedType({\n type,\n isVisible: e.target.checked\n })}\n />\n
\n \n {displayCodeMeaning}\n \n (\n \n )}\n >\n }\n />\n \n
\n
\n )\n })}\n
\n \n \n )\n}\n\nexport default AnnotationCategoryItem\n","import React from 'react'\nimport { Menu } from 'antd'\nimport AnnotationCategoryItem from './AnnotationCategoryItem'\n\nexport interface AnnotationCategoryAndType {\n uid: string\n type: Omit\n category: Omit\n}\nexport interface Type {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n uids: string[]\n}\nexport interface Category {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n types: Type[]\n}\n\nconst getCategories = (annotations: any): Record => {\n const categories = annotations?.reduce(\n (\n categoriesAcc: Record }>,\n annotation: AnnotationCategoryAndType\n ) => {\n const { category, type, uid } = annotation\n const categoryKey = category.CodeMeaning\n const typeKey = type.CodeMeaning\n\n const oldCategory = categoriesAcc[categoryKey] ?? {\n ...category,\n types: {}\n }\n const oldType = oldCategory.types[typeKey] ?? {\n ...type,\n uids: []\n }\n\n return {\n ...categoriesAcc,\n [categoryKey]: {\n ...oldCategory,\n types: {\n ...oldCategory.types,\n [typeKey]: { ...oldType, uids: [...oldType.uids, uid] }\n }\n }\n }\n },\n {}\n )\n\n // Normalizing types so that it's an array instead of an object:\n Object.keys(categories).forEach((categoryKey: string) => {\n const category = categories[categoryKey]\n const { types } = category\n const typesArr = Object.keys(types).map(\n (typeKey: string) => types[typeKey]\n )\n categories[categoryKey].types = typesArr\n })\n\n return categories\n}\n\nconst AnnotationCategoryList = ({\n annotations,\n onChange,\n onStyleChange,\n defaultAnnotationStyles,\n checkedAnnotationUids\n}: {\n annotations: AnnotationCategoryAndType[]\n onChange: Function\n onStyleChange: Function\n defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n }\n checkedAnnotationUids: Set\n}): JSX.Element => {\n const categories: Record = getCategories(annotations)\n\n if (Object.keys(categories).length === 0) {\n return <>\n }\n\n const items = Object.keys(categories).map((categoryKey: any) => {\n const category = categories[categoryKey]\n return (\n \n )\n })\n\n return {items}\n}\nexport default AnnotationCategoryList\n","const HoveredRoiTooltip = ({\n xPosition,\n yPosition,\n attributes\n}: {\n xPosition: number\n yPosition: number\n attributes: Array<{ name: string, value: string }>\n}): JSX.Element => {\n return (\n \n {attributes.map((attr) => (\n
\n {attr.name}: {attr.value}\n
\n ))}\n \n )\n}\n\nexport default HoveredRoiTooltip\n","import * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport { AnnotationCategoryAndType } from '../components/AnnotationCategoryList'\n\nexport const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndType => {\n const { uid, evaluations } = roi\n\n const result = {\n category: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n },\n type: {\n CodeValue: 'undefined',\n CodeMeaning: 'undefined',\n CodingSchemeDesignator: 'undefined'\n }\n }\n\n evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const value = codeContentItem.ConceptCodeSequence[0]\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n result.category = { ...value }\n } else if (nameValue === '121071') {\n result.type = { ...value }\n }\n }\n })\n\n return {\n ...result,\n uid\n }\n}\n","import React from 'react'\nimport {\n FaCrosshairs,\n FaDrawPolygon,\n FaEye,\n FaEyeSlash,\n FaHandPaper,\n FaHandPointer,\n FaTrash,\n FaSave\n} from 'react-icons/fa'\nimport {\n Button as Btn,\n Checkbox,\n Descriptions,\n Divider,\n InputNumber,\n message,\n Menu,\n Modal,\n Layout,\n Row,\n Select,\n Space,\n Tooltip\n} from 'antd'\nimport { UndoOutlined, CheckOutlined, StopOutlined } from '@ant-design/icons'\nimport * as dmv from 'dicom-microscopy-viewer'\nimport * as dcmjs from 'dcmjs'\nimport * as dwc from 'dicomweb-client'\n\nimport DicomWebManager from '../DicomWebManager'\nimport AnnotationList from './AnnotationList'\nimport AnnotationGroupList from './AnnotationGroupList'\nimport Button from './Button'\nimport Equipment from './Equipment'\nimport Report, { MeasurementReport } from './Report'\nimport SpecimenList from './SpecimenList'\nimport OpticalPathList from './OpticalPathList'\nimport MappingList from './MappingList'\nimport SegmentList from './SegmentList'\nimport { AnnotationSettings } from '../AppConfig'\nimport { Slide } from '../data/slides'\nimport { StorageClasses } from '../data/uids'\nimport { findContentItemsByName } from '../utils/sr'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\nimport AnnotationCategoryList from './AnnotationCategoryList'\nimport HoveredRoiTooltip from './HoveredRoiTooltip'\nimport { adaptRoiToAnnotation } from '../services/RoiToAnnotationAdapter'\n\nconst DEFAULT_ROI_STROKE_COLOR: number[] = [255, 234, 0] // [0, 126, 163]\nconst DEFAULT_ROI_FILL_COLOR: number[] = [255, 234, 0, 0.2] // [0, 126, 163, 0.2]\nconst DEFAULT_ROI_STROKE_WIDTH: number = 2\nconst DEFAULT_ROI_RADIUS: number = 5\n\nconst DEFAULT_ANNOTATION_OPACITY = 0.4\nconst DEFAULT_ANNOTATION_STROKE_COLOR = [0, 0, 0]\nconst DEFAULT_ANNOTATION_COLOR_PALETTE = [\n [54, 162, 235],\n [181, 65, 98],\n [75, 192, 192],\n [255, 158, 64],\n [153, 102, 254],\n [255, 205, 86],\n [200, 203, 207]\n]\n\nconst _buildKey = (concept: {\n CodeValue: string\n CodeMeaning: string\n CodingSchemeDesignator: string\n CodingSchemeVersion?: string\n}): string => {\n const codingScheme = concept.CodingSchemeDesignator\n const codeValue = concept.CodeValue\n return `${codingScheme}-${codeValue}`\n}\n\nconst _getRoiKey = (roi: dmv.roi.ROI): string | undefined => {\n const matches = findContentItemsByName({\n content: roi.evaluations,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n })\n })\n if (matches.length === 0) {\n console.warn(`no finding found for ROI ${roi.uid}`)\n return\n }\n const finding = matches[0] as dcmjs.sr.valueTypes.CodeContentItem\n const findingName = finding.ConceptCodeSequence[0]\n return _buildKey(findingName)\n}\n\nconst _areROIsEqual = (a: dmv.roi.ROI, b: dmv.roi.ROI): boolean => {\n if (a.scoord3d.graphicType !== b.scoord3d.graphicType) {\n return false\n }\n if (a.scoord3d.frameOfReferenceUID !== b.scoord3d.frameOfReferenceUID) {\n return false\n }\n if (a.scoord3d.graphicData.length !== b.scoord3d.graphicData.length) {\n return false\n }\n\n const decimals = 6\n for (let i = 0; i < a.scoord3d.graphicData.length; ++i) {\n if (a.scoord3d.graphicType === 'POINT') {\n const s1 = a.scoord3d as dmv.scoord3d.Point\n const s2 = b.scoord3d as dmv.scoord3d.Point\n const c1 = s1.graphicData[i].toPrecision(decimals)\n const c2 = s2.graphicData[i].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n } else {\n const s1 = a.scoord3d as dmv.scoord3d.Polygon\n const s2 = b.scoord3d as dmv.scoord3d.Polygon\n for (let j = 0; j < s1.graphicData[i].length; ++j) {\n const c1 = s1.graphicData[i][j].toPrecision(decimals)\n const c2 = s2.graphicData[i][j].toPrecision(decimals)\n if (c1 !== c2) {\n return false\n }\n }\n }\n }\n return true\n}\n\nconst _formatRoiStyle = (style: {\n stroke?: {\n color?: number[]\n width?: number\n }\n fill?: {\n color?: number[]\n }\n radius?: number\n}): dmv.viewer.ROIStyleOptions => {\n const stroke = {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n }\n if (style.stroke != null) {\n if (style.stroke.color != null) {\n stroke.color = style.stroke.color\n }\n if (style.stroke.width != null) {\n stroke.width = style.stroke.width\n }\n }\n const fill = {\n color: DEFAULT_ROI_FILL_COLOR\n }\n if (style.fill != null) {\n if (style.fill.color != null) {\n fill.color = style.fill.color\n }\n }\n return {\n stroke,\n fill,\n image: {\n circle: {\n radius: style.radius != null\n ? style.radius\n : Math.max(5 - stroke.width, 1),\n stroke,\n fill\n }\n }\n }\n}\n\nconst _constructViewers = ({ clients, slide, preload }: {\n clients: { [key: string]: dwc.api.DICOMwebClient }\n slide: Slide\n preload?: boolean\n}): {\n volumeViewer: dmv.viewer.VolumeImageViewer\n labelViewer?: dmv.viewer.LabelImageViewer\n} => {\n console.info(\n 'instantiate viewer for VOLUME images of slide ' +\n `\"${slide.volumeImages[0].ContainerIdentifier}\"`\n )\n try {\n const volumeViewer = new dmv.viewer.VolumeImageViewer({\n clientMapping: clients,\n metadata: slide.volumeImages,\n controls: ['overview', 'position'],\n preload: preload,\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV, error\n )\n }\n })\n volumeViewer.activateSelectInteraction({})\n\n let labelViewer\n if (slide.labelImages.length > 0) {\n console.info(\n 'instantiate viewer for LABEL image of slide ' +\n `\"${slide.labelImages[0].ContainerIdentifier}\"`\n )\n labelViewer = new dmv.viewer.LabelImageViewer({\n client: clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE],\n metadata: slide.labelImages[0],\n resizeFactor: 1,\n orientation: 'vertical',\n errorInterceptor: (error: CustomError) => {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DMV,\n error\n )\n }\n })\n }\n\n return { volumeViewer, labelViewer }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to instantiate viewer'\n )\n )\n throw error\n }\n}\n\n/*\n * Check whether the report is structured according to template\n * TID 1500 \"MeasurementReport\".\n */\nconst _implementsTID1500 = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const templateSeq = report.ContentTemplateSequence\n if (templateSeq.length > 0) {\n const tid = templateSeq[0].TemplateIdentifier\n if (tid === '1500') {\n return true\n }\n }\n return false\n}\n\n/*\n * Check whether the subject described in the report is a specimen as compared\n * to a patient, fetus, or device.\n */\nconst _describesSpecimenSubject = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const items = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121024',\n schemeDesignator: 'DCM',\n meaning: 'Subject Class'\n })\n })\n if (items.length === 0) {\n return false\n }\n const subjectClassItem = items[0] as dcmjs.sr.valueTypes.CodeContentItem\n const subjectClassValue = subjectClassItem.ConceptCodeSequence[0]\n const retrievedConcept = new dcmjs.sr.coding.CodedConcept({\n value: subjectClassValue.CodeValue,\n meaning: subjectClassValue.CodeMeaning,\n schemeDesignator: subjectClassValue.CodingSchemeDesignator\n })\n const expectedConcept = new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n meaning: 'Specimen',\n schemeDesignator: 'DCM'\n })\n if (retrievedConcept.equals(expectedConcept)) {\n return true\n }\n return false\n}\n\n/*\n * Check whether the report contains appropriate graphic ROI annotations.\n */\nconst _containsROIAnnotations = (\n report: dmv.metadata.Comprehensive3DSR\n): boolean => {\n const measurements = findContentItemsByName({\n content: report.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '126010',\n schemeDesignator: 'DCM',\n meaning: 'Imaging Measurements'\n })\n })\n if (measurements.length === 0) {\n return false\n }\n const container = measurements[0] as dcmjs.sr.valueTypes.ContainerContentItem\n const measurementGroups = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '125007',\n schemeDesignator: 'DCM',\n meaning: 'Measurement Group'\n })\n })\n\n let foundRegion = false\n measurementGroups.forEach((group) => {\n const container = group as dcmjs.sr.valueTypes.ContainerContentItem\n const regions = findContentItemsByName({\n content: container.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '111030',\n schemeDesignator: 'DCM',\n meaning: 'Image Region'\n })\n })\n if (regions.length > 0) {\n if (regions[0].ValueType === dcmjs.sr.valueTypes.ValueTypes.SCOORD3D) {\n foundRegion = true\n }\n }\n })\n\n return foundRegion\n}\n\ninterface EvaluationOptions {\n name: dcmjs.sr.coding.CodedConcept\n values: dcmjs.sr.coding.CodedConcept[]\n}\n\ninterface Evaluation {\n name: dcmjs.sr.coding.CodedConcept\n value: dcmjs.sr.coding.CodedConcept\n}\n\ninterface Measurement {\n name: dcmjs.sr.coding.CodedConcept\n value?: number\n unit: dcmjs.sr.coding.CodedConcept\n}\n\ninterface SlideViewerProps extends RouteComponentProps {\n slide: Slide\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n seriesInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload?: boolean\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n user?: {\n name: string\n email: string\n }\n selectedPresentationStateUID?: string\n}\n\ninterface SlideViewerState {\n visibleRoiUIDs: Set\n visibleSegmentUIDs: Set\n visibleMappingUIDs: Set\n visibleAnnotationGroupUIDs: Set\n visibleOpticalPathIdentifiers: Set\n activeOpticalPathIdentifiers: Set\n presentationStates: dmv.metadata.AdvancedBlendingPresentationState[]\n selectedPresentationStateUID?: string\n selectedFinding?: dcmjs.sr.coding.CodedConcept\n selectedEvaluations: Evaluation[]\n selectedGeometryType?: string\n selectedMarkup?: string\n selectedRoi?: dmv.roi.ROI\n selectedRoiUIDs: Set\n generatedReport?: dmv.metadata.Comprehensive3DSR\n isLoading: boolean\n isAnnotationModalVisible: boolean\n isSelectedRoiModalVisible: boolean\n isHoveredRoiTooltipVisible: boolean\n hoveredRoi?: dmv.roi.ROI\n hoveredRoiAttributes: Array<{ name: string, value: string }>\n hoveredRoiTooltipX: number\n hoveredRoiTooltipY: number\n isReportModalVisible: boolean\n isRoiDrawingActive: boolean\n isRoiModificationActive: boolean\n isRoiTranslationActive: boolean\n isGoToModalVisible: boolean\n isSelectedMagnificationValid: boolean\n isSelectedXCoordinateValid: boolean\n isSelectedYCoordinateValid: boolean\n selectedXCoordinate?: number\n validXCoordinateRange: number[]\n selectedYCoordinate?: number\n validYCoordinateRange: number[]\n selectedMagnification?: number\n areRoisHidden: boolean\n pixelDataStatistics: {\n [opticalPathIdentifier: string]: {\n min: number\n max: number\n numFramesSampled: number\n }\n }\n loadingFrames: Set\n}\n\n/**\n * React component for interactive viewing of an individual digital slide,\n * which corresponds to one DICOM Series of DICOM Slide Microscopy images and\n * potentially one or more associated DICOM Series of DICOM SR documents.\n */\nclass SlideViewer extends React.Component {\n private readonly findingOptions: dcmjs.sr.coding.CodedConcept[] = []\n\n private readonly evaluationOptions: { [key: string]: EvaluationOptions[] } = {}\n\n private readonly measurements: Measurement[] = []\n\n private readonly geometryTypeOptions: { [key: string]: string[] } = {}\n\n private readonly volumeViewportRef: React.RefObject\n\n private readonly labelViewportRef: React.RefObject\n\n private volumeViewer: dmv.viewer.VolumeImageViewer\n\n private labelViewer?: dmv.viewer.LabelImageViewer\n\n private readonly defaultRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: {\n color: DEFAULT_ROI_STROKE_COLOR,\n width: DEFAULT_ROI_STROKE_WIDTH\n },\n fill: {\n color: DEFAULT_ROI_FILL_COLOR\n },\n image: {\n circle: {\n fill: {\n color: DEFAULT_ROI_STROKE_COLOR\n },\n radius: DEFAULT_ROI_RADIUS\n }\n }\n }\n\n private roiStyles: {[key: string]: dmv.viewer.ROIStyleOptions} = {}\n\n private defaultAnnotationStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n\n private readonly selectionColor: number[] = [140, 184, 198]\n\n private readonly selectedRoiStyle: dmv.viewer.ROIStyleOptions = {\n stroke: { color: [...this.selectionColor, 1], width: 3 },\n fill: { color: [...this.selectionColor, 0.2] },\n image: {\n circle: {\n radius: 5,\n fill: { color: [...this.selectionColor, 1] }\n }\n }\n }\n\n constructor (props: SlideViewerProps) {\n super(props)\n console.info(\n `view slide \"${this.props.slide.containerIdentifier}\": `,\n this.props.slide\n )\n const geometryTypeOptions = [\n 'point',\n 'circle',\n 'box',\n 'polygon',\n 'line',\n 'freehandpolygon',\n 'freehandline'\n ]\n props.annotations.forEach((annotation: AnnotationSettings) => {\n const finding = new dcmjs.sr.coding.CodedConcept(annotation.finding)\n this.findingOptions.push(finding)\n const key = _buildKey(finding)\n if (annotation.geometryTypes !== undefined) {\n this.geometryTypeOptions[key] = annotation.geometryTypes\n } else {\n this.geometryTypeOptions[key] = geometryTypeOptions\n }\n this.evaluationOptions[key] = []\n if (annotation.evaluations !== undefined) {\n annotation.evaluations.forEach(evaluation => {\n this.evaluationOptions[key].push({\n name: new dcmjs.sr.coding.CodedConcept(evaluation.name),\n values: evaluation.values.map(value => {\n return new dcmjs.sr.coding.CodedConcept(value)\n })\n })\n })\n }\n if (annotation.measurements !== undefined) {\n annotation.measurements.forEach(measurement => {\n this.measurements.push({\n name: new dcmjs.sr.coding.CodedConcept(measurement.name),\n value: undefined,\n unit: new dcmjs.sr.coding.CodedConcept(measurement.unit)\n })\n })\n }\n if (annotation.style != null) {\n this.roiStyles[key] = _formatRoiStyle(annotation.style)\n } else {\n this.roiStyles[key] = this.defaultRoiStyle\n }\n })\n\n this.componentSetup = this.componentSetup.bind(this)\n this.componentCleanup = this.componentCleanup.bind(this)\n\n this.onWindowResize = this.onWindowResize.bind(this)\n this.handleRoiDrawing = this.handleRoiDrawing.bind(this)\n this.handleRoiTranslation = this.handleRoiTranslation.bind(this)\n this.handleRoiModification = this.handleRoiModification.bind(this)\n this.handleRoiVisibilityChange = this.handleRoiVisibilityChange.bind(this)\n this.handleRoiRemoval = this.handleRoiRemoval.bind(this)\n this.handleRoiSelectionCancellation = this.handleRoiSelectionCancellation.bind(this)\n this.handleAnnotationConfigurationCancellation = this.handleAnnotationConfigurationCancellation.bind(this)\n this.handleAnnotationGeometryTypeSelection = this.handleAnnotationGeometryTypeSelection.bind(this)\n this.handleAnnotationMeasurementActivation = this.handleAnnotationMeasurementActivation.bind(this)\n this.handleAnnotationFindingSelection = this.handleAnnotationFindingSelection.bind(this)\n this.handleAnnotationEvaluationSelection = this.handleAnnotationEvaluationSelection.bind(this)\n this.handleAnnotationEvaluationClearance = this.handleAnnotationEvaluationClearance.bind(this)\n this.handleAnnotationConfigurationCompletion = this.handleAnnotationConfigurationCompletion.bind(this)\n this.handleAnnotationSelection = this.handleAnnotationSelection.bind(this)\n this.handleAnnotationVisibilityChange = this.handleAnnotationVisibilityChange.bind(this)\n this.handleAnnotationGroupVisibilityChange = this.handleAnnotationGroupVisibilityChange.bind(this)\n this.handleAnnotationGroupStyleChange = this.handleAnnotationGroupStyleChange.bind(this)\n this.handleRoiStyleChange = this.handleRoiStyleChange.bind(this)\n this.handleGoTo = this.handleGoTo.bind(this)\n this.handleXCoordinateSelection = this.handleXCoordinateSelection.bind(this)\n this.handleYCoordinateSelection = this.handleYCoordinateSelection.bind(this)\n this.handleMagnificationSelection = this.handleMagnificationSelection.bind(this)\n this.handleSlidePositionSelection = this.handleSlidePositionSelection.bind(this)\n this.handleSlidePositionSelectionCancellation = this.handleSlidePositionSelectionCancellation.bind(this)\n this.handleReportGeneration = this.handleReportGeneration.bind(this)\n this.handleReportVerification = this.handleReportVerification.bind(this)\n this.handleReportCancellation = this.handleReportCancellation.bind(this)\n this.handleSegmentVisibilityChange = this.handleSegmentVisibilityChange.bind(this)\n this.handleSegmentStyleChange = this.handleSegmentStyleChange.bind(this)\n this.handleMappingVisibilityChange = this.handleMappingVisibilityChange.bind(this)\n this.handleMappingStyleChange = this.handleMappingStyleChange.bind(this)\n this.handleOpticalPathVisibilityChange = this.handleOpticalPathVisibilityChange.bind(this)\n this.handleOpticalPathStyleChange = this.handleOpticalPathStyleChange.bind(this)\n this.handleOpticalPathActivityChange = this.handleOpticalPathActivityChange.bind(this)\n this.handlePresentationStateSelection = this.handlePresentationStateSelection.bind(this)\n this.handlePresentationStateReset = this.handlePresentationStateReset.bind(this)\n\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n this.volumeViewportRef = React.createRef()\n this.labelViewportRef = React.createRef()\n\n /**\n * Deactivate all optical paths. Visibility will be set later, potentially\n * using based on available presentation state instances.\n */\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n this.volumeViewer.deactivateOpticalPath(opticalPath.identifier)\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.state = {\n selectedRoiUIDs: new Set(),\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers: new Set(),\n activeOpticalPathIdentifiers: new Set(),\n presentationStates: [],\n selectedFinding: undefined,\n selectedEvaluations: [],\n generatedReport: undefined,\n isLoading: false,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isHoveredRoiTooltipVisible: false,\n hoveredRoiTooltipX: 0,\n hoveredRoiTooltipY: 0,\n hoveredRoiAttributes: [],\n isSelectedMagnificationValid: false,\n isReportModalVisible: false,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n selectedXCoordinate: undefined,\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n selectedYCoordinate: undefined,\n validYCoordinateRange: [offset[1], offset[1] + size[1]],\n selectedMagnification: undefined,\n areRoisHidden: false,\n pixelDataStatistics: {},\n selectedPresentationStateUID: this.props.selectedPresentationStateUID,\n loadingFrames: new Set()\n }\n }\n\n componentDidUpdate (\n previousProps: SlideViewerProps,\n previousState: SlideViewerState\n ): void {\n /** Fetch data and update the viewports if the route has changed (\n * i.e., if another series has been selected) or if the client has changed.\n */\n if (\n this.props.location.pathname !== previousProps.location.pathname ||\n this.props.studyInstanceUID !== previousProps.studyInstanceUID ||\n this.props.seriesInstanceUID !== previousProps.seriesInstanceUID ||\n this.props.slide !== previousProps.slide ||\n this.props.clients !== previousProps.clients\n ) {\n if (this.volumeViewportRef.current != null) {\n this.volumeViewportRef.current.innerHTML = ''\n }\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n if (this.labelViewportRef.current != null) {\n this.labelViewportRef.current.innerHTML = ''\n }\n this.labelViewer.cleanup()\n }\n const { volumeViewer, labelViewer } = _constructViewers({\n clients: this.props.clients,\n slide: this.props.slide,\n preload: this.props.preload\n })\n this.volumeViewer = volumeViewer\n this.labelViewer = labelViewer\n\n const activeOpticalPathIdentifiers: Set = new Set()\n const visibleOpticalPathIdentifiers: Set = new Set()\n this.volumeViewer.getAllOpticalPaths().forEach(opticalPath => {\n const identifier = opticalPath.identifier\n if (this.volumeViewer.isOpticalPathVisible(identifier)) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n if (this.volumeViewer.isOpticalPathActive(identifier)) {\n activeOpticalPathIdentifiers.add(identifier)\n }\n })\n\n const [offset, size] = this.volumeViewer.boundingBox\n\n this.setState({\n visibleRoiUIDs: new Set(),\n visibleSegmentUIDs: new Set(),\n visibleMappingUIDs: new Set(),\n visibleAnnotationGroupUIDs: new Set(),\n visibleOpticalPathIdentifiers,\n activeOpticalPathIdentifiers,\n presentationStates: [],\n loadingFrames: new Set(),\n validXCoordinateRange: [offset[0], offset[0] + size[0]],\n validYCoordinateRange: [offset[1], offset[1] + size[1]]\n })\n this.populateViewports()\n }\n }\n\n /**\n * Retrieve Presentation State instances that reference the any images of\n * the currently selected series.\n */\n loadPresentationStates = (): void => {\n console.info('search for Presentation State instances')\n const client = this.props.clients[\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE\n ]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'PR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach((rawInstance, index) => {\n const { dataset } = dmv.metadata.formatMetadata(rawInstance)\n const instance = dataset as dmv.metadata.Instance\n console.info(`retrieve PR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n if (this.props.slide.areVolumeImagesMonochrome) {\n const presentationState = (\n dataset as\n unknown as\n dmv.metadata.AdvancedBlendingPresentationState\n )\n let doesMatch = false\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n doesMatch = this.props.slide.seriesInstanceUIDs.includes(\n blendingItem.SeriesInstanceUID\n )\n }\n )\n if (doesMatch) {\n console.info(\n 'include Advanced Blending Presentation State instance ' +\n `\"${presentationState.SOPInstanceUID}\"`\n )\n if (\n index === 0 &&\n this.props.selectedPresentationStateUID == null\n ) {\n this.setPresentationState(presentationState)\n } else {\n if (\n presentationState.SOPInstanceUID ===\n this.props.selectedPresentationStateUID\n ) {\n this.setPresentationState(presentationState)\n }\n }\n this.setState(state => {\n const mapping: {\n [sopInstanceUID: string]:\n dmv.metadata.AdvancedBlendingPresentationState\n } = {}\n state.presentationStates.forEach(instance => {\n mapping[instance.SOPInstanceUID] = instance\n })\n mapping[presentationState.SOPInstanceUID] = presentationState\n return { presentationStates: Object.values(mapping) }\n })\n }\n } else {\n console.info(\n `ignore presentation state \"${instance.SOPInstanceUID}\", ` +\n 'application of presentation states for color images ' +\n 'has not (yet) been implemented'\n )\n }\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n console.error(\n 'failed to load presentation state ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be loaded'\n )\n )\n })\n }\n\n /**\n * Set presentation state as specified by a DICOM Presentation State instance.\n */\n setPresentationState = (\n presentationState: dmv.metadata.AdvancedBlendingPresentationState\n ): void => {\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n console.info(\n `apply Presentation State instance \"${presentationState.SOPInstanceUID}\"`\n )\n const opticalPathStyles: {\n [opticalPathIdentifier: string]: {\n opacity: number\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n limitValues?: number[]\n } | null\n } = {}\n opticalPaths.forEach(opticalPath => {\n // First, deactivate and hide all optical paths and reset style\n const identifier = opticalPath.identifier\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n\n presentationState.AdvancedBlendingSequence.forEach(blendingItem => {\n /**\n * Referenced Instance Sequence should be used instead of Referenced\n * Image Sequence, but that's easy to mix up and we have encountered\n * implementations that get it wrong.\n */\n let refInstanceItems = blendingItem.ReferencedInstanceSequence\n if (refInstanceItems === undefined) {\n refInstanceItems = blendingItem.ReferencedImageSequence\n }\n if (refInstanceItems === undefined) {\n return\n }\n refInstanceItems.forEach(imageItem => {\n const isReferenced = opticalPath.sopInstanceUIDs.includes(\n imageItem.ReferencedSOPInstanceUID\n ) as boolean\n if (isReferenced) {\n let paletteColorLUT\n if (blendingItem.PaletteColorLookupTableSequence != null) {\n const cpLUTItem = blendingItem.PaletteColorLookupTableSequence[0]\n paletteColorLUT = new dmv.color.PaletteColorLookupTable({\n uid: (\n cpLUTItem.PaletteColorLookupTableUID != null\n ? cpLUTItem.PaletteColorLookupTableUID\n : ''\n ),\n redDescriptor:\n cpLUTItem.RedPaletteColorLookupTableDescriptor,\n greenDescriptor:\n cpLUTItem.GreenPaletteColorLookupTableDescriptor,\n blueDescriptor:\n cpLUTItem.BluePaletteColorLookupTableDescriptor,\n redData: (\n (cpLUTItem.RedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.RedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenData: (\n (cpLUTItem.GreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.GreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueData: (\n (cpLUTItem.BluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.BluePaletteColorLookupTableData\n )\n : undefined\n ),\n redSegmentedData: (\n (cpLUTItem.SegmentedRedPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedRedPaletteColorLookupTableData\n )\n : undefined\n ),\n greenSegmentedData: (\n (cpLUTItem.SegmentedGreenPaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedGreenPaletteColorLookupTableData\n )\n : undefined\n ),\n blueSegmentedData: (\n (cpLUTItem.SegmentedBluePaletteColorLookupTableData != null)\n ? new Uint16Array(\n cpLUTItem.SegmentedBluePaletteColorLookupTableData\n )\n : undefined\n )\n })\n }\n\n let limitValues\n if (blendingItem.SoftcopyVOILUTSequence != null) {\n const voiLUTItem = blendingItem.SoftcopyVOILUTSequence[0]\n const windowCenter = voiLUTItem.WindowCenter\n const windowWidth = voiLUTItem.WindowWidth\n limitValues = [\n windowCenter - windowWidth * 0.5,\n windowCenter + windowWidth * 0.5\n ]\n }\n\n opticalPathStyles[identifier] = {\n opacity: 1,\n paletteColorLookupTable: paletteColorLUT,\n limitValues: limitValues\n }\n }\n })\n })\n })\n\n const selectedOpticalPathIdentifiers: Set = new Set()\n Object.keys(opticalPathStyles).forEach(identifier => {\n const styleOptions = opticalPathStyles[identifier]\n if (styleOptions != null) {\n this.volumeViewer.setOpticalPathStyle(identifier, styleOptions)\n this.volumeViewer.activateOpticalPath(identifier)\n this.volumeViewer.showOpticalPath(identifier)\n selectedOpticalPathIdentifiers.add(identifier)\n } else {\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n }\n })\n const searchParams = new URLSearchParams(this.props.location.search)\n searchParams.set('state', presentationState.SOPInstanceUID)\n this.props.navigate(\n {\n pathname: this.props.location.pathname,\n search: searchParams.toString()\n },\n { replace: true }\n )\n this.setState(state => ({\n activeOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n visibleOpticalPathIdentifiers: selectedOpticalPathIdentifiers,\n selectedPresentationStateUID: presentationState.SOPInstanceUID\n }))\n }\n\n getRoiStyle = (key?: string): dmv.viewer.ROIStyleOptions => {\n if (key == null) {\n return this.defaultRoiStyle\n }\n if (this.roiStyles[key] !== undefined) {\n return this.roiStyles[key]\n }\n return this.defaultRoiStyle\n }\n\n /**\n * Retrieve Structured Report instances that contain regions of interests\n * with 3D spatial coordinates defined in the same frame of reference as the\n * currently selected series and add them to the VOLUME image viewer.\n */\n addAnnotations = (): void => {\n console.info('search for Comprehensive 3D SR instances')\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.searchForInstances({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SR'\n }\n }).then((matchedInstances): void => {\n if (matchedInstances == null) {\n matchedInstances = []\n }\n matchedInstances.forEach(i => {\n const { dataset } = dmv.metadata.formatMetadata(i)\n const instance = dataset as dmv.metadata.Instance\n if (instance.SOPClassUID === StorageClasses.COMPREHENSIVE_3D_SR) {\n console.info(`retrieve SR instance \"${instance.SOPInstanceUID}\"`)\n client.retrieveInstance({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: instance.SeriesInstanceUID,\n sopInstanceUID: instance.SOPInstanceUID\n }).then((retrievedInstance): void => {\n const data = dcmjs.data.DicomMessage.readFile(retrievedInstance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n const report = dataset as unknown as dmv.metadata.Comprehensive3DSR\n /*\n * Perform a couple of checks to ensure the document content of the\n * report fullfils the requirements of the application.\n */\n if (!_implementsTID1500(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it is not structured according to template ' +\n 'TID 1500 \"MeasurementReport\"'\n )\n return\n }\n if (!_describesSpecimenSubject(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not describe a specimen subject'\n )\n return\n }\n if (!_containsROIAnnotations(report)) {\n console.debug(\n `ignore SR document \"${report.SOPInstanceUID}\" ` +\n 'because it does not contain any suitable ROI annotations'\n )\n return\n }\n\n const content = new MeasurementReport(report)\n content.ROIs.forEach(roi => {\n console.info(`add ROI \"${roi.uid}\"`)\n const scoord3d = roi.scoord3d\n const image = this.props.slide.volumeImages[0]\n if (scoord3d.frameOfReferenceUID === image.FrameOfReferenceUID) {\n /*\n * ROIs may get assigned new UIDs upon re-rendering of the\n * page and we need to ensure that we don't add them twice.\n * The same ROI may be stored in multiple SR documents and\n * we don't want them to show up twice.\n * TODO: We should probably either \"merge\" measurements and\n * quantitative evaluations or pick the ROI from the \"best\"\n * available report (COMPLETE and VERIFIED).\n */\n const doesROIExist = this.volumeViewer.getAllROIs().some(\n (otherROI: dmv.roi.ROI): boolean => {\n return _areROIsEqual(otherROI, roi)\n }\n )\n if (!doesROIExist) {\n try {\n // Add ROI without style such that it won't be visible.\n this.volumeViewer.addROI(roi, {})\n } catch {\n console.error(`could not add ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(`skip already existing ROI \"${roi.uid}\"`)\n }\n } else {\n console.debug(\n `skip ROI \"${roi.uid}\" ` +\n `of SR document \"${report.SOPInstanceUID}\"` +\n 'because it is defined in another frame of reference'\n )\n }\n })\n }).catch((error) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n console.error(\n 'failed to load ROIs ' +\n `of SOP instance \"${instance.SOPInstanceUID}\" ` +\n `of series \"${instance.SeriesInstanceUID}\" ` +\n `of study \"${this.props.studyInstanceUID}\": `,\n error\n )\n })\n /*\n * React is not aware of the fact that ROIs have been added via the\n * viewer (the viewport is a ref object) and won't show the\n * annotations in the user interface unless an update is forced.\n */\n this.forceUpdate()\n }\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Annotations could not be loaded'\n )\n )\n })\n }\n\n /**\n * Retrieve Microscopy Bulk Simple Annotations instances that contain\n * annotation groups defined in the same frame of reference as the currently\n * selected series and add them to the VOLUME image viewer.\n */\n addAnnotationGroups = (): void => {\n console.info('search for Microscopy Bulk Simple Annotations instances')\n const client = this.props.clients[\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION\n ]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'ANN'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const annotations: dmv.metadata.MicroscopyBulkSimpleAnnotations[] = retrievedMetadata.map(metadata => {\n return new dmv.metadata.MicroscopyBulkSimpleAnnotations({\n metadata\n })\n })\n // annotations = annotations.filter(ann => {\n // const refImage = this.props.slide.volumeImages[0]\n // return (\n // ann.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n // ann.ContainerIdentifier === refImage.ContainerIdentifier\n // )\n // })\n annotations.forEach(ann => {\n try {\n this.volumeViewer.addAnnotationGroups(ann)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Microscopy Bulk Simple Annotations cannot be displayed.'\n )\n )\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n console.error('failed to add annotation groups:', error)\n }\n ann.AnnotationGroupSequence.forEach(item => {\n const annotationGroupUID = item.AnnotationGroupUID\n const finding = item.AnnotationPropertyTypeCodeSequence[0]\n const key = _buildKey(finding)\n const style = this.roiStyles[key]\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (style != null && style.fill != null) {\n this.volumeViewer.setAnnotationGroupStyle(\n annotationGroupUID,\n { color: style.fill.color }\n )\n }\n })\n })\n /*\n * React is not aware of the fact that annotation groups have been\n * added via the viewer (the underlying HTML viewport element is a\n * ref object) and won't show the annotation groups in the user\n * interface unless an update is forced.\n */\n this.forceUpdate()\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Microscopy Bulk Simple Annotations ' +\n 'instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Microscopy Bulk Simple Annotations instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Segmentation instances that contain segments defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addSegmentations = (): void => {\n console.info('search for Segmentation instances')\n const client = this.props.clients[StorageClasses.SEGMENTATION]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'SEG'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach((s, i) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const segmentations: dmv.metadata.Segmentation[] = []\n retrievedMetadata.forEach(metadata => {\n const seg = new dmv.metadata.Segmentation({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n seg.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n seg.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n segmentations.push(seg)\n }\n })\n if (segmentations.length > 0) {\n try {\n this.volumeViewer.addSegments(segmentations)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Segmentations cannot be displayed'\n )\n )\n console.error('failed to add segments: ', error)\n }\n /*\n * React is not aware of the fact that segments have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the segments in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Segmentation instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Segmentation instances failed.'\n )\n )\n })\n }\n\n /**\n * Retrieve Parametric Map instances that contain mappings defined in the same\n * frame of reference as the currently selected series and add them to the\n * VOLUME image viewer.\n */\n addParametricMaps = (): void => {\n console.info('search for Parametric Map instances')\n const client = this.props.clients[StorageClasses.PARAMETRIC_MAP]\n client.searchForSeries({\n studyInstanceUID: this.props.studyInstanceUID,\n queryParams: {\n Modality: 'OT'\n }\n }).then((matchedSeries): void => {\n if (matchedSeries == null) {\n matchedSeries = []\n }\n matchedSeries.forEach(s => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const series = dataset as dmv.metadata.Series\n client.retrieveSeriesMetadata({\n studyInstanceUID: this.props.studyInstanceUID,\n seriesInstanceUID: series.SeriesInstanceUID\n }).then((retrievedMetadata): void => {\n const parametricMaps: dmv.metadata.ParametricMap[] = []\n retrievedMetadata.forEach(metadata => {\n const pm = new dmv.metadata.ParametricMap({ metadata })\n const refImage = this.props.slide.volumeImages[0]\n if (\n pm.FrameOfReferenceUID === refImage.FrameOfReferenceUID &&\n pm.ContainerIdentifier === refImage.ContainerIdentifier\n ) {\n parametricMaps.push(pm)\n } else {\n console.warn(\n `skip Parametric Map instance \"${pm.SOPInstanceUID}\"`\n )\n }\n })\n if (parametricMaps.length > 0) {\n try {\n this.volumeViewer.addParameterMappings(parametricMaps)\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Parametric Map cannot be displayed'\n )\n )\n console.error('failed to add mappings: ', error)\n }\n /*\n * React is not aware of the fact that mappings have been added via\n * the viewer (the underlying HTML viewport element is a ref object)\n * and won't show the mappings in the user interface unless an update\n * is forced.\n */\n this.forceUpdate()\n }\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Retrieval of metadata of Parametric Map instances failed.'\n )\n )\n })\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Search for Parametric Map instances failed.'\n )\n )\n })\n }\n\n /**\n * Populate viewports of the VOLUME and LABEL image viewers.\n */\n populateViewports = (): void => {\n console.info('populate viewports...')\n this.setState({\n isLoading: true,\n presentationStates: []\n })\n\n if (this.volumeViewportRef.current != null) {\n this.volumeViewer.render({ container: this.volumeViewportRef.current })\n }\n if (\n this.labelViewportRef.current != null &&\n this.labelViewer != null\n ) {\n this.labelViewer.render({ container: this.labelViewportRef.current })\n }\n\n // State update will also ensure that the component is re-rendered.\n this.setState({ isLoading: false })\n\n this.setDefaultPresentationState()\n this.loadPresentationStates()\n\n this.addAnnotations()\n this.addAnnotationGroups()\n this.addSegmentations()\n this.addParametricMaps()\n }\n\n onRoiModified = (event: CustomEventInit): void => {\n // Update state to trigger rendering\n this.setState(state => ({\n visibleRoiUIDs: new Set(state.visibleRoiUIDs)\n }))\n }\n\n onWindowResize = (event: Event): void => {\n console.info('resize viewports')\n this.volumeViewer.resize()\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }\n\n onRoiDrawn = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n const selectedFinding = this.state.selectedFinding\n const selectedEvaluations = this.state.selectedEvaluations\n if (roi !== undefined && selectedFinding !== undefined) {\n console.debug(`add ROI \"${roi.uid}\"`)\n const findingItem = new dcmjs.sr.valueTypes.CodeContentItem({\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121071',\n meaning: 'Finding',\n schemeDesignator: 'DCM'\n }),\n value: selectedFinding,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(findingItem)\n selectedEvaluations.forEach((evaluation: Evaluation) => {\n const item = new dcmjs.sr.valueTypes.CodeContentItem({\n name: evaluation.name,\n value: evaluation.value,\n relationshipType: 'CONTAINS'\n })\n roi.addEvaluation(item)\n })\n const key = _buildKey(selectedFinding)\n const style = this.getRoiStyle(key)\n this.volumeViewer.addROI(roi, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.debug(`could not add ROI \"${roi.uid}\"`)\n }\n }\n\n onRoiDoubleClicked = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n this.setState({\n isSelectedRoiModalVisible: true\n })\n } else {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n }\n\n setHoveredRoiAttributes = (hoveredRoi: dmv.roi.ROI): void => {\n const attributes: Array<{ name: string, value: string }> = []\n hoveredRoi.evaluations.forEach((\n item: (\n dcmjs.sr.valueTypes.TextContentItem |\n dcmjs.sr.valueTypes.CodeContentItem\n )\n ) => {\n const nameValue = item.ConceptNameCodeSequence[0].CodeValue\n const nameMeaning = item.ConceptNameCodeSequence[0].CodeMeaning\n const name = `${nameMeaning}`\n if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {\n const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem\n const valueMeaning = codeContentItem.ConceptCodeSequence[0].CodeMeaning\n // For consistency with Segment and Annotation Group\n if (nameValue === '276214006') {\n attributes.push({\n name: 'Property category',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '121071') {\n attributes.push({\n name: 'Property type',\n value: `${valueMeaning}`\n })\n } else if (nameValue === '111001') {\n attributes.push({\n name: 'Algorithm Name',\n value: `${valueMeaning}`\n })\n } else {\n attributes.push({\n name: name,\n value: `${valueMeaning}`\n })\n }\n } else if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.TEXT) {\n const textContentItem = item as dcmjs.sr.valueTypes.TextContentItem\n attributes.push({\n name: name,\n value: textContentItem.TextValue\n })\n }\n })\n\n this.setState({ hoveredRoiAttributes: attributes })\n }\n\n onPointerMove = (event: CustomEventInit): void => {\n const { feature: hoveredRoi, event: evt } = event.detail.payload\n if (hoveredRoi != null) {\n const originalEvent = evt.originalEvent\n this.setHoveredRoiAttributes(hoveredRoi)\n this.setState({\n isHoveredRoiTooltipVisible: true,\n hoveredRoi,\n hoveredRoiTooltipX: originalEvent.clientX,\n hoveredRoiTooltipY: originalEvent.clientY\n })\n } else {\n this.setState({\n isHoveredRoiTooltipVisible: false\n })\n }\n }\n\n onRoiSelected = (event: CustomEventInit): void => {\n const selectedRoi = event.detail.payload as dmv.roi.ROI\n if (selectedRoi != null) {\n console.debug(`selected ROI \"${selectedRoi.uid}\"`)\n this.volumeViewer.setROIStyle(selectedRoi.uid, this.selectedRoiStyle)\n const key = _getRoiKey(selectedRoi)\n this.volumeViewer.getAllROIs().forEach((roi) => {\n if (roi.uid !== selectedRoi.uid) {\n this.volumeViewer.setROIStyle(roi.uid, this.getRoiStyle(key))\n }\n })\n this.setState({\n selectedRoiUIDs: new Set([selectedRoi.uid]),\n selectedRoi: selectedRoi\n })\n } else {\n this.setState({\n selectedRoiUIDs: new Set(),\n selectedRoi: undefined\n })\n }\n }\n\n handleRoiSelectionCancellation (): void {\n this.setState({\n isSelectedRoiModalVisible: false\n })\n }\n\n onLoadingStarted = (event: CustomEventInit): void => {\n this.setState({ isLoading: true })\n }\n\n onLoadingEnded = (event: CustomEventInit): void => {\n this.setState({ isLoading: false })\n }\n\n onFrameLoadingStarted = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n } = event.detail.payload\n const key: string = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.add(key)\n return state\n })\n }\n\n onFrameLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load frame')\n }\n\n onLoadingError = (event: CustomEventInit): void => {\n console.error('Failed to load data')\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n const message = (event.detail?.payload?.message === null ? 'Failed to load data' : event.detail?.payload?.message) as string\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n message\n ) as any\n )\n }\n\n onFrameLoadingEnded = (event: CustomEventInit): void => {\n const frameInfo: {\n studyInstanceUID: string\n seriesInstanceUID: string\n sopInstanceUID: string\n sopClassUID: string\n frameNumber: string\n channelIdentifier: string\n pixelArray: Uint8Array|Uint16Array|Float32Array|null\n } = event.detail.payload\n const key = `${frameInfo.sopInstanceUID}-${frameInfo.frameNumber}`\n this.setState(state => {\n state.loadingFrames.delete(key)\n let isLoading: boolean = false\n if (state.loadingFrames.size > 0) {\n isLoading = true\n }\n return {\n isLoading,\n loadingFrames: state.loadingFrames\n }\n })\n if (\n frameInfo.sopClassUID === StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE &&\n this.props.slide.areVolumeImagesMonochrome\n ) {\n const opticalPathIdentifier = frameInfo.channelIdentifier\n if (\n !(opticalPathIdentifier in this.state.pixelDataStatistics) &&\n frameInfo.pixelArray != null\n ) {\n /*\n * There are limits on the number of arguments Math.min and Math.max\n * functions can accept. Therefore, we compute values in smaller chunks.\n */\n const size = 2 ** 16\n const chunks = Math.ceil(frameInfo.pixelArray.length / size)\n let offset = 0\n const minValues: number[] = []\n const maxValues: number[] = []\n for (let i = 0; i < chunks; i++) {\n offset = i * size\n const pixels = frameInfo.pixelArray.slice(offset, offset + size)\n minValues.push(Math.min(...pixels))\n maxValues.push(Math.max(...pixels))\n }\n const min = Math.min(...minValues)\n const max = Math.max(...maxValues)\n this.setState(state => {\n const stats = state.pixelDataStatistics\n if (stats[opticalPathIdentifier] != null) {\n stats[opticalPathIdentifier] = {\n min: Math.min(stats[opticalPathIdentifier].min, min),\n max: Math.max(stats[opticalPathIdentifier].max, max),\n numFramesSampled: stats[opticalPathIdentifier].numFramesSampled + 1\n }\n } else {\n stats[opticalPathIdentifier] = {\n min: min,\n max: max,\n numFramesSampled: 1\n }\n }\n if (state.selectedPresentationStateUID == null) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(opticalPathIdentifier)\n }\n style.limitValues = [\n stats[opticalPathIdentifier].min,\n stats[opticalPathIdentifier].max\n ]\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, style)\n }\n return state\n })\n }\n }\n }\n\n onRoiRemoved = (event: CustomEventInit): void => {\n const roi = event.detail.payload as dmv.roi.ROI\n console.debug(`removed ROI \"${roi.uid}\"`)\n }\n\n componentCleanup (): void {\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.removeEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.removeEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.removeEventListener('resize', this.onWindowResize)\n\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n /*\n * FIXME: React appears to not clean the content of referenced\n * HTMLDivElement objects when the page is reloaded. As a consequence,\n * optical paths and other display items cannot be toggled or updated after\n * a manual page reload. I have tried using ref callbacks and passing the\n * ref objects from the parent component via the props. Both didn't work\n * either.\n */\n }\n\n onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiModificationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.activateSelectInteraction({})\n } else if (this.state.isRoiTranslationActive) {\n console.info('deactivate modification of ROIs')\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.activateSelectInteraction({})\n }\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else if (event.altKey) {\n if (event.code === 'KeyD') {\n this.handleRoiDrawing()\n } else if (event.code === 'KeyM') {\n this.handleRoiModification()\n } else if (event.code === 'KeyT') {\n this.handleRoiTranslation()\n } else if (event.code === 'KeyR') {\n this.handleRoiRemoval()\n } else if (event.code === 'KeyV') {\n this.handleRoiVisibilityChange()\n } else if (event.code === 'KeyS') {\n this.handleReportGeneration()\n } else if (event.code === 'KeyG') {\n this.handleGoTo()\n }\n }\n }\n\n componentWillUnmount (): void {\n this.volumeViewer.cleanup()\n if (this.labelViewer != null) {\n this.labelViewer.cleanup()\n }\n window.removeEventListener('beforeunload', this.componentCleanup)\n }\n\n componentSetup (): void {\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_drawn',\n this.onRoiDrawn\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_selected',\n this.onRoiSelected\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_double_clicked',\n this.onRoiDoubleClicked\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_pointer_move',\n this.onPointerMove\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_removed',\n this.onRoiRemoved\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_roi_modified',\n this.onRoiModified\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_started',\n this.onLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_ended',\n this.onLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_loading_error',\n this.onLoadingError\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_started',\n this.onFrameLoadingStarted\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_ended',\n this.onFrameLoadingEnded\n )\n document.body.addEventListener(\n 'dicommicroscopyviewer_frame_loading_error',\n this.onFrameLoadingError\n )\n document.body.addEventListener(\n 'keyup',\n this.onKeyUp\n )\n window.addEventListener('beforeunload', this.componentCleanup)\n window.addEventListener('resize', this.onWindowResize)\n }\n\n componentDidMount (): void {\n this.componentSetup()\n this.populateViewports()\n\n if (!this.props.slide.areVolumeImagesMonochrome) {\n let hasICCProfile = false\n const image = this.props.slide.volumeImages[0]\n const metadataItem = image.OpticalPathSequence[0]\n if (metadataItem.ICCProfile == null) {\n if ('OpticalPathSequence' in image.bulkdataReferences) {\n // @ts-expect-error\n const bulkdataItem = image.bulkdataReferences.OpticalPathSequence[0]\n if ('ICCProfile' in bulkdataItem) {\n hasICCProfile = true\n }\n }\n } else {\n hasICCProfile = true\n }\n if (!hasICCProfile) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No ICC Profile was found for color images')\n }\n }\n }\n\n /**\n * Handler that gets called when a finding has been selected for annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationFindingSelection (\n value: string,\n option: any\n ): void {\n this.findingOptions.forEach(finding => {\n if (finding.CodeValue === value) {\n console.info(`selected finding \"${finding.CodeMeaning}\"`)\n this.setState({\n selectedFinding: finding,\n selectedEvaluations: []\n })\n }\n })\n }\n\n /**\n * Handler that gets called when a geometry type has been selected for\n * annotation.\n *\n * @param value - Code value of the coded finding that got selected\n * @param option - Option that got selected\n */\n handleAnnotationGeometryTypeSelection (value: string, option: any): void {\n this.setState({ selectedGeometryType: value })\n }\n\n /**\n * Handler that gets called when measurements have been selected for\n * annotation.\n */\n handleAnnotationMeasurementActivation (event: any): void {\n const active: boolean = event.target.checked\n if (active) {\n this.setState({ selectedMarkup: 'measurement' })\n } else {\n this.setState({ selectedMarkup: undefined })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been selected for an\n * annotation.\n *\n * @param value - Code value of the coded evaluation that got selected\n * @param option - Option that got selected\n */\n handleAnnotationEvaluationSelection (\n value: string,\n option: any\n ): void {\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n const name = option.label\n this.evaluationOptions[key].forEach(evaluation => {\n if (\n evaluation.name.CodeValue === name.CodeValue &&\n evaluation.name.CodingSchemeDesignator === name.CodingSchemeDesignator\n ) {\n evaluation.values.forEach(code => {\n if (code.CodeValue === value) {\n const filteredEvaluations = this.state.selectedEvaluations.filter(\n (item: Evaluation) => item.name !== evaluation.name\n )\n this.setState({\n selectedEvaluations: [\n ...filteredEvaluations,\n { name: name, value: code }\n ]\n })\n }\n })\n }\n })\n }\n }\n\n /**\n * Handler that gets called when an evaluation has been cleared for an\n * annotation.\n */\n handleAnnotationEvaluationClearance (): void {\n this.setState({\n selectedEvaluations: []\n })\n }\n\n handleXCoordinateSelection (value: any): void {\n if (value != null) {\n const x = Number(value)\n const start = this.state.validXCoordinateRange[0]\n const end = this.state.validXCoordinateRange[1]\n if (x >= start && x <= end) {\n this.setState({\n selectedXCoordinate: x,\n isSelectedXCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedXCoordinate: undefined,\n isSelectedXCoordinateValid: false\n })\n }\n\n handleYCoordinateSelection (value: any): void {\n if (value != null) {\n const y = Number(value)\n const start = this.state.validYCoordinateRange[0]\n const end = this.state.validYCoordinateRange[1]\n if (y >= start && y <= end) {\n this.setState({\n selectedYCoordinate: y,\n isSelectedYCoordinateValid: true\n })\n return\n }\n }\n this.setState({\n selectedYCoordinate: undefined,\n isSelectedYCoordinateValid: false\n })\n }\n\n handleMagnificationSelection (value: any): void {\n if (value != null) {\n if (value > 0 && value <= 40) {\n this.setState({\n selectedMagnification: Number(value),\n isSelectedMagnificationValid: true\n })\n return\n }\n }\n this.setState({\n selectedMagnification: undefined,\n isSelectedMagnificationValid: false\n })\n }\n\n /**\n * Handler that gets called when the selection of slide position was\n * completed.\n */\n handleSlidePositionSelection (): void {\n if (\n this.state.isSelectedXCoordinateValid &&\n this.state.isSelectedYCoordinateValid &&\n this.state.isSelectedMagnificationValid &&\n this.state.selectedXCoordinate != null &&\n this.state.selectedYCoordinate != null &&\n this.state.selectedMagnification != null\n ) {\n console.info(\n 'select slide position ' +\n `(${this.state.selectedXCoordinate}, ` +\n `${this.state.selectedYCoordinate}) ` +\n `at ${this.state.selectedMagnification}x magnification`\n )\n\n const factor = this.state.selectedMagnification\n /**\n * On an optical microscope an objective with 1x magnification\n * corresponds to approximately 10 micrometer pixel spacing\n * (due to the ocular).\n */\n const targetPixelSpacing = 0.01 / factor\n const diffs = []\n for (let i = 0; i < this.volumeViewer.numLevels; i++) {\n const actualPixelSpacing = this.volumeViewer.getPixelSpacing(i)[0]\n diffs.push(Math.abs(targetPixelSpacing - actualPixelSpacing))\n }\n const level = diffs.indexOf(Math.min(...diffs))\n this.volumeViewer.navigate({\n position: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate\n ],\n level: level\n })\n const point = new dmv.scoord3d.Point({\n coordinates: [\n this.state.selectedXCoordinate,\n this.state.selectedYCoordinate,\n 0\n ],\n frameOfReferenceUID: this.volumeViewer.frameOfReferenceUID\n })\n const roi = new dmv.roi.ROI({ scoord3d: point })\n this.volumeViewer.addROI(roi, this.defaultRoiStyle)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return {\n visibleRoiUIDs,\n isGoToModalVisible: false\n }\n })\n }\n }\n\n /**\n * Handler that gets called when the selection of a slide position was\n * canceled.\n */\n handleSlidePositionSelectionCancellation (): void {\n console.log('cancel slide position selection')\n this.setState({\n isGoToModalVisible: false,\n isSelectedXCoordinateValid: false,\n isSelectedYCoordinateValid: false,\n isSelectedMagnificationValid: false,\n selectedXCoordinate: undefined,\n selectedYCoordinate: undefined,\n selectedMagnification: undefined\n })\n }\n\n /**\n * Handler that gets called when annotation configuration has been completed.\n */\n handleAnnotationConfigurationCompletion (): void {\n console.debug('complete annotation configuration')\n const finding = this.state.selectedFinding\n const geometryType = this.state.selectedGeometryType\n const markup = this.state.selectedMarkup\n if (geometryType !== undefined && finding !== undefined) {\n this.volumeViewer.activateDrawInteraction({ geometryType, markup })\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: true\n })\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Could not complete annotation configuration'\n )\n )\n }\n }\n\n /**\n * Handler that gets called when annotation configuration has been cancelled.\n */\n handleAnnotationConfigurationCancellation (): void {\n console.debug('cancel annotation configuration')\n this.setState({\n isAnnotationModalVisible: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that gets called when a report should be generated for the current\n * set of annotations.\n */\n handleReportGeneration (): void {\n console.info('save ROIs')\n const rois = this.volumeViewer.getAllROIs()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n const metadata = this.volumeViewer.getOpticalPathMetadata(\n opticalPaths[0].identifier\n )\n // Metadata should be sorted such that the image with the highest\n // resolution is the last item in the array.\n const refImage = metadata[metadata.length - 1]\n // We assume that there is only one specimen (tissue section) per\n // ontainer (slide). Only the tissue section is tracked with a unique\n // identifier, even if the section may be composed of different biological\n // samples.\n if (refImage.SpecimenDescriptionSequence.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'More than one specimen has been described for the slide'\n )\n )\n }\n const refSpecimen = refImage.SpecimenDescriptionSequence[0]\n\n console.debug('create Observation Context')\n let observer\n if (this.props.user !== undefined) {\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: this.props.user.name,\n loginName: this.props.user.email\n })\n } else {\n console.warn('no user information available')\n observer = new dcmjs.sr.templates.PersonObserverIdentifyingAttributes({\n name: 'ANONYMOUS'\n })\n }\n const observationContext = new dcmjs.sr.templates.ObservationContext({\n observerPersonContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121006',\n schemeDesignator: 'DCM',\n meaning: 'Person'\n }),\n observerIdentifyingAttributes: observer\n }),\n observerDeviceContext: new dcmjs.sr.templates.ObserverContext({\n observerType: new dcmjs.sr.coding.CodedConcept({\n value: '121007',\n schemeDesignator: 'DCM',\n meaning: 'Device'\n }),\n observerIdentifyingAttributes:\n new dcmjs.sr.templates.DeviceObserverIdentifyingAttributes({\n uid: this.props.app.uid,\n manufacturerName: 'MGH Computational Pathology',\n modelName: this.props.app.name\n })\n }),\n subjectContext: new dcmjs.sr.templates.SubjectContext({\n subjectClass: new dcmjs.sr.coding.CodedConcept({\n value: '121027',\n schemeDesignator: 'DCM',\n meaning: 'Specimen'\n }),\n subjectClassSpecificContext:\n new dcmjs.sr.templates.SubjectContextSpecimen({\n uid: refSpecimen.SpecimenUID,\n identifier: refSpecimen.SpecimenIdentifier,\n containerIdentifier: refImage.ContainerIdentifier\n })\n })\n })\n\n console.debug('encode Imaging Measurements')\n const imagingMeasurements: dcmjs.sr.valueTypes.ContainerContentItem[] = []\n for (let i = 0; i < rois.length; i++) {\n const roi = rois[i]\n if (!this.state.visibleRoiUIDs.has(roi.uid)) {\n continue\n }\n let findingType = roi.evaluations.find(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue === '121071'\n }\n )\n if (findingType === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `No finding type was specified for ROI \"${roi.uid}\"`\n )\n )\n }\n findingType = findingType as dcmjs.sr.valueTypes.CodeContentItem\n const group = new dcmjs.sr.templates.PlanarROIMeasurementsAndQualitativeEvaluations({\n trackingIdentifier: new dcmjs.sr.templates.TrackingIdentifier({\n uid: roi.properties.trackingUID ?? roi.uid,\n identifier: `ROI #${i + 1}`\n }),\n referencedRegion: new dcmjs.sr.contentItems.ImageRegion3D({\n graphicType: roi.scoord3d.graphicType,\n graphicData: roi.scoord3d.graphicData,\n frameOfReferenceUID: roi.scoord3d.frameOfReferenceUID\n }),\n findingType: new dcmjs.sr.coding.CodedConcept({\n value: findingType.ConceptCodeSequence[0].CodeValue,\n schemeDesignator:\n findingType.ConceptCodeSequence[0].CodingSchemeDesignator,\n meaning: findingType.ConceptCodeSequence[0].CodeMeaning\n }),\n qualitativeEvaluations: roi.evaluations.filter(\n (item: dcmjs.sr.valueTypes.ContentItem) => {\n return item.ConceptNameCodeSequence[0].CodeValue !== '121071'\n }\n ),\n measurements: roi.measurements\n })\n const measurements = group as dcmjs.sr.valueTypes.ContainerContentItem[]\n measurements[0].ContentTemplateSequence = [{\n MappingResource: 'DCMR',\n TemplateIdentifier: '1410'\n }]\n imagingMeasurements.push(...measurements)\n }\n\n console.debug('create Measurement Report document content')\n const measurementReport = new dcmjs.sr.templates.MeasurementReport({\n languageOfContentItemAndDescendants: new dcmjs.sr.templates.LanguageOfContentItemAndDescendants({}),\n observationContext: observationContext,\n procedureReported: new dcmjs.sr.coding.CodedConcept({\n value: '112703',\n schemeDesignator: 'DCM',\n meaning: 'Whole Slide Imaging'\n }),\n imagingMeasurements: imagingMeasurements\n })\n\n console.info('create Comprehensive 3D SR document')\n const dataset = new dcmjs.sr.documents.Comprehensive3DSR({\n content: measurementReport[0],\n evidence: [refImage],\n seriesInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n seriesNumber: 1,\n seriesDescription: 'Annotation',\n sopInstanceUID: dcmjs.data.DicomMetaDictionary.uid(),\n instanceNumber: 1,\n manufacturer: 'MGH Computational Pathology',\n previousVersions: undefined // TODO\n })\n\n this.setState({\n isReportModalVisible: true,\n generatedReport: dataset as dmv.metadata.Comprehensive3DSR\n })\n }\n\n /**\n * Handler that gets called when a report should be verified. The current\n * list of annotations will be presented to the user together with other\n * pertinent metadata about the patient, study, and specimen.\n */\n handleReportVerification (): void {\n console.info('verfied report')\n\n const report = this.state.generatedReport\n if (report !== undefined) {\n const dataset = report as unknown as dmv.metadata.Comprehensive3DSR\n console.debug('create File Meta Information')\n const fileMetaInformationVersionArray = new Uint8Array(2)\n fileMetaInformationVersionArray[1] = 1\n const fileMeta = {\n // FileMetaInformationVersion\n '00020001': {\n Value: [fileMetaInformationVersionArray.buffer],\n vr: 'OB'\n },\n // MediaStorageSOPClassUID\n '00020002': {\n Value: [dataset.SOPClassUID],\n vr: 'UI'\n },\n // MediaStorageSOPInstanceUID\n '00020003': {\n Value: [dataset.SOPInstanceUID],\n vr: 'UI'\n },\n // TransferSyntaxUID\n '00020010': {\n Value: ['1.2.840.10008.1.2.1'],\n vr: 'UI'\n },\n // ImplementationClassUID\n '00020012': {\n Value: [this.props.app.uid],\n vr: 'UI'\n }\n }\n\n console.info('store Comprehensive 3D SR document')\n const writer = new dcmjs.data.DicomDict(fileMeta)\n writer.dict = dcmjs.data.DicomMetaDictionary.denaturalizeDataset(dataset)\n const buffer = writer.write()\n const client = this.props.clients[StorageClasses.COMPREHENSIVE_3D_SR]\n client.storeInstances({ datasets: [buffer] }).then(\n (response: any) => message.info('Annotations were saved.')\n ).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Annotations could not be saved'\n )\n )\n })\n }\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when report generation has been cancelled.\n */\n handleReportCancellation (): void {\n this.setState({\n isReportModalVisible: false,\n generatedReport: undefined\n })\n }\n\n /**\n * Handler that gets called when an annotation has been selected from the\n * current list of annotations.\n */\n handleAnnotationSelection ({ roiUID }: { roiUID: string }): void {\n console.log(`selected ROI ${roiUID}`)\n this.setState({ selectedRoiUIDs: new Set([roiUID]) })\n this.volumeViewer.getAllROIs().forEach((roi) => {\n let style = {}\n if (roi.uid === roiUID) {\n style = this.selectedRoiStyle\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n if (this.state.visibleRoiUIDs.has(roi.uid)) {\n const key = _getRoiKey(roi)\n style = this.getRoiStyle(key)\n }\n }\n this.volumeViewer.setROIStyle(roi.uid, style)\n })\n }\n\n /**\n * Handle toggling of annotation visibility, i.e., whether a given\n * annotation should be either displayed or hidden by the viewer.\n */\n handleAnnotationVisibilityChange ({ roiUID, isVisible }: {\n roiUID: string\n isVisible: boolean\n }): void {\n if (isVisible) {\n console.info(`show ROI ${roiUID}`)\n const roi = this.volumeViewer.getROI(roiUID)\n const key = _getRoiKey(roi)\n const style = this.getRoiStyle(key)\n this.volumeViewer.setROIStyle(roi.uid, style)\n this.setState(state => {\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.add(roi.uid)\n return { visibleRoiUIDs }\n })\n } else {\n console.info(`hide ROI ${roiUID}`)\n this.setState(state => {\n const selectedRoiUIDs = state.selectedRoiUIDs\n selectedRoiUIDs.delete(roiUID)\n const visibleRoiUIDs = state.visibleRoiUIDs\n visibleRoiUIDs.delete(roiUID)\n return { visibleRoiUIDs, selectedRoiUIDs }\n })\n this.volumeViewer.setROIStyle(roiUID, {})\n }\n }\n\n /**\n * Handle toggling of annotation group visibility, i.e., whether a given\n * annotation group should be either displayed or hidden by the viewer.\n */\n handleAnnotationGroupVisibilityChange ({ annotationGroupUID, isVisible }: {\n annotationGroupUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of annotation group ${annotationGroupUID}`)\n if (isVisible) {\n console.info(`show annotation group ${annotationGroupUID}`)\n try {\n this.volumeViewer.showAnnotationGroup(annotationGroupUID)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to show annotation group.'\n )\n )\n throw error\n }\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.add(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n } else {\n console.info(`hide annotation group ${annotationGroupUID}`)\n this.volumeViewer.hideAnnotationGroup(annotationGroupUID)\n this.setState(state => {\n const visibleAnnotationGroupUIDs = new Set(\n state.visibleAnnotationGroupUIDs\n )\n visibleAnnotationGroupUIDs.delete(annotationGroupUID)\n return { visibleAnnotationGroupUIDs }\n })\n }\n }\n\n /**\n * Handle change of annotation group style.\n */\n handleAnnotationGroupStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity?: number\n color?: number[]\n measurement?: dcmjs.sr.coding.CodedConcept\n }\n }): void {\n console.log(`change style of annotation group ${uid}`)\n try {\n this.volumeViewer.setAnnotationGroupStyle(\n uid,\n styleOptions\n )\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of annotation group.'\n )\n )\n throw error\n }\n }\n\n generateRoiStyle (\n styleOptions: {\n opacity?: number\n color?: number[]\n }): dmv.viewer.ROIStyleOptions {\n const opacity = styleOptions.opacity ?? DEFAULT_ANNOTATION_OPACITY\n const strokeColor = styleOptions.color ?? DEFAULT_ANNOTATION_STROKE_COLOR\n const fillColor = strokeColor.map((c) => Math.min(c + 25, 255))\n const style = _formatRoiStyle({\n fill: { color: [...fillColor, opacity] },\n stroke: { color: [...strokeColor, opacity] },\n radius: this.defaultRoiStyle.stroke?.width\n })\n return style\n }\n\n handleRoiStyleChange ({ uid, styleOptions }: {\n uid: string\n styleOptions: {\n opacity: number\n color: number[]\n }\n }): void {\n console.log(`change style of ROI ${uid}`)\n try {\n this.defaultAnnotationStyles[uid] = styleOptions\n const style = this.generateRoiStyle(styleOptions)\n\n const roi = this.volumeViewer.getROI(uid)\n const key = _getRoiKey(roi) as string\n this.roiStyles[key] = style\n this.volumeViewer.setROIStyle(uid, style)\n this.state.visibleRoiUIDs.add(uid)\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Failed to change style of ROI.'\n )\n )\n throw error\n }\n }\n\n /**\n * Handle toggling of segment visibility, i.e., whether a given\n * segment should be either displayed or hidden by the viewer.\n */\n handleSegmentVisibilityChange ({ segmentUID, isVisible }: {\n segmentUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of segment ${segmentUID}`)\n if (isVisible) {\n console.info(`show segment ${segmentUID}`)\n this.volumeViewer.showSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.add(segmentUID)\n return { visibleSegmentUIDs }\n })\n } else {\n console.info(`hide segment ${segmentUID}`)\n this.volumeViewer.hideSegment(segmentUID)\n this.setState(state => {\n const visibleSegmentUIDs = new Set(state.visibleSegmentUIDs)\n visibleSegmentUIDs.delete(segmentUID)\n return { visibleSegmentUIDs }\n })\n }\n }\n\n /**\n * Handle change of segment style.\n */\n handleSegmentStyleChange ({ segmentUID, styleOptions }: {\n segmentUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of segment ${segmentUID}`)\n this.volumeViewer.setSegmentStyle(segmentUID, styleOptions)\n }\n\n /**\n * Handle toggling of mapping visibility, i.e., whether a given\n * mapping should be either displayed or hidden by the viewer.\n */\n handleMappingVisibilityChange ({ mappingUID, isVisible }: {\n mappingUID: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of mapping ${mappingUID}`)\n if (isVisible) {\n console.info(`show mapping ${mappingUID}`)\n this.volumeViewer.showParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.add(mappingUID)\n return { visibleMappingUIDs }\n })\n } else {\n console.info(`hide mapping ${mappingUID}`)\n this.volumeViewer.hideParameterMapping(mappingUID)\n this.setState(state => {\n const visibleMappingUIDs = new Set(state.visibleMappingUIDs)\n visibleMappingUIDs.delete(mappingUID)\n return { visibleMappingUIDs }\n })\n }\n }\n\n /**\n * Handle change of mapping style.\n */\n handleMappingStyleChange ({ mappingUID, styleOptions }: {\n mappingUID: string\n styleOptions: {\n opacity?: number\n }\n }): void {\n console.log(`change style of mapping ${mappingUID}`)\n this.volumeViewer.setParameterMappingStyle(mappingUID, styleOptions)\n }\n\n /**\n * Handle toggling of optical path visibility, i.e., whether a given\n * optical path should be either displayed or hidden by the viewer.\n */\n handleOpticalPathVisibilityChange ({ opticalPathIdentifier, isVisible }: {\n opticalPathIdentifier: string\n isVisible: boolean\n }): void {\n console.log(`change visibility of optical path ${opticalPathIdentifier}`)\n if (isVisible) {\n console.info(`show optical path ${opticalPathIdentifier}`)\n this.volumeViewer.showOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n } else {\n console.info(`hide optical path ${opticalPathIdentifier}`)\n this.volumeViewer.hideOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const visibleOpticalPathIdentifiers = new Set(\n state.visibleOpticalPathIdentifiers\n )\n visibleOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { visibleOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Handle change of optical path style.\n */\n handleOpticalPathStyleChange ({ opticalPathIdentifier, styleOptions }: {\n opticalPathIdentifier: string\n styleOptions: {\n opacity?: number\n color?: number[]\n limitValues?: number[]\n }\n }): void {\n console.log(`change style of optical path ${opticalPathIdentifier}`)\n this.volumeViewer.setOpticalPathStyle(opticalPathIdentifier, styleOptions)\n }\n\n /**\n * Handle toggling of optical path activity, i.e., whether a given\n * optical path should be either added or removed from the viewport.\n */\n handleOpticalPathActivityChange ({ opticalPathIdentifier, isActive }: {\n opticalPathIdentifier: string\n isActive: boolean\n }): void {\n console.log(`change activity of optical path ${opticalPathIdentifier}`)\n if (isActive) {\n console.info(`activate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.activateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.add(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n } else {\n console.info(`deactivate optical path ${opticalPathIdentifier}`)\n this.volumeViewer.deactivateOpticalPath(opticalPathIdentifier)\n this.setState(state => {\n const activeOpticalPathIdentifiers = new Set(\n state.activeOpticalPathIdentifiers\n )\n activeOpticalPathIdentifiers.delete(opticalPathIdentifier)\n return { activeOpticalPathIdentifiers }\n })\n }\n }\n\n /**\n * Set default presentation state that is either defined by metadata included\n * in the DICOM Slide Microscopy instance or by the viewer.\n */\n setDefaultPresentationState (): void {\n const visibleOpticalPathIdentifiers: Set = new Set()\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n const style = this.volumeViewer.getOpticalPathDefaultStyle(identifier)\n this.volumeViewer.setOpticalPathStyle(identifier, style)\n this.volumeViewer.hideOpticalPath(identifier)\n this.volumeViewer.deactivateOpticalPath(identifier)\n if (item.isMonochromatic) {\n /*\n * If the image metadata contains a palette color lookup table for the\n * optical path, then it will be displayed by default.\n */\n if (item.paletteColorLookupTableUID != null) {\n visibleOpticalPathIdentifiers.add(identifier)\n }\n } else {\n /* Color images will always be displayed by default. */\n visibleOpticalPathIdentifiers.add(identifier)\n }\n })\n\n /*\n * If no optical paths have been selected for visualization so far, select\n * first n optical paths and set a default value of interest (VOI) window\n * (using pre-computed pixel data statistics) and a default color.\n */\n if (visibleOpticalPathIdentifiers.size === 0) {\n const defaultColors = [\n [255, 255, 255]\n ]\n opticalPaths.forEach((item: dmv.opticalPath.OpticalPath) => {\n const identifier = item.identifier\n if (item.isMonochromatic) {\n const numVisible = visibleOpticalPathIdentifiers.size\n if (numVisible < defaultColors.length) {\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n const index = numVisible\n style.color = defaultColors[index]\n const stats = this.state.pixelDataStatistics[item.identifier]\n if (stats != null) {\n style.limitValues = [stats.min, stats.max]\n }\n this.volumeViewer.setOpticalPathStyle(item.identifier, style)\n visibleOpticalPathIdentifiers.add(item.identifier)\n }\n }\n })\n }\n\n console.info(\n `selected n=${visibleOpticalPathIdentifiers.size} optical paths ` +\n 'for visualization'\n )\n visibleOpticalPathIdentifiers.forEach(identifier => {\n this.volumeViewer.showOpticalPath(identifier)\n })\n this.setState(state => ({\n activeOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers),\n visibleOpticalPathIdentifiers: new Set(visibleOpticalPathIdentifiers)\n }))\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateReset (): void {\n this.setState({ selectedPresentationStateUID: undefined })\n const urlPath = this.props.location.pathname\n this.props.navigate(urlPath)\n this.setDefaultPresentationState()\n }\n\n /**\n * Handler that gets called when a presentation state has been selected from\n * the current list of available presentation states.\n */\n handlePresentationStateSelection (\n value?: string,\n option?: any\n ): void {\n if (value != null) {\n console.info(`select Presentation State instance \"${value}\"`)\n let presentationState\n this.state.presentationStates.forEach(instance => {\n if (instance.SOPInstanceUID === value) {\n presentationState = instance\n }\n })\n if (presentationState != null) {\n let urlPath = this.props.location.pathname\n urlPath += `?state=${value}`\n this.props.navigate(urlPath)\n this.setPresentationState(presentationState)\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.VISUALIZATION,\n 'Presentation State could not be found'\n )\n )\n console.log(\n 'failed to handle section of presentation state: ' +\n `could not find instance \"${value}\"`\n )\n }\n } else {\n this.handlePresentationStateReset()\n }\n this.setState({ selectedPresentationStateUID: value })\n }\n\n /**\n * Handler that will toggle the ROI drawing tool, i.e., either activate or\n * de-activate it, depending on its current state.\n */\n handleRoiDrawing (): void {\n if (this.state.isRoiDrawingActive) {\n console.info('deactivate drawing of ROIs')\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isGoToModalVisible: false\n })\n } else {\n console.info('activate drawing of ROIs')\n this.setState({\n isAnnotationModalVisible: true,\n isSelectedRoiModalVisible: false,\n isRoiDrawingActive: true,\n isRoiModificationActive: false,\n isRoiTranslationActive: false,\n isGoToModalVisible: false\n })\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n }\n }\n\n /**\n * Handler that will toggle the ROI modification tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiModification (): void {\n console.info('toggle modification of ROIs')\n if (this.volumeViewer.isModifyInteractionActive) {\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.activateSelectInteraction({})\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiModificationActive: true,\n isRoiDrawingActive: false,\n isRoiTranslationActive: false\n })\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateSnapInteraction({})\n this.volumeViewer.activateModifyInteraction({})\n }\n }\n\n /**\n * Handler that will toggle the ROI translation tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiTranslation (): void {\n console.info('toggle translation of ROIs')\n if (this.volumeViewer.isTranslateInteractionActive) {\n this.volumeViewer.deactivateTranslateInteraction()\n this.setState({\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.setState({\n isRoiTranslationActive: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.activateTranslateInteraction({})\n }\n }\n\n handleGoTo (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.setState({\n isGoToModalVisible: true,\n isAnnotationModalVisible: false,\n isSelectedRoiModalVisible: false,\n isReportModalVisible: false,\n isRoiTranslationActive: false,\n isRoiModificationActive: false,\n isRoiDrawingActive: false\n })\n }\n\n /**\n * Handler that will toggle the ROI removal tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiRemoval (): void {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n if (this.state.selectedRoiUIDs.size > 0) {\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.warning('No annotation was selected for removal')\n return\n }\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n message.info('Annotation was removed')\n })\n this.setState({\n selectedRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n } else {\n this.state.visibleRoiUIDs.forEach(uid => {\n console.info(`remove ROI \"${uid}\"`)\n this.volumeViewer.removeROI(uid)\n })\n this.setState({\n visibleRoiUIDs: new Set(),\n isRoiTranslationActive: false,\n isRoiDrawingActive: false,\n isRoiModificationActive: false\n })\n }\n this.volumeViewer.activateSelectInteraction({})\n }\n\n /**\n * Handler that will toggle the ROI visibility tool, i.e., either activate\n * or de-activate it, depending on its current state.\n */\n handleRoiVisibilityChange (): void {\n console.info('toggle visibility of ROIs')\n if (this.volumeViewer.areROIsVisible) {\n this.volumeViewer.deactivateDrawInteraction()\n this.volumeViewer.deactivateSnapInteraction()\n this.volumeViewer.deactivateTranslateInteraction()\n this.volumeViewer.deactivateSelectInteraction()\n this.volumeViewer.deactivateModifyInteraction()\n this.volumeViewer.hideROIs()\n this.setState({\n areRoisHidden: true,\n isRoiDrawingActive: false,\n isRoiModificationActive: false,\n isRoiTranslationActive: false\n })\n } else {\n this.volumeViewer.showROIs()\n this.volumeViewer.activateSelectInteraction({})\n this.state.selectedRoiUIDs.forEach(uid => {\n if (uid !== undefined) {\n this.volumeViewer.setROIStyle(uid, this.selectedRoiStyle)\n }\n })\n this.setState({ areRoisHidden: false })\n }\n }\n\n render (): React.ReactNode {\n const rois: dmv.roi.ROI[] = []\n const segments: dmv.segment.Segment[] = []\n const mappings: dmv.mapping.ParameterMapping[] = []\n const annotationGroups: dmv.annotation.AnnotationGroup[] = []\n rois.push(...this.volumeViewer.getAllROIs())\n segments.push(...this.volumeViewer.getAllSegments())\n mappings.push(...this.volumeViewer.getAllParameterMappings())\n const allAnnotationGroups = this.volumeViewer.getAllAnnotationGroups()\n const filteredAnnotationGroups = allAnnotationGroups?.filter((annotationGroup) =>\n annotationGroup.referencedSeriesInstanceUID === this.props.seriesInstanceUID\n )\n annotationGroups.push(...filteredAnnotationGroups)\n\n const annotations = rois.map(roi => adaptRoiToAnnotation(roi))\n\n const openSubMenuItems = [\n 'specimens', 'optical-paths', 'annotations', 'presentation-states'\n ]\n\n let report: React.ReactNode\n const dataset = this.state.generatedReport\n if (dataset !== undefined) {\n report = \n }\n\n let annotationMenuItems: React.ReactNode\n if (rois.length > 0) {\n annotationMenuItems = (\n \n )\n }\n\n const findingOptions = this.findingOptions.map(finding => {\n return (\n \n {finding.CodeMeaning}\n \n )\n })\n\n const geometryTypeOptionsMapping: { [key: string]: React.ReactNode } = {\n point: Point,\n circle: Circle,\n box: Box,\n polygon: Polygon,\n line: Line,\n freehandpolygon: (\n \n Polygon (freehand)\n \n ),\n freehandline: (\n \n Line (freehand)\n \n )\n }\n\n const annotationConfigurations: React.ReactNode[] = [\n (\n \n {findingOptions}\n \n )\n ]\n\n const selectedFinding = this.state.selectedFinding\n if (selectedFinding !== undefined) {\n const key = _buildKey(selectedFinding)\n this.evaluationOptions[key].forEach(evaluation => {\n const evaluationOptions = evaluation.values.map(code => {\n return (\n \n {code.CodeMeaning}\n \n )\n })\n annotationConfigurations.push(\n <>\n {evaluation.name.CodeMeaning}\n \n {evaluationOptions}\n \n \n )\n })\n const geometryTypeOptions = this.geometryTypeOptions[key].map(name => {\n return geometryTypeOptionsMapping[name]\n })\n annotationConfigurations.push(\n <>\n ROI geometry type\n \n {geometryTypeOptions}\n \n \n )\n annotationConfigurations.push(\n \n measure\n \n )\n }\n\n const specimenMenu = (\n \n \n \n )\n\n const equipmentMenu = (\n \n \n \n )\n\n const opticalPaths = this.volumeViewer.getAllOpticalPaths()\n opticalPaths.sort((a, b) => {\n if (a.identifier.localeCompare(b.identifier) === 1) {\n return 1\n } else if (b.identifier.localeCompare(a.identifier) === 1) {\n return -1\n }\n return 0\n })\n const opticalPathStyles: {\n [identifier: string]: {\n opacity: number\n color?: number[]\n limitValues?: number[]\n paletteColorLookupTable?: dmv.color.PaletteColorLookupTable\n }\n } = {}\n const opticalPathMetadata: {\n [identifier: string]: dmv.metadata.VLWholeSlideMicroscopyImage[]\n } = {}\n opticalPaths.forEach(opticalPath => {\n const identifier = opticalPath.identifier\n const metadata = this.volumeViewer.getOpticalPathMetadata(identifier)\n opticalPathMetadata[identifier] = metadata\n const style = {\n ...this.volumeViewer.getOpticalPathStyle(identifier)\n }\n opticalPathStyles[identifier] = style\n })\n const opticalPathMenu = (\n \n \n \n )\n\n let presentationStateMenu\n if (this.state.presentationStates.length > 0) {\n const presentationStateOptions = []\n this.state.presentationStates.forEach(instance => {\n presentationStateOptions.push(\n \n {instance.ContentDescription}\n \n )\n })\n presentationStateOptions.push(\n \n <>\n \n )\n presentationStateMenu = (\n \n \n \n {presentationStateOptions}\n \n \n }\n type='primary'\n onClick={this.handlePresentationStateReset}\n />\n \n \n \n )\n }\n\n let segmentationMenu\n if (segments.length > 0) {\n const defaultSegmentStyles: {\n [segmentUID: string]: {\n opacity: number\n }\n } = {}\n const segmentMetadata: {\n [segmentUID: string]: dmv.metadata.Segmentation[]\n } = {}\n const segments = this.volumeViewer.getAllSegments()\n segments.forEach(segment => {\n defaultSegmentStyles[segment.uid] = this.volumeViewer.getSegmentStyle(\n segment.uid\n )\n segmentMetadata[segment.uid] = this.volumeViewer.getSegmentMetadata(\n segment.uid\n )\n })\n segmentationMenu = (\n \n \n \n )\n openSubMenuItems.push('segmentations')\n }\n\n let parametricMapMenu\n if (mappings.length > 0) {\n const defaultMappingStyles: {\n [mappingUID: string]: {\n opacity: number\n }\n } = {}\n const mappingMetadata: {\n [mappingUID: string]: dmv.metadata.ParametricMap[]\n } = {}\n mappings.forEach(mapping => {\n defaultMappingStyles[mapping.uid] = this.volumeViewer.getParameterMappingStyle(\n mapping.uid\n )\n mappingMetadata[mapping.uid] = this.volumeViewer.getParameterMappingMetadata(\n mapping.uid\n )\n })\n parametricMapMenu = (\n \n \n \n )\n openSubMenuItems.push('parametric-maps')\n }\n\n let annotationGroupMenu\n\n if (annotations.length > 0) {\n annotations.forEach((annotation) => {\n const roi = this.volumeViewer.getROI(annotation.uid)\n const key = _getRoiKey(roi) as string\n const color = this.roiStyles[key] !== undefined\n ? this.roiStyles[key].stroke?.color.slice(0, 3)\n : DEFAULT_ANNOTATION_COLOR_PALETTE[\n Object.keys(this.roiStyles).length % DEFAULT_ANNOTATION_COLOR_PALETTE.length\n ]\n this.defaultAnnotationStyles[annotation.uid] = {\n color,\n opacity: DEFAULT_ANNOTATION_OPACITY\n } as any\n\n this.roiStyles[key] = this.generateRoiStyle(\n this.defaultAnnotationStyles[annotation.uid]\n )\n })\n }\n\n if (annotationGroups.length > 0) {\n const annotationGroupMetadata: {\n [annotationGroupUID: string]: dmv.metadata.MicroscopyBulkSimpleAnnotations\n } = {}\n const defaultAnnotationGroupStyles: {\n [annotationUID: string]: {\n opacity: number\n color: number[]\n }\n } = {}\n annotationGroups.forEach(annotationGroup => {\n defaultAnnotationGroupStyles[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupStyle(\n annotationGroup.uid\n )\n annotationGroupMetadata[annotationGroup.uid] = this.volumeViewer.getAnnotationGroupMetadata(\n annotationGroup.uid\n )\n })\n annotationGroupMenu = (\n \n \n \n )\n openSubMenuItems.push('annotationGroups')\n }\n\n let toolbar\n let toolbarHeight = '0px'\n const annotationTools = [\n ,\n ,\n ,\n ,\n ,\n \n ]\n const controlTools = [\n \n ]\n if (this.props.enableAnnotationTools) {\n toolbar = (\n \n {annotationTools.map((item, i) => {\n return {item}\n })}\n {controlTools.map((item, i) => {\n return {item}\n })}\n \n )\n toolbarHeight = '50px'\n }\n\n let cursor = 'default'\n if (this.state.isLoading) {\n cursor = 'progress'\n }\n\n let selectedRoiInformation\n if (this.state.selectedRoi != null) {\n const roiAttributes: Array<{\n name: string\n value: string\n unit?: string\n }> = [\n {\n name: 'UID',\n value: this.state.selectedRoi.uid\n }\n ]\n const roiScoordAttributes: Array<{\n name: string\n value: string\n }> = [\n {\n name: 'Graphic type',\n value: this.state.selectedRoi.scoord3d.graphicType\n }\n ]\n const roiEvaluationAttributes: Array<{\n name: string\n value: string\n }> = []\n this.state.selectedRoi.evaluations.forEach(item => {\n if (item.ValueType === 'CODE') {\n const codeItem = item as dcmjs.sr.valueTypes.CodeContentItem\n roiEvaluationAttributes.push({\n name: codeItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: codeItem.ConceptCodeSequence[0].CodeMeaning\n })\n } else {\n const textItem = item as dcmjs.sr.valueTypes.TextContentItem\n roiEvaluationAttributes.push({\n name: textItem.ConceptNameCodeSequence[0].CodeMeaning,\n value: textItem.TextValue\n })\n }\n })\n const roiMeasurmentAttributesPerOpticalPath: {\n [identifier: string]: Array<{\n name: string\n value: string\n unit?: string\n }>\n } = {}\n this.state.selectedRoi.measurements.forEach(item => {\n let identifier = 'default'\n if (item.ContentSequence != null) {\n const refItems = findContentItemsByName({\n content: item.ContentSequence,\n name: new dcmjs.sr.coding.CodedConcept({\n value: '121112',\n meaning: 'Source of Measurement',\n schemeDesignator: 'DCM'\n })\n })\n if (refItems.length > 0) {\n identifier = (\n refItems[0]\n // @ts-expect-error\n .ReferencedSOPSequence[0]\n .ReferencedOpticalPathIdentifier\n )\n }\n }\n if (!(identifier in roiMeasurmentAttributesPerOpticalPath)) {\n roiMeasurmentAttributesPerOpticalPath[identifier] = []\n }\n const measuredValueItem = item.MeasuredValueSequence[0]\n roiMeasurmentAttributesPerOpticalPath[identifier].push({\n name: item.ConceptNameCodeSequence[0].CodeMeaning,\n value: measuredValueItem.NumericValue.toString(),\n unit: measuredValueItem.MeasurementUnitsCodeSequence[0].CodeMeaning\n })\n })\n const createRoiDescription = (\n attributes: Array<{ name: string, value: string, unit?: string }>\n ): React.ReactNode[] => {\n return attributes.map(item => {\n let value\n if (item.unit != null) {\n value = `${item.value} [${item.unit}]`\n } else {\n value = item.value\n }\n return (\n \n {value}\n \n )\n })\n }\n const roiDescriptions = createRoiDescription(roiAttributes)\n const roiScoordDescriptions = createRoiDescription(\n roiScoordAttributes\n )\n const roiEvaluationDescriptions = createRoiDescription(\n roiEvaluationAttributes\n )\n const roiMeasurementDescriptions = []\n for (const identifier in roiMeasurmentAttributesPerOpticalPath) {\n const descriptions = createRoiDescription(\n roiMeasurmentAttributesPerOpticalPath[identifier]\n )\n if (identifier === 'default') {\n roiMeasurementDescriptions.push(descriptions)\n } else {\n roiMeasurementDescriptions.push(\n <>\n \n {identifier}\n \n {descriptions}\n \n )\n }\n }\n selectedRoiInformation = (\n <>\n \n {roiDescriptions}\n \n \n Spatial coordinates\n \n \n {roiScoordDescriptions}\n \n \n Evaluations\n \n \n {roiEvaluationDescriptions}\n \n \n Measurements\n \n \n {roiMeasurementDescriptions}\n \n \n )\n }\n\n return (\n \n \n {toolbar}\n\n \n\n \n \n {annotationConfigurations}\n \n \n\n \n \n {selectedRoiInformation}\n \n \n\n \n \n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n )\n : (\n \n )\n }\n />\n \n \n\n \n {report}\n \n \n\n \n {\n // Give menu item time to render before updating viewer size\n setTimeout(() => {\n if (this.labelViewer != null) {\n this.labelViewer.resize()\n }\n }, 100)\n }}\n >\n {this.labelViewportRef.current != null && (\n \n \n \n \n \n )}\n {specimenMenu}\n {equipmentMenu}\n {opticalPathMenu}\n {presentationStateMenu}\n \n {annotationMenuItems}\n \n {annotationGroupMenu}\n {annotations.length === 0\n ? (\n <>\n )\n : (\n \n \n \n )}\n {segmentationMenu}\n {parametricMapMenu}\n \n \n {this.state.isHoveredRoiTooltipVisible &&\n this.state.hoveredRoiAttributes.length > 0\n ? (\n \n )\n : (\n <>\n )}\n \n )\n }\n}\n\nexport default withRouter(SlideViewer)\n","import * as dmv from 'dicom-microscopy-viewer'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from '../services/NotificationMiddleware'\n\nenum ImageFlavors {\n VOLUME = 'VOLUME',\n LABEL = 'LABEL',\n OVERVIEW = 'OVERVIEW',\n THUMBNAIL = 'THUMBNAIL'\n}\n\nconst hasImageFlavor = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n imageFlavor: ImageFlavors\n): boolean => {\n return image.ImageType[2] === imageFlavor\n}\n\nconst areSameAcquisition = (\n image: dmv.metadata.VLWholeSlideMicroscopyImage,\n refImage: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean => {\n if (image.AcquisitionUID != null) {\n return image.AcquisitionUID === refImage.AcquisitionUID\n }\n return false\n}\n\ninterface SlideImageCollection {\n acquisitionUID?: string\n frameOfReferenceUID: string\n containerIdentifier: string\n volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n}\n\ninterface SlideOptions {\n images: dmv.metadata.VLWholeSlideMicroscopyImage[]\n description?: string\n}\n\n/**\n * Slide - collection of images with the same Frame of Reference UID and\n * Container Identifier.\n */\nclass Slide {\n readonly description: string\n readonly acquisitionUID: string | null | undefined\n readonly frameOfReferenceUID: string\n readonly containerIdentifier: string\n readonly seriesInstanceUIDs: string[]\n readonly opticalPathIdentifiers: string[]\n readonly pyramidUIDs: string[] = []\n readonly areVolumeImagesMonochrome: boolean\n readonly volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n readonly overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n\n /**\n * @param options\n * @param options.images - Metadata of images associated with the slide\n * @param options.description - Description of the slide\n */\n constructor (\n options: SlideOptions\n ) {\n if (options.images.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Value of option \"images\" have been non-zero length.'\n )\n )\n }\n\n const seriesInstanceUIDs = new Set([] as string[])\n const acquisitionUIDs = new Set([] as string[])\n const opticalPathIdentifiers = new Set([] as string[])\n const containerIdentifiers = new Set([] as string[])\n const frameOfReferenceUIDs = {\n VOLUME: new Set([] as string[]),\n LABEL: new Set([] as string[]),\n OVERVIEW: new Set([] as string[])\n }\n const pyramidUIDs: {\n [key: string]: { [opticalPathIdentifier: string]: Set }\n } = {\n VOLUME: {}\n }\n const volumeImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const labelImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n const overviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n options.images.forEach((image) => {\n containerIdentifiers.add(image.ContainerIdentifier)\n seriesInstanceUIDs.add(image.SeriesInstanceUID)\n image.OpticalPathSequence.forEach(item => {\n opticalPathIdentifiers.add(item.OpticalPathIdentifier)\n })\n if (image.AcquisitionUID != null) {\n acquisitionUIDs.add(image.AcquisitionUID)\n }\n if (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n ) {\n frameOfReferenceUIDs.VOLUME.add(image.FrameOfReferenceUID)\n if (image.PyramidUID != null) {\n for (const identifier in opticalPathIdentifiers) {\n pyramidUIDs.VOLUME[identifier].add(image.PyramidUID)\n }\n }\n volumeImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.LABEL)) {\n frameOfReferenceUIDs.LABEL.add(image.FrameOfReferenceUID)\n labelImages.push(image)\n } else if (hasImageFlavor(image, ImageFlavors.OVERVIEW)) {\n frameOfReferenceUIDs.OVERVIEW.add(image.FrameOfReferenceUID)\n overviewImages.push(image)\n }\n })\n if (volumeImages.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'At least one VOLUME image must be provided for a slide.'\n )\n )\n } else {\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const samplesPerPixel = new Set([] as number[])\n volumeImages.forEach((image) => {\n samplesPerPixel.add(image.SamplesPerPixel)\n })\n if (samplesPerPixel.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have the same number of ' +\n 'Samples per Pixel.'\n )\n )\n }\n const isNotResampled = volumeImages.filter(image => {\n return image.ImageType[3] !== 'RESAMPLED'\n })\n if (isNotResampled.length > opticalPathIdentifiers.size) {\n console.warn(\n 'the set of VOLUME images of a slide must contain only a single ' +\n 'image that has not been resampled per optical path'\n )\n }\n }\n this.volumeImages = volumeImages\n this.labelImages = labelImages\n this.overviewImages = overviewImages\n\n this.seriesInstanceUIDs = [...seriesInstanceUIDs]\n this.opticalPathIdentifiers = [...opticalPathIdentifiers]\n\n if (containerIdentifiers.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All images of a slide must have the same Container Identifier.'\n )\n )\n }\n this.containerIdentifier = [...containerIdentifiers][0]\n\n if (frameOfReferenceUIDs.VOLUME.size !== 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must have ' +\n 'the same Frame of Reference UID.'\n )\n )\n }\n this.frameOfReferenceUID = [...frameOfReferenceUIDs.VOLUME][0]\n\n let requirePyramidUID = false\n if (Object.keys(pyramidUIDs.VOLUME).length > 0) {\n requirePyramidUID = true\n }\n this.opticalPathIdentifiers.forEach(identifier => {\n if (pyramidUIDs.VOLUME[identifier] != null) {\n if (pyramidUIDs.VOLUME[identifier].size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `All VOLUME images for optical path \"${identifier}\"` +\n 'must be part of the same multi-resolution pyramid.'\n )\n )\n } else if (pyramidUIDs.VOLUME[identifier].size === 1) {\n this.pyramidUIDs.push([...pyramidUIDs.VOLUME[identifier]][0])\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n } else {\n if (requirePyramidUID) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n `The VOLUME images for optical path \"${identifier}\" ` +\n 'lack the Pyramid UID, while the images for other optical paths ' +\n 'contain it.'\n )\n )\n }\n }\n })\n\n if (acquisitionUIDs.size > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'All VOLUME images of a slide must be part of the same ' +\n 'acquisition and have the same Acquisition UID.'\n )\n )\n } else if (acquisitionUIDs.size === 1) {\n this.acquisitionUID = [...acquisitionUIDs][0]\n } else {\n this.acquisitionUID = null\n }\n\n this.areVolumeImagesMonochrome = (\n this.volumeImages[0].SamplesPerPixel === 1 &&\n this.volumeImages[0].PhotometricInterpretation === 'MONOCHROME2'\n )\n\n this.description = (\n options.description !== undefined ? options.description : ''\n )\n }\n}\n\n/**\n * Create slides.\n *\n * @param imagesPerSeries - Image instances grouped per series\n * @param referenceSeriesInstanceUID - Unique identifier of the series that serves as a reference for the slide\n * @returns Slides\n */\nconst createSlides = (\n images: dmv.metadata.VLWholeSlideMicroscopyImage[][]\n): Slide[] => {\n const slideMetadata: SlideImageCollection[] = []\n images.forEach((series) => {\n if (series.length > 0) {\n const volumeImages = series.filter((image) => {\n return (\n hasImageFlavor(image, ImageFlavors.VOLUME) ||\n hasImageFlavor(image, ImageFlavors.THUMBNAIL)\n )\n })\n if (volumeImages.length > 0) {\n const refImage = volumeImages[0]\n const filteredVolumeImages = volumeImages.filter((image) => {\n return refImage.SamplesPerPixel === image.SamplesPerPixel\n })\n const slideMetadataIndex = slideMetadata.findIndex((slide) => {\n return _doesImageBelongToSlide(slide, refImage)\n })\n\n const labelImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.LABEL)\n })\n let filteredLabelImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (labelImages.length > 1) {\n filteredLabelImages = labelImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredLabelImages = labelImages\n }\n const overviewImages = series.filter((image) => {\n return hasImageFlavor(image, ImageFlavors.OVERVIEW)\n })\n let filteredOverviewImages: dmv.metadata.VLWholeSlideMicroscopyImage[]\n if (overviewImages.length > 1) {\n filteredOverviewImages = overviewImages.filter((image) => {\n return areSameAcquisition(image, refImage)\n })\n } else {\n filteredOverviewImages = overviewImages\n }\n\n if (slideMetadataIndex === -1) {\n const slideMetadataItem: SlideImageCollection = {\n acquisitionUID: refImage.AcquisitionUID,\n frameOfReferenceUID: refImage.FrameOfReferenceUID,\n containerIdentifier: refImage.ContainerIdentifier,\n volumeImages: filteredVolumeImages,\n labelImages: filteredLabelImages,\n overviewImages: filteredOverviewImages\n }\n slideMetadata.push(slideMetadataItem)\n } else {\n const slideMetadataItem = slideMetadata[slideMetadataIndex]\n slideMetadataItem.volumeImages.push(...filteredVolumeImages)\n slideMetadataItem.labelImages.push(...filteredLabelImages)\n slideMetadataItem.overviewImages.push(...filteredOverviewImages)\n }\n }\n }\n })\n\n let slides: Slide[] = slideMetadata.map((item) => {\n return new Slide({\n images: [\n ...item.volumeImages,\n ...item.labelImages,\n ...item.overviewImages\n ]\n })\n })\n slides = slides.sort((a, b) => {\n const imgA = a.volumeImages[0]\n const imgB = b.volumeImages[0]\n if (imgA.ContainerIdentifier != null && imgB.ContainerIdentifier != null) {\n return Number(imgA.ContainerIdentifier) - Number(imgB.ContainerIdentifier)\n } else {\n return 0\n }\n })\n\n return slides\n}\n\n/**\n * Check if instance belongs to the slide.\n *\n * Compares values of Frame of Reference UID and Container Identifier attributes.\n *\n * @param slide - Slide metadata object\n * @param image - Metadata of VOLUME, LABEL or OVERVIEW image instance\n */\nfunction _doesImageBelongToSlide (\n slide: SlideImageCollection,\n image: dmv.metadata.VLWholeSlideMicroscopyImage\n): boolean {\n if (\n slide.frameOfReferenceUID === image.FrameOfReferenceUID &&\n slide.containerIdentifier === image.ContainerIdentifier &&\n slide.acquisitionUID === image.AcquisitionUID\n ) {\n return true\n }\n return false\n}\n\nexport { Slide, createSlides }\n","import * as dmv from 'dicom-microscopy-viewer'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { StorageClasses } from '../data/uids'\nimport { CustomError, errorTypes } from '../utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './NotificationMiddleware'\nimport { createSlides, Slide } from '../data/slides'\n\ninterface FetchImageMetadataParams {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n onSuccess: (slides: Slide[]) => void\n onError: (error: Error) => void\n}\n\nexport const fetchImageMetadata = async ({\n clients,\n studyInstanceUID,\n onSuccess,\n onError\n}: FetchImageMetadataParams): Promise => {\n try {\n const images: dmv.metadata.VLWholeSlideMicroscopyImage[][] = []\n console.info(`search for series of study \"${studyInstanceUID}\"...`)\n\n const client = clients[StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE]\n const matchedSeries = await client.searchForSeries({\n queryParams: {\n Modality: 'SM',\n StudyInstanceUID: studyInstanceUID\n }\n })\n\n await Promise.all(\n matchedSeries.map(async (s) => {\n const { dataset } = dmv.metadata.formatMetadata(s)\n const loadingSeries = dataset as dmv.metadata.Series\n console.info(\n `retrieve metadata of series \"${loadingSeries.SeriesInstanceUID}\"`\n )\n const retrievedMetadata = await client.retrieveSeriesMetadata({\n studyInstanceUID: studyInstanceUID,\n seriesInstanceUID: loadingSeries.SeriesInstanceUID\n })\n\n const seriesImages: dmv.metadata.VLWholeSlideMicroscopyImage[] = []\n retrievedMetadata.forEach((item) => {\n if (\n item['00080016']?.Value?.[0] ===\n StorageClasses.VL_WHOLE_SLIDE_MICROSCOPY_IMAGE\n ) {\n const image = new dmv.metadata.VLWholeSlideMicroscopyImage({\n metadata: item\n })\n seriesImages.push(image)\n }\n })\n\n if (seriesImages.length > 0) {\n images.push(seriesImages)\n }\n })\n )\n const newSlides = createSlides(images)\n onSuccess(newSlides)\n } catch (err) {\n console.error(err)\n const customError = new CustomError(\n errorTypes.ENCODINGANDDECODING,\n 'Image metadata could not be retrieved or decoded.'\n )\n onError(customError)\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n customError\n )\n }\n}\n","import { useState, useEffect } from 'react'\n\nimport DicomWebManager from '../DicomWebManager'\nimport { Slide } from '../data/slides'\nimport { fetchImageMetadata } from '../services/fetchImageMetadata'\n\ninterface UseSlidesProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\ninterface UseSlidesReturn {\n slides: Slide[]\n isLoading: boolean\n error: Error | null\n}\n\nconst slidesCache = new Map()\nconst pendingRequests = new Map>()\n\n/**\n * Hook to fetch and manage whole slide microscopy images for a given study.\n * Values are cached so they can be reused if props are not provided.\n *\n * @param props - Hook configuration props\n * @param props.clients - Map of DICOM web clients keyed by storage class\n */\nexport const useSlides = ({ clients, studyInstanceUID }: UseSlidesProps): UseSlidesReturn => {\n const [slides, setSlides] = useState([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState(null)\n\n useEffect(() => {\n if (studyInstanceUID === undefined) {\n setSlides([])\n setIsLoading(false)\n return\n }\n\n const cachedData = slidesCache.get(studyInstanceUID)\n if (cachedData !== undefined) {\n setSlides(cachedData)\n setIsLoading(false)\n return\n }\n\n setIsLoading(true)\n\n const fetchSlides = async (): Promise => {\n // Check if there's already a pending request for this study\n let pendingRequest = pendingRequests.get(studyInstanceUID)\n\n if (pendingRequest === undefined) {\n // Create a new promise for this request\n pendingRequest = new Promise((resolve, reject): void => {\n fetchImageMetadata({\n clients,\n studyInstanceUID,\n onSuccess: (newSlides) => {\n slidesCache.set(studyInstanceUID, newSlides)\n resolve(newSlides)\n },\n onError: (err) => {\n reject(err)\n }\n }).catch((err) => {\n reject(err)\n })\n })\n pendingRequests.set(studyInstanceUID, pendingRequest)\n }\n\n try {\n const newSlides = await pendingRequest\n setSlides(newSlides)\n setError(null)\n } catch (err) {\n setError(err as Error)\n setSlides([])\n } finally {\n pendingRequests.delete(studyInstanceUID)\n setIsLoading(false)\n }\n }\n\n void fetchSlides()\n }, [clients, studyInstanceUID])\n\n return { slides, isLoading, error }\n}\n","import { Routes, Route, useLocation, useParams } from 'react-router-dom'\nimport { Layout, Menu } from 'antd'\n\nimport { AnnotationSettings } from '../AppConfig'\nimport ClinicalTrial from './ClinicalTrial'\nimport DicomWebManager from '../DicomWebManager'\nimport Patient from './Patient'\nimport Study from './Study'\nimport SlideList from './SlideList'\nimport SlideViewer from './SlideViewer'\n\nimport { User } from '../auth'\nimport { Slide } from '../data/slides'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport { useSlides } from '../hooks/useSlides'\n\nfunction ParametrizedSlideViewer ({\n clients,\n slides,\n user,\n app,\n preload,\n enableAnnotationTools,\n annotations\n}: {\n clients: { [key: string]: DicomWebManager }\n slides: Slide[]\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n preload: boolean\n enableAnnotationTools: boolean\n annotations: AnnotationSettings[]\n}): JSX.Element | null {\n const { studyInstanceUID, seriesInstanceUID } = useParams()\n const location = useLocation()\n\n const selectedSlide = slides.find((slide: Slide) => {\n return slide.seriesInstanceUIDs.find((uid: string) => {\n return uid === seriesInstanceUID\n })\n })\n const searchParams = new URLSearchParams(location.search)\n let presentationStateUID: string | null | undefined\n if (!searchParams.has('access_token')) {\n presentationStateUID = searchParams.get('state')\n if (presentationStateUID === null) {\n presentationStateUID = undefined\n }\n }\n let viewer = null\n if (selectedSlide != null) {\n viewer = (\n \n )\n }\n return viewer\n}\n\ninterface ViewerProps extends RouteComponentProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n annotations: AnnotationSettings[]\n enableAnnotationTools: boolean\n preload: boolean\n user?: {\n name: string\n email: string\n }\n}\n\nfunction Viewer (props: ViewerProps): JSX.Element | null {\n const { clients, studyInstanceUID, location, navigate } = props\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n\n const handleSeriesSelection = ({ seriesInstanceUID }: { seriesInstanceUID: string }): void => {\n console.info(`switch to series \"${seriesInstanceUID}\"`)\n let urlPath = (\n `/studies/${studyInstanceUID}` +\n `/series/${seriesInstanceUID}`\n )\n\n if (location.pathname.includes('/projects/')) {\n urlPath = location.pathname\n if (!location.pathname.includes('/series/')) {\n urlPath += `/series/${seriesInstanceUID}`\n } else {\n urlPath = urlPath.replace(/\\/series\\/[^/]+/, `/series/${seriesInstanceUID}`)\n }\n }\n\n if (\n location.pathname.includes('/series/') &&\n location.search != null\n ) {\n urlPath += location.search\n }\n\n navigate(urlPath, { replace: true })\n }\n\n if (isLoading) {\n return null\n }\n\n if (slides.length === 0) {\n return null\n }\n\n const firstSlide = slides[0]\n const volumeInstances = firstSlide.volumeImages\n if (volumeInstances.length === 0) {\n return null\n }\n const refImage = volumeInstances[0]\n\n /* If a series is encoded in the path, route the viewer to this series.\n * Otherwise select the first series correspondent to\n * the first slide contained in the study.\n */\n let selectedSeriesInstanceUID: string\n if (location.pathname.includes('series/')) {\n const seriesFragment = location.pathname.split('series/')[1]\n selectedSeriesInstanceUID = seriesFragment.includes('/') ? seriesFragment.split('/')[0] : seriesFragment\n } else {\n selectedSeriesInstanceUID = volumeInstances[0].SeriesInstanceUID\n }\n\n let clinicalTrialMenu\n if (refImage.ClinicalTrialSponsorName != null) {\n clinicalTrialMenu = (\n \n \n \n )\n }\n\n return (\n \n \n \n \n \n \n \n \n \n {clinicalTrialMenu}\n \n \n \n \n \n\n \n \n }\n />\n \n \n )\n}\n\nexport default withRouter(Viewer)\n","import dcmjs from 'dcmjs'\n\nconst { DicomMetaDictionary } = dcmjs.data\n\ninterface TagInfo {\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TagInfo[]\n level: number\n}\n\nexport interface DicomTag {\n name: string\n vr: string\n Value?: any[]\n [key: string]: any\n}\n\nconst formatValue = (val: any): string => {\n if (typeof val === 'object' && val !== null) {\n return JSON.stringify(val)\n }\n return String(val)\n}\n\nexport const formatTagValue = (tag: DicomTag): string => {\n if (tag.Value == null) return ''\n\n if (Array.isArray(tag.Value)) {\n return tag.Value.map(formatValue).join(', ')\n }\n\n return formatValue(tag.Value)\n}\n\n/**\n * Processes DICOM metadata and returns a flattened array of tag information\n * @param metadata - The DICOM metadata object to process\n * @param depth - The current depth level for nested sequences (default: 0)\n * @returns Array of processed tag information\n */\nexport function getRows (metadata: Record, depth = 0): TagInfo[] {\n if (metadata === undefined || metadata === null) return []\n const keywords = Object.keys(metadata).filter(key => key !== '_vrMap')\n\n return keywords.flatMap(keyword => {\n // @ts-expect-error\n const tagInfo = DicomMetaDictionary.nameMap[keyword] as TagInfo | undefined\n let value = metadata[keyword]\n\n // Handle private or unknown tags\n if (tagInfo === undefined) {\n const regex = /[0-9A-Fa-f]{6}/g\n if (keyword.match(regex) == null) return []\n\n return [{\n tag: `(${keyword.substring(0, 4)},${keyword.substring(4, 8)})`,\n vr: '',\n keyword: 'Private Tag',\n value: value?.toString() ?? '',\n level: depth\n }]\n }\n\n // Handle sequence values (SQ VR)\n if (tagInfo.vr === 'SQ' && value !== undefined) {\n const sequenceItems = Array.isArray(value) ? value : [value]\n\n // Create a parent sequence node\n const sequenceNode: TagInfo = {\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword,\n value: `Sequence with ${sequenceItems.length} item(s)`,\n level: depth,\n children: []\n }\n\n // Create individual nodes for each sequence item\n sequenceNode.children = sequenceItems.map((item, index) => {\n const itemNode: TagInfo = {\n tag: `${tagInfo.tag}.${index + 1}`,\n vr: 'Item',\n keyword: `Item ${index + 1}`,\n value: `Sequence Item ${index + 1}`,\n level: depth + 1,\n children: getRows(item, depth + 2)\n }\n return itemNode\n })\n\n return [sequenceNode]\n }\n\n // Handle array values\n if (Array.isArray(value)) {\n value = value.map(formatValue).join('\\\\')\n } else if (typeof value === 'object' && value !== null) {\n value = formatValue(value)\n }\n\n return [{\n tag: tagInfo.tag,\n vr: tagInfo.vr,\n keyword: keyword.replace('RETIRED_', ''),\n value: value?.toString() ?? '',\n level: depth\n }]\n })\n}\n\n/**\n * Sorts DICOM tags alphabetically by tag value\n * @param metadata - The DICOM metadata object to process\n * @returns Sorted array of tag information\n */\nexport function getSortedTags (metadata: Record): TagInfo[] {\n const tagList = getRows(metadata)\n return tagList.sort((a, b) => a.tag.localeCompare(b.tag))\n}\n","/**\n * Formats a DICOM datetime string (YYYYMMDD:HHmmss) into a human-readable format\n *\n * @param dateStr - DICOM datetime string in format \"YYYYMMDD:HHmmss\"\n * @returns Formatted date string (e.g., \"Mon, Jan 1 2024\")\n * @example\n * formatDicomDate(\"20240101:120000\") // Returns \"Mon, Jan 1 2024\"\n * formatDicomDate(\"invalid\") // Returns \"invalid\"\n */\nexport const formatDicomDate = (dateStr: string): string => {\n // Parse YYYYMMDD:HHmmss format\n const match = dateStr.match(/^(\\d{4})(\\d{2})(\\d{2}):(\\d{2})(\\d{2})(\\d{2})/)\n if (match == null) return dateStr\n\n const [, year, month, day, hour, minute, second] = match\n\n // Validate month and day\n const monthNum = parseInt(month)\n const dayNum = parseInt(day)\n if (monthNum < 1 || monthNum > 12 || dayNum < 1 || dayNum > 31) {\n return dateStr\n }\n\n const date = new Date(\n parseInt(year),\n monthNum - 1, // months are 0-based\n dayNum,\n parseInt(hour),\n parseInt(minute),\n parseInt(second)\n )\n\n // Check if the date is invalid or if the month/day combination is invalid\n // This catches cases like February 31st where the date rolls over to March\n if (\n date.getMonth() !== monthNum - 1 || // month rolled over\n date.getDate() !== dayNum // day rolled over\n ) {\n return dateStr\n }\n\n // Format parts separately to avoid the extra comma\n const weekday = date.toLocaleDateString('en-US', { weekday: 'short' })\n const monthName = date.toLocaleDateString('en-US', { month: 'short' })\n const dayFormatted = date.getDate()\n const yearNum = date.getFullYear()\n\n return `${weekday}, ${monthName} ${dayFormatted} ${yearNum}`\n}\n","import { v4 as generateUUID } from 'uuid'\n\n/**\n * Consumer must implement:\n * this.listeners = {}\n * this.EVENTS = { \"EVENT_KEY\": \"EVENT_VALUE\" }\n */\nconst pubSubInterface = {\n subscribe,\n _broadcastEvent,\n _unsubscribe,\n _isValidEvent\n}\n\nexport default pubSubInterface\n\n/**\n * Subscribe to updates.\n *\n * @param {string} eventName The name of the event\n * @param {Function} callback Events callback\n * @return {Object} Observable object with actions\n */\nfunction subscribe (this: PubSubService, eventName: string, callback: Function): { unsubscribe: () => any } {\n if (this._isValidEvent(eventName)) {\n const listenerId = generateUUID()\n const subscription = { id: listenerId, callback }\n\n // console.info(`Subscribing to '${eventName}'.`);\n if (Array.isArray(this.listeners[eventName])) {\n this.listeners[eventName].push(subscription)\n } else {\n this.listeners[eventName] = [subscription]\n }\n\n return {\n unsubscribe: () => this._unsubscribe(eventName, listenerId)\n }\n } else {\n throw new Error(`Event ${eventName} not supported.`)\n }\n}\n\n/**\n * Unsubscribe to measurement updates.\n *\n * @param {string} eventName The name of the event\n * @param {string} listenerId The listeners id\n * @return void\n */\nfunction _unsubscribe (this: PubSubService, eventName: string, listenerId: string): void {\n if (this.listeners[eventName] === undefined) {\n return\n }\n\n const listeners = this.listeners[eventName]\n if (Array.isArray(listeners)) {\n this.listeners[eventName] = listeners.filter(({ id }) => id !== listenerId)\n } else {\n this.listeners[eventName] = []\n }\n}\n\n/**\n * Check if a given event is valid.\n *\n * @param {string} eventName The name of the event\n * @return {boolean} Event name validation\n */\nfunction _isValidEvent (this: PubSubService, eventName: string): boolean {\n return Object.values(this.EVENTS).includes(eventName)\n}\n\n/**\n * Broadcasts changes.\n *\n * @param {string} eventName - The event name\n * @param {func} callbackProps - Properties to pass callback\n * @return void\n */\nfunction _broadcastEvent (this: PubSubService, eventName: string, callbackProps: any): void {\n const hasListeners = Object.keys(this.listeners).length > 0\n const hasCallbacks = Array.isArray(this.listeners[eventName])\n\n if (hasListeners && hasCallbacks) {\n this.listeners[eventName].forEach((listener: { id: string, callback: Function }) => {\n listener.callback(callbackProps)\n })\n }\n}\n\n/** Export a PubSubService class to be used instead of the individual items */\nexport class PubSubService {\n EVENTS: any\n subscribe: (\n eventName: string,\n callback: Function\n ) => { unsubscribe: () => any }\n\n _broadcastEvent: (eventName: string, callbackProps: any) => void\n _unsubscribe: (eventName: string, listenerId: string) => void\n _isValidEvent: (eventName: string) => boolean\n listeners: { [key: string]: Array<{ id: string, callback: Function }> }\n unsubscriptions: any[]\n constructor (EVENTS: Record) {\n this.EVENTS = EVENTS\n this.subscribe = subscribe\n this._broadcastEvent = _broadcastEvent\n this._unsubscribe = _unsubscribe\n this._isValidEvent = _isValidEvent\n this.listeners = {}\n this.unsubscriptions = []\n }\n\n reset (): void {\n this.unsubscriptions.forEach((unsub) => unsub())\n this.unsubscriptions = []\n }\n\n /**\n * Creates an event that records whether or not someone\n * has consumed it. Call eventData.consume() to consume the event.\n * Check eventData.isConsumed to see if it is consumed or not.\n * @param props - to include in the event\n */\n protected createConsumableEvent (props: Record): Record {\n return {\n ...props,\n isConsumed: false,\n consume: function Consume () {\n this.isConsumed = true\n }\n }\n }\n}\n","import { Instance, Series } from '../services/DICOMMetadataStore'\n\nfunction createSeriesMetadata (SeriesInstanceUID: string, defaultInstances?: Instance[]): Series {\n const instances: Instance[] = []\n const instancesMap = new Map()\n\n return {\n SeriesInstanceUID,\n Modality: '',\n SeriesNumber: 0,\n SeriesDescription: '',\n SeriesDate: '',\n SeriesTime: '',\n ...defaultInstances?.[0],\n instances,\n addInstance: function (newInstance: Instance) {\n this.addInstances([newInstance])\n },\n addInstances: function (newInstances: Instance[]) {\n for (let i = 0, len = newInstances.length; i < len; i++) {\n const instance = newInstances[i]\n\n if (!instancesMap.has(instance.SOPInstanceUID)) {\n instancesMap.set(instance.SOPInstanceUID, instance)\n instances.push(instance)\n }\n }\n },\n getInstance: function (SOPInstanceUID: string) {\n return instancesMap.get(SOPInstanceUID)\n }\n }\n}\n\nexport default createSeriesMetadata\n","import createSeriesMetadata from './createSeriesMetadata'\n\nimport { Study, Series, Instance } from '../services/DICOMMetadataStore'\n\nfunction createStudyMetadata (StudyInstanceUID: string): Study {\n return {\n StudyInstanceUID,\n StudyDescription: '',\n PatientID: '',\n PatientName: '',\n StudyDate: '',\n AccessionNumber: '',\n NumInstances: 0,\n ModalitiesInStudy: [],\n isLoaded: false,\n series: [] as Series[],\n /**\n * @param {object} instance\n */\n addInstanceToSeries: function (instance: Instance) {\n this.addInstancesToSeries([instance])\n },\n /**\n * @param {object[]} instances\n * @param {string} instances[].SeriesInstanceUID\n * @param {string} instances[].StudyDescription\n */\n addInstancesToSeries: function (instances: Instance[]) {\n const { SeriesInstanceUID } = instances[0]\n\n if (this.StudyDescription !== '' && this.StudyDescription !== undefined) {\n this.StudyDescription = instances[0].StudyDescription\n }\n\n let series = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n series = createSeriesMetadata(SeriesInstanceUID, instances)\n this.series.push(series)\n }\n\n series.addInstances(instances)\n },\n\n setSeriesMetadata: function (\n SeriesInstanceUID: string,\n seriesMetadata: any\n ) {\n let existingSeries = this.series.find(\n (s) => s.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (existingSeries != null) {\n existingSeries = Object.assign(existingSeries, seriesMetadata)\n } else {\n const series = createSeriesMetadata(SeriesInstanceUID)\n this.series.push(Object.assign(series, seriesMetadata))\n }\n }\n }\n}\n\nexport default createStudyMetadata\n","import dcmjs from 'dcmjs'\n\nimport pubSubServiceInterface from '../utils/pubSubServiceInterface'\nimport createStudyMetadata from '../utils/createStudyMetadata'\n\nexport const EVENTS = {\n STUDY_ADDED: 'event::dicomMetadataStore:studyAdded',\n INSTANCES_ADDED: 'event::dicomMetadataStore:instancesAdded',\n SERIES_ADDED: 'event::dicomMetadataStore:seriesAdded',\n SERIES_UPDATED: 'event::dicomMetadataStore:seriesUpdated'\n}\n\nexport interface Instance {\n SOPInstanceUID: string\n SOPClassUID: string\n Rows: number\n Columns: number\n PatientSex: string\n Modality: string\n InstanceNumber: string\n imageId?: string\n [key: string]: any // For dynamic metadata properties\n}\n\nexport interface Series {\n Modality: string\n SeriesInstanceUID: string\n SeriesNumber: number\n SeriesDate: string\n SeriesTime: string\n SeriesDescription: string\n instances: Instance[]\n addInstance: (newInstance: Instance) => void\n addInstances: (newInstances: Instance[]) => void\n getInstance: (SOPInstanceUID: string) => Instance | undefined\n}\n\nexport interface Study {\n StudyInstanceUID: string\n StudyDescription: string\n PatientID: string\n PatientName: string\n StudyDate: string\n AccessionNumber: string\n NumInstances: number\n ModalitiesInStudy: any[]\n NumberOfStudyRelatedSeries?: number\n isLoaded: boolean\n series: Series[]\n addInstanceToSeries: (instance: Instance) => void\n addInstancesToSeries: (instances: Instance[]) => void\n setSeriesMetadata: (SeriesInstanceUID: string, metadata: any) => void\n}\n\ninterface Model {\n studies: Study[]\n}\n\nconst _model: Model = {\n studies: []\n}\n\nfunction _getStudyInstanceUIDs (): string[] {\n return _model.studies.map((aStudy) => aStudy.StudyInstanceUID)\n}\n\nfunction _getStudy (StudyInstanceUID: string): Study | undefined {\n return _model.studies.find(\n (aStudy) => aStudy.StudyInstanceUID === StudyInstanceUID\n )\n}\n\nfunction _getSeries (StudyInstanceUID: string, SeriesInstanceUID: string): Series | undefined {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n return study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n}\n\nfunction _getInstance (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n SOPInstanceUID: string\n): Instance | undefined {\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n\n if (series == null) {\n return\n }\n\n return series.getInstance(SOPInstanceUID)\n}\n\nfunction _getInstanceByImageId (imageId: string): Instance | undefined {\n for (const study of _model.studies) {\n for (const series of study.series) {\n for (const instance of series.instances) {\n if (instance.imageId === imageId) {\n return instance\n }\n }\n }\n }\n}\n\n/**\n * Update the metadata of a specific series\n * @param {*} StudyInstanceUID\n * @param {*} SeriesInstanceUID\n * @param {*} metadata metadata inform of key value pairs\n * @returns\n */\nfunction _updateMetadataForSeries (\n StudyInstanceUID: string,\n SeriesInstanceUID: string,\n metadata: Record\n): void {\n const study = _getStudy(StudyInstanceUID)\n\n if (study == null) {\n return\n }\n\n const series = study.series.find(\n (aSeries) => aSeries.SeriesInstanceUID === SeriesInstanceUID\n )\n\n if (series == null) {\n return\n }\n\n const { instances } = series\n instances.forEach((instance) => {\n Object.keys(metadata).forEach((key) => {\n if (typeof metadata[key] === 'object') {\n instance[key] = { ...instance[key], ...metadata[key] }\n } else {\n instance[key] = metadata[key]\n }\n })\n })\n}\n\ninterface BaseImplementationType {\n EVENTS: typeof EVENTS\n listeners: Record\n addInstance: (dicomJSONDatasetOrP10ArrayBuffer: ArrayBuffer | Record) => void\n addInstances: (instances: Instance[], madeInClient?: boolean) => void\n updateSeriesMetadata: (seriesMetadata: Record) => void\n addSeriesMetadata: (seriesSummaryMetadata: Array>, madeInClient?: boolean) => void\n addStudy: (study: Record) => void\n getStudyInstanceUIDs: typeof _getStudyInstanceUIDs\n getStudy: typeof _getStudy\n getSeries: typeof _getSeries\n getInstance: typeof _getInstance\n getInstanceByImageId: typeof _getInstanceByImageId\n updateMetadataForSeries: typeof _updateMetadataForSeries\n _broadcastEvent: (eventName: string, data: any) => void\n}\n\nconst BaseImplementation: BaseImplementationType = {\n EVENTS,\n listeners: {},\n addInstance (dicomJSONDatasetOrP10ArrayBuffer) {\n let dicomJSONDataset\n\n // If Arraybuffer, parse to DICOMJSON before naturalizing.\n if (dicomJSONDatasetOrP10ArrayBuffer instanceof ArrayBuffer) {\n const dicomData = dcmjs.data.DicomMessage.readFile(\n dicomJSONDatasetOrP10ArrayBuffer\n )\n\n dicomJSONDataset = dicomData.dict\n } else {\n dicomJSONDataset = dicomJSONDatasetOrP10ArrayBuffer\n }\n\n let naturalizedDataset: Instance\n\n if (!('SeriesInstanceUID' in dicomJSONDataset)) {\n naturalizedDataset =\n dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomJSONDataset) as Instance\n } else {\n naturalizedDataset = dicomJSONDataset as unknown as Instance\n }\n\n const { StudyInstanceUID } = naturalizedDataset\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstanceToSeries(naturalizedDataset)\n },\n addInstances (instances, madeInClient = false) {\n const { StudyInstanceUID, SeriesInstanceUID } = instances[0]\n\n let study = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (study == null) {\n _model.studies.push(createStudyMetadata(StudyInstanceUID))\n study = _model.studies[_model.studies.length - 1]\n }\n\n study.addInstancesToSeries(instances)\n\n // Broadcast an event even if we used cached data.\n // This is because the mode needs to listen to instances that are added to build up its active displaySets.\n // It will see there are cached displaySets and end early if this Series has already been fired in this\n // Mode session for some reason.\n this._broadcastEvent(EVENTS.INSTANCES_ADDED, {\n StudyInstanceUID,\n SeriesInstanceUID,\n madeInClient\n })\n },\n updateSeriesMetadata (seriesMetadata) {\n const { StudyInstanceUID, SeriesInstanceUID } = seriesMetadata\n const series = _getSeries(StudyInstanceUID, SeriesInstanceUID)\n if (series == null) {\n return\n }\n\n const study = _getStudy(StudyInstanceUID)\n if (study != null) {\n study.setSeriesMetadata(SeriesInstanceUID, seriesMetadata)\n }\n },\n addSeriesMetadata (seriesSummaryMetadata, madeInClient = false) {\n if (\n seriesSummaryMetadata === undefined ||\n seriesSummaryMetadata.length === 0 ||\n seriesSummaryMetadata[0] === undefined\n ) {\n return\n }\n\n const { StudyInstanceUID } = seriesSummaryMetadata[0]\n let study = _getStudy(StudyInstanceUID)\n if (study == null) {\n study = createStudyMetadata(StudyInstanceUID)\n // Will typically be undefined with a compliant DICOMweb server, reset later\n study.StudyDescription = seriesSummaryMetadata[0].StudyDescription\n seriesSummaryMetadata?.forEach((item) => {\n if (study !== undefined && !study.ModalitiesInStudy?.includes(item.Modality)) {\n study.ModalitiesInStudy?.push(item.Modality)\n }\n })\n study.NumberOfStudyRelatedSeries = seriesSummaryMetadata.length\n _model.studies.push(study)\n }\n\n seriesSummaryMetadata.forEach((series) => {\n const { SeriesInstanceUID } = series\n study?.setSeriesMetadata(SeriesInstanceUID, series)\n })\n\n this._broadcastEvent(EVENTS.SERIES_ADDED, {\n StudyInstanceUID,\n seriesSummaryMetadata,\n madeInClient\n })\n },\n addStudy (study) {\n const { StudyInstanceUID } = study\n\n const existingStudy = _model.studies.find(\n (study) => study.StudyInstanceUID === StudyInstanceUID\n )\n\n if (existingStudy == null) {\n const newStudy = createStudyMetadata(StudyInstanceUID)\n\n newStudy.PatientID = study.PatientID\n newStudy.PatientName = study.PatientName\n newStudy.StudyDate = study.StudyDate\n newStudy.ModalitiesInStudy = study.ModalitiesInStudy\n newStudy.StudyDescription = study.StudyDescription\n newStudy.AccessionNumber = study.AccessionNumber\n newStudy.NumInstances = study.NumInstances // todo: Correct naming?\n\n _model.studies.push(newStudy)\n }\n },\n getStudyInstanceUIDs: _getStudyInstanceUIDs,\n getStudy: _getStudy,\n getSeries: _getSeries,\n getInstance: _getInstance,\n getInstanceByImageId: _getInstanceByImageId,\n updateMetadataForSeries: _updateMetadataForSeries,\n _broadcastEvent (eventName: string, data: any): void {\n }\n}\n\ninterface DicomMetadataStoreType extends BaseImplementationType {\n subscribe: (event: string, callback: (data: any) => void) => { unsubscribe: () => any }\n unsubscribe: (event: string, callback: (data: any) => void) => void\n}\n\nconst DicomMetadataStore = Object.assign(\n {},\n BaseImplementation,\n pubSubServiceInterface\n) as unknown as DicomMetadataStoreType\n\nexport { DicomMetadataStore }\nexport default DicomMetadataStore\n","import { useState, useEffect } from 'react'\n\n/**\n * A hook that delays updating a value for the specified time\n * @param value The value to debounce\n * @param delay The delay time in milliseconds\n * @returns The debounced value\n * @example\n * const debouncedSearchTerm = useDebounce(searchTerm, 300)\n */\nexport const useDebounce = (value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState(value)\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value)\n }, delay)\n\n return () => {\n clearTimeout(timer)\n }\n }, [value, delay])\n\n return debouncedValue\n}\n","import { useState, useMemo, useEffect } from 'react'\nimport { Select, Input, Slider, Typography, Table } from 'antd'\nimport { SearchOutlined } from '@ant-design/icons'\n\nimport DicomWebManager from '../../DicomWebManager'\nimport './DicomTagBrowser.css'\nimport { useSlides } from '../../hooks/useSlides'\nimport { getSortedTags } from './dicomTagUtils'\nimport { formatDicomDate } from '../../utils/formatDicomDate'\nimport DicomMetadataStore, { Series, Study } from '../../services/DICOMMetadataStore'\nimport { useDebounce } from '../../hooks/useDebounce'\n\nconst { Option } = Select\n\ninterface DisplaySet {\n displaySetInstanceUID: number\n SeriesDate?: string\n SeriesTime?: string\n SeriesNumber: string\n SeriesDescription?: string\n Modality: string\n images: any[]\n}\n\ninterface TableDataItem {\n key: string\n tag: string\n vr: string\n keyword: string\n value: string\n children?: TableDataItem[]\n}\n\ninterface DicomTagBrowserProps {\n clients: { [key: string]: DicomWebManager }\n studyInstanceUID: string\n}\n\nconst DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): JSX.Element => {\n const { slides, isLoading } = useSlides({ clients, studyInstanceUID })\n const [study, setStudy] = useState(undefined)\n\n const [displaySets, setDisplaySets] = useState([])\n const [selectedDisplaySetInstanceUID, setSelectedDisplaySetInstanceUID] = useState(0)\n const [instanceNumber, setInstanceNumber] = useState(1)\n const [filterValue, setFilterValue] = useState('')\n const [expandedKeys, setExpandedKeys] = useState([])\n const [searchInput, setSearchInput] = useState('')\n\n const debouncedSearchValue = useDebounce(searchInput, 300)\n\n useEffect(() => {\n setFilterValue(debouncedSearchValue)\n }, [debouncedSearchValue])\n\n useEffect(() => {\n const handler = (event: any): void => {\n const study: Study | undefined = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n }\n const seriesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.SERIES_ADDED, handler)\n const instancesAddedSubscription = DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.INSTANCES_ADDED, handler)\n\n const study = Object.assign({}, DicomMetadataStore.getStudy(studyInstanceUID))\n setStudy(study)\n\n return () => {\n seriesAddedSubscription.unsubscribe()\n instancesAddedSubscription.unsubscribe()\n }\n }, [studyInstanceUID])\n\n useEffect(() => {\n let displaySets: DisplaySet[] = []\n let derivedDisplaySets: DisplaySet[] = []\n const processedSeries: string[] = []\n let index = 0\n\n if (slides.length > 0) {\n displaySets = slides\n .map((slide): DisplaySet | null => {\n const { volumeImages } = slide\n if (volumeImages?.[0] === undefined) return null\n\n const {\n SeriesDate,\n SeriesTime,\n SeriesNumber,\n SeriesInstanceUID,\n SeriesDescription,\n Modality\n } = volumeImages[0]\n\n processedSeries.push(SeriesInstanceUID)\n\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate,\n SeriesTime,\n SeriesInstanceUID,\n // @ts-expect-error\n SeriesNumber,\n SeriesDescription,\n Modality,\n images: volumeImages\n }\n index++\n return ds\n })\n .filter((set): set is DisplaySet => set !== null)\n }\n\n if (study !== undefined && study.series?.length > 0) {\n derivedDisplaySets = study.series.filter(s => !processedSeries.includes(s.SeriesInstanceUID))\n .map((series: Series): DisplaySet => {\n const ds: DisplaySet = {\n displaySetInstanceUID: index,\n SeriesDate: series.SeriesDate,\n SeriesTime: series.SeriesTime,\n // @ts-expect-error\n SeriesNumber: series.SeriesNumber,\n SeriesDescription: series.SeriesDescription,\n SeriesInstanceUID: series.SeriesInstanceUID,\n Modality: series.Modality,\n images: series?.instances?.length > 0 ? series.instances : [series]\n }\n index++\n return ds\n })\n }\n\n setDisplaySets([...displaySets, ...derivedDisplaySets])\n }, [slides, study])\n\n const displaySetList = useMemo(() => {\n displaySets.sort((a, b) => Number(a.SeriesNumber) - Number(b.SeriesNumber))\n return displaySets.map((displaySet, index) => {\n const {\n SeriesDate = '',\n SeriesTime = '',\n SeriesNumber = '',\n SeriesDescription = '',\n Modality = ''\n } = displaySet\n\n const dateStr = `${SeriesDate}:${SeriesTime}`.split('.')[0]\n const displayDate = formatDicomDate(dateStr)\n\n return {\n value: index,\n label: `${SeriesNumber} (${Modality}): ${SeriesDescription}`,\n description: displayDate\n }\n })\n }, [displaySets])\n\n const showInstanceList =\n displaySets[selectedDisplaySetInstanceUID]?.images.length > 1\n\n console.debug('displaySets:', displaySets)\n\n const instanceSliderMarks = useMemo(() => {\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return {}\n const totalInstances = displaySets[selectedDisplaySetInstanceUID].images.length\n\n // Create marks for first, middle, and last instances\n const marks: Record = {\n 1: '1', // First\n [Math.ceil(totalInstances / 2)]: String(Math.ceil(totalInstances / 2)), // Middle\n [totalInstances]: String(totalInstances) // Last\n }\n\n return marks\n }, [selectedDisplaySetInstanceUID, displaySets])\n\n const columns = [\n {\n title: 'Tag',\n dataIndex: 'tag',\n key: 'tag',\n width: '30%'\n },\n {\n title: 'VR',\n dataIndex: 'vr',\n key: 'vr',\n width: '5%'\n },\n {\n title: 'Keyword',\n dataIndex: 'keyword',\n key: 'keyword',\n width: '30%'\n },\n {\n title: 'Value',\n dataIndex: 'value',\n key: 'value',\n width: '40%'\n }\n ]\n\n const tableData = useMemo(() => {\n const transformTagsToTableData = (tags: any[], parentKey = ''): TableDataItem[] => {\n return tags.map((tag, index) => {\n // Create a unique key using tag value if available, otherwise use index\n const keyBase: string = tag.tag !== '' ? tag.tag.replace(/[(),]/g, '') : index.toString()\n const currentKey: string = parentKey !== '' ? `${parentKey}-${keyBase}` : keyBase\n\n const item: TableDataItem = {\n key: currentKey,\n tag: tag.tag,\n vr: tag.vr,\n keyword: tag.keyword,\n value: tag.value\n }\n\n if (tag.children !== undefined && tag.children.length > 0) {\n item.children = transformTagsToTableData(tag.children, currentKey)\n }\n\n return item\n })\n }\n\n if (displaySets[selectedDisplaySetInstanceUID] === undefined) return []\n const metadata = displaySets[selectedDisplaySetInstanceUID]?.images[instanceNumber - 1]\n const tags = getSortedTags(metadata)\n return transformTagsToTableData(tags)\n }, [instanceNumber, selectedDisplaySetInstanceUID, displaySets])\n\n // Reset expanded keys when search value changes\n useEffect(() => {\n setExpandedKeys([])\n }, [filterValue])\n\n const filteredData = useMemo(() => {\n if (filterValue === undefined || filterValue === '') return tableData\n\n const searchLower = filterValue.toLowerCase()\n\n const nodeMatches = (node: TableDataItem): boolean => {\n return (\n (node.tag?.toLowerCase() ?? '').includes(searchLower) ||\n (node.vr?.toLowerCase() ?? '').includes(searchLower) ||\n (node.keyword?.toLowerCase() ?? '').includes(searchLower) ||\n (node.value?.toString().toLowerCase() ?? '').includes(searchLower)\n )\n }\n\n const findMatchingNodes = (nodes: TableDataItem[]): TableDataItem[] => {\n const results: TableDataItem[] = []\n\n const searchNode = (node: TableDataItem): void => {\n if (nodeMatches(node)) {\n // Create a new matching node with its original structure\n const matchingNode: TableDataItem = {\n key: node.key,\n tag: node.tag,\n vr: node.vr,\n keyword: node.keyword,\n value: node.value\n }\n\n // If the node has children, preserve them for expansion\n matchingNode.children = node?.children?.map((child): TableDataItem => ({\n key: child.key,\n tag: child.tag,\n vr: child.vr,\n keyword: child.keyword,\n value: child.value,\n children: child.children\n }))\n\n results.push(matchingNode)\n }\n\n // Continue searching through children\n node?.children?.forEach(searchNode)\n }\n\n nodes.forEach(searchNode)\n return results\n }\n\n return findMatchingNodes(tableData)\n }, [tableData, filterValue])\n\n if (isLoading) {\n return
Loading...
\n }\n\n return (\n
\n \n
\n
\n Slides\n {\n setSelectedDisplaySetInstanceUID(value)\n setInstanceNumber(1)\n }}\n optionLabelProp='label'\n optionFilterProp='label'\n >\n {displaySetList.map((item) => (\n
\n \n ))}\n \n
\n\n {showInstanceList && (\n
\n \n Instance Number: {instanceNumber}\n \n setInstanceNumber(value)}\n marks={instanceSliderMarks}\n tooltip={{\n formatter: (value: number | undefined) => value !== undefined ? `Instance ${value}` : ''\n }}\n />\n
\n )}\n
\n\n }\n onChange={(e) => setSearchInput(e.target.value)}\n value={searchInput}\n />\n\n setExpandedKeys(keys as string[])\n }}\n size='small'\n scroll={{ y: 500 }}\n />\n \n \n )\n}\n\nexport default DicomTagBrowser\n","import React from 'react'\nimport { NavLink } from 'react-router-dom'\nimport {\n Col,\n Descriptions,\n Dropdown,\n Input,\n Layout,\n Modal,\n Row,\n Space,\n Badge,\n Collapse\n} from 'antd'\nimport {\n ApiOutlined,\n CheckOutlined,\n InfoOutlined,\n StopOutlined,\n FileSearchOutlined,\n UnorderedListOutlined,\n UserOutlined,\n SettingOutlined\n} from '@ant-design/icons'\nimport { detect } from 'detect-browser'\n\nimport Button from './Button'\nimport { RouteComponentProps, withRouter } from '../utils/router'\nimport NotificationMiddleware, { NotificationMiddlewareEvents } from '../services/NotificationMiddleware'\nimport { CustomError } from '../utils/CustomError'\nimport { v4 as uuidv4 } from 'uuid'\nimport DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser'\nimport DicomWebManager from '../DicomWebManager'\n\ninterface HeaderProps extends RouteComponentProps {\n app: {\n name: string\n version: string\n homepage: string\n uid: string\n organization?: string\n }\n user?: {\n name: string\n email: string\n }\n clients: { [key: string]: DicomWebManager }\n showWorklistButton: boolean\n onServerSelection: ({ url }: { url: string }) => void\n onUserLogout?: () => void\n showServerSelectionButton: boolean\n}\n\ninterface ExtendedCustomError extends CustomError {\n source: string\n}\n\ninterface HeaderState {\n selectedServerUrl?: string\n isServerSelectionModalVisible: boolean\n isServerSelectionDisabled: boolean\n errorObj: ExtendedCustomError[]\n errorCategory: string[]\n warnings: string[]\n}\n\n/**\n * React component for the application header.\n */\nclass Header extends React.Component {\n constructor (props: HeaderProps) {\n super(props)\n this.state = {\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n }\n\n const onErrorHandler = ({ source, error }: {\n source: string\n error: CustomError\n }): void => {\n this.setState(state => ({\n ...state,\n errorObj: [...state.errorObj, { ...error, source }],\n errorCategory: [...state.errorCategory, error.type]\n }))\n }\n\n const onWarningHandler = (warning: string): void => {\n this.setState(state => ({\n ...state,\n warnings: [...state.warnings, warning]\n }))\n }\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnError,\n onErrorHandler\n )\n\n NotificationMiddleware.subscribe(\n NotificationMiddlewareEvents.OnWarning,\n onWarningHandler\n )\n }\n\n componentDidUpdate (prevProps: Readonly, prevState: Readonly): void {\n if (((prevState.warnings.length > 0) || (prevState.errorObj.length > 0)) && this.props.location.pathname !== prevProps.location.pathname) {\n this.setState({\n isServerSelectionModalVisible: false,\n isServerSelectionDisabled: true,\n errorObj: [],\n errorCategory: [],\n warnings: []\n })\n }\n }\n\n handleInfoButtonClick = (): void => {\n const browser = detect()\n const environment: {\n browser: {\n name?: string\n version?: string\n }\n os: {\n name?: string\n }\n } = {\n browser: {},\n os: {}\n }\n if (browser != null) {\n environment.browser = {\n name: browser.name != null ? browser.name : undefined,\n version: browser.version != null ? browser.version : undefined\n }\n environment.os = {\n name: browser.os != null ? browser.os : undefined\n }\n }\n\n Modal.info({\n title: 'About',\n width: 600,\n content: (\n <>\n \n \n {this.props.app.name}\n \n \n {this.props.app.version}\n \n \n {this.props.app.homepage}\n \n \n \n \n {environment.browser.name}\n \n \n {environment.browser.version}\n \n \n \n \n {environment.os.name}\n \n \n \n ),\n onOk (): void {}\n })\n }\n\n handleDicomTagBrowserButtonClick = (): void => {\n const width = window.innerWidth - 200\n Modal.info({\n title: 'DICOM Tag Browser',\n width,\n content: ,\n onOk (): void {}\n })\n }\n\n handleDebugButtonClick = (): void => {\n const errorMsgs: {\n Authentication: string[]\n Communication: string[]\n EncodingDecoding: string[]\n Visualization: string[]\n } = {\n Authentication: [],\n Communication: [],\n EncodingDecoding: [],\n Visualization: []\n }\n\n type ObjectKey = keyof typeof errorMsgs\n const errorNum = this.state.errorObj.length\n\n if (errorNum > 0) {\n for (let i = 0; i < errorNum; i++) {\n const category = this.state.errorCategory[i] as ObjectKey\n errorMsgs[category].push(`${this.state.errorObj[i].message as string} (Source: ${this.state.errorObj[i].source})`)\n }\n }\n\n const { Panel } = Collapse\n\n const showErrorCount = (errcount: number): JSX.Element => (\n \n )\n\n const showWarningCount = (warncount: number): JSX.Element => (\n \n )\n\n Modal.info({\n title: 'Debug Information\\n (Check console for more information)',\n width: 800,\n content: (\n \n \n
    \n {errorMsgs.Communication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.EncodingDecoding.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Visualization.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {errorMsgs.Authentication.map(e => (\n
  1. {e}
  2. \n ))}\n
\n \n \n
    \n {this.state.warnings.map(warning => (\n
  1. {warning}
  2. \n ))}\n
\n \n
\n ),\n onOk (): void {}\n })\n }\n\n handleServerSelectionButtonClick = (): void => {\n this.setState({ isServerSelectionModalVisible: true })\n }\n\n render (): React.ReactNode {\n let user = null\n if (this.props.user !== undefined) {\n const userMenuItems = []\n if (this.props.onUserLogout !== undefined) {\n userMenuItems.push(\n {\n label: 'Logout',\n key: 'user-logout',\n onClick: () => {\n if (this.props.onUserLogout !== undefined) {\n this.props.onUserLogout()\n }\n }\n }\n )\n }\n const userMenu = { items: userMenuItems }\n user = (\n \n e.preventDefault()}\n label={`${this.props.user.name} (${this.props.user.email})`}\n />\n \n )\n }\n\n let worklistButton\n if (this.props.showWorklistButton) {\n worklistButton = (\n \n \n this.handleReset(clearFilters)}\n size='small'\n style={{ width: 90 }}\n >\n Reset\n \n \n \n ),\n filterIcon: (filtered: boolean) => (\n \n )\n })\n}\n\nexport default withRouter(Worklist)\n","/**\n * Join a URI with a path to form a full URL.\n *\n * @param path - Path component\n * @param uri - Base URI to which the path component should be added\n */\nexport const joinUrl = (path: string, uri: string): string => {\n let baseUri = uri\n if (!baseUri.endsWith('/')) {\n baseUri += '/'\n }\n const url = new URL(path, baseUri)\n return url.toString()\n}\n\n/**\n * Check whether a URL contains an OAuth 2.0 authorization code.\n *\n * @param location - URL components (JavaScript location object)\n * @returns Whether the URL contains a code\n */\nexport const isAuthorizationCodeInUrl = (location: {\n search: string\n hash: string\n}): boolean => {\n const searchParams = new URLSearchParams(location.search)\n const hashParams = new URLSearchParams(location.hash.replace('#', '?'))\n\n return Boolean(\n searchParams.get('code') ??\n searchParams.get('id_token') ??\n searchParams.get('session_state') ??\n hashParams.get('code') ??\n hashParams.get('id_token') ??\n hashParams.get('session_state')\n )\n}\n","import { UserManager, User as UserData } from 'oidc-client'\n\nimport { OidcSettings } from '../AppConfig'\nimport { isAuthorizationCodeInUrl } from '../utils/url'\nimport { User, AuthManager, SignInCallback } from './'\nimport NotificationMiddleware,\n{ NotificationMiddlewareContext } from '../services/NotificationMiddleware'\nimport { CustomError, errorTypes } from '../utils/CustomError'\n\nconst createUser = (userData: UserData | null): User => {\n let profile\n if (userData !== null) {\n profile = userData.profile\n }\n\n if (profile !== undefined) {\n if (profile.name === undefined || profile.email === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user \"name\" and \"email\".'\n )\n )\n } else {\n return {\n name: profile.name,\n email: profile.email\n }\n }\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n return {\n name: undefined,\n email: undefined\n }\n}\n\nexport default class OidcManager implements AuthManager {\n private _oidc: UserManager\n\n constructor (baseUri: string, settings: OidcSettings) {\n let responseType = 'code'\n if (settings.grantType !== undefined) {\n if (settings.grantType === 'implicit') {\n responseType = 'id_token token'\n }\n }\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`\n })\n if (settings.endSessionEndpoint != null) {\n /*\n * Unfortunately, the end session endpoint alone cannot be provided to\n * the construction of UserManager and the other metadata parameters\n * would need to be provided as well. However, configuring all of them\n * individually would not be desirable and they will be automatically\n * determined anyways. Therefore, we first construct an object, get the\n * metadata, update the metadata, and then reconstruct an object with the\n * updated metadata.\n */\n this._oidc.metadataService.getMetadata().then(metadata => {\n if (settings.endSessionEndpoint != null) {\n metadata.end_session_endpoint = settings.endSessionEndpoint\n this._oidc = new UserManager({\n authority: settings.authority,\n client_id: settings.clientId,\n redirect_uri: baseUri,\n scope: settings.scope,\n response_type: responseType,\n loadUserInfo: true,\n automaticSilentRenew: true,\n revokeAccessTokenOnSignout: true,\n post_logout_redirect_uri: `${baseUri}/logout`,\n metadata\n })\n }\n }).catch((error) => {\n console.error(\n 'failed to get metadata from authorization server: ',\n error\n )\n })\n }\n }\n\n /**\n * Sign-in to authenticate the user and obtain authorization.\n */\n signIn = async ({ onSignIn }: {\n onSignIn?: SignInCallback\n }): Promise => {\n const handleSignIn = (userData: UserData): void => {\n const user = createUser(userData)\n const authorization = `${userData.token_type} ${userData.access_token}`\n if (onSignIn != null) {\n console.info('handling sign-in using provided callback function')\n onSignIn({ user: user, authorization: authorization })\n } else {\n console.warn('no callback function was provided to handle sign-in')\n }\n }\n\n if (isAuthorizationCodeInUrl(window.location)) {\n /* Handle the callback from the authorization server: extract the code\n * from the callback URL, obtain user information and the access token\n * for the DICOMweb server.\n */\n console.info('obtaining authorization')\n const userData = await this._oidc.signinCallback()\n if (userData != null) {\n console.info('obtained user data: ', userData)\n handleSignIn(userData)\n }\n } else {\n /* Redirect to the authorization server to authenticate the user\n * and authorize the application to obtain user information and access\n * the DICOMweb server.\n */\n const userData = await this._oidc.getUser()\n if (userData === null || userData.expired) {\n console.info('authenticating user')\n await this._oidc.signinRedirect()\n } else {\n console.info('user has already been authenticated')\n handleSignIn(userData)\n }\n }\n }\n\n /**\n * Sign-out to revoke authorization.\n */\n signOut = async (): Promise => {\n console.log('signing out user and revoking authorization')\n return await this._oidc.signoutRedirect()\n }\n\n /**\n * Get authorization. Requires prior sign-in.\n */\n getAuthorization = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData !== null) {\n return userData.access_token\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user profile.'\n )\n )\n }\n })\n }\n\n /**\n * Get user information. Requires prior sign-in.\n */\n getUser = async (): Promise => {\n return await this._oidc.getUser().then((userData) => {\n if (userData === null) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Failed to obtain user information.'\n )\n )\n }\n return createUser(userData)\n })\n }\n}\n","import retry from 'retry'\n\nimport {\n RetryRequestSettings,\n DICOMwebClientRequestHookMetadata\n} from '../AppConfig'\n\ntype RequestHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n) => XMLHttpRequest\n\n/**\n * Returns a configured retry request hook function\n * that can be used to add retry functionality to XHR request.\n *\n * Default options:\n * retries: 5\n * factor: 3\n * minTimeout: 1 * 1000\n * maxTimeout: 60 * 1000\n * randomize: true\n *\n * @param options\n * @param options.retires - Number of retries\n * @param options.factor - Factor\n * @param options.minTimeout - Min number of seconds to wait before next retry\n * @param options.maxTimeout - Max number of seconds to wait before next retry\n * @param options.randomize - Whether randomization should be applied\n * @param options.retryableStatusCodes HTTP status codes that can trigger a retry\n * @returns Configured retry request function\n */\nexport const getXHRRetryHook = (options: RetryRequestSettings = {\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n retryableStatusCodes: [429, 500]\n}): RequestHook => {\n const retryOptions = options\n\n if (options.retries != null) {\n retryOptions.retries = options.retries\n }\n\n if (options.factor != null) {\n retryOptions.factor = options.factor\n }\n\n if (options.minTimeout != null) {\n retryOptions.minTimeout = options.minTimeout\n }\n\n if (options.maxTimeout != null) {\n retryOptions.maxTimeout = options.maxTimeout\n }\n\n if (options.randomize != null) {\n retryOptions.randomize = options.randomize\n }\n\n if (options.retryableStatusCodes != null) {\n retryOptions.retryableStatusCodes = options.retryableStatusCodes\n }\n\n /**\n * Request hook used to add retry functionality to XHR requests.\n *\n * @param request - XHR request instance\n * @param metadata - Metadata about the request\n * @param metadata.url - URL\n * @param metadata.method - HTTP method\n * @returns - XHR request instance (potentially modified)\n */\n const xhrRetryHook = (\n request: XMLHttpRequest,\n metadata: DICOMwebClientRequestHookMetadata\n ): XMLHttpRequest => {\n const { url, method } = metadata\n\n function faultTolerantRequestSend (...args: any): void {\n const operation = retry.operation(retryOptions)\n\n operation.attempt(function operationAttempt (currentAttempt) {\n const originalOnReadyStateChange = request.onreadystatechange\n\n /** Overriding/extending XHR function */\n request.onreadystatechange = function onReadyStateChange (...args: any): void {\n if (originalOnReadyStateChange != null) {\n originalOnReadyStateChange.apply(request, args)\n }\n\n if (retryOptions.retryableStatusCodes.includes(request.status)) {\n const errorMessage = `Attempt to request ${url} failed.`\n const attemptFailedError = new Error(errorMessage)\n operation.retry(attemptFailedError)\n }\n }\n\n /** Call open only on retry (after headers and other things were set in the xhr instance) */\n if (currentAttempt > 1) {\n console.warn(`Requesting ${url}... (attempt: ${currentAttempt})`)\n request.open(method, url, true)\n }\n })\n\n originalRequestSend.apply(request, args)\n }\n\n /** Overriding/extending XHR function */\n const originalRequestSend = request.send\n request.send = faultTolerantRequestSend\n\n return request\n }\n\n return xhrRetryHook\n}\n\nexport default getXHRRetryHook\n","import * as dwc from 'dicomweb-client'\nimport * as dcmjs from 'dcmjs'\nimport * as dmv from 'dicom-microscopy-viewer'\n\nimport { ServerSettings, DicomWebManagerErrorHandler } from './AppConfig'\nimport { joinUrl } from './utils/url'\nimport getXHRRetryHook from './utils/xhrRetryHook'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\nimport DicomMetadataStore, { Instance } from './services/DICOMMetadataStore'\n\nconst { naturalizeDataset } = dcmjs.data.DicomMetaDictionary\n\ninterface Store {\n id: string\n read: boolean\n write: boolean\n client: dwc.api.DICOMwebClient\n}\n\nexport default class DicomWebManager implements dwc.api.DICOMwebClient {\n private readonly stores: Store[] = []\n\n private readonly handleError: DicomWebManagerErrorHandler\n\n constructor ({ baseUri, settings, onError }: {\n baseUri: string\n settings: ServerSettings[]\n onError?: DicomWebManagerErrorHandler\n }) {\n if (onError != null) {\n this.handleError = onError\n } else {\n this.handleError = (error, serverSettings) => {\n console.error(error, serverSettings)\n }\n }\n\n settings.forEach(serverSettings => {\n if (serverSettings === undefined) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'At least one server needs to be configured.'\n )\n )\n }\n\n let serviceUrl\n if (serverSettings.url !== undefined) {\n serviceUrl = serverSettings.url\n } else if (serverSettings.path !== undefined) {\n serviceUrl = joinUrl(serverSettings.path, baseUri)\n } else {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Either path or full URL needs to be configured for server.'\n )\n )\n }\n\n const hasHttpsUrl = (url?: string): boolean => url?.startsWith('https') ?? false\n\n const clientSettings: dwc.api.DICOMwebClientOptions = {\n url: serviceUrl\n }\n\n const shouldUpgradeInsecure = serverSettings.upgradeInsecureRequests === true && [\n serviceUrl,\n serverSettings.qidoPathPrefix,\n serverSettings.wadoPathPrefix,\n serverSettings.stowPathPrefix\n ].some(hasHttpsUrl)\n\n if (serverSettings.qidoPathPrefix !== undefined) {\n clientSettings.qidoURLPrefix = serverSettings.qidoPathPrefix\n }\n if (serverSettings.wadoPathPrefix !== undefined) {\n clientSettings.wadoURLPrefix = serverSettings.wadoPathPrefix\n }\n if (serverSettings.stowPathPrefix !== undefined) {\n clientSettings.stowURLPrefix = serverSettings.stowPathPrefix\n }\n\n if (shouldUpgradeInsecure) {\n clientSettings.headers = {\n ...clientSettings.headers,\n 'Content-Security-Policy': 'upgrade-insecure-requests'\n }\n }\n\n if (serverSettings.retry !== undefined) {\n clientSettings.requestHooks = [getXHRRetryHook(serverSettings.retry)]\n }\n\n clientSettings.errorInterceptor = (error: dwc.api.DICOMwebClientError) => {\n this.handleError(error, serverSettings)\n }\n\n this.stores.push({\n id: serverSettings.id,\n write: serverSettings.write ?? false,\n read: serverSettings.read ?? true,\n client: new dwc.api.DICOMwebClient(clientSettings)\n })\n })\n\n if (this.stores.length > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one store is supported for now.'\n )\n )\n }\n }\n\n get baseURL (): string {\n return this.stores[0].client.baseURL\n }\n\n updateHeaders = (fields: { [name: string]: string }): void => {\n for (const f in fields) {\n this.stores[0].client.headers[f] = fields[f]\n }\n }\n\n get headers (): { [name: string]: string } {\n return this.stores[0].client.headers\n }\n\n storeInstances = async (\n options: dwc.api.StoreInstancesOptions\n ): Promise => {\n if (this.stores[0].write) {\n return await this.stores[0].client.storeInstances(options)\n } else {\n return await Promise.reject(\n new Error('Store is not writable.')\n )\n }\n }\n\n searchForStudies = async (\n options: dwc.api.SearchForStudiesOptions\n ): Promise => {\n return await this.stores[0].client.searchForStudies(options)\n }\n\n searchForSeries = async (\n options: dwc.api.SearchForSeriesOptions\n ): Promise => {\n return await this.stores[0].client.searchForSeries(options)\n }\n\n searchForInstances = async (\n options: dwc.api.SearchForInstancesOptions\n ): Promise => {\n return await this.stores[0].client.searchForInstances(options)\n }\n\n retrieveStudyMetadata = async (\n options: dwc.api.RetrieveStudyMetadataOptions\n ): Promise => {\n const studySummaryMetadata = await this.stores[0].client.retrieveStudyMetadata(options)\n const naturalized = naturalizeDataset(studySummaryMetadata)\n DicomMetadataStore.addStudy(naturalized)\n return studySummaryMetadata\n }\n\n retrieveSeriesMetadata = async (\n options: dwc.api.RetrieveSeriesMetadataOptions\n ): Promise => {\n const seriesSummaryMetadata = await this.stores[0].client.retrieveSeriesMetadata(options)\n console.debug('seriesSummaryMetadata:', seriesSummaryMetadata)\n const naturalized = seriesSummaryMetadata.map(naturalizeDataset)\n console.debug('naturalized:', naturalized)\n DicomMetadataStore.addSeriesMetadata(naturalized, true)\n return seriesSummaryMetadata\n }\n\n retrieveInstanceMetadata = async (\n options: dwc.api.RetrieveInstanceMetadataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceMetadata(options)\n }\n\n retrieveInstance = async (\n options: dwc.api.RetrieveInstanceOptions\n ): Promise => {\n const instance = await this.stores[0].client.retrieveInstance(options)\n const data = dcmjs.data.DicomMessage.readFile(instance)\n const { dataset } = dmv.metadata.formatMetadata(data.dict)\n DicomMetadataStore.addInstances([dataset as Instance])\n return instance\n }\n\n retrieveInstanceFrames = async (\n options: dwc.api.RetrieveInstanceFramesOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFrames(options)\n }\n\n retrieveInstanceRendered = async (\n options: dwc.api.RetrieveInstanceRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceRendered(options)\n }\n\n retrieveInstanceFramesRendered = async (\n options: dwc.api.RetrieveInstanceFramesRenderedOptions\n ): Promise => {\n return await this.stores[0].client.retrieveInstanceFramesRendered(options)\n }\n\n retrieveBulkData = async (\n options: dwc.api.RetrieveBulkDataOptions\n ): Promise => {\n return await this.stores[0].client.retrieveBulkData(options)\n }\n}\n","import React from 'react'\nimport {\n BrowserRouter,\n Navigate,\n Route,\n Routes,\n useParams\n} from 'react-router-dom'\nimport { Layout, message } from 'antd'\nimport { FaSpinner } from 'react-icons/fa'\nimport * as dwc from 'dicomweb-client'\n\nimport AppConfig, { ServerSettings, ErrorMessageSettings } from './AppConfig'\nimport CaseViewer from './components/CaseViewer'\nimport Header from './components/Header'\nimport InfoPage from './components/InfoPage'\nimport Worklist from './components/Worklist'\n\nimport { User, AuthManager } from './auth'\nimport OidcManager from './auth/OidcManager'\nimport { StorageClasses } from './data/uids'\nimport DicomWebManager from './DicomWebManager'\nimport { joinUrl } from './utils/url'\nimport { CustomError, errorTypes } from './utils/CustomError'\nimport NotificationMiddleware, {\n NotificationMiddlewareContext\n} from './services/NotificationMiddleware'\n\nfunction ParametrizedCaseViewer ({ clients, user, app, config }: {\n clients: { [key: string]: DicomWebManager }\n user?: User\n app: {\n name: string\n version: string\n uid: string\n organization?: string\n }\n config: AppConfig\n}): JSX.Element {\n const { studyInstanceUID } = useParams()\n\n const enableAnnotationTools = !(config.disableAnnotationTools ?? false)\n const preload = config.preload ?? false\n return (\n \n )\n}\n\nfunction _createClientMapping ({ baseUri, gcpBaseUrl, settings, onError }: {\n baseUri: string\n gcpBaseUrl: string\n settings: ServerSettings[]\n onError: (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ) => void\n}): { [sopClassUID: string]: DicomWebManager } {\n const storageClassMapping: { [key: string]: number } = { default: 0 }\n const clientMapping: { [sopClassUID: string]: DicomWebManager } = {}\n\n settings.forEach(serverSettings => {\n if (serverSettings.storageClasses != null) {\n serverSettings.storageClasses.forEach(sopClassUID => {\n if (Object.values(StorageClasses).includes(sopClassUID)) {\n if (sopClassUID in storageClassMapping) {\n storageClassMapping[sopClassUID] += 1\n } else {\n storageClassMapping[sopClassUID] = 1\n }\n } else {\n console.warn(\n `unknown storage class \"${sopClassUID}\" specified ` +\n `for configured server \"${serverSettings.id}\"`\n )\n }\n })\n } else {\n if (window.location.pathname.includes('/projects/')) {\n const pathname = window.location.pathname.split('/study/')[0]\n const pathUrl = `${gcpBaseUrl}${pathname}/dicomWeb`\n serverSettings.url = pathUrl\n }\n\n storageClassMapping.default += 1\n clientMapping.default = new DicomWebManager({\n baseUri,\n settings: [serverSettings],\n onError\n })\n }\n })\n\n if (storageClassMapping.default > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one default server can be configured without specification ' +\n 'of storage classes.'\n )\n )\n }\n\n for (const key in storageClassMapping) {\n if (key === 'default') {\n continue\n }\n if (storageClassMapping[key] > 1) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'Only one configured server can specify a given storage class. ' +\n `Storage class \"${key}\" is specified by more than one ` +\n 'of the configured servers.'\n )\n )\n }\n }\n\n if (Object.keys(storageClassMapping).length > 1) {\n settings.forEach(server => {\n const client = new DicomWebManager({\n baseUri,\n settings: [server],\n onError\n })\n if (server.storageClasses != null) {\n server.storageClasses.forEach(sopClassUID => {\n clientMapping[sopClassUID] = client\n })\n }\n })\n }\n\n Object.values(StorageClasses).forEach(sopClassUID => {\n if (!(sopClassUID in clientMapping)) {\n clientMapping[sopClassUID] = clientMapping.default\n }\n })\n return clientMapping\n}\n\ninterface AppProps {\n name: string\n homepage: string\n version: string\n config: AppConfig\n}\n\ninterface AppState {\n clients: { [sopClassUID: string]: DicomWebManager }\n user?: User\n isLoading: boolean\n redirectTo?: string\n wasAuthSuccessful: boolean\n error?: ErrorMessageSettings\n}\n\nclass App extends React.Component {\n private readonly auth?: AuthManager\n\n private readonly handleDICOMwebError = (\n error: dwc.api.DICOMwebClientError,\n serverSettings: ServerSettings\n ): void => {\n if (error.status === 401) {\n this.signIn()\n } else if (error.status === 403) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'User is not authorized to access DICOMweb resources.')\n )\n }\n\n const logServerError = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.DICOMWEB,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'An unexpected server error occured.'\n )\n )\n }\n\n if (serverSettings.errorMessages !== undefined) {\n serverSettings.errorMessages.forEach((setting: ErrorMessageSettings) => {\n if (error.status === setting.status) {\n this.setState({\n error: {\n status: error.status,\n message: setting.message\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n })\n } else if (error.status === 500) {\n logServerError()\n }\n }\n\n constructor (props: AppProps) {\n super(props)\n\n console.info('instatiate app')\n console.info(`app is located at \"${props.config.path}\"`)\n const { protocol, host } = window.location\n const baseUri = `${protocol}//${host}`\n const appUri = joinUrl(props.config.path, baseUri)\n\n const oidcSettings = props.config.oidc\n if (oidcSettings !== undefined) {\n console.info(\n 'app uses the following OIDC configuration: ',\n props.config.oidc\n )\n this.auth = new OidcManager(appUri, oidcSettings)\n }\n\n if (props.config.servers.length === 0) {\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.SLIM,\n new CustomError(\n errorTypes.COMMUNICATION,\n 'One server needs to be configured.')\n )\n }\n console.info(\n 'app uses the following DICOMweb server configuration: ',\n props.config.servers\n )\n\n this.handleServerSelection = this.handleServerSelection.bind(this)\n\n message.config({ duration: 5 })\n this.addGcpSecondaryAnnotationServer(props.config)\n\n this.state = {\n clients: _createClientMapping({\n baseUri,\n gcpBaseUrl: props.config.gcpBaseUrl ?? 'https://healthcare.googleapis.com/v1',\n settings: props.config.servers,\n onError: this.handleDICOMwebError\n }),\n isLoading: true,\n wasAuthSuccessful: false\n }\n }\n\n addGcpSecondaryAnnotationServer (config: AppProps['config']): void {\n const serverId = 'gcp_secondary_annotation_server'\n const urlParams = new URLSearchParams(window.location.search)\n const url = urlParams.get('gcp')\n const gcpSecondaryAnnotationServer = config.servers.find(\n (server) => server.id === serverId\n )\n if (gcpSecondaryAnnotationServer === undefined && typeof url === 'string') {\n config.servers.push({\n id: serverId,\n write: true,\n url,\n storageClasses: [\n StorageClasses.COMPREHENSIVE_SR,\n StorageClasses.COMPREHENSIVE_3D_SR,\n StorageClasses.SEGMENTATION,\n StorageClasses.MICROSCOPY_BULK_SIMPLE_ANNOTATION,\n StorageClasses.PARAMETRIC_MAP,\n StorageClasses.ADVANCED_BLENDING_PRESENTATION_STATE,\n StorageClasses.COLOR_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.GRAYSCALE_SOFTCOPY_PRESENTATION_STATE,\n StorageClasses.PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE\n ]\n })\n }\n }\n\n handleServerSelection ({ url }: { url: string }): void {\n console.info('select DICOMweb server: ', url)\n const tmpClient = new DicomWebManager({\n baseUri: '',\n settings: [{\n id: 'tmp',\n url,\n read: true,\n write: false\n }],\n onError: this.handleDICOMwebError\n })\n tmpClient.updateHeaders(this.state.clients.default.headers)\n /**\n * Use the newly created client for all storage classes. We may want to\n * make this more sophisticated in the future to allow users to override\n * the entire server configuration.\n */\n this.setState(state => {\n const clients: { [key: string]: DicomWebManager } = {}\n for (const key in state.clients) {\n clients[key] = tmpClient\n }\n return { clients }\n })\n }\n\n /**\n * Handle successful authentication event.\n *\n * Authorizes the DICOMweb client to access the DICOMweb server and directs\n * the user back to the App.\n *\n * @param user - Information about the user\n * @param authorization - Value of the \"Authorization\" HTTP header field\n */\n handleSignIn = ({ user, authorization }: {\n user: User\n authorization: string\n }): void => {\n for (const key in this.state.clients) {\n const client = this.state.clients[key]\n client.updateHeaders({ Authorization: authorization })\n }\n const storedPath = window.localStorage.getItem('slim_path')\n const storedSearch = window.localStorage.getItem('slim_search')\n if (storedPath != null) {\n const currentPath = window.location.pathname\n if (storedPath !== currentPath) {\n let path = storedPath\n if (storedSearch != null) {\n path += storedSearch\n }\n window.location.href = path\n }\n }\n window.localStorage.removeItem('slim_path')\n window.localStorage.removeItem('slim_search')\n this.setState({ user: user })\n }\n\n signIn (): void {\n if (this.auth !== undefined) {\n console.info('try to sign in user')\n this.auth.signIn({ onSignIn: this.handleSignIn }).then(() => {\n console.info('sign-in was successful')\n this.setState({\n isLoading: false,\n wasAuthSuccessful: true\n })\n }).catch((error) => {\n console.error(error)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n NotificationMiddleware.onError(\n NotificationMiddlewareContext.AUTH,\n new CustomError(\n errorTypes.AUTHENTICATION,\n 'Could not sign-in user.')\n )\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: false\n })\n })\n } else {\n this.setState({\n isLoading: false,\n redirectTo: undefined,\n wasAuthSuccessful: true\n })\n }\n }\n\n componentDidMount (): void {\n const path = window.localStorage.getItem('slim_path')\n if (path == null) {\n window.localStorage.setItem('slim_path', window.location.pathname)\n window.localStorage.setItem('slim_search', window.location.search)\n }\n this.signIn()\n }\n\n render (): React.ReactNode {\n const appInfo = {\n name: this.props.name,\n version: this.props.version,\n homepage: this.props.homepage,\n uid: '1.2.826.0.1.3680043.9.7433.1.5',\n organization: this.props.config.organization\n }\n\n const enableWorklist = !(\n this.props.config.disableWorklist ?? false\n )\n const enableServerSelection = (\n this.props.config.enableServerSelection ?? false\n )\n\n let worklist\n if (enableWorklist) {\n worklist = \n } else {\n worklist =
Worklist has been disabled.
\n }\n\n let isLogoutPossible = false\n let onLogout: () => void\n if (\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n this.props.config.oidc != null &&\n this.props.config.oidc.endSessionEndpoint != null\n ) {\n onLogout = (): void => {\n if (this.auth != null) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.auth.signOut()\n }\n }\n isLogoutPossible = true\n } else {\n onLogout = () => {}\n isLogoutPossible = false\n }\n\n const layoutStyle = { height: '100vh' }\n const layoutContentStyle = { height: '100%' }\n\n if (this.state.redirectTo !== undefined) {\n return (\n \n \n \n )\n } else if (this.state.isLoading) {\n return (\n \n \n \n \n \n \n \n \n )\n } else if (!this.state.wasAuthSuccessful) {\n return (\n \n )\n } else if (this.state.error != null) {\n return (\n \n )\n } else {\n return (\n \n \n \n \n \n {worklist}\n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n \n \n \n \n }\n />\n \n \n Logged out\n \n }\n />\n \n \n )\n }\n }\n}\n\nexport default App\n"],"names":["Description","layout","labelLineHeight","undefined","this","props","hasLongValues","items","attributes","map","item","index","uid","generateUUID","label","name","labelStyle","lineHeight","contentStyle","fontWeight","whiteSpace","span","value","icon","title","header","extra","size","hoverable","selectable","bordered","actions","methods","column","children","React","metadata","ClinicalTrialSponsorName","push","ClinicalTrialProtocolID","ClinicalTrialProtocolName","ClinicalTrialSiteName","ClinicalTrialTimePointID","parseName","Alphabetic","split","join","parseDate","year","substring","month","day","parseTime","hours","minutes","seconds","parseSex","F","M","O","PatientID","PatientName","PatientSex","PatientBirthDate","AccessionNumber","StudyID","StudyDate","StudyTime","StorageClasses","_subscriptions","Symbol","_lastSubscriptionId","PubSub","eventName","callback","Error","hasOwnProperty","subscriptionId","callbacks","payload","errorTypes","CustomError","type","message","stack","NotificationMiddlewareEvents","NotificationMiddlewareContext","NotificationType","NotificationSourceDefinition","sources","category","notificationType","outerContext","args","publish","Array","from","warn","console","JSON","stringify","arguments","includes","apply","prototype","slice","call","source","error","notificationMsg","errorCategory","find","s","String","notification","description","duration","state","isLoading","overviewViewportRef","overviewViewer","setState","slide","overviewImages","length","current","innerHTML","info","ContainerIdentifier","dmv","client","clients","VL_WHOLE_SLIDE_MICROSCOPY_IMAGE","resizeFactor","errorInterceptor","NotificationMiddleware","render","container","resize","style","height","containerIdentifier","ref","seriesInstanceUIDs","selectedSeriesInstanceUID","onSeriesSelection","seriesInstanceUID","slideList","slideItemList","i","slideItem","selectedKeys","width","onSelect","key","keyPath","domEvent","toString","mode","inlineIndent","handleVisibilityChange","bind","checked","event","onVisibilityChange","roiUID","roi","isVisible","identifier","otherProps","evaluations","forEach","nameValue","ConceptNameCodeSequence","CodeValue","nameMeaning","CodeMeaning","ValueType","dcmjs","valueMeaning","ConceptCodeSequence","textContentItem","TextValue","measurements","seq","MeasuredValueSequence","NumericValue","toPrecision","unit","MeasurementUnitsCodeSequence","align","paddingLeft","onChange","checkedChildren","unCheckedChildren","handleMenuItemSelection","rois","visibleRoiUIDs","object","onSelection","has","paddingTop","paddingBottom","selectedRoiUIDs","values","onClick","handleMeasurementSelection","handleOpacityChange","handleColorRChange","handleColorGChange","handleColorBChange","getCurrentColor","currentStyle","opacity","defaultStyle","color","annotationGroupUID","annotationGroup","onStyleChange","styleOptions","limitValues","isArray","option","codeComponents","measurement","schemeDesignator","meaning","colorSettings","windowSettings","explorationSettings","AnnotationGroupSequence","findIndex","AnnotationGroupUID","propertyType","propertyCategory","GraphicType","AnnotationCoordinateType","measurementsSequence","MeasurementsSequence","measurementOptions","measurementItem","CodingSchemeDesignator","dropdownMatchSelectWidth","disabled","plain","justify","gutter","range","min","max","step","handleLowerLimitChange","handleLimitChange","handleUpperLimitChange","minWidth","defaultValue","settings","isBadgeVisible","direction","placement","content","overlayStyle","shape","SettingOutlined","offset","count","borderStyle","borderWidth","borderColor","visibility","backgroundImage","annotationGroups","visibleAnnotationGroupUIDs","defaultAnnotationGroupStyles","onAnnotationGroupVisibilityChange","onAnnotationGroupStyleChange","handleClick","text","button","Icon","isSelected","tooltip","Manufacturer","ManufacturerModelName","DeviceSerialNumber","SoftwareVersions","InstitutionName","findContentItemsByName","concept","hasName","hasValueType","valueType","getROIs","report","matches","ContentSequence","measurementsItem","measurementGroupItems","observerType","group","trackingUIDItem","algorithmNameItem","algorithmVersionItem","scoord3d","regionItem","frameOfReferenceUID","ReferencedFrameOfReferenceUID","coordinates","GraphicData","evaluation","findEvaluationItems","findMeasurementItems","properties","trackingUID","UID","MeasurementReport","PersonObserverName","PersonObserverLoginName","DeviceObserverUID","DeviceObserverName","SpecimenUID","SpecimenIdentifier","ROIs","specimenUIDItem","specimenIdItem","containerIdItem","personNameItem","PersonName","personLoginNameItem","deviceUIDItem","deviceNameItem","dataset","containerAttrs","specimenAttrs","observerAttrs","annotations","id","attrs","orientation","groups","SpecimenPreparationAdditives","FIXATIVE","EMBEDDING_MEDIUM","SpecimenPreparationStepItems","SPECIMEN_IDENTIFIER","PARENT_SPECIMEN_IDENTIFIER","PROCESSING_TYPE","DATETIME_OF_PROCESSING","PROCESSING_STEP_DESCRIPTION","COLLECTION_METHOD","SAMPLING_METHOD","STAIN","specimenDescription","SpecimenDescriptionSequence","SpecimenShortDescription","PrimaryAnatomicStructureSequence","structures","SpecimenPreparationSequence","SpecimenPreparationStepContentItemSequence","equals","showstain","overflowY","handleRemoval","getCurrentColors","paletteColorLookupTable","previousProps","previousState","opticalPath","opticalPathIdentifier","rgb2hex","data","onRemoval","illuminationWaveLength","illuminationColor","specimenDescriptions","maxValue","Math","pow","BitsAllocated","isMonochromatic","colors","buttons","isRemovable","DeleteOutlined","EyeOutlined","EyeInvisibleOutlined","Option","Select","selectedOpticalPathIdentifier","handleItemAddition","handleItemRemoval","handleItemSelectionChange","onOpticalPathActivityChange","isActive","opticalPathSelector","isSelectable","opticalPaths","opticalPathItems","optionItems","images","SeriesInstanceUID","OpticalPathSequence","opticalPathItem","OpticalPathIdentifier","OpticalPathDescription","activeOpticalPathIdentifiers","visibleOpticalPathIdentifiers","defaultOpticalPathStyles","onOpticalPathVisibilityChange","onOpticalPathStyleChange","padding","allowClear","AppstoreAddOutlined","mappingUID","mapping","mappings","visibleMappingUIDs","defaultMappingStyles","onMappingVisibilityChange","onMappingStyleChange","segmentUID","segment","algorithmName","segments","visibleSegmentUIDs","defaultSegmentStyles","onSegmentVisibilityChange","onSegmentStyleChange","withRouter","Component","location","useLocation","navigate","useNavigate","params","useParams","annotationGroupsUIDs","checkedAnnotationUids","defaultAnnotationStyles","types","checkAll","every","uids","indeterminate","some","handleChangeCheckedType","e","target","mouseEnterDelay","reduce","acc","marginLeft","shortenedCodeMeaning","displayCodeMeaning","isChecked","indeterminateType","display","flexDirection","categories","categoriesAcc","annotation","categoryKey","typeKey","oldCategory","oldType","Object","keys","typesArr","getCategories","xPosition","yPosition","position","top","left","backgroundColor","minHeight","pointerEvents","attr","DEFAULT_ROI_STROKE_COLOR","DEFAULT_ROI_FILL_COLOR","DEFAULT_ANNOTATION_STROKE_COLOR","DEFAULT_ANNOTATION_COLOR_PALETTE","_buildKey","codingScheme","codeValue","_getRoiKey","findingName","_formatRoiStyle","stroke","fill","image","circle","radius","_constructViewers","preload","volumeImages","labelViewer","volumeViewer","clientMapping","controls","activateSelectInteraction","labelImages","SlideViewer","findingOptions","evaluationOptions","geometryTypeOptions","volumeViewportRef","labelViewportRef","defaultRoiStyle","roiStyles","selectionColor","selectedRoiStyle","loadPresentationStates","ADVANCED_BLENDING_PRESENTATION_STATE","searchForInstances","studyInstanceUID","queryParams","Modality","then","matchedInstances","rawInstance","instance","SOPInstanceUID","retrieveInstance","sopInstanceUID","retrievedInstance","dict","areVolumeImagesMonochrome","presentationState","doesMatch","AdvancedBlendingSequence","blendingItem","selectedPresentationStateUID","setPresentationState","presentationStates","catch","getAllOpticalPaths","opticalPathStyles","hideOpticalPath","deactivateOpticalPath","getOpticalPathDefaultStyle","setOpticalPathStyle","refInstanceItems","ReferencedInstanceSequence","ReferencedImageSequence","imageItem","sopInstanceUIDs","ReferencedSOPInstanceUID","paletteColorLUT","PaletteColorLookupTableSequence","cpLUTItem","PaletteColorLookupTableUID","redDescriptor","RedPaletteColorLookupTableDescriptor","greenDescriptor","GreenPaletteColorLookupTableDescriptor","blueDescriptor","BluePaletteColorLookupTableDescriptor","redData","RedPaletteColorLookupTableData","Uint16Array","greenData","GreenPaletteColorLookupTableData","blueData","BluePaletteColorLookupTableData","redSegmentedData","SegmentedRedPaletteColorLookupTableData","greenSegmentedData","SegmentedGreenPaletteColorLookupTableData","blueSegmentedData","SegmentedBluePaletteColorLookupTableData","SoftcopyVOILUTSequence","voiLUTItem","windowCenter","WindowCenter","windowWidth","WindowWidth","selectedOpticalPathIdentifiers","Set","activateOpticalPath","showOpticalPath","add","searchParams","URLSearchParams","search","set","pathname","replace","getRoiStyle","addAnnotations","COMPREHENSIVE_3D_SR","SOPClassUID","templateSeq","ContentTemplateSequence","TemplateIdentifier","_implementsTID1500","subjectClassValue","retrievedConcept","expectedConcept","_describesSpecimenSubject","debug","measurementGroups","foundRegion","regions","_containsROIAnnotations","FrameOfReferenceUID","doesROIExist","getAllROIs","otherROI","a","b","graphicType","graphicData","s1","s2","j","_areROIsEqual","addROI","forceUpdate","addAnnotationGroups","MICROSCOPY_BULK_SIMPLE_ANNOTATION","searchForSeries","matchedSeries","series","retrieveSeriesMetadata","retrievedMetadata","ann","finding","AnnotationPropertyTypeCodeSequence","setAnnotationGroupStyle","addSegmentations","SEGMENTATION","segmentations","seg","refImage","addSegments","addParametricMaps","PARAMETRIC_MAP","parametricMaps","pm","addParameterMappings","populateViewports","setDefaultPresentationState","onRoiModified","onWindowResize","onRoiDrawn","detail","selectedFinding","selectedEvaluations","findingItem","relationshipType","addEvaluation","onRoiDoubleClicked","isSelectedRoiModalVisible","setHoveredRoiAttributes","hoveredRoi","hoveredRoiAttributes","onPointerMove","feature","evt","originalEvent","isHoveredRoiTooltipVisible","hoveredRoiTooltipX","clientX","hoveredRoiTooltipY","clientY","onRoiSelected","selectedRoi","setROIStyle","onLoadingStarted","onLoadingEnded","onFrameLoadingStarted","frameInfo","frameNumber","loadingFrames","onFrameLoadingError","onLoadingError","onFrameLoadingEnded","delete","sopClassUID","channelIdentifier","pixelDataStatistics","pixelArray","chunks","ceil","minValues","maxValues","pixels","stats","numFramesSampled","getOpticalPathStyle","onRoiRemoved","onKeyUp","isRoiDrawingActive","deactivateDrawInteraction","isRoiModificationActive","deactivateModifyInteraction","isRoiTranslationActive","deactivateTranslateInteraction","isAnnotationModalVisible","isGoToModalVisible","altKey","code","handleRoiDrawing","handleRoiModification","handleRoiTranslation","handleRoiRemoval","handleRoiVisibilityChange","handleReportGeneration","handleGoTo","geometryTypes","componentSetup","componentCleanup","handleRoiSelectionCancellation","handleAnnotationConfigurationCancellation","handleAnnotationGeometryTypeSelection","handleAnnotationMeasurementActivation","handleAnnotationFindingSelection","handleAnnotationEvaluationSelection","handleAnnotationEvaluationClearance","handleAnnotationConfigurationCompletion","handleAnnotationSelection","handleAnnotationVisibilityChange","handleAnnotationGroupVisibilityChange","handleAnnotationGroupStyleChange","handleRoiStyleChange","handleXCoordinateSelection","handleYCoordinateSelection","handleMagnificationSelection","handleSlidePositionSelection","handleSlidePositionSelectionCancellation","handleReportVerification","handleReportCancellation","handleSegmentVisibilityChange","handleSegmentStyleChange","handleMappingVisibilityChange","handleMappingStyleChange","handleOpticalPathVisibilityChange","handleOpticalPathStyleChange","handleOpticalPathActivityChange","handlePresentationStateSelection","handlePresentationStateReset","boundingBox","generatedReport","isSelectedMagnificationValid","isReportModalVisible","isSelectedXCoordinateValid","isSelectedYCoordinateValid","selectedXCoordinate","validXCoordinateRange","selectedYCoordinate","validYCoordinateRange","selectedMagnification","areRoisHidden","cleanup","isOpticalPathVisible","isOpticalPathActive","document","body","removeEventListener","window","addEventListener","hasICCProfile","ICCProfile","bulkdataReferences","selectedGeometryType","selectedMarkup","filteredEvaluations","filter","x","Number","start","end","y","targetPixelSpacing","diffs","numLevels","actualPixelSpacing","getPixelSpacing","abs","level","indexOf","point","log","geometryType","markup","activateDrawInteraction","getOpticalPathMetadata","observer","refSpecimen","user","loginName","email","observationContext","observerPersonContext","observerIdentifyingAttributes","observerDeviceContext","app","manufacturerName","modelName","subjectContext","subjectClass","subjectClassSpecificContext","imagingMeasurements","findingType","trackingIdentifier","referencedRegion","qualitativeEvaluations","MappingResource","measurementReport","languageOfContentItemAndDescendants","procedureReported","evidence","seriesNumber","seriesDescription","instanceNumber","manufacturer","previousVersions","fileMetaInformationVersionArray","Uint8Array","fileMeta","Value","buffer","vr","writer","write","storeInstances","datasets","response","getROI","showAnnotationGroup","hideAnnotationGroup","strokeColor","fillColor","c","generateRoiStyle","showSegment","hideSegment","setSegmentStyle","showParameterMapping","hideParameterMapping","setParameterMappingStyle","sort","localeCompare","paletteColorLookupTableUID","defaultColors","numVisible","urlPath","deactivateSelectInteraction","deactivateSnapInteraction","isModifyInteractionActive","activateSnapInteraction","activateModifyInteraction","isTranslateInteractionActive","activateTranslateInteraction","removeROI","areROIsVisible","hideROIs","showROIs","getAllSegments","getAllParameterMappings","allAnnotationGroups","getAllAnnotationGroups","filteredAnnotationGroups","referencedSeriesInstanceUID","annotationMenuItems","result","adaptRoiToAnnotation","openSubMenuItems","geometryTypeOptionsMapping","box","polygon","line","freehandpolygon","freehandline","annotationConfigurations","defaultActiveFirstOption","onClear","specimenMenu","equipmentMenu","opticalPathMetadata","presentationStateMenu","segmentationMenu","parametricMapMenu","annotationGroupMenu","toolbar","opticalPathMenu","presentationStateOptions","ContentDescription","maxWidth","UndoOutlined","segmentMetadata","getSegmentStyle","getSegmentMetadata","mappingMetadata","getParameterMappingStyle","getParameterMappingMetadata","annotationGroupMetadata","getAnnotationGroupStyle","getAnnotationGroupMetadata","toolbarHeight","annotationTools","FaDrawPolygon","FaHandPointer","FaHandPaper","FaTrash","FaEye","FaEyeSlash","FaSave","controlTools","FaCrosshairs","enableAnnotationTools","selectedRoiInformation","cursor","roiAttributes","roiScoordAttributes","roiEvaluationAttributes","codeItem","textItem","roiMeasurmentAttributesPerOpticalPath","refItems","ReferencedSOPSequence","ReferencedOpticalPathIdentifier","measuredValueItem","createRoiDescription","roiDescriptions","roiScoordDescriptions","roiEvaluationDescriptions","roiMeasurementDescriptions","descriptions","orientationMargin","dashed","hasSider","overflow","open","onOk","onCancel","okText","maskClosable","footer","placeholder","prefix","onPressEnter","addonAfter","CheckOutlined","StopOutlined","reverseArrow","borderLeft","borderLeftWidth","background","defaultOpenKeys","forceSubMenuRender","onOpenChange","setTimeout","ImageFlavors","hasImageFlavor","imageFlavor","ImageType","areSameAcquisition","AcquisitionUID","Slide","options","acquisitionUID","opticalPathIdentifiers","pyramidUIDs","acquisitionUIDs","containerIdentifiers","frameOfReferenceUIDs","VOLUME","LABEL","OVERVIEW","THUMBNAIL","PyramidUID","samplesPerPixel","SamplesPerPixel","requirePyramidUID","PhotometricInterpretation","createSlides","slideMetadata","filteredLabelImages","filteredVolumeImages","slideMetadataIndex","_doesImageBelongToSlide","filteredOverviewImages","slideMetadataItem","slides","imgA","imgB","fetchImageMetadata","onSuccess","onError","StudyInstanceUID","Promise","all","loadingSeries","seriesImages","newSlides","customError","slidesCache","Map","pendingRequests","useSlides","useState","setSlides","setIsLoading","setError","useEffect","cachedData","get","fetchSlides","pendingRequest","resolve","reject","err","ParametrizedSlideViewer","presentationStateUID","selectedSlide","viewer","volumeInstances","clinicalTrialMenu","seriesFragment","borderRight","borderRightWidth","path","element","DicomMetaDictionary","formatValue","val","getRows","depth","keywords","flatMap","keyword","tagInfo","nameMap","match","tag","sequenceItems","sequenceNode","getSortedTags","subscribe","_broadcastEvent","_unsubscribe","_isValidEvent","listenerId","subscription","listeners","unsubscribe","EVENTS","callbackProps","hasListeners","hasCallbacks","listener","defaultInstances","instances","instancesMap","SeriesNumber","SeriesDescription","SeriesDate","SeriesTime","addInstance","newInstance","addInstances","newInstances","len","getInstance","StudyDescription","NumInstances","ModalitiesInStudy","isLoaded","addInstanceToSeries","addInstancesToSeries","createSeriesMetadata","setSeriesMetadata","seriesMetadata","existingSeries","assign","STUDY_ADDED","INSTANCES_ADDED","SERIES_ADDED","SERIES_UPDATED","_model","studies","_getStudy","aStudy","_getSeries","study","aSeries","BaseImplementation","dicomJSONDatasetOrP10ArrayBuffer","dicomJSONDataset","naturalizedDataset","ArrayBuffer","createStudyMetadata","madeInClient","updateSeriesMetadata","addSeriesMetadata","seriesSummaryMetadata","NumberOfStudyRelatedSeries","addStudy","existingStudy","newStudy","getStudyInstanceUIDs","getStudy","getSeries","getInstanceByImageId","imageId","updateMetadataForSeries","pubSubServiceInterface","setStudy","displaySets","setDisplaySets","selectedDisplaySetInstanceUID","setSelectedDisplaySetInstanceUID","setInstanceNumber","filterValue","setFilterValue","expandedKeys","setExpandedKeys","searchInput","setSearchInput","debouncedSearchValue","delay","debouncedValue","setDebouncedValue","timer","clearTimeout","useDebounce","handler","DicomMetadataStore","seriesAddedSubscription","instancesAddedSubscription","derivedDisplaySets","processedSeries","ds","displaySetInstanceUID","displaySetList","useMemo","displaySet","displayDate","dateStr","hour","minute","second","monthNum","parseInt","dayNum","date","Date","getMonth","getDate","weekday","toLocaleDateString","monthName","dayFormatted","yearNum","getFullYear","formatDicomDate","showInstanceList","instanceSliderMarks","totalInstances","tableData","transformTagsToTableData","tags","parentKey","keyBase","currentKey","filteredData","searchLower","toLowerCase","nodes","results","searchNode","node","nodeMatches","matchingNode","child","findMatchingNodes","className","gap","marginBottom","flex","strong","optionLabelProp","optionFilterProp","fontSize","marks","formatter","SearchOutlined","columns","dataIndex","dataSource","pagination","expandable","expandedRowKeys","onExpandedRowsChange","scroll","handleInfoButtonClick","browser","detect","environment","os","version","Modal","homepage","handleDicomTagBrowserButtonClick","innerWidth","handleDebugButtonClick","errorMsgs","Authentication","Communication","EncodingDecoding","Visualization","errorNum","errorObj","warncount","Panel","Collapse","showErrorCount","errcount","uuidv4","warnings","warning","handleServerSelectionButtonClick","isServerSelectionModalVisible","isServerSelectionDisabled","prevProps","prevState","worklistButton","userMenuItems","onUserLogout","userMenu","menu","trigger","UserOutlined","preventDefault","showWorklistButton","to","UnorderedListOutlined","serverSelectionButton","infoButton","InfoOutlined","debugButton","dicomTagBrowserButton","FileSearchOutlined","showServerSelectionButton","ApiOutlined","handleServerSelection","url","selectedServerUrl","closeModal","startsWith","onServerSelection","src","process","alt","margin","currentTarget","isDisabled","URL","protocol","TypeError","alignItems","justifyContent","subTitle","defaultPageSize","handleSearch","confirm","handleReset","clearFilters","getColumnSearchProps","filterDropdown","setSelectedKeys","filterIcon","filtered","fetchData","handleChange","numStudies","pageSize","searchOptions","searchForStudies","limit","searchCriteria","fuzzymatching","filters","hideOnSinglePage","showSizeChanger","showQuickJumper","showTotal","total","rowKey","record","onRow","loading","joinUrl","uri","baseUri","endsWith","isAuthorizationCodeInUrl","hashParams","hash","Boolean","createUser","userData","profile","OidcManager","_oidc","signIn","onSignIn","handleSignIn","authorization","token_type","access_token","signinCallback","getUser","expired","signinRedirect","signOut","signoutRedirect","getAuthorization","responseType","grantType","UserManager","authority","client_id","clientId","redirect_uri","scope","response_type","loadUserInfo","automaticSilentRenew","revokeAccessTokenOnSignout","post_logout_redirect_uri","endSessionEndpoint","metadataService","getMetadata","end_session_endpoint","retries","factor","minTimeout","maxTimeout","randomize","retryableStatusCodes","retryOptions","xhrRetryHook","request","method","originalRequestSend","send","operation","retry","attempt","currentAttempt","originalOnReadyStateChange","onreadystatechange","status","errorMessage","attemptFailedError","naturalizeDataset","DicomWebManager","stores","handleError","updateHeaders","fields","f","headers","retrieveStudyMetadata","studySummaryMetadata","naturalized","retrieveInstanceMetadata","retrieveInstanceFrames","retrieveInstanceRendered","retrieveInstanceFramesRendered","retrieveBulkData","serverSettings","serviceUrl","clientSettings","shouldUpgradeInsecure","upgradeInsecureRequests","qidoPathPrefix","wadoPathPrefix","stowPathPrefix","qidoURLPrefix","wadoURLPrefix","stowURLPrefix","requestHooks","getXHRRetryHook","read","dwc","baseURL","ParametrizedCaseViewer","config","disableAnnotationTools","CaseViewer","_createClientMapping","gcpBaseUrl","storageClassMapping","default","storageClasses","pathUrl","server","auth","handleDICOMwebError","logServerError","errorMessages","setting","Authorization","storedPath","localStorage","getItem","storedSearch","href","removeItem","host","appUri","oidcSettings","oidc","servers","addGcpSecondaryAnnotationServer","wasAuthSuccessful","serverId","COMPREHENSIVE_SR","COLOR_SOFTCOPY_PRESENTATION_STATE","GRAYSCALE_SOFTCOPY_PRESENTATION_STATE","PSEUDOCOLOR_SOFTCOPY_PRESENTATION_STATE","tmpClient","redirectTo","setItem","worklist","appInfo","organization","enableWorklist","disableWorklist","enableServerSelection","onLogout","isLogoutPossible","layoutStyle","layoutContentStyle","basename"],"sourceRoot":""} \ No newline at end of file