@ohif/app 3.7.0-beta.98 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{202.bundle.96bbb4547a346fe3921f.js → 202.bundle.d3490836f71e001dd30f.js} +746 -19
  2. package/dist/{221.bundle.772f38088c3079c8035b.js → 221.bundle.a331e2a9a29f9599fd40.js} +70 -14
  3. package/dist/{236.bundle.197bab4e86815ec4ca4a.js → 236.bundle.b09ef6a3c16be7ad1d05.js} +2 -2
  4. package/dist/{342.bundle.1d55f37e9c918e0825ec.js → 342.bundle.3f9ebc45fdc6d6879adc.js} +40 -22
  5. package/dist/{359.bundle.fed8617ddfa6afa1328a.js → 359.bundle.aa2adce78c3935aa19c1.js} +1 -3
  6. package/dist/{370.bundle.1a6cbcbde7c8207d2864.js → 370.bundle.31f3d861d96bdd540dc7.js} +4 -4
  7. package/dist/{743.bundle.4bfe6e562ffb2c22708f.js → 743.bundle.489f7df3a089d4d374e1.js} +13 -0
  8. package/dist/{831.bundle.83658f62fcc769043605.js → 757.bundle.ec8301d8e70d2b990f65.js} +368 -1
  9. package/dist/{782.bundle.441460bad5d3665e8357.js → 788.bundle.b9dabaea41cb029360b1.js} +5 -305
  10. package/dist/{1.bundle.b1dc2af5a703ba3cb14b.js → 82.bundle.ec05d3de5ac5b0c577fe.js} +142 -111
  11. package/dist/{957.bundle.8c09a01840ab8aa32734.js → 957.bundle.9ea4506963ef8b2d84ba.js} +61 -51
  12. package/dist/app.bundle.css +1 -1
  13. package/dist/{app.bundle.56a25a631c0c24cd0ca7.js → app.bundle.dacb6768b481e9135f71.js} +149 -105
  14. package/dist/index.html +1 -1
  15. package/dist/sw.js +1 -1
  16. package/package.json +19 -18
  17. /package/dist/{12.bundle.13308b06fcc1666c266b.js → 12.bundle.b965cc54108a0b38a022.js} +0 -0
  18. /package/dist/{181.bundle.169383e9b1a0358b44e8.js → 181.bundle.ceb057236403bcb630ac.js} +0 -0
  19. /package/dist/{19.bundle.3a597d9f26991241e7fc.js → 19.bundle.d961845411cf4e95d27c.js} +0 -0
  20. /package/dist/{281.bundle.2ac8032b2e4370ee907b.js → 281.bundle.4f7c49673b5861436311.js} +0 -0
  21. /package/dist/{410.bundle.f697feb951e10d10802b.js → 410.bundle.12c1bc7cb765ef74d275.js} +0 -0
  22. /package/dist/{506.bundle.52619b4a87b149b12232.js → 506.bundle.311783d53e8d64b84280.js} +0 -0
  23. /package/dist/{613.bundle.20a09bdee6888011429d.js → 613.bundle.4359bc30c68b8f567140.js} +0 -0
  24. /package/dist/{663.bundle.2baa791ccd0f499c3bcb.js → 663.bundle.87300c41b902228496ec.js} +0 -0
  25. /package/dist/{687.bundle.853e30cdf7d7a189d19b.js → 687.bundle.a3caefcf2e55897bad75.js} +0 -0
  26. /package/dist/{774.bundle.7528cba56a1407357144.js → 774.bundle.4b2dc46a35012b898e1a.js} +0 -0
  27. /package/dist/{814.bundle.a766b5f4317cea6bef89.js → 814.bundle.a3d1fbc03a4a3ea3f23d.js} +0 -0
  28. /package/dist/{1.css → 82.css} +0 -0
  29. /package/dist/{822.bundle.0545d6dbb49515aa04ee.js → 822.bundle.891f2e57b1b7bc2f4cb4.js} +0 -0
  30. /package/dist/{99.bundle.48d8d120921b5135f9e7.js → 99.bundle.d77c8c0a957274c827da.js} +0 -0
