@ohif/app 3.9.0 → 3.9.2

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 (38) hide show
  1. package/dist/{1185.bundle.a6e220f00576d6926fe7.js → 1185.bundle.d328aabb2b43e9ea1f96.js} +62 -14
  2. package/dist/{1266.bundle.8fd38b710e91305721e5.js → 1266.bundle.46de27eda2ef1fce1243.js} +5 -0
  3. package/dist/{1436.bundle.773756cd51b69e887bac.js → 1436.bundle.27ae9c87e9fc7f52cad3.js} +234 -63
  4. package/dist/{1927.bundle.49539e3ab5b0aad1399c.js → 1927.bundle.2b2fa0b539d6ac5b0dc3.js} +1 -1
  5. package/dist/{3200.bundle.45b19ea468d6208f0e7e.js → 3200.bundle.ccb809fb554332d9a0f5.js} +62 -9
  6. package/dist/{149.bundle.b8d177954628f4631fc0.js → 3900.bundle.3937999d1ee1f391647a.js} +46 -7
  7. package/dist/{4571.bundle.3b1691730b3c57bf4d35.js → 4571.bundle.a37be49663df2f4a2c8a.js} +99 -89
  8. package/dist/{5247.bundle.03fa8aac71d4e597d708.js → 5247.bundle.1a1d7c27de482e4a73f3.js} +2 -2
  9. package/dist/{5252.bundle.5ec502c53a9cc877ed8d.js → 5252.bundle.f2675336275573a288d5.js} +13 -1
  10. package/dist/{1520.bundle.fde5eb31364855194519.js → 5630.bundle.1bd2402f37597078c1a1.js} +70 -59
  11. package/dist/{5717.bundle.848e13f256818475f57f.js → 5717.bundle.32836c212103dbbe8e4a.js} +247 -64
  12. package/dist/{7197.bundle.db0d51e5529d88a4cd7f.js → 7197.bundle.42a975bb7ae4a8df2d00.js} +2 -2
  13. package/dist/{7955.bundle.699bffabae3a9915c326.js → 7955.bundle.f6c5edb284bdf8b80f2a.js} +1 -1
  14. package/dist/{8228.bundle.55ac03d7165248f47d4e.js → 8228.bundle.0a7997d04c82dd8c11c5.js} +2 -2
  15. package/dist/{8523.bundle.648334132159465cdc41.js → 8523.bundle.c0ec85de98ba380ebeb4.js} +55 -13
  16. package/dist/{9551.bundle.13a3eec1e003a46095bc.js → 9551.bundle.63b2679dd7beee6396d8.js} +1 -1
  17. package/dist/{app.bundle.8e454976c3d4c3348750.js → app.bundle.632bc6188462e1c95a41.js} +156 -89
  18. package/dist/app.bundle.css +2 -2
  19. package/dist/index.html +1 -1
  20. package/dist/{polySeg.bundle.b79ae514989e86301c71.js → polySeg.bundle.6e85073e3abf2e6e6078.js} +1 -1
  21. package/dist/serve.json +1 -10
  22. package/dist/{suv-peak-worker.bundle.76dd4fdf82aaa2c3ad41.js → suv-peak-worker.bundle.1f483dc7131d7c26b517.js} +3 -3
  23. package/dist/sw.js +1 -1
  24. package/package.json +19 -19
  25. /package/dist/{1374.bundle.f56c07364d8f6ed2d00e.js → 1374.bundle.1ee8326c0748c7b1a7c0.js} +0 -0
  26. /package/dist/{213.bundle.38caad239bcfec1d28fb.js → 213.bundle.8c04fecea2e3796e4d73.js} +0 -0
  27. /package/dist/{2424.bundle.c7b6d3475da1ffff744b.js → 2424.bundle.38b19314ebd984c9d393.js} +0 -0
  28. /package/dist/{2825.bundle.ba60e0011bcebdf7a413.js → 2825.bundle.0307cae794e8b057c674.js} +0 -0
  29. /package/dist/{3198.bundle.9b80ca2f1d99a7f9a4fe.js → 3198.bundle.ab612063af0d67397377.js} +0 -0
  30. /package/dist/{4834.bundle.4bfa1bd1d4a163de3350.js → 4834.bundle.c25348524be5214e90d6.js} +0 -0
  31. /package/dist/{5139.bundle.b185b1df3847a2025829.js → 5139.bundle.db30dc02cf41e91c8985.js} +0 -0
  32. /package/dist/{5687.bundle.3a558ac2eb26f5295668.js → 5687.bundle.05de4787676bf79f9906.js} +0 -0
  33. /package/dist/{717.bundle.62437bfeb54f01269abe.js → 717.bundle.3a4b8835adf03e4554c7.js} +0 -0
  34. /package/dist/{8008.bundle.1ab47eccf7608fe14e92.js → 8008.bundle.d4187a30e8f656a21316.js} +0 -0
  35. /package/dist/{8259.bundle.4385bd89c3f7f4ced27c.js → 8259.bundle.990db2fa9ce0800319e9.js} +0 -0
  36. /package/dist/{8558.bundle.3b0654ad2a52ac9786dd.js → 8558.bundle.63714e2329c22c9cb9da.js} +0 -0
  37. /package/dist/{9611.bundle.767595c93877e5166c03.js → 9611.bundle.78a4ffb439f65cfd0379.js} +0 -0
  38. /package/dist/{9862.bundle.7146682e56aa66130ae6.js → 9862.bundle.aa2f8e0010f1be1bc87d.js} +0 -0
