@ohif/app 3.8.0-beta.80 → 3.8.0-beta.81

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 (33) hide show
  1. package/dist/{121.bundle.787f5a848ed632a4d5fc.js → 121.bundle.47f05840a5b3cdf75543.js} +4 -1
  2. package/dist/{183.bundle.72bf18ad23ee6624986d.js → 183.bundle.a3e238998be71c4b2af8.js} +64 -48
  3. package/dist/{206.bundle.f957e0d1cdff66dbac69.js → 206.bundle.fcaa081a0d1f68095c31.js} +45 -20
  4. package/dist/{217.bundle.be1cc412f8e26be87d21.js → 217.bundle.d44bbaa50b6fa563fe15.js} +116 -69
  5. package/dist/{295.bundle.6f734abf8fa85b1a310d.js → 295.bundle.5ace95771ced62bdcab8.js} +4 -1
  6. package/dist/{325.bundle.84909a08305556e9f924.js → 325.bundle.fd8e0c18db4708d03a91.js} +4 -8
  7. package/dist/{335.bundle.c39d4aefe33aecab958f.js → 335.bundle.8400aa5a88697a6b9d53.js} +2 -2
  8. package/dist/{41.bundle.7c943bb857ed37831905.js → 41.bundle.0905b258a90a7c6437bb.js} +174 -104
  9. package/dist/{422.bundle.bd6529c536f59807fbee.js → 422.bundle.c6fd037b075dd54f1ba7.js} +9 -25
  10. package/dist/{433.bundle.4c77c1fe8fc90ac14218.js → 433.bundle.e0018820758f5a86fa7f.js} +61 -7
  11. package/dist/{448.bundle.deedeff5744e77510734.js → 448.bundle.5e6da31477887bf53016.js} +6 -12
  12. package/dist/{487.bundle.7890ca42826941ebcd60.js → 487.bundle.89d973049defb3ba6cb7.js} +3 -2
  13. package/dist/{530.bundle.7c94543955552475c56a.js → 530.bundle.207b38c15c4c01e4db0e.js} +14 -2
  14. package/dist/{574.bundle.be075ac52fb52b442a8b.js → 574.bundle.d648fea691d6709bf2b4.js} +14 -3
  15. package/dist/{633.bundle.c1658e76f104cbd14cab.js → 633.bundle.acab89baaa06a299d679.js} +48 -33
  16. package/dist/{540.bundle.079d43a6717e95c24392.js → 669.bundle.b17e8a621e38d92c653f.js} +95 -87
  17. package/dist/{699.bundle.4f01772e7ce6637de339.js → 699.bundle.9367d7ef9f7615b2e733.js} +41 -37
  18. package/dist/{724.bundle.e5794460c391ee9cba2c.js → 724.bundle.55f9f49816de931af91a.js} +1 -1
  19. package/dist/{862.bundle.c0ee6e1d4d97e1353213.js → 862.bundle.d32ab08e64806b2e964d.js} +4 -1
  20. package/dist/{94.bundle.c452d9b0645277c2cf4e.js → 94.bundle.f5f2479c214180d05d42.js} +7 -13
  21. package/dist/app.bundle.css +1 -1
  22. package/dist/{app.bundle.6c090a2d6d3ccc97a81d.js → app.bundle.ed937512f7d19d61c411.js} +188 -64
  23. package/dist/index.html +1 -1
  24. package/dist/{polySeg.bundle.63011312c3c79e717ea9.js → polySeg.bundle.f1a6ece1396dc1385155.js} +1 -1
  25. package/dist/sw.js +1 -1
  26. package/package.json +18 -18
  27. /package/dist/{164.bundle.d4598e491783753a8b6b.js → 164.bundle.fadc7c5d634402c73b5f.js} +0 -0
  28. /package/dist/{188.bundle.b80554ec7df7dcd435a5.js → 188.bundle.51dc4b37920f45594393.js} +0 -0
  29. /package/dist/{594.bundle.0b1165661dd638820082.js → 594.bundle.84076375b127b9c7f673.js} +0 -0
  30. /package/dist/{889.bundle.7858e4b7ca1a2b12b64f.js → 889.bundle.8ef8b723d0163d5d135c.js} +0 -0
  31. /package/dist/{905.bundle.170908fe660fc6b40649.js → 905.bundle.8a96e1a75b7cfe5ec093.js} +0 -0
  32. /package/dist/{907.bundle.dee4e30420caf07caea6.js → 907.bundle.5c88ed911bed18582da4.js} +0 -0
  33. /package/dist/{961.bundle.aaaaaba0ec015a3b85d8.js → 961.bundle.f4e52bc76d3044d05372.js} +0 -0