@@ -1,6 +1,6 @@
1
- (self["webpackChunk"] = self["webpackChunk"] || []).push([[1],{
1
+ (self["webpackChunk"] = self["webpackChunk"] || []).push([[82],{
2
2
 
3
- /***/ 95270:
3
+ /***/ 78227:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -16,14 +16,11 @@ __webpack_require__.d(__webpack_exports__, {
16
16
  toolNames: () => (/* reexport */ toolNames)
17
17
  });
18
18
 
19
- // NAMESPACE OBJECT: ../../../extensions/cornerstone/src/types/index.ts
20
- var types_namespaceObject = {};
21
- __webpack_require__.r(types_namespaceObject);
22
-
23
19
  // NAMESPACE OBJECT: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
24
20
  var utils_namespaceObject = {};
25
21
  __webpack_require__.r(utils_namespaceObject);
26
22
  __webpack_require__.d(utils_namespaceObject, {
23
+ getDisplayUnit: () => (utils_getDisplayUnit),
27
24
  getFirstAnnotationSelected: () => (getFirstAnnotationSelected),
28
25
  getHandlesFromPoints: () => (getHandlesFromPoints),
29
26
  getSOPInstanceAttributes: () => (getSOPInstanceAttributes/* default */.Z),
@@ -31,6 +28,10 @@ __webpack_require__.d(utils_namespaceObject, {
31
28
  setAnnotationSelected: () => (setAnnotationSelected)
32
29
  });
33
30
 
31
+ // NAMESPACE OBJECT: ../../../extensions/cornerstone/src/types/index.ts
32
+ var types_namespaceObject = {};
33
+ __webpack_require__.r(types_namespaceObject);
34
+
34
35
  // EXTERNAL MODULE: ../../../node_modules/react/index.js
35
36
  var react = __webpack_require__(43001);
36
37
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 331 modules
@@ -839,10 +840,69 @@ function getDisplayText(mappedAnnotations, displaySet) {
839
840
  return displayText;
840
841
  }
841
842
  /* harmony default export */ const measurementServiceMappings_Length = (Length);
843
+ ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getHandlesFromPoints.js
844
+ function getHandlesFromPoints(points) {
845
+ if (points.longAxis && points.shortAxis) {
846
+ const handles = {};
847
+ handles.start = points.longAxis[0];
848
+ handles.end = points.longAxis[1];
849
+ handles.perpendicularStart = points.longAxis[0];
850
+ handles.perpendicularEnd = points.longAxis[1];
851
+ return handles;
852
+ }
853
+ return points.map((p, i) => i % 10 === 0 ? {
854
+ start: p
855
+ } : {
856
+ end: p
857
+ }).reduce((obj, item) => Object.assign(obj, {
858
+ ...item
859
+ }), {});
860
+ }
861
+ ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/selection.ts
862
+
863
+
864
+ /**
865
+ * Check whether an annotation from imaging library is selected or not.
866
+ * @param {string} annotationUID uid of imaging library annotation
867
+ * @returns boolean
868
+ */
869
+ function isAnnotationSelected(annotationUID) {
870
+ return dist_esm.annotation.selection.isAnnotationSelected(annotationUID);
871
+ }
872
+
873
+ /**
874
+ * Change an annotation from imaging library's selected property.
875
+ * @param annotationUID - uid of imaging library annotation
876
+ * @param selected - new value for selected
877
+ */
878
+ function setAnnotationSelected(annotationUID, selected) {
879
+ const isCurrentSelected = isAnnotationSelected(annotationUID);
880
+ // branch cut, avoid invoking imaging library unnecessarily.
881
+ if (isCurrentSelected !== selected) {
882
+ dist_esm.annotation.selection.setAnnotationSelected(annotationUID, selected);
883
+ }
884
+ }
885
+ function getFirstAnnotationSelected(element) {
886
+ const [selectedAnnotationUID] = dist_esm.annotation.selection.getAnnotationsSelected() || [];
887
+ if (selectedAnnotationUID) {
888
+ return dist_esm.annotation.state.getAnnotation(selectedAnnotationUID);
889
+ }
890
+ }
891
+
892
+ ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getDisplayUnit.js
893
+ const getDisplayUnit = unit => unit == null ? '' : unit;
894
+ /* harmony default export */ const utils_getDisplayUnit = (getDisplayUnit);
895
+ ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
896
+
897
+
898
+
899
+
900
+
842
901
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/Bidirectional.ts
843
902
 
844
903
 
845
904
 
905
+
846
906
  const Bidirectional = {
847
907
  toAnnotation: measurement => {},
848
908
  toMeasurement: (csToolsEventDetail, displaySetService, cornerstoneViewportService, getValueTypeFromToolType) => {
@@ -1014,8 +1074,8 @@ function Bidirectional_getDisplayText(mappedAnnotations, displaySet) {
1014
1074
  }
1015
1075
  const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
1016
1076
  const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
1017
- displayText.push(`L: ${roundedLength} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
1018
- displayText.push(`W: ${roundedWidth} ${unit}`);
1077
+ displayText.push(`L: ${roundedLength} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
1078
+ displayText.push(`W: ${roundedWidth} ${utils_getDisplayUnit(unit)}`);
1019
1079
  return displayText;
1020
1080
  }
1021
1081
  /* harmony default export */ const measurementServiceMappings_Bidirectional = (Bidirectional);
@@ -1023,6 +1083,7 @@ function Bidirectional_getDisplayText(mappedAnnotations, displaySet) {
1023
1083
 
1024
1084
 
1025
1085
 
1086
+
1026
1087
  const EllipticalROI = {
1027
1088
  toAnnotation: measurement => {},
1028
1089
  toMeasurement: (csToolsEventDetail, displaySetService, cornerstoneViewportService, getValueTypeFromToolType) => {
@@ -1205,7 +1266,7 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
1205
1266
  const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
1206
1267
  const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
1207
1268
  const roundedArea = src.utils.roundNumber(area, 2);
1208
- displayText.push(`${roundedArea} ${areaUnit}`);
1269
+ displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
1209
1270
 
1210
1271
  // Todo: we need a better UI for displaying all these information
1211
1272
  mappedAnnotations.forEach(mappedAnnotation => {
@@ -1217,7 +1278,7 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
1217
1278
  let maxStr = '';
1218
1279
  if (max) {
1219
1280
  const roundedMax = src.utils.roundNumber(max, 2);
1220
- maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
1281
+ maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
1221
1282
  }
1222
1283
  const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
1223
1284
  if (!displayText.includes(str)) {
@@ -1231,6 +1292,7 @@ function EllipticalROI_getDisplayText(mappedAnnotations, displaySet) {
1231
1292
 
1232
1293
 
1233
1294
 
1295
+
1234
1296
  const CircleROI = {
1235
1297
  toAnnotation: measurement => {},
1236
1298
  toMeasurement: (csToolsEventDetail, DisplaySetService, CornerstoneViewportService, getValueTypeFromToolType) => {
@@ -1415,7 +1477,7 @@ function CircleROI_getDisplayText(mappedAnnotations, displaySet) {
1415
1477
 
1416
1478
  // Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
1417
1479
  const roundedArea = src.utils.roundNumber(area || 0, 2);
1418
- displayText.push(`${roundedArea} ${areaUnit}`);
1480
+ displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
1419
1481
 
1420
1482
  // Todo: we need a better UI for displaying all these information
1421
1483
  mappedAnnotations.forEach(mappedAnnotation => {
@@ -1427,7 +1489,7 @@ function CircleROI_getDisplayText(mappedAnnotations, displaySet) {
1427
1489
  let maxStr = '';
1428
1490
  if (max) {
1429
1491
  const roundedMax = src.utils.roundNumber(max, 2);
1430
- maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
1492
+ maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
1431
1493
  }
1432
1494
  const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
1433
1495
  if (!displayText.includes(str)) {
@@ -1566,6 +1628,7 @@ function ArrowAnnotate_getDisplayText(mappedAnnotations, displaySet) {
1566
1628
 
1567
1629
 
1568
1630
 
1631
+
1569
1632
  const CobbAngle = {
1570
1633
  toAnnotation: measurement => {},
1571
1634
  /**
@@ -1740,7 +1803,7 @@ function CobbAngle_getDisplayText(mappedAnnotations, displaySet) {
1740
1803
  return displayText;
1741
1804
  }
1742
1805
  const roundedAngle = src.utils.roundNumber(angle, 2);
1743
- displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
1806
+ displayText.push(`${roundedAngle} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
1744
1807
  return displayText;
1745
1808
  }
1746
1809
  /* harmony default export */ const measurementServiceMappings_CobbAngle = (CobbAngle);
@@ -1748,6 +1811,7 @@ function CobbAngle_getDisplayText(mappedAnnotations, displaySet) {
1748
1811
 
1749
1812
 
1750
1813
 
1814
+
1751
1815
  const Angle = {
1752
1816
  toAnnotation: measurement => {},
1753
1817
  /**
@@ -1922,7 +1986,7 @@ function Angle_getDisplayText(mappedAnnotations, displaySet) {
1922
1986
  return displayText;
1923
1987
  }
1924
1988
  const roundedAngle = src.utils.roundNumber(angle, 2);
1925
- displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
1989
+ displayText.push(`${roundedAngle} ${utils_getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`);
1926
1990
  return displayText;
1927
1991
  }
1928
1992
  /* harmony default export */ const measurementServiceMappings_Angle = (Angle);
@@ -2064,6 +2128,7 @@ function PlanarFreehandROI_getDisplayText(mappedAnnotations) {
2064
2128
 
2065
2129
 
2066
2130
 
2131
+
2067
2132
  const RectangleROI = {
2068
2133
  toAnnotation: measurement => {},
2069
2134
  toMeasurement: (csToolsEventDetail, DisplaySetService, CornerstoneViewportService, getValueTypeFromToolType) => {
@@ -2248,7 +2313,7 @@ function RectangleROI_getDisplayText(mappedAnnotations, displaySet) {
2248
2313
 
2249
2314
  // Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
2250
2315
  const roundedArea = src.utils.roundNumber(area || 0, 2);
2251
- displayText.push(`${roundedArea} ${areaUnit}`);
2316
+ displayText.push(`${roundedArea} ${utils_getDisplayUnit(areaUnit)}`);
2252
2317
 
2253
2318
  // Todo: we need a better UI for displaying all these information
2254
2319
  mappedAnnotations.forEach(mappedAnnotation => {
@@ -2260,7 +2325,7 @@ function RectangleROI_getDisplayText(mappedAnnotations, displaySet) {
2260
2325
  let maxStr = '';
2261
2326
  if (max) {
2262
2327
  const roundedMax = src.utils.roundNumber(max, 2);
2263
- maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
2328
+ maxStr = `Max: ${roundedMax} <small>${utils_getDisplayUnit(unit)}</small> `;
2264
2329
  }
2265
2330
  const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
2266
2331
  if (!displayText.includes(str)) {
@@ -4671,7 +4736,6 @@ function disableSync(syncName, servicesManager) {
4671
4736
  syncGroupService.removeViewportFromSyncGroup(viewport.id, viewport.getRenderingEngine().id, syncName);
4672
4737
  });
4673
4738
  }
4674
- ;
4675
4739
 
4676
4740
  /**
4677
4741
  * Gets the consistent spacing stack viewport types, which are the ones which
@@ -4702,38 +4766,6 @@ function getReconstructableStackViewports(viewportGridService, displaySetService
4702
4766
  });
4703
4767
  return viewports;
4704
4768
  }
4705
- ;
4706
- ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/selection.ts
4707
-
4708
-
4709
- /**
4710
- * Check whether an annotation from imaging library is selected or not.
4711
- * @param {string} annotationUID uid of imaging library annotation
4712
- * @returns boolean
4713
- */
4714
- function isAnnotationSelected(annotationUID) {
4715
- return dist_esm.annotation.selection.isAnnotationSelected(annotationUID);
4716
- }
4717
-
4718
- /**
4719
- * Change an annotation from imaging library's selected property.
4720
- * @param annotationUID - uid of imaging library annotation
4721
- * @param selected - new value for selected
4722
- */
4723
- function setAnnotationSelected(annotationUID, selected) {
4724
- const isCurrentSelected = isAnnotationSelected(annotationUID);
4725
- // branch cut, avoid invoking imaging library unnecessarily.
4726
- if (isCurrentSelected !== selected) {
4727
- dist_esm.annotation.selection.setAnnotationSelected(annotationUID, selected);
4728
- }
4729
- }
4730
- function getFirstAnnotationSelected(element) {
4731
- const [selectedAnnotationUID] = dist_esm.annotation.selection.getAnnotationsSelected() || [];
4732
- if (selectedAnnotationUID) {
4733
- return dist_esm.annotation.state.getAnnotation(selectedAnnotationUID);
4734
- }
4735
- }
4736
-
4737
4769
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/commandsModule.ts
4738
4770
 
4739
4771
 
@@ -4752,7 +4784,6 @@ function commandsModule(_ref) {
4752
4784
  toolGroupService,
4753
4785
  cineService,
4754
4786
  toolbarService,
4755
- stateSyncService,
4756
4787
  uiDialogService,
4757
4788
  cornerstoneViewportService,
4758
4789
  uiNotificationService,
@@ -4879,7 +4910,7 @@ function commandsModule(_ref) {
4879
4910
  * @param props - containing the updates to apply
4880
4911
  * @param props.measurementKey - chooses the measurement key to apply the
4881
4912
  * code to. This will typically be finding or site to apply a
4882
- * finind code or a findingSites code.
4913
+ * finding code or a findingSites code.
4883
4914
  * @param props.code - A coding scheme value from DICOM, including:
4884
4915
  * * CodeValue - the language independent code, for example '1234'
4885
4916
  * * CodingSchemeDesignator - the issue of the code value
@@ -4955,6 +4986,22 @@ function commandsModule(_ref) {
4955
4986
  } = _ref7;
4956
4987
  utils_callInputDialog(uiDialogService, data, callback);
4957
4988
  },
4989
+ cleanUpCrosshairs: () => {
4990
+ // if the crosshairs tool is active, deactivate it and set window level active
4991
+ // since we are going back to main non-mpr HP
4992
+ const activeViewportToolGroup = toolGroupService.getToolGroup(null);
4993
+ if (activeViewportToolGroup._toolInstances?.Crosshairs?.mode === dist_esm.Enums.ToolModes.Active) {
4994
+ actions.toolbarServiceRecordInteraction({
4995
+ interactionType: 'tool',
4996
+ commands: [{
4997
+ commandOptions: {
4998
+ toolName: 'WindowLevel'
4999
+ },
5000
+ context: 'CORNERSTONE'
5001
+ }]
5002
+ });
5003
+ }
5004
+ },
4958
5005
  toggleCine: () => {
4959
5006
  const {
4960
5007
  viewports
@@ -5041,16 +5088,7 @@ function commandsModule(_ref) {
5041
5088
  return;
5042
5089
  }
5043
5090
  const toolGroup = toolGroupService.getToolGroup(toolGroupId);
5044
- const toolGroupViewportIds = toolGroup?.getViewportIds?.();
5045
-
5046
- // if toolGroup has been destroyed, or its viewports have been removed
5047
- if (!toolGroupViewportIds || !toolGroupViewportIds.length) {
5048
- return;
5049
- }
5050
- const filteredViewports = Array.from(viewports.values()).filter(viewport => {
5051
- return toolGroupViewportIds.includes(viewport.viewportId);
5052
- });
5053
- if (!filteredViewports.length) {
5091
+ if (!toolGroup) {
5054
5092
  return;
5055
5093
  }
5056
5094
  if (!toolGroup.getToolInstance(toolName)) {
@@ -5209,7 +5247,7 @@ function commandsModule(_ref) {
5209
5247
  viewport.resetProperties();
5210
5248
  viewport.resetCamera();
5211
5249
  } else {
5212
- // Todo: add reset properties for volume viewport
5250
+ viewport.resetProperties();
5213
5251
  viewport.resetCamera();
5214
5252
  }
5215
5253
  viewport.render();
@@ -5512,6 +5550,9 @@ function commandsModule(_ref) {
5512
5550
  },
5513
5551
  setToolbarToggled: {
5514
5552
  commandFn: actions.setToolbarToggled
5553
+ },
5554
+ cleanUpCrosshairs: {
5555
+ commandFn: actions.cleanUpCrosshairs
5515
5556
  }
5516
5557
  };
5517
5558
  return {
@@ -5545,16 +5586,7 @@ const mpr = {
5545
5586
  }],
5546
5587
  // Turns off crosshairs when switching out of MPR mode
5547
5588
  onProtocolExit: [{
5548
- commandName: 'toolbarServiceRecordInteraction',
5549
- commandOptions: {
5550
- interactionType: 'tool',
5551
- commands: [{
5552
- commandOptions: {
5553
- toolName: 'WindowLevel'
5554
- },
5555
- context: 'CORNERSTONE'
5556
- }]
5557
- }
5589
+ commandName: 'cleanUpCrosshairs'
5558
5590
  }]
5559
5591
  },
5560
5592
  displaySetSelectors: {
@@ -6428,7 +6460,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6428
6460
  volumeId: segmentationId,
6429
6461
  targetBuffer: {
6430
6462
  type: 'Uint8Array',
6431
- sharedArrayBuffer: true
6463
+ sharedArrayBuffer: window.SharedArrayBuffer
6432
6464
  }
6433
6465
  });
6434
6466
  const defaultScheme = this._getDefaultSegmentationScheme();
@@ -6555,7 +6587,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6555
6587
  }
6556
6588
  };
6557
6589
  this.getConfiguration = toolGroupId => {
6558
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
6590
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
6559
6591
  const brushSize = 1;
6560
6592
  // const brushSize = cstUtils.segmentation.getBrushSizeForToolGroup(
6561
6593
  // toolGroupId
@@ -6682,7 +6714,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6682
6714
  if (segmentInfo === undefined) {
6683
6715
  throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`);
6684
6716
  }
6685
- toolGroupId = toolGroupId ?? _this._getFirstToolGroupId();
6717
+ toolGroupId = toolGroupId ?? _this._getApplicableToolGroupId();
6686
6718
  const segmentationRepresentation = _this._getSegmentationRepresentation(segmentationId, toolGroupId);
6687
6719
  if (!segmentationRepresentation) {
6688
6720
  throw new Error('Must add representation to toolgroup before setting segments');
@@ -6709,7 +6741,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6709
6741
  if (segmentInfo === undefined) {
6710
6742
  throw new Error(`Segment ${segmentIndex} not yet added to segmentation: ${segmentationId}`);
6711
6743
  }
6712
- toolGroupId = toolGroupId ?? _this._getFirstToolGroupId();
6744
+ toolGroupId = toolGroupId ?? _this._getApplicableToolGroupId();
6713
6745
  const segmentationRepresentation = _this._getSegmentationRepresentation(segmentationId, toolGroupId);
6714
6746
  if (!segmentationRepresentation) {
6715
6747
  throw new Error('Must add representation to toolgroup before setting segments');
@@ -6831,12 +6863,18 @@ class SegmentationService extends src/* PubSubService */.hC {
6831
6863
  });
6832
6864
  });
6833
6865
  };
6834
- this._getFirstToolGroupId = () => {
6866
+ this._getApplicableToolGroupId = () => {
6835
6867
  const {
6836
- toolGroupService
6868
+ toolGroupService,
6869
+ viewportGridService,
6870
+ cornerstoneViewportService
6837
6871
  } = this.servicesManager.services;
6838
- const toolGroupIds = toolGroupService.getToolGroupIds();
6839
- return toolGroupIds[0];
6872
+ const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportGridService.getActiveViewportId());
6873
+ if (!viewportInfo) {
6874
+ const toolGroupIds = toolGroupService.getToolGroupIds();
6875
+ return toolGroupIds[0];
6876
+ }
6877
+ return viewportInfo.getToolGroupId();
6840
6878
  };
6841
6879
  this.getNextColorLUTIndex = () => {
6842
6880
  let i = 0;
@@ -6880,7 +6918,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6880
6918
  if (config?.segmentIndex === 0) {
6881
6919
  throw new Error('Segment index 0 is reserved for "no label"');
6882
6920
  }
6883
- const toolGroupId = config.toolGroupId ?? this._getFirstToolGroupId();
6921
+ const toolGroupId = config.toolGroupId ?? this._getApplicableToolGroupId();
6884
6922
  const {
6885
6923
  segmentationRepresentationUID,
6886
6924
  segmentation
@@ -6924,7 +6962,7 @@ class SegmentationService extends src/* PubSubService */.hC {
6924
6962
  if (visibility !== undefined) {
6925
6963
  this._setSegmentVisibility(segmentationId, segmentIndex, visibility, toolGroupId, suppressEvents);
6926
6964
  }
6927
- if (active !== undefined) {
6965
+ if (active === true) {
6928
6966
  this._setActiveSegment(segmentationId, segmentIndex, suppressEvents);
6929
6967
  }
6930
6968
  if (isLocked !== undefined) {
@@ -7017,7 +7055,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7017
7055
  this._setSegmentOpacity(segmentationId, segmentIndex, opacity, toolGroupId);
7018
7056
  }
7019
7057
  setActiveSegmentationForToolGroup(segmentationId, toolGroupId) {
7020
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7058
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7021
7059
  const suppressEvents = false;
7022
7060
  this._setActiveSegmentationForToolGroup(segmentationId, toolGroupId, suppressEvents);
7023
7061
  }
@@ -7047,6 +7085,21 @@ class SegmentationService extends src/* PubSubService */.hC {
7047
7085
  const segmentations = this.arrayOfObjects(this.segmentations);
7048
7086
  return segmentations && segmentations.map(m => this.segmentations[Object.keys(m)[0]]);
7049
7087
  }
7088
+ getActiveSegmentation() {
7089
+ const segmentations = this.getSegmentations();
7090
+ return segmentations.find(segmentation => segmentation.isActive);
7091
+ }
7092
+ getActiveSegment() {
7093
+ const activeSegmentation = this.getActiveSegmentation();
7094
+ const {
7095
+ activeSegmentIndex,
7096
+ segments
7097
+ } = activeSegmentation;
7098
+ if (activeSegmentIndex === null) {
7099
+ return;
7100
+ }
7101
+ return segments[activeSegmentIndex];
7102
+ }
7050
7103
 
7051
7104
  /**
7052
7105
  * Get specific segmentation by its id.
@@ -7168,7 +7221,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7168
7221
  volumeId: segmentationId,
7169
7222
  targetBuffer: {
7170
7223
  type: 'Uint8Array',
7171
- sharedArrayBuffer: true
7224
+ sharedArrayBuffer: window.SharedArrayBuffer
7172
7225
  }
7173
7226
  });
7174
7227
  const derivedVolumeScalarData = derivedVolume.getScalarData();
@@ -7405,7 +7458,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7405
7458
  clearInterval(this.highlightIntervalId);
7406
7459
  }
7407
7460
  const segmentation = this.getSegmentation(segmentationId);
7408
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7461
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7409
7462
  const segmentationRepresentation = this._getSegmentationRepresentation(segmentationId, toolGroupId);
7410
7463
  const {
7411
7464
  type
@@ -7535,7 +7588,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7535
7588
  const {
7536
7589
  id
7537
7590
  } = remainingHydratedSegmentations[0];
7538
- this._setActiveSegmentationForToolGroup(id, this._getFirstToolGroupId(), false);
7591
+ this._setActiveSegmentationForToolGroup(id, this._getApplicableToolGroupId(), false);
7539
7592
  }
7540
7593
  }
7541
7594
  this._setDisplaySetIsHydrated(segmentationId, false);
@@ -7690,7 +7743,7 @@ class SegmentationService extends src/* PubSubService */.hC {
7690
7743
  }
7691
7744
  _setSegmentVisibility(segmentationId, segmentIndex, isVisible, toolGroupId) {
7692
7745
  let suppressEvents = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
7693
- toolGroupId = toolGroupId ?? this._getFirstToolGroupId();
7746
+ toolGroupId = toolGroupId ?? this._getApplicableToolGroupId();
7694
7747
  const {
7695
7748
  segmentationRepresentationUID,
7696
7749
  segmentation
@@ -8035,7 +8088,8 @@ class CornerstoneCacheService {
8035
8088
  for (const segmentation of segmentations) {
8036
8089
  const segDisplaySetInstanceUID = segmentation.displaySetInstanceUID;
8037
8090
  const segDisplaySet = displaySetService.getDisplaySetByUID(segDisplaySetInstanceUID);
8038
- const shouldDisplaySeg = segmentationService.shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, segDisplaySet.instances[0].FrameOfReferenceUID);
8091
+ const instance = segDisplaySet.instances?.[0] || segDisplaySet.instance;
8092
+ const shouldDisplaySeg = segmentationService.shouldRenderSegmentation(viewportDisplaySetInstanceUIDs, instance.FrameOfReferenceUID);
8039
8093
  if (shouldDisplaySeg) {
8040
8094
  return true;
8041
8095
  }
@@ -9172,29 +9226,6 @@ const package_namespaceObject = JSON.parse('{"u2":"@ohif/extension-cornerstone"}
9172
9226
 
9173
9227
  const id = package_namespaceObject.u2;
9174
9228
 
9175
- ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/getHandlesFromPoints.js
9176
- function getHandlesFromPoints(points) {
9177
- if (points.longAxis && points.shortAxis) {
9178
- const handles = {};
9179
- handles.start = points.longAxis[0];
9180
- handles.end = points.longAxis[1];
9181
- handles.perpendicularStart = points.longAxis[0];
9182
- handles.perpendicularEnd = points.longAxis[1];
9183
- return handles;
9184
- }
9185
- return points.map((p, i) => i % 10 === 0 ? {
9186
- start: p
9187
- } : {
9188
- end: p
9189
- }).reduce((obj, item) => Object.assign(obj, {
9190
- ...item
9191
- }), {});
9192
- }
9193
- ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/utils/index.ts
9194
-
9195
-
9196
-
9197
-
9198
9229
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/measurementServiceMappings/index.ts
9199
9230
 
9200
9231