-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectedStandaloneRouting.bundle.ecb78cbb7ce3e66fb3d9.js.map
1 lines (1 loc) · 18.9 KB
/
ConnectedStandaloneRouting.bundle.ecb78cbb7ce3e66fb3d9.js.map
1
{"version":3,"sources":["webpack:///./routes/StandaloneRouting.js","webpack:///./connectedComponents/ConnectedStandaloneRouting.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/node_modules/querystring-es3/index.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/node_modules/querystring-es3/decode.js","webpack:////Users/kaiyuhsu/Documents/projects/medervahealth/ohif-source/node_modules/querystring-es3/encode.js"],"names":["log","OHIF","metadata","studyMetadataManager","utils","OHIFStudyMetadata","StandaloneRouting","studies","server","studyInstanceUIDs","seriesInstanceUIDs","error","loading","query","Promise","resolve","reject","url","Error","oReq","XMLHttpRequest","addEventListener","warn","event","target","status","responseText","info","JSON","stringify","data","parse","servers","dicomWeb","type","props","activateServer","split","StudyInstanceUID","SeriesInstanceUID","metadataProvider","cornerstone","forEach","study","series","instances","instance","imageId","naturalizedDicom","addInstance","addImageIdToUIDs","SOPInstanceUID","open","setRequestHeader","send","search","this","location","slice","length","qs","parseQueryAndRetrieveDICOMWebData","_mapStudiesToNewFormat","updatedStudies","updatedStudiesInstanceUIDs","setState","message","state","NotFound","showGoBackButton","ConnectedViewer","ConnectedViewerRetrieveStudyData","Component","PropTypes","object","store","setServers","func","purge","uniqueStudyUIDs","Set","map","studyMetadata","sopClassHandlerModules","extensionManager","modules","displaySets","createDisplaySets","add","Array","from","ConnectedStandaloneRouting","connect","dispatch","exports","decode","encode","hasOwnProperty","obj","prop","Object","prototype","call","module","sep","eq","options","regexp","maxKeys","len","i","kstr","vstr","k","v","x","replace","idx","indexOf","substr","decodeURIComponent","isArray","push","xs","toString","stringifyPrimitive","isFinite","name","undefined","objectKeys","ks","encodeURIComponent","join","f","res","keys","key"],"mappings":"uqCAUQA,EAAy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AvCvB,OAAOC,UAAUuB,SAAStB,KAAKqB,IAGxC,SAAS1C,EAAK0C,EAAIU,GAChB,GAAIV,EAAG1C,IAAK,OAAO0C,EAAG1C,IAAIoD,GAE1B,IADA,IAAIC,EAAM,GACDxB,EAAI,EAAGA,EAAIa,EAAGhE,OAAQmD,IAC7BwB,EAAIZ,KAAKW,EAAEV,EAAGb,GAAIA,IAEpB,OAAOwB,EAGT,IAAIL,EAAa7B,OAAOmC,MAAQ,SAAUrC,GACxC,IAAIoC,EAAM,GACV,IAAK,IAAIE,KAAOtC,EACVE,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAKsC,IAAMF,EAAIZ,KAAKc,GAE/D,OAAOF","file":"ConnectedStandaloneRouting.bundle.ecb78cbb7ce3e66fb3d9.js","sourcesContent":["import React, { Component } from 'react';\nimport OHIF from '@ohif/core';\nimport PropTypes from 'prop-types';\nimport qs from 'querystring';\n\nimport { extensionManager } from './../App.js';\nimport ConnectedViewer from '../connectedComponents/ConnectedViewer';\nimport ConnectedViewerRetrieveStudyData from '../connectedComponents/ConnectedViewerRetrieveStudyData';\nimport NotFound from '../routes/NotFound';\n\nconst { log, metadata, utils } = OHIF;\nconst { studyMetadataManager } = utils;\nconst { OHIFStudyMetadata } = metadata;\n\nclass StandaloneRouting extends Component {\n state = {\n studies: null,\n server: null,\n studyInstanceUIDs: null,\n seriesInstanceUIDs: null,\n error: null,\n loading: true,\n };\n\n static propTypes = {\n location: PropTypes.object,\n store: PropTypes.object,\n setServers: PropTypes.func,\n };\n\n parseQueryAndRetrieveDICOMWebData(query) {\n return new Promise((resolve, reject) => {\n const url = query.url;\n\n if (!url) {\n return reject(new Error('No URL was specified. Use ?url=$yourURL'));\n }\n\n // Define a request to the server to retrieve the study data\n // as JSON, given a URL that was in the Route\n const oReq = new XMLHttpRequest();\n\n // Add event listeners for request failure\n oReq.addEventListener('error', error => {\n log.warn('An error occurred while retrieving the JSON data');\n reject(error);\n });\n\n // When the JSON has been returned, parse it into a JavaScript Object\n // and render the OHIF Viewer with this data\n oReq.addEventListener('load', event => {\n if (event.target.status === 404) {\n reject(new Error('No JSON data found'));\n }\n\n // Parse the response content\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText\n if (!oReq.responseText) {\n log.warn('Response was undefined');\n reject(new Error('Response was undefined'));\n }\n\n log.info(JSON.stringify(oReq.responseText, null, 2));\n\n const data = JSON.parse(oReq.responseText);\n if (data.servers) {\n if (!query.studyInstanceUIDs) {\n log.warn('No study instance uids specified');\n reject(new Error('No study instance uids specified'));\n }\n\n const server = data.servers.dicomWeb[0];\n server.type = 'dicomWeb';\n\n log.warn('Activating server', server);\n this.props.activateServer(server);\n\n const studyInstanceUIDs = query.studyInstanceUIDs.split(';');\n const seriesInstanceUIDs = query.seriesInstanceUIDs\n ? query.seriesInstanceUIDs.split(';')\n : [];\n\n resolve({ server, studyInstanceUIDs, seriesInstanceUIDs });\n } else {\n // Parse data here and add to metadata provider.\n const metadataProvider = OHIF.cornerstone.metadataProvider;\n\n let StudyInstanceUID;\n let SeriesInstanceUID;\n\n data.studies.forEach(study => {\n StudyInstanceUID = study.StudyInstanceUID;\n\n study.series.forEach(series => {\n SeriesInstanceUID = series.SeriesInstanceUID;\n\n series.instances.forEach(instance => {\n const { url: imageId, metadata: naturalizedDicom } = instance;\n\n // Add instance to metadata provider.\n metadataProvider.addInstance(naturalizedDicom);\n // Add imageId specific mapping to this data as the URL isn't necessarliy WADO-URI.\n metadataProvider.addImageIdToUIDs(imageId, {\n StudyInstanceUID,\n SeriesInstanceUID,\n SOPInstanceUID: naturalizedDicom.SOPInstanceUID,\n });\n });\n });\n });\n\n resolve({ studies: data.studies, studyInstanceUIDs: [] });\n }\n });\n\n // Open the Request to the server for the JSON data\n // In this case we have a server-side route called /api/\n // which responds to GET requests with the study data\n log.info(`Sending Request to: ${url}`);\n oReq.open('GET', url);\n oReq.setRequestHeader('Accept', 'application/json');\n\n // Fire the request to the server\n oReq.send();\n });\n }\n\n async componentDidMount() {\n try {\n let { search } = this.props.location;\n\n // Remove ? prefix which is included for some reason\n search = search.slice(1, search.length);\n const query = qs.parse(search);\n\n let {\n server,\n studies,\n studyInstanceUIDs,\n seriesInstanceUIDs,\n } = await this.parseQueryAndRetrieveDICOMWebData(query);\n\n if (studies) {\n const {\n studies: updatedStudies,\n studyInstanceUIDs: updatedStudiesInstanceUIDs,\n } = _mapStudiesToNewFormat(studies);\n studies = updatedStudies;\n studyInstanceUIDs = updatedStudiesInstanceUIDs;\n }\n\n this.setState({\n studies,\n server,\n studyInstanceUIDs,\n seriesInstanceUIDs,\n loading: false,\n });\n } catch (error) {\n this.setState({ error: error.message, loading: false });\n }\n }\n\n render() {\n const message = this.state.error\n ? `Error: ${JSON.stringify(this.state.error)}`\n : 'Loading...';\n if (this.state.error || this.state.loading) {\n return <NotFound message={message} showGoBackButton={this.state.error} />;\n }\n\n return this.state.studies ? (\n <ConnectedViewer studies={this.state.studies} />\n ) : (\n <ConnectedViewerRetrieveStudyData\n studyInstanceUIDs={this.state.studyInstanceUIDs}\n seriesInstanceUIDs={this.state.seriesInstanceUIDs}\n server={this.state.server}\n />\n );\n }\n}\n\nconst _mapStudiesToNewFormat = studies => {\n studyMetadataManager.purge();\n\n /* Map studies to new format, update metadata manager? */\n const uniqueStudyUIDs = new Set();\n const updatedStudies = studies.map(study => {\n const studyMetadata = new OHIFStudyMetadata(study, study.StudyInstanceUID);\n\n const sopClassHandlerModules =\n extensionManager.modules['sopClassHandlerModule'];\n study.displaySets =\n study.displaySets ||\n studyMetadata.createDisplaySets(sopClassHandlerModules);\n\n studyMetadataManager.add(studyMetadata);\n uniqueStudyUIDs.add(study.StudyInstanceUID);\n\n return study;\n });\n\n return {\n studies: updatedStudies,\n studyInstanceUIDs: Array.from(uniqueStudyUIDs),\n };\n};\n\nexport default StandaloneRouting;\n","import { connect } from 'react-redux';\nimport StandaloneRouting from '../routes/StandaloneRouting';\n\nconst mapDispatchToProps = dispatch => {\n return {\n activateServer: server => {\n const action = {\n type: 'ACTIVATE_SERVER',\n server,\n };\n dispatch(action);\n },\n };\n};\n\nconst ConnectedStandaloneRouting = connect(\n null,\n mapDispatchToProps\n)(StandaloneRouting);\n\nexport default ConnectedStandaloneRouting;\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n"],"sourceRoot":""}