@@ -983,8 +983,8 @@ function initWADOImageLoader(userAuthenticationService, appConfig, extensionMana
983
983
  function destroy() {
984
984
  console.debug('Destroying WADO Image Loader');
985
985
  }
986
- // EXTERNAL MODULE: ../../../extensions/default/src/index.ts + 114 modules
987
- var default_src = __webpack_require__(71520);
986
+ // EXTERNAL MODULE: ../../../extensions/default/src/index.ts + 115 modules
987
+ var default_src = __webpack_require__(55630);
988
988
  // EXTERNAL MODULE: ../../../extensions/cornerstone/src/state.ts
989
989
  var state = __webpack_require__(71353);
990
990
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/utils/getActiveViewportEnabledElement.ts
@@ -4408,9 +4408,9 @@ const initMeasurementService = (measurementService, displaySetService, cornersto
4408
4408
  /* Mappings */
4409
4409
  measurementService.addMapping(csTools3DVer1MeasurementSource, 'Length', Length.matchingCriteria, Length.toAnnotation, Length.toMeasurement);
4410
4410
  measurementService.addMapping(csTools3DVer1MeasurementSource, 'Crosshairs', Length.matchingCriteria, () => {
4411
- console.warn('Crosshairs mapping not implemented.');
4411
+ return null;
4412
4412
  }, () => {
4413
- console.warn('Crosshairs mapping not implemented.');
4413
+ return null;
4414
4414
  });
4415
4415
  measurementService.addMapping(csTools3DVer1MeasurementSource, 'Bidirectional', Bidirectional.matchingCriteria, Bidirectional.toAnnotation, Bidirectional.toMeasurement);
4416
4416
  measurementService.addMapping(csTools3DVer1MeasurementSource, 'EllipticalROI', EllipticalROI.matchingCriteria, EllipticalROI.toAnnotation, EllipticalROI.toMeasurement);
@@ -5278,7 +5278,7 @@ function interleaveTopToBottom({
5278
5278
  const AllRequests = [];
5279
5279
  volumes.forEach(volume => {
5280
5280
  const requests = volume.getImageLoadRequests();
5281
- if (!requests.length || !requests[0] || !requests[0].imageId) {
5281
+ if (!requests?.[0]?.imageId) {
5282
5282
  return;
5283
5283
  }
5284
5284
 
@@ -5652,6 +5652,8 @@ var useLutPresentationStore = __webpack_require__(10182);
5652
5652
  var usePositionPresentationStore = __webpack_require__(44646);
5653
5653
  // EXTERNAL MODULE: ../../../extensions/cornerstone/src/stores/useSegmentationPresentationStore.ts + 1 modules
5654
5654
  var useSegmentationPresentationStore = __webpack_require__(2847);
5655
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/utilities/index.js + 40 modules
5656
+ var esm_utilities = __webpack_require__(49035);
5655
5657
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone/src/init.tsx
5656
5658
 
5657
5659
 
@@ -5674,6 +5676,7 @@ var useSegmentationPresentationStore = __webpack_require__(2847);
5674
5676
 
5675
5677
 
5676
5678
 
5679
+
5677
5680
 
5678
5681
 
5679
5682
  const {
@@ -5755,9 +5758,18 @@ async function init({
5755
5758
  const metadataProvider = src/* default.classes */.Ay.classes.MetadataProvider;
5756
5759
  esm.volumeLoader.registerVolumeLoader('cornerstoneStreamingImageVolume', loaders/* cornerstoneStreamingImageVolumeLoader */.FC);
5757
5760
  esm.volumeLoader.registerVolumeLoader('cornerstoneStreamingDynamicImageVolume', loaders/* cornerstoneStreamingDynamicImageVolumeLoader */.Mr);
5758
- hangingProtocolService.registerImageLoadStrategy('interleaveCenter', interleaveCenterLoader);
5759
- hangingProtocolService.registerImageLoadStrategy('interleaveTopToBottom', interleaveTopToBottom);
5760
- hangingProtocolService.registerImageLoadStrategy('nth', interleaveNthLoader);
5761
+
5762
+ // Register strategies using the wrapper
5763
+ const imageLoadStrategies = {
5764
+ interleaveCenter: interleaveCenterLoader,
5765
+ interleaveTopToBottom: interleaveTopToBottom,
5766
+ nth: interleaveNthLoader
5767
+ };
5768
+ Object.entries(imageLoadStrategies).forEach(([name, strategyFn]) => {
5769
+ hangingProtocolService.registerImageLoadStrategy(name, createMetadataWrappedStrategy(strategyFn));
5770
+ });
5771
+
5772
+ // ... existing code ...
5761
5773
 
5762
5774
  // add metadata providers
5763
5775
  esm.metaData.addProvider(esm.utilities.calibratedPixelSpacingMetadataProvider.get.bind(esm.utilities.calibratedPixelSpacingMetadataProvider)); // this provider is required for Calibration tool
@@ -5920,6 +5932,27 @@ function initializeWebWorkerProgressHandler(uiNotificationService) {
5920
5932
  }
5921
5933
  });
5922
5934
  }
5935
+
5936
+ /**
5937
+ * Creates a wrapped image load strategy with metadata handling
5938
+ * @param strategyFn - The image loading strategy function to wrap
5939
+ * @returns A wrapped strategy function that handles metadata configuration
5940
+ */
5941
+ const createMetadataWrappedStrategy = strategyFn => {
5942
+ return args => {
5943
+ const clonedConfig = esm_utilities.imageRetrieveMetadataProvider.clone();
5944
+ esm_utilities.imageRetrieveMetadataProvider.clear();
5945
+ try {
5946
+ const result = strategyFn(args);
5947
+ return result;
5948
+ } finally {
5949
+ // Ensure metadata is always restored, even if there's an error
5950
+ setTimeout(() => {
5951
+ esm_utilities.imageRetrieveMetadataProvider.restore(clonedConfig);
5952
+ }, 10);
5953
+ }
5954
+ };
5955
+ };
5923
5956
  function CPUModal() {
5924
5957
  return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement("p", null, "Your computer does not have enough GPU power to support the default GPU rendering mode. OHIF has switched to CPU rendering mode. Please note that CPU rendering does not support all features such as Volume Rendering, Multiplanar Reconstruction, and Segmentation Overlays."));
5925
5958
  }
@@ -13305,6 +13338,20 @@ class CornerstoneViewportService extends src/* PubSubService */.Rc {
13305
13338
  * individual resize observers
13306
13339
  */
13307
13340
  resize(isGridResize = false) {
13341
+ // https://stackoverflow.com/a/26279685
13342
+ // This resize() call, among other things, rerenders the viewports. But when the entire viewer is
13343
+ // display: none'd, it makes the size of all hidden elements 0, including the viewport canvas and its containers.
13344
+ // Even if the viewer is later displayed again, trying to render when the size is 0 permanently "breaks" the
13345
+ // viewport, making it fully black even after the size is normal again. So just ignore resize events when hidden:
13346
+ const areViewportsHidden = Array.from(this.viewportsById.values()).every(viewportInfo => {
13347
+ const element = viewportInfo.getElement();
13348
+ return element.clientWidth === 0 && element.clientHeight === 0;
13349
+ });
13350
+ if (areViewportsHidden) {
13351
+ console.warn('Ignoring resize when viewports have size 0');
13352
+ return;
13353
+ }
13354
+
13308
13355
  // if there is a grid resize happening, it means the viewport grid
13309
13356
  // has been manipulated (e.g., panels closed, added, etc.) and we need
13310
13357
  // to resize all viewports, so we will add a timeout here to make sure
@@ -14140,6 +14187,11 @@ class CornerstoneViewportService extends src/* PubSubService */.Rc {
14140
14187
  id: viewportId
14141
14188
  }) => {
14142
14189
  const presentation = this._getPositionPresentation(viewportId);
14190
+
14191
+ // During a resize, the slice index should remain unchanged. This is a temporary fix for
14192
+ // a larger issue regarding the definition of slice index with slab thickness.
14193
+ // We need to revisit this to make it more robust and understandable.
14194
+ delete presentation.viewReference.sliceIndex;
14143
14195
  this.beforeResizePositionPresentations.set(viewportId, presentation);
14144
14196
  });
14145
14197
 
@@ -14148,7 +14200,7 @@ class CornerstoneViewportService extends src/* PubSubService */.Rc {
14148
14200
  renderingEngine.resize(isImmediate);
14149
14201
  renderingEngine.render();
14150
14202
 
14151
- // Reset the camera for viewports that should reset their camera on resize,
14203
+ // Reset the camera for all viewports using position presentation to maintain relative size/position
14152
14204
  // which means only those viewports that have a zoom level of 1.
14153
14205
  this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => {
14154
14206
  this.setPresentations(viewportId, {
@@ -14905,10 +14957,6 @@ function getDicomMicroscopySopClassHandler({
14905
14957
  function getSopClassHandlerModule(params) {
14906
14958
  return [getDicomMicroscopySopClassHandler(params)];
14907
14959
  }
14908
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/utilities/index.js + 40 modules
14909
- var esm_utilities = __webpack_require__(49035);
14910
- // EXTERNAL MODULE: ../../../extensions/default/src/stores/useToggleOneUpViewportGridStore.ts
14911
- var useToggleOneUpViewportGridStore = __webpack_require__(73325);
14912
14960
  // EXTERNAL MODULE: ../../../node_modules/lodash.debounce/index.js
14913
14961
  var lodash_debounce = __webpack_require__(62051);
14914
14962
  var lodash_debounce_default = /*#__PURE__*/__webpack_require__.n(lodash_debounce);
@@ -16738,7 +16786,7 @@ const cornerstoneExtension = {
16738
16786
  useLutPresentationStore/* useLutPresentationStore */.I.getState().clearLutPresentationStore();
16739
16787
  usePositionPresentationStore/* usePositionPresentationStore */.q.getState().clearPositionPresentationStore();
16740
16788
  useSynchronizersStore/* useSynchronizersStore */.U.getState().clearSynchronizersStore();
16741
- useToggleOneUpViewportGridStore/* useToggleOneUpViewportGridStore */.Y.getState().clearToggleOneUpViewportGridStore();
16789
+ default_src.useToggleOneUpViewportGridStore.getState().clearToggleOneUpViewportGridStore();
16742
16790
  useSegmentationPresentationStore/* useSegmentationPresentationStore */.v.getState().clearSegmentationPresentationStore();
16743
16791
  segmentationService.removeAllSegmentations();
16744
16792
  },
@@ -762,6 +762,11 @@ const performCustomizations = customizationService => {
762
762
  id: 'PanelSegmentation.disableEditing',
763
763
  disableEditing: true
764
764
  }
765
+ // to only show current study in the panel study browser
766
+ // {
767
+ // id: 'PanelStudyBrowser.studyMode',
768
+ // mode: 'primary',
769
+ // },
765
770
  // To disable editing in the MeasurementTable
766
771
  // {
767
772
  // id: 'PanelMeasurement.disableEditing',
@@ -4116,6 +4116,9 @@ class Synchronizer {
4116
4116
  };
4117
4117
  viewports.forEach((vp) => {
4118
4118
  const eventSource = this.getEventSource(vp);
4119
+ if (!eventSource) {
4120
+ return;
4121
+ }
4119
4122
  eventSource.removeEventListener(esm.Enums.Events.ELEMENT_DISABLED, disableHandler);
4120
4123
  eventSource.addEventListener(esm.Enums.Events.ELEMENT_DISABLED, disableHandler);
4121
4124
  });
@@ -4129,9 +4132,13 @@ class Synchronizer {
4129
4132
  const { renderingEngineId, viewportId } = viewportInfo;
4130
4133
  const renderingEngine = (0,esm.getRenderingEngine)(renderingEngineId);
4131
4134
  if (!renderingEngine) {
4132
- throw new Error(`No RenderingEngine for Id: ${renderingEngineId}`);
4135
+ return null;
4133
4136
  }
4134
- return renderingEngine.getViewport(viewportId).element;
4137
+ const viewport = renderingEngine.getViewport(viewportId);
4138
+ if (!viewport) {
4139
+ return null;
4140
+ }
4141
+ return viewport.element;
4135
4142
  }
4136
4143
  }
4137
4144
  function _getUniqueViewports(vp1, vp2) {
@@ -6504,16 +6511,10 @@ class CrosshairsTool extends base/* AnnotationTool */.EC {
6504
6511
  return otherViewportsAnnotationsWithUniqueCameras;
6505
6512
  };
6506
6513
  this._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
6507
- const actors = viewport.getActors();
6508
- const otherViewportActors = otherViewport.getActors();
6509
- let sameScene = true;
6510
- actors.forEach((actor) => {
6511
- if (actors.length !== otherViewportActors.length ||
6512
- otherViewportActors.find(({ uid }) => uid === actor.uid) === undefined) {
6513
- sameScene = false;
6514
- }
6515
- });
6516
- return sameScene;
6514
+ const volumeIds = viewport.getAllVolumeIds();
6515
+ const otherVolumeIds = otherViewport.getAllVolumeIds();
6516
+ return (volumeIds.length === otherVolumeIds.length &&
6517
+ volumeIds.every((id) => otherVolumeIds.includes(id)));
6517
6518
  };
6518
6519
  this._jump = (enabledElement, jumpWorld) => {
6519
6520
  state/* state */.wk.isInteractingWithTool = true;
@@ -9162,7 +9163,7 @@ class ScaleOverlayTool extends AnnotationDisplayTool/* default */.A {
9162
9163
  }
9163
9164
  const { viewUp, viewPlaneNormal } = viewport.getCamera();
9164
9165
  const viewportCanvasCornersInWorld = esm.utilities.getViewportImageCornersInWorld(viewport);
9165
- let annotation = this.editData.annotation;
9166
+ let annotation = this.editData?.annotation;
9166
9167
  const annotations = (0,annotationState.getAnnotations)(this.getToolName(), viewport.element);
9167
9168
  if (annotations.length) {
9168
9169
  annotation = annotations.filter((thisAnnotation) => thisAnnotation.data.viewportId == viewport.id)[0];
@@ -9190,7 +9191,7 @@ class ScaleOverlayTool extends AnnotationDisplayTool/* default */.A {
9190
9191
  annotation = newAnnotation;
9191
9192
  }
9192
9193
  });
9193
- if (this.editData.annotation &&
9194
+ if (this.editData?.annotation &&
9194
9195
  this.editData.annotation.data.viewportId == viewport.id) {
9195
9196
  this.editData.annotation.data.handles.points =
9196
9197
  viewportCanvasCornersInWorld;
@@ -9405,7 +9406,7 @@ class ScaleOverlayTool extends AnnotationDisplayTool/* default */.A {
9405
9406
  };
9406
9407
  }
9407
9408
  renderAnnotation(enabledElement, svgDrawingHelper) {
9408
- if (!this.editData.viewport) {
9409
+ if (!this.editData || !this.editData.viewport) {
9409
9410
  return;
9410
9411
  }
9411
9412
  const location = this.configuration.scaleLocation;
@@ -9911,7 +9912,7 @@ class LengthTool extends base/* AnnotationTool */.EC {
9911
9912
  const { currentPoints, element } = eventDetail;
9912
9913
  const worldPos = currentPoints.world;
9913
9914
  const enabledElement = (0,esm.getEnabledElement)(element);
9914
- const { viewport, renderingEngine } = enabledElement;
9915
+ const { viewport } = enabledElement;
9915
9916
  (0,elementCursor.hideElementCursor)(element);
9916
9917
  this.isDrawing = true;
9917
9918
  const { viewPlaneNormal, viewUp, position: cameraPosition, } = viewport.getCamera();
@@ -10226,6 +10227,39 @@ class LengthTool extends base/* AnnotationTool */.EC {
10226
10227
  };
10227
10228
  this._throttledCalculateCachedStats = (0,throttle/* default */.A)(this._calculateCachedStats, 100, { trailing: true });
10228
10229
  }
10230
+ static { this.hydrate = (viewportId, points, options) => {
10231
+ const enabledElement = (0,esm.getEnabledElementByViewportId)(viewportId);
10232
+ if (!enabledElement) {
10233
+ return;
10234
+ }
10235
+ const { viewport } = enabledElement;
10236
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
10237
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
10238
+ const instance = new this();
10239
+ const referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
10240
+ const annotation = {
10241
+ annotationUID: options?.annotationUID || esm.utilities.uuidv4(),
10242
+ data: {
10243
+ handles: {
10244
+ points,
10245
+ },
10246
+ },
10247
+ highlighted: false,
10248
+ autoGenerated: false,
10249
+ invalidated: false,
10250
+ isLocked: false,
10251
+ isVisible: true,
10252
+ metadata: {
10253
+ toolName: instance.getToolName(),
10254
+ viewPlaneNormal,
10255
+ FrameOfReferenceUID,
10256
+ referencedImageId,
10257
+ ...options,
10258
+ },
10259
+ };
10260
+ (0,annotationState.addAnnotation)(annotation, viewport.element);
10261
+ (0,triggerAnnotationRenderForViewportIds/* default */.A)([viewport.id]);
10262
+ }; }
10229
10263
  handleSelectedCallback(evt, annotation, handle) {
10230
10264
  const eventDetail = evt.detail;
10231
10265
  const { element } = eventDetail;
@@ -10970,6 +11004,39 @@ class ProbeTool extends base/* AnnotationTool */.EC {
10970
11004
  return false;
10971
11005
  }
10972
11006
  toolSelectedCallback() { }
11007
+ static { this.hydrate = (viewportId, points, options) => {
11008
+ const enabledElement = (0,esm.getEnabledElementByViewportId)(viewportId);
11009
+ if (!enabledElement) {
11010
+ return;
11011
+ }
11012
+ const { viewport } = enabledElement;
11013
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
11014
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
11015
+ const instance = new this();
11016
+ const referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
11017
+ const annotation = {
11018
+ annotationUID: options?.annotationUID || esm.utilities.uuidv4(),
11019
+ data: {
11020
+ handles: {
11021
+ points,
11022
+ },
11023
+ },
11024
+ highlighted: false,
11025
+ autoGenerated: false,
11026
+ invalidated: false,
11027
+ isLocked: false,
11028
+ isVisible: true,
11029
+ metadata: {
11030
+ toolName: instance.getToolName(),
11031
+ viewPlaneNormal,
11032
+ FrameOfReferenceUID,
11033
+ referencedImageId,
11034
+ ...options,
11035
+ },
11036
+ };
11037
+ (0,annotationState.addAnnotation)(annotation, viewport.element);
11038
+ (0,triggerAnnotationRenderForViewportIds/* default */.A)([viewport.id]);
11039
+ }; }
10973
11040
  getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
10974
11041
  const enabledElement = (0,esm.getEnabledElement)(element);
10975
11042
  const { viewport } = enabledElement;
@@ -12459,6 +12526,52 @@ class CircleROITool extends base/* AnnotationTool */.EC {
12459
12526
  };
12460
12527
  this._throttledCalculateCachedStats = (0,throttle/* default */.A)(this._calculateCachedStats, 100, { trailing: true });
12461
12528
  }
12529
+ static { this.hydrate = (viewportId, points, options) => {
12530
+ const enabledElement = (0,esm.getEnabledElementByViewportId)(viewportId);
12531
+ if (!enabledElement) {
12532
+ return;
12533
+ }
12534
+ const { viewport } = enabledElement;
12535
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
12536
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
12537
+ const instance = new this();
12538
+ const referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
12539
+ const annotation = {
12540
+ annotationUID: options?.annotationUID || esm.utilities.uuidv4(),
12541
+ data: {
12542
+ handles: {
12543
+ points,
12544
+ textBox: {
12545
+ hasMoved: false,
12546
+ worldPosition: [0, 0, 0],
12547
+ worldBoundingBox: {
12548
+ topLeft: [0, 0, 0],
12549
+ topRight: [0, 0, 0],
12550
+ bottomLeft: [0, 0, 0],
12551
+ bottomRight: [0, 0, 0],
12552
+ },
12553
+ },
12554
+ activeHandleIndex: null,
12555
+ },
12556
+ label: '',
12557
+ cachedStats: {},
12558
+ },
12559
+ highlighted: false,
12560
+ autoGenerated: false,
12561
+ invalidated: false,
12562
+ isLocked: false,
12563
+ isVisible: true,
12564
+ metadata: {
12565
+ toolName: instance.getToolName(),
12566
+ viewPlaneNormal,
12567
+ FrameOfReferenceUID,
12568
+ referencedImageId,
12569
+ ...options,
12570
+ },
12571
+ };
12572
+ (0,annotationState.addAnnotation)(annotation, viewport.element);
12573
+ (0,triggerAnnotationRenderForViewportIds/* default */.A)([viewport.id]);
12574
+ }; }
12462
12575
  }
12463
12576
  function CircleROITool_defaultGetTextLines(data, targetId) {
12464
12577
  const cachedVolumeStats = data.cachedStats[targetId];
@@ -12979,8 +13092,6 @@ class SplineROITool extends ContourSegmentationBaseTool/* default */.A {
12979
13092
  viewportIdsToRender,
12980
13093
  movingTextBox: false,
12981
13094
  };
12982
- const enabledElement = (0,esm.getEnabledElement)(element);
12983
- const { renderingEngine } = enabledElement;
12984
13095
  this._activateModify(element);
12985
13096
  (0,utilities.triggerAnnotationRenderForViewportIds)(viewportIdsToRender);
12986
13097
  evt.preventDefault();
@@ -13574,6 +13685,61 @@ class SplineROITool extends ContourSegmentationBaseTool/* default */.A {
13574
13685
  }
13575
13686
  return spline;
13576
13687
  }
13688
+ static { this.hydrate = (viewportId, points, options) => {
13689
+ const enabledElement = (0,esm.getEnabledElementByViewportId)(viewportId);
13690
+ if (!enabledElement) {
13691
+ return;
13692
+ }
13693
+ if (points.length < SPLINE_MIN_POINTS) {
13694
+ console.warn('Spline requires at least 3 control points');
13695
+ return;
13696
+ }
13697
+ const { viewport } = enabledElement;
13698
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
13699
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
13700
+ const instance = new this();
13701
+ const referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
13702
+ const splineType = options?.splineType || SplineTypesEnum.CatmullRom;
13703
+ const splineConfig = instance._getSplineConfig(splineType);
13704
+ const SplineClass = splineConfig.Class;
13705
+ const splineInstance = new SplineClass();
13706
+ const canvasPoints = points.map((point) => viewport.worldToCanvas(point));
13707
+ splineInstance.setControlPoints(canvasPoints);
13708
+ const splinePolylineCanvas = splineInstance.getPolylinePoints();
13709
+ const splinePolylineWorld = splinePolylineCanvas.map((point) => viewport.canvasToWorld(point));
13710
+ const annotation = {
13711
+ annotationUID: options?.annotationUID || esm.utilities.uuidv4(),
13712
+ data: {
13713
+ handles: {
13714
+ points,
13715
+ },
13716
+ label: '',
13717
+ cachedStats: {},
13718
+ spline: {
13719
+ type: splineType,
13720
+ instance: splineInstance,
13721
+ },
13722
+ contour: {
13723
+ closed: true,
13724
+ polyline: splinePolylineWorld,
13725
+ },
13726
+ },
13727
+ highlighted: false,
13728
+ autoGenerated: false,
13729
+ invalidated: true,
13730
+ isLocked: false,
13731
+ isVisible: true,
13732
+ metadata: {
13733
+ toolName: instance.getToolName(),
13734
+ viewPlaneNormal,
13735
+ FrameOfReferenceUID,
13736
+ referencedImageId,
13737
+ ...options,
13738
+ },
13739
+ };
13740
+ (0,annotationState.addAnnotation)(annotation, viewport.element);
13741
+ (0,utilities.triggerAnnotationRenderForViewportIds)([viewport.id]);
13742
+ }; }
13577
13743
  }
13578
13744
  function SplineROITool_defaultGetTextLines(data, targetId) {
13579
13745
  const cachedVolumeStats = data.cachedStats[targetId];
@@ -20578,7 +20744,7 @@ class SegmentationStateManager {
20578
20744
  type,
20579
20745
  active: true,
20580
20746
  visible: true,
20581
- colorLUTIndex: 0,
20747
+ colorLUTIndex: renderingConfig?.colorLUTIndex || 0,
20582
20748
  segments: segmentReps,
20583
20749
  config: {
20584
20750
  ...getDefaultRenderingConfig(type),
@@ -21305,17 +21471,20 @@ function internalAddSegmentationRepresentation(viewportId, representationInput)
21305
21471
  }
21306
21472
  function getColorLUTIndex(config) {
21307
21473
  const { colorLUTOrIndex } = config || {};
21308
- const isIndexProvided = typeof colorLUTOrIndex === 'number';
21309
- const selectedColorLUT = isIndexProvided
21310
- ? (0,getColorLUT/* getColorLUT */.B)(colorLUTOrIndex)
21311
- : COLOR_LUT/* default */.A;
21312
- const colorLUTIndex = isIndexProvided
21313
- ? colorLUTOrIndex
21314
- : (0,getNextColorLUTIndex/* getNextColorLUTIndex */.u)();
21315
- if (!isIndexProvided) {
21316
- (0,addColorLUT/* addColorLUT */.u)(selectedColorLUT, colorLUTIndex);
21474
+ if (colorLUTOrIndex === undefined) {
21475
+ const index = (0,addColorLUT/* addColorLUT */.u)(JSON.parse(JSON.stringify(COLOR_LUT/* default */.A)));
21476
+ return index;
21477
+ }
21478
+ if (typeof colorLUTOrIndex === 'number') {
21479
+ return colorLUTOrIndex;
21480
+ }
21481
+ if (Array.isArray(colorLUTOrIndex) &&
21482
+ colorLUTOrIndex.every((item) => Array.isArray(item) && item.length === 4)) {
21483
+ const index = (0,addColorLUT/* addColorLUT */.u)(colorLUTOrIndex);
21484
+ return index;
21317
21485
  }
21318
- return colorLUTIndex;
21486
+ const index = (0,addColorLUT/* addColorLUT */.u)(JSON.parse(JSON.stringify(COLOR_LUT/* default */.A)));
21487
+ return index;
21319
21488
  }
21320
21489
 
21321
21490
 
@@ -21615,23 +21784,6 @@ function getActiveSegmentation(viewportId) {
21615
21784
  }
21616
21785
 
21617
21786
 
21618
- /***/ }),
21619
-
21620
- /***/ 50409:
21621
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21622
-
21623
- "use strict";
21624
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21625
- /* harmony export */ B: () => (/* binding */ getColorLUT)
21626
- /* harmony export */ });
21627
- /* harmony import */ var _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59475);
21628
-
21629
- function getColorLUT(index) {
21630
- const segmentationStateManager = _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_0__/* .defaultSegmentationStateManager */ ._6;
21631
- return segmentationStateManager.getColorLUT(index);
21632
- }
21633
-
21634
-
21635
21787
  /***/ }),
21636
21788
 
21637
21789
  /***/ 97577:
@@ -21649,23 +21801,6 @@ function getCurrentLabelmapImageIdForViewport(viewportId, segmentationId) {
21649
21801
  }
21650
21802
 
21651
21803
 
21652
- /***/ }),
21653
-
21654
- /***/ 70906:
21655
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21656
-
21657
- "use strict";
21658
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21659
- /* harmony export */ u: () => (/* binding */ getNextColorLUTIndex)
21660
- /* harmony export */ });
21661
- /* harmony import */ var _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59475);
21662
-
21663
- function getNextColorLUTIndex() {
21664
- const segmentationStateManager = _SegmentationStateManager__WEBPACK_IMPORTED_MODULE_0__/* .defaultSegmentationStateManager */ ._6;
21665
- return segmentationStateManager.getNextColorLUTIndex();
21666
- }
21667
-
21668
-
21669
21804
  /***/ }),
21670
21805
 
21671
21806
  /***/ 93210:
@@ -25762,6 +25897,42 @@ class RectangleROITool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .AnnotationT
25762
25897
  };
