-
Notifications
You must be signed in to change notification settings - Fork 0
/
18.bundle.12ed72312cc5c3ad29f8.js.map
1 lines (1 loc) · 19.6 KB
/
18.bundle.12ed72312cc5c3ad29f8.js.map
1
{"version":3,"sources":["webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/extensions/dicom-html/src/TypedArrayProp.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/extensions/dicom-html/src/DicomHtmlViewport.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/extensions/dicom-html/src/ConnectedDicomHtmlViewport.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/extensions/dicom-html/src/OHIFDicomHtmlViewport.js"],"names":["TypedArrayProp","any","props","propName","componentName","obj","Float64Array","Float32Array","Int32Array","Int16Array","Int8Array","Uint32Array","Uint16Array","Uint8Array","Uint8ClampedArray","Error","float64","float32","float","int32","int16","int8","int","uint32","uint16","uint8","uint8clamped","uint","dcmjs","data","DicomMetaDictionary","DicomMessage","getMainDataItem","key","value","DicomHtmlViewport","content","error","setViewportActive","viewportIndex","activeViewportIndex","this","setContentFromByteArray","byteArray","arrayBuffer","buffer","dicomData","readFile","dataset","naturalizeDataset","dict","_meta","namifyDataset","meta","mainData","root","patientValue","PatientName","PatientSex","PatientID","push","studyValue","StudyDescription","seriesValue","SeriesDescription","SeriesNumber","manufacturerValue","Manufacturer","ManufacturerModelName","DeviceSerialNumber","mainDataObjects","CompletionFlag","VerificationFlag","Object","keys","forEach","item","contentDateTimeValue","ContentDate","ContentTime","getMainData","contentSequence","getContentSequence","header","level","ConceptNameCodeSequence","CodeMeaning","CodeValue","CodingSchemeDesignator","HeaderDynamicLevel","setState","state","data-cy","className","onClick","setViewportActiveHandler","onScroll","JSON","stringify","Component","PropTypes","func","isRequired","number","OHIF","redux","actions","ConnectedDicomHtmlViewport","connect","ownProps","viewports","dispatch","DicomLoaderService","utils","OHIFDicomHtmlViewport","viewportData","displaySet","studies","findDicomDataPromise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KE,MAJA,EAAKqD,SAAS,CACZrD,UAGI,IAAItB,MAAMsB,Q,+BAMpB,OACE,oCACGI,KAAKkD,MAAMhD,WACV,kBAAC,EAAD,CACEA,UAAWF,KAAKkD,MAAMhD,UACtBJ,cAAeE,KAAKvC,MAAMqC,gBAG7BE,KAAKkD,MAAMtD,OAAS,4BAAK4D,KAAKC,UAAUzD,KAAKkD,MAAMtD,c,8BA1CxB8D,a,EAA9Be,E,YACe,CACjBG,QAASjB,IAAUoB,OACnBJ,WAAYhB,IAAUoB,OACtBjF,cAAe6D,IAAUG,OACzBY,aAAcf,IAAUoB,SA2CbN","file":"18.bundle.12ed72312cc5c3ad29f8.js","sourcesContent":["// https://github.com/facebook/prop-types/issues/69\n\nexport const TypedArrayProp = {\n any: (props, propName, componentName) => {\n let obj = props[propName];\n if (\n !(\n obj instanceof Float64Array ||\n obj instanceof Float32Array ||\n obj instanceof Int32Array ||\n obj instanceof Int16Array ||\n obj instanceof Int8Array ||\n obj instanceof Uint32Array ||\n obj instanceof Uint16Array ||\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray\n )\n ) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a typed array.'\n );\n }\n },\n\n float64: (props, propName, componentName) => {\n if (!(props[propName] instanceof Float64Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Float64Array.'\n );\n }\n },\n\n float32: (props, propName, componentName) => {\n if (!(props[propName] instanceof Float32Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Float32Array.'\n );\n }\n },\n\n float: (props, propName, componentName) => {\n if (\n !(\n props[propName] instanceof Float64Array ||\n props[propName] instanceof Float32Array\n )\n ) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Float32Array or Float64Array.'\n );\n }\n },\n\n int32: (props, propName, componentName) => {\n if (!(props[propName] instanceof Int32Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected an Int32Array.'\n );\n }\n },\n\n int16: (props, propName, componentName) => {\n if (!(props[propName] instanceof Int16Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected an In16Array.'\n );\n }\n },\n\n int8: (props, propName, componentName) => {\n if (!(props[propName] instanceof Int8Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected an Int8Array.'\n );\n }\n },\n\n int: (props, propName, componentName) => {\n if (\n !(\n props[propName] instanceof Int32Array ||\n props[propName] instanceof Int16Array ||\n props[propName] instanceof Int8Array\n )\n ) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected an Int32Array, In16Array, or Int8Array.'\n );\n }\n },\n\n uint32: (props, propName, componentName) => {\n if (!(props[propName] instanceof Uint32Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Uint32Array.'\n );\n }\n },\n\n uint16: (props, propName, componentName) => {\n if (!(props[propName] instanceof Uint16Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Uint16Array.'\n );\n }\n },\n\n uint8: (props, propName, componentName) => {\n if (!(props[propName] instanceof Uint8Array)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Uint8Array.'\n );\n }\n },\n\n uint8clamped: (props, propName, componentName) => {\n if (!(props[propName] instanceof Uint8ClampedArray)) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Uint8ClampedArray.'\n );\n }\n },\n\n uint: (props, propName, componentName) => {\n if (\n !(\n props[propName] instanceof Uint32Array ||\n props[propName] instanceof Uint16Array ||\n props[propName] instanceof Uint8Array ||\n props[propName] instanceof Uint8ClampedArray\n )\n ) {\n return new Error(\n 'Invalid prop `' +\n propName +\n '` supplied to' +\n ' `' +\n componentName +\n '`. Expected a Uint32Array, Uint16Array, Uint8Array, or Uint8ClampedArray.'\n );\n }\n }\n};\n\nexport { TypedArrayProp as default };\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport dcmjs from 'dcmjs';\nimport TypedArrayProp from './TypedArrayProp';\n\nimport './DicomHtmlViewport.css';\n\nfunction getRelationshipString(data) {\n switch (data.RelationshipType) {\n case 'HAS CONCEPT MOD':\n return 'Concept modifier: ';\n case 'HAS OBS CONTEXT':\n return 'Observation context: ';\n default:\n return '';\n }\n}\n\nconst getMeaningString = data => {\n if (data.ConceptNameCodeSequence) {\n const { CodeMeaning } = data.ConceptNameCodeSequence;\n\n return `${CodeMeaning} = `;\n }\n\n return '';\n};\n\nfunction getValueString(data) {\n switch (data.ValueType) {\n case 'CODE':\n const {\n CodeMeaning,\n CodeValue,\n CodingSchemeDesignator,\n } = data.ConceptNameCodeSequence;\n\n return `${CodeMeaning} (${CodeValue}, ${CodingSchemeDesignator})`;\n\n case 'PNAME':\n return data.PersonName;\n\n case 'TEXT':\n return data.TextValue;\n\n case 'UIDREF':\n return data.UID;\n\n case 'NUM':\n const { MeasuredValueSequence } = data;\n const numValue = MeasuredValueSequence.NumericValue;\n const codeValue =\n MeasuredValueSequence.MeasurementUnitsCodeSequence.CodeValue;\n return `${numValue} ${codeValue}`;\n }\n}\n\nfunction constructPlainValue(data) {\n const value = getValueString(data);\n\n if (value) {\n return getRelationshipString(data) + getMeaningString(data) + value;\n }\n}\n\nfunction constructContentSequence(data, header) {\n if (!data.ContentSequence) {\n return;\n }\n\n const items = data.ContentSequence.map(item => parseContent(item)).filter(\n item => item\n );\n\n if (!items.length) {\n return;\n }\n\n const result = {\n items,\n };\n\n if (header) {\n result.header = header;\n }\n\n return result;\n}\n\nfunction parseContent(data) {\n if (data.ValueType) {\n if (data.ValueType === 'CONTAINER') {\n const header = data.ConceptNameCodeSequence.CodeMeaning;\n\n return constructContentSequence(data, header);\n }\n\n return constructPlainValue(data);\n }\n\n if (data.ContentSequence) {\n return constructContentSequence(data);\n }\n}\n\nconst { DicomMetaDictionary, DicomMessage } = dcmjs.data;\n\nfunction getMainData(data) {\n const root = [];\n\n const patientValue = `${data.PatientName} (${data.PatientSex}, #${data.PatientID})`;\n root.push(getMainDataItem('Patient', patientValue));\n\n const studyValue = data.StudyDescription;\n root.push(getMainDataItem('Study', studyValue));\n\n const seriesValue = `${data.SeriesDescription} (#${data.SeriesNumber})`;\n root.push(getMainDataItem('Series', seriesValue));\n\n const manufacturerValue = `${data.Manufacturer} (${data.ManufacturerModelName}, #${data.DeviceSerialNumber})`;\n\n root.push(getMainDataItem('Manufacturer', manufacturerValue));\n\n const mainDataObjects = {\n CompletionFlag: 'Completion flag',\n VerificationFlag: 'Verification flag',\n };\n\n Object.keys(mainDataObjects).forEach(key => {\n if (!data[key]) {\n return;\n }\n\n const item = getMainDataItem(mainDataObjects[key], data[key]);\n\n root.push(item);\n });\n\n // TODO: Format these dates\n const contentDateTimeValue = `${data.ContentDate} ${data.ContentTime}`;\n root.push(getMainDataItem('Content Date/Time', contentDateTimeValue));\n\n root.push();\n\n return <div>{root}</div>;\n}\n\nconst getContentSequence = (data, level = 1) => {\n let header;\n\n if (data.ConceptNameCodeSequence) {\n const {\n CodeMeaning,\n CodeValue,\n CodingSchemeDesignator,\n } = data.ConceptNameCodeSequence;\n\n header = `${CodeMeaning} (${CodeValue} - ${CodingSchemeDesignator})`;\n }\n\n const root = [];\n if (header) {\n const HeaderDynamicLevel = `h${level}`;\n\n root.push(<HeaderDynamicLevel key={header}>{header}</HeaderDynamicLevel>);\n }\n\n Object.keys(data).forEach(key => {\n const value = data[key];\n\n let content;\n if (value instanceof Object) {\n content = getContentSequence(value, level + 1);\n } else {\n content = (\n <div key={key}>\n {key} - {data[key]}\n </div>\n );\n }\n\n root.push(content);\n });\n\n return <div>{root}</div>;\n};\n\nfunction getMainDataItem(key, value) {\n return (\n <div key={key}>\n <b>{key}</b>: {value}\n </div>\n );\n}\n\nclass DicomHtmlViewport extends Component {\n state = {\n content: null,\n error: null,\n };\n\n static propTypes = {\n byteArray: TypedArrayProp.uint8,\n setViewportActive: PropTypes.func.isRequired,\n viewportIndex: PropTypes.number.isRequired,\n activeViewportIndex: PropTypes.number.isRequired,\n };\n\n componentDidMount() {\n const dataSet = this.setContentFromByteArray(this.props.byteArray);\n }\n\n setContentFromByteArray(byteArray) {\n const arrayBuffer = byteArray.buffer;\n const dicomData = DicomMessage.readFile(arrayBuffer);\n const dataset = DicomMetaDictionary.naturalizeDataset(dicomData.dict);\n dataset._meta = DicomMetaDictionary.namifyDataset(dicomData.meta);\n\n const mainData = getMainData(dataset);\n const contentSequence = getContentSequence(dataset);\n const content = (\n <>\n {mainData}\n {contentSequence}\n </>\n );\n\n this.setState({\n content,\n });\n }\n\n setViewportActiveHandler = () => {\n const {\n setViewportActive,\n viewportIndex,\n activeViewportIndex,\n } = this.props;\n\n if (viewportIndex !== activeViewportIndex) {\n setViewportActive(viewportIndex);\n }\n };\n\n render() {\n const { content, error } = this.state;\n\n return (\n <div\n data-cy=\"dicom-html-viewport\"\n className=\"DicomHtmlViewport\"\n onClick={this.setViewportActiveHandler}\n onScroll={this.setViewportActiveHandler}\n >\n {content}\n {error && <h2>{JSON.stringify(error)}</h2>}\n </div>\n );\n }\n}\n\nexport default DicomHtmlViewport;\n","import OHIF from '@ohif/core';\nimport { connect } from 'react-redux';\nimport DicomHtmlViewport from './DicomHtmlViewport';\n\nconst { setViewportActive } = OHIF.redux.actions;\n\nconst mapStateToProps = (state, ownProps) => {\n const { viewportIndex, byteArray } = ownProps;\n const { activeViewportIndex } = state.viewports;\n\n return {\n viewportIndex,\n activeViewportIndex,\n byteArray,\n };\n};\n\nconst mapDispatchToProps = (dispatch, ownProps) => {\n const { viewportIndex } = ownProps;\n\n return {\n setViewportActive: () => {\n dispatch(setViewportActive(viewportIndex));\n },\n };\n};\n\nconst ConnectedDicomHtmlViewport = connect(\n mapStateToProps,\n mapDispatchToProps\n)(DicomHtmlViewport);\n\nexport default ConnectedDicomHtmlViewport;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport OHIF from '@ohif/core';\nimport ConnectedDicomHtmlViewport from './ConnectedDicomHtmlViewport';\n\nconst { DicomLoaderService } = OHIF.utils;\n\nclass OHIFDicomHtmlViewport extends Component {\n static propTypes = {\n studies: PropTypes.object,\n displaySet: PropTypes.object,\n viewportIndex: PropTypes.number,\n viewportData: PropTypes.object,\n };\n\n state = {\n byteArray: null,\n error: null,\n };\n\n componentDidMount() {\n const { displaySet, studies } = this.props.viewportData;\n\n DicomLoaderService.findDicomDataPromise(displaySet, studies).then(\n data => {\n const byteArray = new Uint8Array(data);\n this.setState({\n byteArray: byteArray,\n });\n },\n error => {\n this.setState({\n error,\n });\n\n throw new Error(error);\n }\n );\n }\n\n render() {\n return (\n <>\n {this.state.byteArray && (\n <ConnectedDicomHtmlViewport\n byteArray={this.state.byteArray}\n viewportIndex={this.props.viewportIndex}\n />\n )}\n {this.state.error && <h2>{JSON.stringify(this.state.error)}</h2>}\n </>\n );\n }\n}\n\nexport default OHIFDicomHtmlViewport;\n"],"sourceRoot":""}