@@ -2821,7 +2821,7 @@ class AdvancedMagnifyViewport {
2821
2821
  });
2822
2822
  return magnifyElement;
2823
2823
  }
2824
- _convertZoomFactorToParalellScale(viewport, magnifyViewport, zoomFactor) {
2824
+ _convertZoomFactorToParallelScale(viewport, magnifyViewport, zoomFactor) {
2825
2825
  const { parallelScale } = viewport.getCamera();
2826
2826
  const canvasRatio = magnifyViewport.canvas.offsetWidth / viewport.canvas.offsetWidth;
2827
2827
  return parallelScale * (1 / zoomFactor) * canvasRatio;
@@ -2995,7 +2995,7 @@ class AdvancedMagnifyViewport {
2995
2995
  }
2996
2996
  _syncViewportsCameras(sourceViewport, magnifyViewport) {
2997
2997
  const worldPos = sourceViewport.canvasToWorld(this.position);
2998
- const parallelScale = this._convertZoomFactorToParalellScale(sourceViewport, magnifyViewport, this.zoomFactor);
2998
+ const parallelScale = this._convertZoomFactorToParallelScale(sourceViewport, magnifyViewport, this.zoomFactor);
2999
2999
  const { focalPoint, position, viewPlaneNormal } = magnifyViewport.getCamera();
3000
3000
  const distance = Math.sqrt(Math.pow(focalPoint[0] - position[0], 2) +
3001
3001
  Math.pow(focalPoint[1] - position[1], 2) +
@@ -3023,11 +3023,17 @@ class AdvancedMagnifyViewport {
3023
3023
  const { viewport: sourceViewport } = this._sourceEnabledElement;
3024
3024
  const { viewport: magnifyViewport } = this._enabledElement;
3025
3025
  const sourceProperties = sourceViewport.getProperties();
3026
+ const imageData = magnifyViewport.getImageData();
3027
+ if (!imageData) {
3028
+ return;
3029
+ }
3026
3030
  magnifyViewport.setProperties(sourceProperties);
3027
3031
  this._syncViewportsCameras(sourceViewport, magnifyViewport);
3028
3032
  if (this._isStackViewport(sourceViewport)) {
3029
3033
  this._syncStackViewports(sourceViewport, magnifyViewport);
3030
3034
  }
3035
+ this._syncViewportsCameras(sourceViewport, magnifyViewport);
3036
+ magnifyViewport.render();
3031
3037
  }
3032
3038
  _resizeViewport() {
3033
3039
  const { viewport } = this._enabledElement;
@@ -3063,6 +3069,7 @@ class AdvancedMagnifyViewportManager {
3063
3069
  this._magnifyViewportsMap.set(magnifyViewport.viewportId, {
3064
3070
  annotation,
3065
3071
  magnifyViewport,
3072
+ magnifyViewportInfo: viewportInfo,
3066
3073
  });
3067
3074
  return magnifyViewport;
3068
3075
  };
@@ -3071,11 +3078,15 @@ class AdvancedMagnifyViewportManager {
3071
3078
  if (annotation.metadata.toolName !== ADVANCED_MAGNIFY_TOOL_NAME) {
3072
3079
  return;
3073
3080
  }
3074
- this._destroyViewport(annotation.data.magnifyViewportId);
3081
+ this.destroyViewport(annotation.data.magnifyViewportId);
3075
3082
  };
3076
3083
  this._newStackImageCallback = (evt) => {
3077
3084
  const { viewportId: sourceViewportId, imageId } = evt.detail;
3078
3085
  const magnifyViewportsMapEntries = this._getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId);
3086
+ const { viewport } = (0,dist_esm.getEnabledElementByViewportId)(sourceViewportId);
3087
+ if (viewport.stackActorReInitialized) {
3088
+ this._reset(sourceViewportId);
3089
+ }
3079
3090
  magnifyViewportsMapEntries.forEach(({ annotation }) => {
3080
3091
  annotation.metadata.referencedImageId = imageId;
3081
3092
  annotation.invalidated = true;
@@ -3124,7 +3135,7 @@ class AdvancedMagnifyViewportManager {
3124
3135
  this._removeEventListeners();
3125
3136
  this._destroyViewports();
3126
3137
  }
3127
- _destroyViewport(magnifyViewportId) {
3138
+ destroyViewport(magnifyViewportId) {
3128
3139
  const magnifyViewportMapEntry = this._magnifyViewportsMap.get(magnifyViewportId);
3129
3140
  if (magnifyViewportMapEntry) {
3130
3141
  const { magnifyViewport } = magnifyViewportMapEntry;
@@ -3137,7 +3148,7 @@ class AdvancedMagnifyViewportManager {
3137
3148
  }
3138
3149
  _destroyViewports() {
3139
3150
  const magnifyViewportIds = Array.from(this._magnifyViewportsMap.keys());
3140
- magnifyViewportIds.forEach((magnifyViewportId) => this._destroyViewport(magnifyViewportId));
3151
+ magnifyViewportIds.forEach((magnifyViewportId) => this.destroyViewport(magnifyViewportId));
3141
3152
  }
3142
3153
  _getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId) {
3143
3154
  const magnifyViewportsMapEntries = Array.from(this._magnifyViewportsMap.values());
@@ -3146,6 +3157,19 @@ class AdvancedMagnifyViewportManager {
3146
3157
  return viewport.id === sourceViewportId;
3147
3158
  });
3148
3159
  }
3160
+ _reset(sourceViewportId) {
3161
+ const magnifyViewports = this._getMagnifyViewportsMapEntriesBySourceViewportId(sourceViewportId);
3162
+ magnifyViewports.forEach(({ magnifyViewport, annotation, magnifyViewportInfo }) => {
3163
+ this.destroyViewport(magnifyViewport.viewportId);
3164
+ const newEnabledElement = (0,dist_esm.getEnabledElementByViewportId)(sourceViewportId);
3165
+ this.createViewport(annotation, {
3166
+ ...magnifyViewportInfo,
3167
+ sourceEnabledElement: {
3168
+ ...newEnabledElement,
3169
+ },
3170
+ });
3171
+ });
3172
+ }
3149
3173
  _addEventListeners() {
3150
3174
  dist_esm.eventTarget.addEventListener(enums.Events.ANNOTATION_REMOVED, this._annotationRemovedCallback);
3151
3175
  }
@@ -3154,11 +3178,27 @@ class AdvancedMagnifyViewportManager {
3154
3178
  }
3155
3179
  _addSourceElementEventListener(element) {
3156
3180
  element.addEventListener(Events.STACK_NEW_IMAGE, this._newStackImageCallback);
3181
+ const newStackHandler = (evt) => {
3182
+ const { viewportId: sourceViewportId } = evt.detail;
3183
+ this._reset(sourceViewportId);
3184
+ };
3185
+ element.addEventListener(Events.STACK_VIEWPORT_NEW_STACK, newStackHandler);
3186
+ const newVolumeHandler = (evt) => {
3187
+ const { viewportId: sourceViewportId } = evt.detail;
3188
+ this._reset(sourceViewportId);
3189
+ };
3190
+ element.addEventListener(Events.VOLUME_VIEWPORT_NEW_VOLUME, newVolumeHandler);
3157
3191
  element.addEventListener(Events.VOLUME_NEW_IMAGE, this._newVolumeImageCallback);
3192
+ element.newStackHandler = newStackHandler;
3193
+ element.newVolumeHandler = newVolumeHandler;
3158
3194
  }
3159
3195
  _removeSourceElementEventListener(element) {
3160
3196
  element.removeEventListener(Events.STACK_NEW_IMAGE, this._newStackImageCallback);
3161
3197
  element.removeEventListener(Events.VOLUME_NEW_IMAGE, this._newVolumeImageCallback);
3198
+ element.removeEventListener(Events.STACK_VIEWPORT_NEW_STACK, element.newStackHandler);
3199
+ element.removeEventListener(Events.VOLUME_VIEWPORT_NEW_VOLUME, element.newVolumeHandler);
3200
+ delete element.newStackHandler;
3201
+ delete element.newVolumeHandler;
3162
3202
  }
3163
3203
  _initialize() {
3164
3204
  this._addEventListeners();
@@ -7180,6 +7220,9 @@ var esm = __webpack_require__(44753);
7180
7220
  [StrategyCallbacks/* default */.A.ComputeInnerCircleRadius]: (operationData) => {
7181
7221
  const { configuration, viewport } = operationData;
7182
7222
  const { THRESHOLD: { dynamicRadius = 0 } = {} } = configuration.strategySpecificConfiguration || {};
7223
+ if (dynamicRadius === 0) {
7224
+ return;
7225
+ }
7183
7226
  const { spacing } = viewport.getImageData();
7184
7227
  const centerCanvas = [
7185
7228
  viewport.element.clientWidth / 2,
@@ -7342,6 +7385,14 @@ var segmentation = __webpack_require__(63421);
7342
7385
 
7343
7386
 
7344
7387
 
7388
+ function lightenColor(r, g, b, a, factor = 0.4) {
7389
+ return [
7390
+ Math.round(r + (255 - r) * factor),
7391
+ Math.round(g + (255 - g) * factor),
7392
+ Math.round(b + (255 - b) * factor),
7393
+ a,
7394
+ ];
7395
+ }
7345
7396
  /* harmony default export */ const preview = ({
7346
7397
  [StrategyCallbacks/* default */.A.Preview]: function (operationData) {
7347
7398
  const { previewColors, strategySpecificConfiguration, enabledElement } = operationData;
@@ -7379,11 +7430,11 @@ var segmentation = __webpack_require__(63421);
7379
7430
  if (!configColor && !segmentColor) {
7380
7431
  return;
7381
7432
  }
7382
- const previewColor = configColor || segmentColor.map((it) => it * 0.9);
7433
+ const previewColor = configColor || lightenColor(...segmentColor);
7383
7434
  segmentation.config.color.setColorForSegmentIndex(toolGroupId, segmentationRepresentationUID, previewSegmentIndex, previewColor);
7384
7435
  },
7385
7436
  [StrategyCallbacks/* default */.A.AcceptPreview]: (operationData) => {
7386
- const { segmentationVoxelManager: segmentationVoxelManager, previewVoxelManager: previewVoxelManager, previewSegmentIndex, preview, } = operationData;
7437
+ const { segmentationVoxelManager: segmentationVoxelManager, previewVoxelManager: previewVoxelManager, previewSegmentIndex, preview, } = operationData || {};
7387
7438
  if (previewSegmentIndex === undefined) {
7388
7439
  return;
7389
7440
  }
@@ -9534,6 +9585,9 @@ function filterAnnotationsForDisplay(viewport, annotations, filterOptions = {})
9534
9585
  if (!annotation.isVisible) {
9535
9586
  return false;
9536
9587
  }
9588
+ if (annotation.data.isCanvasAnnotation) {
9589
+ return true;
9590
+ }
9537
9591
  return viewport.isReferenceViewable(annotation.metadata, filterOptions);
9538
9592
  });
9539
9593
  }
@@ -301,8 +301,6 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
301
301
  toolName: toolNames.Magnify
302
302
  }, {
303
303
  toolName: toolNames.SegmentationDisplay
304
- }, {
305
- toolName: toolNames.AdvancedMagnify
306
304
  }, {
307
305
  toolName: toolNames.UltrasoundDirectional
308
306
  }, {
@@ -319,6 +317,8 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
319
317
  // disabled
320
318
  disabled: [{
321
319
  toolName: toolNames.ReferenceLines
320
+ }, {
321
+ toolName: toolNames.AdvancedMagnify
322
322
  }]
323
323
  };
324
324
  toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
@@ -497,12 +497,6 @@ const ReferenceLinesListeners = [{
497
497
  commandName: 'setSourceViewportForReferenceLinesTool',
498
498
  context: 'CORNERSTONE'
499
499
  }];
500
- const toggleEnabledDisabledToolbar = {
501
- commandName: 'toggleEnabledDisabledToolbar',
502
- commandOptions: {
503
- toolGroupIds: ['default', 'mpr', 'SRToolGroup', 'volume3d']
504
- }
505
- };
506
500
  const moreTools = [{
507
501
  id: 'MoreTools',
508
502
  uiType: 'ohif.splitButton',
@@ -568,7 +562,7 @@ const moreTools = [{
568
562
  icon: 'tool-referenceLines',
569
563
  label: 'Reference Lines',
570
564
  tooltip: 'Show Reference Lines',
571
- commands: toggleEnabledDisabledToolbar,
565
+ commands: 'toggleEnabledDisabledToolbar',
572
566
  listeners: {
573
567
  [src/* ViewportGridService */.sI.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesListeners,
574
568
  [src/* ViewportGridService */.sI.EVENTS.VIEWPORTS_READY]: ReferenceLinesListeners
@@ -579,7 +573,7 @@ const moreTools = [{
579
573
  icon: 'toggle-dicom-overlay',
580
574
  label: 'Image Overlay',
581
575
  tooltip: 'Toggle Image Overlay',
582
- commands: toggleEnabledDisabledToolbar,
576
+ commands: 'toggleEnabledDisabledToolbar',
583
577
  evaluate: 'evaluate.cornerstoneTool.toggle'
584
578
  }), moreTools_createButton({
585
579
  id: 'StackScroll',
@@ -648,8 +642,8 @@ const moreTools = [{
648
642
  icon: 'icon-tool-loupe',
649
643
  label: 'Loupe',
650
644
  tooltip: 'Loupe',
651
- commands: setToolActiveToolbar,
652
- evaluate: 'evaluate.cornerstoneTool'
645
+ commands: 'toggleActiveDisabledToolbar',
646
+ evaluate: 'evaluate.cornerstoneTool.toggle.ifStrictlyDisabled'
653
647
  }), moreTools_createButton({
654
648
  id: 'UltrasoundDirectionalTool',
655
649
  icon: 'icon-tool-ultrasound-bidirectional',
@@ -733,7 +733,7 @@ const DynamicVolumeControls = ({
733
733
  className: "w-1/2",
734
734
  onClick: () => {
735
735
  setComputedView(false);
736
- onDynamicClick();
736
+ onDynamicClick?.();
737
737
  }
738
738
  }, "4D"), /*#__PURE__*/react.createElement("button", {
739
739
  className: "w-1/2",
@@ -1009,7 +1009,8 @@ function PanelGenerateImage({
1009
1009
  element
1010
1010
  } = viewportInfo;
1011
1011
  cineService.playClip(element, {
1012
- framesPerSecond: frameRate
1012
+ framesPerSecond: frameRate,
1013
+ viewportId: activeViewportId
1013
1014
  });
1014
1015
  };
1015
1016
  const handleStop = () => {
@@ -17,6 +17,7 @@ __webpack_require__.r(__webpack_exports__);
17
17
  /* harmony import */ var _ohif_ui__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5085);
18
18
  /* harmony import */ var _utils_hydrateStructuredReport__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77089);
19
19
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(15575);
20
+ /* harmony import */ var _utils_createReferencedImageDisplaySet__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(92643);
20
21
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
22
 
22
23
 
@@ -26,6 +27,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
26
27
 
27
28
 
28
29
 
30
+
29
31
  const MEASUREMENT_TRACKING_EXTENSION_ID = '@ohif/extension-measurement-tracking';
30
32
  const SR_TOOLGROUP_BASE_NAME = 'SRToolGroup';
31
33
  function OHIFCornerstoneSRViewport(props) {
@@ -198,7 +200,10 @@ function OHIFCornerstoneSRViewport(props) {
198
200
  // The positionIds for the viewport aren't meaningful for the child display sets
199
201
  positionIds: null
200
202
  },
201
- onElementEnabled: onElementEnabled,
203
+ onElementEnabled: evt => {
204
+ props.onElementEnabled?.(evt);
205
+ onElementEnabled(evt);
206
+ },
202
207
  initialImageIndex: initialImageIndex,
203
208
  isJumpToMeasurementDisabled: true
204
209
  }));
@@ -332,12 +337,19 @@ OHIFCornerstoneSRViewport.defaultProps = {
332
337
  customProps: {}
333
338
  };
334
339
  async function _getViewportReferencedDisplaySetData(displaySet, measurementSelected, displaySetService) {
340
+ const {
341
+ measurements
342
+ } = displaySet;
343
+ const measurement = measurements[measurementSelected];
344
+ const {
345
+ displaySetInstanceUID
346
+ } = measurement;
335
347
  if (!displaySet.keyImageDisplaySet) {
336
348
  // Create a new display set, and preserve a reference to it here,
337
349
  // so that it can be re-displayed and shown inside the SR viewport.
338
350
  // This is only for ease of redisplay - the display set is stored in the
339
351
  // usual manner in the display set service.
340
- displaySet.keyImageDisplaySet = createReferencedImageDisplaySet(displaySetService, displaySet);
352
+ displaySet.keyImageDisplaySet = (0,_utils_createReferencedImageDisplaySet__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(displaySetService, displaySet);
341
353
  }
342
354
  const referencedDisplaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
343
355
  const image0 = referencedDisplaySet.images[0];
@@ -1004,7 +1004,8 @@ function WrappedCinePlayer({
1004
1004
  } = cines[viewportId];
1005
1005
  const validFrameRate = Math.max(frameRate, 1);
1006
1006
  return isPlaying ? cineService.playClip(enabledVPElement, {
1007
- framesPerSecond: validFrameRate
1007
+ framesPerSecond: validFrameRate,
1008
+ viewportId
1008
1009
  }) : cineService.stopClip(enabledVPElement);
1009
1010
  };
1010
1011
  const newDisplaySetHandler = (0,react.useCallback)(() => {
@@ -2209,9 +2210,19 @@ const OHIFCornerstoneViewport = /*#__PURE__*/react.memo(props => {
2209
2210
  // Note: you SHOULD NOT use the initialImageIdOrIndex for manipulation
2210
2211
  // of the imageData in the OHIFCornerstoneViewport. This prop is used
2211
2212
  // to set the initial state of the viewport's first image to render
2212
- initialImageIndex
2213
+ initialImageIndex,
2214
+ // if the viewport is part of a hanging protocol layout
2215
+ // we should not really rely on the old synchronizers and
2216
+ // you see below we only rehydrate the synchronizers if the viewport
2217
+ // is not part of the hanging protocol layout. HPs should
2218
+ // define their own synchronizers. Since the synchronizers are
2219
+ // viewportId dependent and
2220
+ isHangingProtocolLayout
2213
2221
  } = props;
2214
2222
  const viewportId = viewportOptions.viewportId;
2223
+ if (!viewportId) {
2224
+ throw new Error('Viewport ID is required');
2225
+ }
2215
2226
 
2216
2227
  // Since we only have support for dynamic data in volume viewports, we should
2217
2228
  // handle this case here and set the viewportType to volume if any of the
@@ -2272,7 +2283,7 @@ const OHIFCornerstoneViewport = /*#__PURE__*/react.memo(props => {
2272
2283
  toolGroupService.addViewportToToolGroup(viewportId, renderingEngineId, toolGroupId);
2273
2284
  syncGroupService.addViewportToSyncGroup(viewportId, renderingEngineId, syncGroups);
2274
2285
  const synchronizersStore = stateSyncService.getState().synchronizersStore;
2275
- if (synchronizersStore?.[viewportId]?.length) {
2286
+ if (synchronizersStore?.[viewportId]?.length && !isHangingProtocolLayout) {
2276
2287
  // If the viewport used to have a synchronizer, re apply it again
2277
2288
  _rehydrateSynchronizers(synchronizersStore, viewportId, syncGroupService);
2278
2289
  }
@@ -509,12 +509,14 @@ function PanelSegmentation({
509
509
  const {
510
510
  segmentationService,
511
511
  viewportGridService,
512
- uiDialogService
512
+ uiDialogService,
513
+ displaySetService
513
514
  } = servicesManager.services;
514
515
  const {
515
516
  t
516
517
  } = (0,dist_es/* useTranslation */.Bd)('PanelSegmentation');
517
518
  const [selectedSegmentationId, setSelectedSegmentationId] = (0,react.useState)(null);
519
+ const [addSegmentationClassName, setAddSegmentationClassName] = (0,react.useState)('');
518
520
  const [segmentationConfiguration, setSegmentationConfiguration] = (0,react.useState)(segmentationService.getConfiguration());
519
521
  const [segmentations, setSegmentations] = (0,react.useState)(() => segmentationService.getSegmentations());
520
522
  (0,react.useEffect)(() => {
@@ -539,6 +541,47 @@ function PanelSegmentation({
539
541
  });
540
542
  };
541
543
  }, []);
544
+
545
+ // temporary measure to not allow add segmentation when the selected viewport
546
+ // is stack viewport
547
+ (0,react.useEffect)(() => {
548
+ const handleActiveViewportChange = viewportId => {
549
+ const displaySetUIDs = viewportGridService.getDisplaySetsUIDsForViewport(viewportId || viewportGridService.getActiveViewportId());
550
+ if (!displaySetUIDs) {
551
+ return;
552
+ }
553
+ const isReconstructable = displaySetUIDs?.some(displaySetUID => {
554
+ const displaySet = displaySetService.getDisplaySetByUID(displaySetUID);
555
+ return displaySet?.isReconstructable;
556
+ }) || false;
557
+ if (isReconstructable) {
558
+ setAddSegmentationClassName('');
559
+ } else {
560
+ setAddSegmentationClassName('ohif-disabled');
561
+ }
562
+ };
563
+
564
+ // Handle initial state
565
+ handleActiveViewportChange();
566
+ const changed = viewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED;
567
+ const ready = viewportGridService.EVENTS.VIEWPORTS_READY;
568
+ const subs = [];
569
+ [ready, changed].forEach(evt => {
570
+ const {
571
+ unsubscribe
572
+ } = viewportGridService.subscribe(evt, ({
573
+ viewportId
574
+ }) => {
575
+ handleActiveViewportChange(viewportId);
576
+ });
577
+ subs.push(unsubscribe);
578
+ });
579
+
580
+ // Clean up
581
+ return () => {
582
+ subs.forEach(unsub => unsub());
583
+ };
584
+ }, []);
542
585
  const getToolGroupIds = segmentationId => {
543
586
  const toolGroupIds = segmentationService.getToolGroupIdsWithSegmentation(segmentationId);
544
587
  return toolGroupIds;
@@ -618,6 +661,8 @@ function PanelSegmentation({
618
661
  const onSegmentDelete = (segmentationId, segmentIndex) => {
619
662
  segmentationService.removeSegment(segmentationId, segmentIndex);
620
663
  };
664
+
665
+ // segment hide
621
666
  const onToggleSegmentVisibility = (segmentationId, segmentIndex) => {
622
667
  const segmentation = segmentationService.getSegmentation(segmentationId);
623
668
  const segmentInfo = segmentation.segments[segmentIndex];
@@ -692,6 +737,7 @@ function PanelSegmentation({
692
737
  disableEditing: configuration.disableEditing,
693
738
  activeSegmentationId: selectedSegmentationId || '',
694
739
  onSegmentationAdd: onSegmentationAddWrapper,
740
+ addSegmentationClassName: addSegmentationClassName,
695
741
  showAddSegment: allowAddSegment,
696
742
  onSegmentationClick: onSegmentationClick,
697
743
  onSegmentationDelete: onSegmentationDelete,
@@ -1366,30 +1412,6 @@ const commandsModule = ({
1366
1412
  });
1367
1413
  });
1368
1414
  });
1369
- },
1370
- toggleThresholdRangeAndDynamic() {
1371
- const toolGroupIds = toolGroupService.getToolGroupIds();
1372
- if (!toolGroupIds) {
1373
- return;
1374
- }
1375
- toolGroupIds.forEach(toolGroupId => {
1376
- const toolGroup = toolGroupService.getToolGroup(toolGroupId);
1377
- const brushInstances = segmentationUtils.getBrushToolInstances(toolGroup.id);
1378
- brushInstances.forEach(({
1379
- configuration
1380
- }) => {
1381
- const {
1382
- activeStrategy,
1383
- strategySpecificConfiguration
1384
- } = configuration;
1385
- if (activeStrategy.startsWith('THRESHOLD')) {
1386
- const thresholdConfig = strategySpecificConfiguration.THRESHOLD;
1387
- if (thresholdConfig) {
1388
- thresholdConfig.isDynamic = !thresholdConfig.isDynamic;
1389
- }
1390
- }
1391
- });
1392
- });
1393
1415
  }
1394
1416
  };
1395
1417
  const definitions = {
@@ -1422,9 +1444,6 @@ const commandsModule = ({
1422
1444
  },
1423
1445
  setThresholdRange: {
1424
1446
  commandFn: actions.setThresholdRange
1425
- },
1426
- toggleThresholdRangeAndDynamic: {
1427
- commandFn: actions.toggleThresholdRangeAndDynamic
1428
1447
  }
1429
1448
  };
1430
1449
  return {
@@ -1496,11 +1515,7 @@ function getToolNameForButton(button) {
1496
1515
  const commands = props?.commands || button.commands;
1497
1516
  const commandsArray = Array.isArray(commands) ? commands : [commands];
1498
1517
  const firstCommand = commandsArray[0];
1499
- if (typeof firstCommand === 'string') {
1500
- // likely not a cornerstone tool
1501
- return null;
1502
- }
1503
- if ('commandOptions' in firstCommand) {
1518
+ if (firstCommand?.commandOptions) {
1504
1519
  return firstCommand.commandOptions.toolName ?? props?.id ?? button.id;
1505
1520
  }
1506
1521