| Total Complexity | 128 |
| Complexity/F | 1.8 |
| Lines of Code | 518 |
| Function Count | 71 |
| Duplicated Lines | 12 |
| Ratio | 2.32 % |
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like src/ohif/14.bundle.1cf6125c06ea4f1118bb.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
| 1 | (window["webpackJsonp"] = window["webpackJsonp"] || []).push([[14],{ |
||
| 2 | |||
| 3 | /***/ 1009: |
||
| 4 | /***/ (function(module, __webpack_exports__, __webpack_require__) { |
||
| 5 | |||
| 6 | "use strict"; |
||
| 7 | __webpack_require__.r(__webpack_exports__); |
||
| 8 | |||
| 9 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react/index.js |
||
| 10 | var react = __webpack_require__(0); |
||
| 11 | var react_default = /*#__PURE__*/__webpack_require__.n(react); |
||
| 12 | |||
| 13 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/prop-types/index.js |
||
| 14 | var prop_types = __webpack_require__(1); |
||
| 15 | var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types); |
||
| 16 | |||
| 17 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/platform/core/src/index.js + 33 modules |
||
| 18 | var src = __webpack_require__(13); |
||
| 19 | |||
| 20 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/react-redux/es/index.js + 21 modules |
||
| 21 | var es = __webpack_require__(59); |
||
| 22 | |||
| 23 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/node_modules/dcmjs/build/dcmjs.es.js |
||
| 24 | var dcmjs_es = __webpack_require__(30); |
||
| 25 | |||
| 26 | // CONCATENATED MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/extensions/dicom-html/src/TypedArrayProp.js |
||
| 27 | // https://github.com/facebook/prop-types/issues/69 |
||
| 28 | var TypedArrayProp = { |
||
| 29 | View Code Duplication | any: function any(props, propName, componentName) { |
|
|
|
|||
| 30 | var obj = props[propName]; |
||
| 31 | |||
| 32 | if (!(obj instanceof Float64Array || obj instanceof Float32Array || obj instanceof Int32Array || obj instanceof Int16Array || obj instanceof Int8Array || obj instanceof Uint32Array || obj instanceof Uint16Array || obj instanceof Uint8Array || obj instanceof Uint8ClampedArray)) { |
||
| 33 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a typed array.'); |
||
| 34 | } |
||
| 35 | }, |
||
| 36 | float64: function float64(props, propName, componentName) { |
||
| 37 | if (!(props[propName] instanceof Float64Array)) { |
||
| 38 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Float64Array.'); |
||
| 39 | } |
||
| 40 | }, |
||
| 41 | float32: function float32(props, propName, componentName) { |
||
| 42 | if (!(props[propName] instanceof Float32Array)) { |
||
| 43 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Float32Array.'); |
||
| 44 | } |
||
| 45 | }, |
||
| 46 | float: function float(props, propName, componentName) { |
||
| 47 | if (!(props[propName] instanceof Float64Array || props[propName] instanceof Float32Array)) { |
||
| 48 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Float32Array or Float64Array.'); |
||
| 49 | } |
||
| 50 | }, |
||
| 51 | int32: function int32(props, propName, componentName) { |
||
| 52 | if (!(props[propName] instanceof Int32Array)) { |
||
| 53 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected an Int32Array.'); |
||
| 54 | } |
||
| 55 | }, |
||
| 56 | int16: function int16(props, propName, componentName) { |
||
| 57 | if (!(props[propName] instanceof Int16Array)) { |
||
| 58 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected an In16Array.'); |
||
| 59 | } |
||
| 60 | }, |
||
| 61 | int8: function int8(props, propName, componentName) { |
||
| 62 | if (!(props[propName] instanceof Int8Array)) { |
||
| 63 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected an Int8Array.'); |
||
| 64 | } |
||
| 65 | }, |
||
| 66 | int: function int(props, propName, componentName) { |
||
| 67 | if (!(props[propName] instanceof Int32Array || props[propName] instanceof Int16Array || props[propName] instanceof Int8Array)) { |
||
| 68 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected an Int32Array, In16Array, or Int8Array.'); |
||
| 69 | } |
||
| 70 | }, |
||
| 71 | uint32: function uint32(props, propName, componentName) { |
||
| 72 | if (!(props[propName] instanceof Uint32Array)) { |
||
| 73 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Uint32Array.'); |
||
| 74 | } |
||
| 75 | }, |
||
| 76 | uint16: function uint16(props, propName, componentName) { |
||
| 77 | if (!(props[propName] instanceof Uint16Array)) { |
||
| 78 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Uint16Array.'); |
||
| 79 | } |
||
| 80 | }, |
||
| 81 | uint8: function uint8(props, propName, componentName) { |
||
| 82 | if (!(props[propName] instanceof Uint8Array)) { |
||
| 83 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Uint8Array.'); |
||
| 84 | } |
||
| 85 | }, |
||
| 86 | uint8clamped: function uint8clamped(props, propName, componentName) { |
||
| 87 | if (!(props[propName] instanceof Uint8ClampedArray)) { |
||
| 88 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Uint8ClampedArray.'); |
||
| 89 | } |
||
| 90 | }, |
||
| 91 | View Code Duplication | uint: function uint(props, propName, componentName) { |
|
| 92 | if (!(props[propName] instanceof Uint32Array || props[propName] instanceof Uint16Array || props[propName] instanceof Uint8Array || props[propName] instanceof Uint8ClampedArray)) { |
||
| 93 | return new Error('Invalid prop `' + propName + '` supplied to' + ' `' + componentName + '`. Expected a Uint32Array, Uint16Array, Uint8Array, or Uint8ClampedArray.'); |
||
| 94 | } |
||
| 95 | } |
||
| 96 | }; |
||
| 97 | |||
| 98 | // EXTERNAL MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/extensions/dicom-html/src/DicomHtmlViewport.css |
||
| 99 | var src_DicomHtmlViewport = __webpack_require__(991); |
||
| 100 | |||
| 101 | // CONCATENATED MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/extensions/dicom-html/src/DicomHtmlViewport.js |
||
| 102 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } |
||
| 103 | |||
| 104 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
||
| 105 | |||
| 106 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
||
| 107 | |||
| 108 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
||
| 109 | |||
| 110 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } |
||
| 111 | |||
| 112 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } |
||
| 113 | |||
| 114 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
||
| 115 | |||
| 116 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } |
||
| 117 | |||
| 118 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
||
| 119 | |||
| 120 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | function getRelationshipString(data) { |
||
| 129 | switch (data.RelationshipType) { |
||
| 130 | case 'HAS CONCEPT MOD': |
||
| 131 | return 'Concept modifier: '; |
||
| 132 | |||
| 133 | case 'HAS OBS CONTEXT': |
||
| 134 | return 'Observation context: '; |
||
| 135 | |||
| 136 | default: |
||
| 137 | return ''; |
||
| 138 | } |
||
| 139 | } |
||
| 140 | |||
| 141 | var getMeaningString = function getMeaningString(data) { |
||
| 142 | if (data.ConceptNameCodeSequence) { |
||
| 143 | var CodeMeaning = data.ConceptNameCodeSequence.CodeMeaning; |
||
| 144 | return "".concat(CodeMeaning, " = "); |
||
| 145 | } |
||
| 146 | |||
| 147 | return ''; |
||
| 148 | }; |
||
| 149 | |||
| 150 | function getValueString(data) { |
||
| 151 | switch (data.ValueType) { |
||
| 152 | case 'CODE': |
||
| 153 | var _data$ConceptNameCode = data.ConceptNameCodeSequence, |
||
| 154 | CodeMeaning = _data$ConceptNameCode.CodeMeaning, |
||
| 155 | CodeValue = _data$ConceptNameCode.CodeValue, |
||
| 156 | CodingSchemeDesignator = _data$ConceptNameCode.CodingSchemeDesignator; |
||
| 157 | return "".concat(CodeMeaning, " (").concat(CodeValue, ", ").concat(CodingSchemeDesignator, ")"); |
||
| 158 | |||
| 159 | case 'PNAME': |
||
| 160 | return data.PersonName; |
||
| 161 | |||
| 162 | case 'TEXT': |
||
| 163 | return data.TextValue; |
||
| 164 | |||
| 165 | case 'UIDREF': |
||
| 166 | return data.UID; |
||
| 167 | |||
| 168 | case 'NUM': |
||
| 169 | var MeasuredValueSequence = data.MeasuredValueSequence; |
||
| 170 | var numValue = MeasuredValueSequence.NumericValue; |
||
| 171 | var codeValue = MeasuredValueSequence.MeasurementUnitsCodeSequence.CodeValue; |
||
| 172 | return "".concat(numValue, " ").concat(codeValue); |
||
| 173 | } |
||
| 174 | } |
||
| 175 | |||
| 176 | function constructPlainValue(data) { |
||
| 177 | var value = getValueString(data); |
||
| 178 | |||
| 179 | if (value) { |
||
| 180 | return getRelationshipString(data) + getMeaningString(data) + value; |
||
| 181 | } |
||
| 182 | } |
||
| 183 | |||
| 184 | function constructContentSequence(data, header) { |
||
| 185 | if (!data.ContentSequence) { |
||
| 186 | return; |
||
| 187 | } |
||
| 188 | |||
| 189 | var items = data.ContentSequence.map(function (item) { |
||
| 190 | return parseContent(item); |
||
| 191 | }).filter(function (item) { |
||
| 192 | return item; |
||
| 193 | }); |
||
| 194 | |||
| 195 | if (!items.length) { |
||
| 196 | return; |
||
| 197 | } |
||
| 198 | |||
| 199 | var result = { |
||
| 200 | items: items |
||
| 201 | }; |
||
| 202 | |||
| 203 | if (header) { |
||
| 204 | result.header = header; |
||
| 205 | } |
||
| 206 | |||
| 207 | return result; |
||
| 208 | } |
||
| 209 | |||
| 210 | function parseContent(data) { |
||
| 211 | if (data.ValueType) { |
||
| 212 | if (data.ValueType === 'CONTAINER') { |
||
| 213 | var header = data.ConceptNameCodeSequence.CodeMeaning; |
||
| 214 | return constructContentSequence(data, header); |
||
| 215 | } |
||
| 216 | |||
| 217 | return constructPlainValue(data); |
||
| 218 | } |
||
| 219 | |||
| 220 | if (data.ContentSequence) { |
||
| 221 | return constructContentSequence(data); |
||
| 222 | } |
||
| 223 | } |
||
| 224 | |||
| 225 | var _dcmjs$data = dcmjs_es["a" /* default */].data, |
||
| 226 | DicomMetaDictionary = _dcmjs$data.DicomMetaDictionary, |
||
| 227 | DicomMessage = _dcmjs$data.DicomMessage; |
||
| 228 | |||
| 229 | function getMainData(data) { |
||
| 230 | var root = []; |
||
| 231 | var patientValue = "".concat(data.PatientName, " (").concat(data.PatientSex, ", #").concat(data.PatientID, ")"); |
||
| 232 | root.push(getMainDataItem('Patient', patientValue)); |
||
| 233 | var studyValue = data.StudyDescription; |
||
| 234 | root.push(getMainDataItem('Study', studyValue)); |
||
| 235 | var seriesValue = "".concat(data.SeriesDescription, " (#").concat(data.SeriesNumber, ")"); |
||
| 236 | root.push(getMainDataItem('Series', seriesValue)); |
||
| 237 | var manufacturerValue = "".concat(data.Manufacturer, " (").concat(data.ManufacturerModelName, ", #").concat(data.DeviceSerialNumber, ")"); |
||
| 238 | root.push(getMainDataItem('Manufacturer', manufacturerValue)); |
||
| 239 | var mainDataObjects = { |
||
| 240 | CompletionFlag: 'Completion flag', |
||
| 241 | VerificationFlag: 'Verification flag' |
||
| 242 | }; |
||
| 243 | Object.keys(mainDataObjects).forEach(function (key) { |
||
| 244 | if (!data[key]) { |
||
| 245 | return; |
||
| 246 | } |
||
| 247 | |||
| 248 | var item = getMainDataItem(mainDataObjects[key], data[key]); |
||
| 249 | root.push(item); |
||
| 250 | }); // TODO: Format these dates |
||
| 251 | |||
| 252 | var contentDateTimeValue = "".concat(data.ContentDate, " ").concat(data.ContentTime); |
||
| 253 | root.push(getMainDataItem('Content Date/Time', contentDateTimeValue)); |
||
| 254 | root.push(); |
||
| 255 | return react_default.a.createElement("div", null, root); |
||
| 256 | } |
||
| 257 | |||
| 258 | var DicomHtmlViewport_getContentSequence = function getContentSequence(data) { |
||
| 259 | var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; |
||
| 260 | var header; |
||
| 261 | |||
| 262 | if (data.ConceptNameCodeSequence) { |
||
| 263 | var _data$ConceptNameCode2 = data.ConceptNameCodeSequence, |
||
| 264 | CodeMeaning = _data$ConceptNameCode2.CodeMeaning, |
||
| 265 | CodeValue = _data$ConceptNameCode2.CodeValue, |
||
| 266 | CodingSchemeDesignator = _data$ConceptNameCode2.CodingSchemeDesignator; |
||
| 267 | header = "".concat(CodeMeaning, " (").concat(CodeValue, " - ").concat(CodingSchemeDesignator, ")"); |
||
| 268 | } |
||
| 269 | |||
| 270 | var root = []; |
||
| 271 | |||
| 272 | if (header) { |
||
| 273 | var HeaderDynamicLevel = "h".concat(level); |
||
| 274 | root.push(react_default.a.createElement(HeaderDynamicLevel, { |
||
| 275 | key: header |
||
| 276 | }, header)); |
||
| 277 | } |
||
| 278 | |||
| 279 | Object.keys(data).forEach(function (key) { |
||
| 280 | var value = data[key]; |
||
| 281 | var content; |
||
| 282 | |||
| 283 | if (value instanceof Object) { |
||
| 284 | content = getContentSequence(value, level + 1); |
||
| 285 | } else { |
||
| 286 | content = react_default.a.createElement("div", { |
||
| 287 | key: key |
||
| 288 | }, key, " - ", data[key]); |
||
| 289 | } |
||
| 290 | |||
| 291 | root.push(content); |
||
| 292 | }); |
||
| 293 | return react_default.a.createElement("div", null, root); |
||
| 294 | }; |
||
| 295 | |||
| 296 | function getMainDataItem(key, value) { |
||
| 297 | return react_default.a.createElement("div", { |
||
| 298 | key: key |
||
| 299 | }, react_default.a.createElement("b", null, key), ": ", value); |
||
| 300 | } |
||
| 301 | |||
| 302 | var DicomHtmlViewport_DicomHtmlViewport = |
||
| 303 | /*#__PURE__*/ |
||
| 304 | function (_Component) { |
||
| 305 | _inherits(DicomHtmlViewport, _Component); |
||
| 306 | |||
| 307 | function DicomHtmlViewport() { |
||
| 308 | var _getPrototypeOf2; |
||
| 309 | |||
| 310 | var _this; |
||
| 311 | |||
| 312 | _classCallCheck(this, DicomHtmlViewport); |
||
| 313 | |||
| 314 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
||
| 315 | args[_key] = arguments[_key]; |
||
| 316 | } |
||
| 317 | |||
| 318 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DicomHtmlViewport)).call.apply(_getPrototypeOf2, [this].concat(args))); |
||
| 319 | |||
| 320 | _defineProperty(_assertThisInitialized(_this), "state", { |
||
| 321 | content: null, |
||
| 322 | error: null |
||
| 323 | }); |
||
| 324 | |||
| 325 | _defineProperty(_assertThisInitialized(_this), "setViewportActiveHandler", function () { |
||
| 326 | var _this$props = _this.props, |
||
| 327 | setViewportActive = _this$props.setViewportActive, |
||
| 328 | viewportIndex = _this$props.viewportIndex, |
||
| 329 | activeViewportIndex = _this$props.activeViewportIndex; |
||
| 330 | |||
| 331 | if (viewportIndex !== activeViewportIndex) { |
||
| 332 | setViewportActive(viewportIndex); |
||
| 333 | } |
||
| 334 | }); |
||
| 335 | |||
| 336 | return _this; |
||
| 337 | } |
||
| 338 | |||
| 339 | _createClass(DicomHtmlViewport, [{ |
||
| 340 | key: "componentDidMount", |
||
| 341 | value: function componentDidMount() { |
||
| 342 | var dataSet = this.setContentFromByteArray(this.props.byteArray); |
||
| 343 | } |
||
| 344 | }, { |
||
| 345 | key: "setContentFromByteArray", |
||
| 346 | value: function setContentFromByteArray(byteArray) { |
||
| 347 | var arrayBuffer = byteArray.buffer; |
||
| 348 | var dicomData = DicomMessage.readFile(arrayBuffer); |
||
| 349 | var dataset = DicomMetaDictionary.naturalizeDataset(dicomData.dict); |
||
| 350 | dataset._meta = DicomMetaDictionary.namifyDataset(dicomData.meta); |
||
| 351 | var mainData = getMainData(dataset); |
||
| 352 | var contentSequence = DicomHtmlViewport_getContentSequence(dataset); |
||
| 353 | var content = react_default.a.createElement(react_default.a.Fragment, null, mainData, contentSequence); |
||
| 354 | this.setState({ |
||
| 355 | content: content |
||
| 356 | }); |
||
| 357 | } |
||
| 358 | }, { |
||
| 359 | key: "render", |
||
| 360 | value: function render() { |
||
| 361 | var _this$state = this.state, |
||
| 362 | content = _this$state.content, |
||
| 363 | error = _this$state.error; |
||
| 364 | return react_default.a.createElement("div", { |
||
| 365 | "data-cy": "dicom-html-viewport", |
||
| 366 | className: "DicomHtmlViewport", |
||
| 367 | onClick: this.setViewportActiveHandler, |
||
| 368 | onScroll: this.setViewportActiveHandler |
||
| 369 | }, content, error && react_default.a.createElement("h2", null, JSON.stringify(error))); |
||
| 370 | } |
||
| 371 | }]); |
||
| 372 | |||
| 373 | return DicomHtmlViewport; |
||
| 374 | }(react["Component"]); |
||
| 375 | |||
| 376 | _defineProperty(DicomHtmlViewport_DicomHtmlViewport, "propTypes", { |
||
| 377 | byteArray: TypedArrayProp.uint8, |
||
| 378 | setViewportActive: prop_types_default.a.func.isRequired, |
||
| 379 | viewportIndex: prop_types_default.a.number.isRequired, |
||
| 380 | activeViewportIndex: prop_types_default.a.number.isRequired |
||
| 381 | }); |
||
| 382 | |||
| 383 | /* harmony default export */ var dicom_html_src_DicomHtmlViewport = (DicomHtmlViewport_DicomHtmlViewport); |
||
| 384 | // CONCATENATED MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/extensions/dicom-html/src/ConnectedDicomHtmlViewport.js |
||
| 385 | |||
| 386 | |||
| 387 | |||
| 388 | var _setViewportActive = src["a" /* default */].redux.actions.setViewportActive; |
||
| 389 | |||
| 390 | var mapStateToProps = function mapStateToProps(state, ownProps) { |
||
| 391 | var viewportIndex = ownProps.viewportIndex, |
||
| 392 | byteArray = ownProps.byteArray; |
||
| 393 | var activeViewportIndex = state.viewports.activeViewportIndex; |
||
| 394 | return { |
||
| 395 | viewportIndex: viewportIndex, |
||
| 396 | activeViewportIndex: activeViewportIndex, |
||
| 397 | byteArray: byteArray |
||
| 398 | }; |
||
| 399 | }; |
||
| 400 | |||
| 401 | var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { |
||
| 402 | var viewportIndex = ownProps.viewportIndex; |
||
| 403 | return { |
||
| 404 | setViewportActive: function setViewportActive() { |
||
| 405 | dispatch(_setViewportActive(viewportIndex)); |
||
| 406 | } |
||
| 407 | }; |
||
| 408 | }; |
||
| 409 | |||
| 410 | var ConnectedDicomHtmlViewport = Object(es["b" /* connect */])(mapStateToProps, mapDispatchToProps)(dicom_html_src_DicomHtmlViewport); |
||
| 411 | /* harmony default export */ var src_ConnectedDicomHtmlViewport = (ConnectedDicomHtmlViewport); |
||
| 412 | // CONCATENATED MODULE: /home/salim/GaelO-Dev/OHIF/Viewers/extensions/dicom-html/src/OHIFDicomHtmlViewport.js |
||
| 413 | function OHIFDicomHtmlViewport_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { OHIFDicomHtmlViewport_typeof = function _typeof(obj) { return typeof obj; }; } else { OHIFDicomHtmlViewport_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return OHIFDicomHtmlViewport_typeof(obj); } |
||
| 414 | |||
| 415 | function OHIFDicomHtmlViewport_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
||
| 416 | |||
| 417 | function OHIFDicomHtmlViewport_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
||
| 418 | |||
| 419 | function OHIFDicomHtmlViewport_createClass(Constructor, protoProps, staticProps) { if (protoProps) OHIFDicomHtmlViewport_defineProperties(Constructor.prototype, protoProps); if (staticProps) OHIFDicomHtmlViewport_defineProperties(Constructor, staticProps); return Constructor; } |
||
| 420 | |||
| 421 | function OHIFDicomHtmlViewport_possibleConstructorReturn(self, call) { if (call && (OHIFDicomHtmlViewport_typeof(call) === "object" || typeof call === "function")) { return call; } return OHIFDicomHtmlViewport_assertThisInitialized(self); } |
||
| 422 | |||
| 423 | function OHIFDicomHtmlViewport_getPrototypeOf(o) { OHIFDicomHtmlViewport_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return OHIFDicomHtmlViewport_getPrototypeOf(o); } |
||
| 424 | |||
| 425 | function OHIFDicomHtmlViewport_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
||
| 426 | |||
| 427 | function OHIFDicomHtmlViewport_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) OHIFDicomHtmlViewport_setPrototypeOf(subClass, superClass); } |
||
| 428 | |||
| 429 | function OHIFDicomHtmlViewport_setPrototypeOf(o, p) { OHIFDicomHtmlViewport_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return OHIFDicomHtmlViewport_setPrototypeOf(o, p); } |
||
| 430 | |||
| 431 | function OHIFDicomHtmlViewport_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
||
| 432 | |||
| 433 | |||
| 434 | |||
| 435 | |||
| 436 | |||
| 437 | var DicomLoaderService = src["a" /* default */].utils.DicomLoaderService; |
||
| 438 | |||
| 439 | var OHIFDicomHtmlViewport_OHIFDicomHtmlViewport = |
||
| 440 | /*#__PURE__*/ |
||
| 441 | function (_Component) { |
||
| 442 | OHIFDicomHtmlViewport_inherits(OHIFDicomHtmlViewport, _Component); |
||
| 443 | |||
| 444 | function OHIFDicomHtmlViewport() { |
||
| 445 | var _getPrototypeOf2; |
||
| 446 | |||
| 447 | var _this; |
||
| 448 | |||
| 449 | OHIFDicomHtmlViewport_classCallCheck(this, OHIFDicomHtmlViewport); |
||
| 450 | |||
| 451 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
||
| 452 | args[_key] = arguments[_key]; |
||
| 453 | } |
||
| 454 | |||
| 455 | _this = OHIFDicomHtmlViewport_possibleConstructorReturn(this, (_getPrototypeOf2 = OHIFDicomHtmlViewport_getPrototypeOf(OHIFDicomHtmlViewport)).call.apply(_getPrototypeOf2, [this].concat(args))); |
||
| 456 | |||
| 457 | OHIFDicomHtmlViewport_defineProperty(OHIFDicomHtmlViewport_assertThisInitialized(_this), "state", { |
||
| 458 | byteArray: null, |
||
| 459 | error: null |
||
| 460 | }); |
||
| 461 | |||
| 462 | return _this; |
||
| 463 | } |
||
| 464 | |||
| 465 | OHIFDicomHtmlViewport_createClass(OHIFDicomHtmlViewport, [{ |
||
| 466 | key: "componentDidMount", |
||
| 467 | value: function componentDidMount() { |
||
| 468 | var _this2 = this; |
||
| 469 | |||
| 470 | var _this$props$viewportD = this.props.viewportData, |
||
| 471 | displaySet = _this$props$viewportD.displaySet, |
||
| 472 | studies = _this$props$viewportD.studies; |
||
| 473 | DicomLoaderService.findDicomDataPromise(displaySet, studies).then(function (data) { |
||
| 474 | var byteArray = new Uint8Array(data); |
||
| 475 | |||
| 476 | _this2.setState({ |
||
| 477 | byteArray: byteArray |
||
| 478 | }); |
||
| 479 | }, function (error) { |
||
| 480 | _this2.setState({ |
||
| 481 | error: error |
||
| 482 | }); |
||
| 483 | |||
| 484 | throw new Error(error); |
||
| 485 | }); |
||
| 486 | } |
||
| 487 | }, { |
||
| 488 | key: "render", |
||
| 489 | value: function render() { |
||
| 490 | return react_default.a.createElement(react_default.a.Fragment, null, this.state.byteArray && react_default.a.createElement(src_ConnectedDicomHtmlViewport, { |
||
| 491 | byteArray: this.state.byteArray, |
||
| 492 | viewportIndex: this.props.viewportIndex |
||
| 493 | }), this.state.error && react_default.a.createElement("h2", null, JSON.stringify(this.state.error))); |
||
| 494 | } |
||
| 495 | }]); |
||
| 496 | |||
| 497 | return OHIFDicomHtmlViewport; |
||
| 498 | }(react["Component"]); |
||
| 499 | |||
| 500 | OHIFDicomHtmlViewport_defineProperty(OHIFDicomHtmlViewport_OHIFDicomHtmlViewport, "propTypes", { |
||
| 501 | studies: prop_types_default.a.object, |
||
| 502 | displaySet: prop_types_default.a.object, |
||
| 503 | viewportIndex: prop_types_default.a.number, |
||
| 504 | viewportData: prop_types_default.a.object |
||
| 505 | }); |
||
| 506 | |||
| 507 | /* harmony default export */ var src_OHIFDicomHtmlViewport = __webpack_exports__["default"] = (OHIFDicomHtmlViewport_OHIFDicomHtmlViewport); |
||
| 508 | |||
| 509 | /***/ }), |
||
| 510 | |||
| 511 | /***/ 991: |
||
| 512 | /***/ (function(module, exports, __webpack_require__) { |
||
| 513 | |||
| 514 | // extracted by extract-css-chunks-webpack-plugin |
||
| 515 | |||
| 516 | /***/ }) |
||
| 517 | |||
| 518 | }]); |