25763
25898
  this._throttledCalculateCachedStats = (0,_utilities_throttle__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)(this._calculateCachedStats, 100, { trailing: true });
25764
25899
  }
25900
+ static { this.hydrate = (viewportId, points, options) => {
25901
+ const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.getEnabledElementByViewportId)(viewportId);
25902
+ if (!enabledElement) {
25903
+ return;
25904
+ }
25905
+ const { viewport } = enabledElement;
25906
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
25907
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
25908
+ const instance = new this();
25909
+ const referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
25910
+ const annotation = {
25911
+ annotationUID: options?.annotationUID || _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__.utilities.uuidv4(),
25912
+ data: {
25913
+ handles: {
25914
+ points,
25915
+ activeHandleIndex: null,
25916
+ },
25917
+ label: '',
25918
+ cachedStats: {},
25919
+ },
25920
+ highlighted: false,
25921
+ autoGenerated: false,
25922
+ invalidated: false,
25923
+ isLocked: false,
25924
+ isVisible: true,
25925
+ metadata: {
25926
+ toolName: instance.getToolName(),
25927
+ viewPlaneNormal,
25928
+ FrameOfReferenceUID,
25929
+ referencedImageId,
25930
+ ...options,
25931
+ },
25932
+ };
25933
+ (0,_stateManagement__WEBPACK_IMPORTED_MODULE_4__/* .addAnnotation */ .lC)(annotation, viewport.element);
25934
+ (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .A)([viewport.id]);
25935
+ }; }
25765
25936
  }
25766
25937
  function defaultGetTextLines(data, targetId) {
25767
25938
  const cachedVolumeStats = data.cachedStats[targetId];
@@ -172,7 +172,7 @@
172
172
  /******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
173
173
  /******/ __webpack_require__.u = (chunkId) => {
174
174
  /******/ // return url for filenames based on template
175
- /******/ return "" + chunkId + ".bundle." + {"732":"532947c280e1a8f6e020","4571":"3b1691730b3c57bf4d35","8094":"411698eaf81975a7f12d"}[chunkId] + ".js";
175
+ /******/ return "" + chunkId + ".bundle." + {"732":"532947c280e1a8f6e020","4571":"a37be49663df2f4a2c8a","8094":"411698eaf81975a7f12d"}[chunkId] + ".js";
176
176
  /******/ };
177
177
  /******/ })();
178
178
  /******/