@ohif/app 3.12.0-beta.133 → 3.12.0-beta.134

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 (37) hide show
  1. package/dist/{3081.bundle.c97d56344e5008acbaba.js → 3081.bundle.9f62df4f5aff3aa7912b.js} +83 -2
  2. package/dist/{4019.bundle.fd035b6abe8792af15f2.js → 4019.bundle.83a604779f7da0101ced.js} +0 -300
  3. package/dist/{4410.bundle.c563b02780d4bd1efc91.js → 4410.bundle.c5224cd7d6238a7d4660.js} +1 -3
  4. package/dist/{2928.bundle.ebad527793dcf8c9707b.js → 6409.bundle.b36048896cb11c8571fb.js} +303 -1
  5. package/dist/{7412.bundle.5a2f7834d3ddb1a5a83f.js → 7412.bundle.fab1742191b7fe937330.js} +46 -14
  6. package/dist/{8558.bundle.2f742b9b03bf3ea8d35c.js → 8558.bundle.be3751b8a21398b3d636.js} +1 -1
  7. package/dist/{9195.bundle.07bd4e046b929a8a2811.js → 9195.bundle.f08a186c1e75ecd7558c.js} +2 -2
  8. package/dist/{5549.bundle.ad154ff0c199466c0624.js → 997.bundle.822b33e561263084e18c.js} +350 -13
  9. package/dist/{app.bundle.382039aebcdf56709ba3.js → app.bundle.cb7154a1f63abb2f5dd0.js} +1841 -145
  10. package/dist/{compute.bundle.7e48af7ce0caa7bf0789.js → compute.bundle.64280c7af19ff567465f.js} +3 -3
  11. package/dist/index.html +1 -1
  12. package/dist/{polySeg.bundle.82de43dd7e361254a00d.js → polySeg.bundle.a5aa9130b4191253c410.js} +3 -3
  13. package/dist/sw.js +1 -1
  14. package/package.json +22 -22
  15. /package/dist/{1403.bundle.ad7c1e0eb3cae7fd230b.js → 1403.bundle.f57849a5c044f32fd89d.js} +0 -0
  16. /package/dist/{1459.bundle.be143d5555effc0e32ec.js → 1459.bundle.7c2bd1e739d1a56b7847.js} +0 -0
  17. /package/dist/{1730.bundle.d910db3b30a3b008ed28.js → 1730.bundle.7b861d2dc61c019b3fc2.js} +0 -0
  18. /package/dist/{1933.bundle.479eaeb08baa88ec4446.js → 1933.bundle.3db08d1b4ae873878767.js} +0 -0
  19. /package/dist/{2018.bundle.4ee769e94af6b21bb63e.js → 2018.bundle.6d3f611e5afb9d1f8322.js} +0 -0
  20. /package/dist/{213.bundle.ffe4ac0768cf58fd724e.js → 213.bundle.31dfa58ae122d1bc365a.js} +0 -0
  21. /package/dist/{2424.bundle.fd35390457fcdbbaa099.js → 2424.bundle.766d596f2fabdc0544a5.js} +0 -0
  22. /package/dist/{3461.bundle.273957b80c68870c956b.js → 3461.bundle.ac03fd92ddc6fec01270.js} +0 -0
  23. /package/dist/{4775.bundle.558853fdd70d86c552e5.js → 4775.bundle.a94400fda82045499c47.js} +0 -0
  24. /package/dist/{4819.bundle.95ec684143aa56cb5256.js → 4819.bundle.40ca87fa8736a1b8ade9.js} +0 -0
  25. /package/dist/{5028.bundle.db6e71170a7753e50a14.js → 5028.bundle.5d4d9236a8c9c25a68c0.js} +0 -0
  26. /package/dist/{5457.bundle.dcab3e70baf935761939.js → 5457.bundle.b5e5f20bd4fc7fce84af.js} +0 -0
  27. /package/dist/{5485.bundle.e914e66be9cfd026d40b.js → 5485.bundle.b4b3df75322a8cce5f27.js} +0 -0
  28. /package/dist/{5802.bundle.5efcdbbf3a50c2046ce7.js → 5802.bundle.3bf5e6b3ab330a594a47.js} +0 -0
  29. /package/dist/{6027.bundle.f1f72a23293e1b2edc9c.js → 6027.bundle.a83e9d1729a513c49c7c.js} +0 -0
  30. /package/dist/{6163.bundle.43e63878cba217fe10ba.js → 6163.bundle.7f454c6397990dd5343b.js} +0 -0
  31. /package/dist/{6347.bundle.dc3c510434405c16a6e9.js → 6347.bundle.784c48912700f281de1d.js} +0 -0
  32. /package/dist/{7431.bundle.19ab56016caaca2fc5db.js → 7431.bundle.b01791d10e6cf9f503b0.js} +0 -0
  33. /package/dist/{7639.bundle.cf932bf2d3bd4a42639b.js → 7639.bundle.756e732c0b4efbe5613f.js} +0 -0
  34. /package/dist/{8305.bundle.63789133a27ecbb1f22a.js → 8305.bundle.fb0202a40ebac5b2a5ee.js} +0 -0
  35. /package/dist/{85.bundle.4ef381060e778c201b8d.js → 85.bundle.6e5a66853e6dfcac092b.js} +0 -0
  36. /package/dist/{8583.bundle.fab525990e425fd1195f.js → 8583.bundle.121d0d60c5a6fdf1bf26.js} +0 -0
  37. /package/dist/{9927.bundle.6a30965ca7a070a50e40.js → 9927.bundle.a8a1a45a55583a80dc3f.js} +0 -0
@@ -9723,6 +9723,11 @@ async function updateSegmentationStats({
9723
9723
  // Loop through each segment's stats
9724
9724
  Object.entries(stats).forEach(([segmentIndex, segmentStats]) => {
9725
9725
  const index = parseInt(segmentIndex);
9726
+ if (!updatedSegmentation.segments[index]) {
9727
+ // This happens when a segment is being restored
9728
+ console.warn('Segment not found to update cached stats:', index);
9729
+ return;
9730
+ }
9726
9731
  if (!updatedSegmentation.segments[index].cachedStats) {
9727
9732
  updatedSegmentation.segments[index].cachedStats = {};
9728
9733
  hasUpdates = true;
@@ -19130,6 +19135,9 @@ var _SegmentationService;
19130
19135
 
19131
19136
 
19132
19137
 
19138
+ const {
19139
+ DefaultHistoryMemo: SegmentationService_DefaultHistoryMemo
19140
+ } = esm.utilities.HistoryMemo;
19133
19141
  const {
19134
19142
  Labelmap: LABELMAP,
19135
19143
  Contour: CONTOUR,
@@ -19890,11 +19898,69 @@ class SegmentationService extends src/* PubSubService */.Rc {
19890
19898
  });
19891
19899
  }
19892
19900
 
19901
+ /**
19902
+ * Creates a memo that records the current state of a segment (segmentationId/segmentIndex)
19903
+ * so that undo can restore it via addSegment and redo can call removeSegment again
19904
+ * without recording history.
19905
+ *
19906
+ * @param segmentationId - The ID of the segmentation.
19907
+ * @param segmentIndex - The index of the segment (must still exist when called).
19908
+ * @param _options - Reserved (e.g. deleting) for future use.
19909
+ * @returns A Memo with restoreMemo(undo): undo => addSegment, redo => removeSegment (skipRecordingHistory).
19910
+ */
19911
+ createSegmentIndexMemo(segmentationId, segmentIndex, _options) {
19912
+ const csSegmentation = this.getCornerstoneSegmentation(segmentationId);
19913
+ const segment = csSegmentation?.segments?.[segmentIndex];
19914
+ if (!segment) {
19915
+ return null;
19916
+ }
19917
+ let color;
19918
+ let visibility;
19919
+ const viewportIds = this.getViewportIdsWithSegmentation(segmentationId);
19920
+ if (viewportIds.length > 0) {
19921
+ const firstViewportId = viewportIds[0];
19922
+ const representations = this.getSegmentationRepresentations(firstViewportId, {
19923
+ segmentationId
19924
+ });
19925
+ const repType = representations[0]?.type ?? LABELMAP;
19926
+ color = this.getSegmentColor(firstViewportId, segmentationId, segmentIndex);
19927
+ visibility = dist_esm.segmentation.config.visibility.getSegmentIndexVisibility(firstViewportId, {
19928
+ segmentationId,
19929
+ type: repType
19930
+ }, segmentIndex);
19931
+ }
19932
+ const segmentState = {
19933
+ segmentIndex,
19934
+ label: segment.label,
19935
+ isLocked: segment.locked,
19936
+ active: segment.active,
19937
+ color,
19938
+ visibility
19939
+ };
19940
+ const service = this;
19941
+ const memo = {
19942
+ id: esm.utilities.uuidv4(),
19943
+ operationType: 'segmentIndex',
19944
+ restoreMemo(undo) {
19945
+ if (undo === true) {
19946
+ service.addSegment(segmentationId, segmentState);
19947
+ } else {
19948
+ // Redo: remove the segment via cornerstone without recording history
19949
+ dist_esm.segmentation.removeSegment(segmentationId, segmentIndex, {
19950
+ recordHistory: false
19951
+ });
19952
+ }
19953
+ }
19954
+ };
19955
+ return memo;
19956
+ }
19957
+
19893
19958
  /**
19894
19959
  * Removes a segment from a segmentation and updates the active segment index if necessary.
19895
19960
  *
19896
19961
  * @param segmentationId - The ID of the segmentation containing the segment to remove.
19897
19962
  * @param segmentIndex - The index of the segment to remove.
19963
+ * @param options - Optional. skipRecordingHistory: if true, do not push undo memo (used when redoing).
19898
19964
  *
19899
19965
  * @remarks
19900
19966
  * This method performs the following actions:
@@ -19903,8 +19969,23 @@ class SegmentationService extends src/* PubSubService */.Rc {
19903
19969
  * 3. If the removed segment was the active segment, it updates the active segment index.
19904
19970
  *
19905
19971
  */
19906
- removeSegment(segmentationId, segmentIndex) {
19907
- dist_esm.segmentation.removeSegment(segmentationId, segmentIndex);
19972
+ removeSegment(segmentationId, segmentIndex, options) {
19973
+ let memo;
19974
+ if (!options?.skipRecordingHistory) {
19975
+ memo = this.createSegmentIndexMemo(segmentationId, segmentIndex, {
19976
+ deleting: true
19977
+ });
19978
+ SegmentationService_DefaultHistoryMemo.startGroupRecording();
19979
+ dist_esm.segmentation.removeSegment(segmentationId, segmentIndex, {
19980
+ recordHistory: true
19981
+ });
19982
+ SegmentationService_DefaultHistoryMemo.push(memo);
19983
+ SegmentationService_DefaultHistoryMemo.endGroupRecording();
19984
+ } else {
19985
+ dist_esm.segmentation.removeSegment(segmentationId, segmentIndex, {
19986
+ recordHistory: false
19987
+ });
19988
+ }
19908
19989
  }
19909
19990
  setSegmentVisibility(viewportId, segmentationId, segmentIndex, isVisible, type) {
19910
19991
  this._setSegmentVisibility(viewportId, segmentationId, segmentIndex, isVisible, type);
@@ -1778,306 +1778,6 @@ function registerRenderMethods(toolInstance) {
1778
1778
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (registerRenderMethods);
1779
1779
 
1780
1780
 
1781
- /***/ }),
1782
-
1783
- /***/ 91350:
1784
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1785
-
1786
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1787
- /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
1788
- /* harmony export */ });
1789
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
1790
- /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3823);
1791
- /* harmony import */ var _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6030);
1792
- /* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2076);
1793
- /* harmony import */ var _stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29601);
1794
- /* harmony import */ var _stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82056);
1795
- /* harmony import */ var _stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(44049);
1796
- /* harmony import */ var _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(75183);
1797
- /* harmony import */ var _stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17343);
1798
- /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(56534);
1799
- /* harmony import */ var _utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(33459);
1800
-
1801
-
1802
-
1803
-
1804
-
1805
-
1806
-
1807
-
1808
-
1809
-
1810
-
1811
- const { DefaultHistoryMemo } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.HistoryMemo;
1812
- class AnnotationTool extends _AnnotationDisplayTool__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A {
1813
- static createAnnotationForViewport(viewport, ...annotationBaseData) {
1814
- return this.createAnnotation({ metadata: viewport.getViewReference() }, ...annotationBaseData);
1815
- }
1816
- static createAndAddAnnotation(viewport, ...annotationBaseData) {
1817
- const annotation = this.createAnnotationForViewport(viewport, ...annotationBaseData);
1818
- (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, viewport.element);
1819
- (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(annotation, viewport.element);
1820
- }
1821
- constructor(toolProps, defaultToolProps) {
1822
- super(toolProps, defaultToolProps);
1823
- this.mouseMoveCallback = (evt, filteredAnnotations) => {
1824
- if (!filteredAnnotations) {
1825
- return false;
1826
- }
1827
- const { element, currentPoints } = evt.detail;
1828
- const canvasCoords = currentPoints.canvas;
1829
- let annotationsNeedToBeRedrawn = false;
1830
- for (const annotation of filteredAnnotations) {
1831
- if ((0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_3__.isAnnotationLocked)(annotation.annotationUID) ||
1832
- !(0,_stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_4__.isAnnotationVisible)(annotation.annotationUID)) {
1833
- continue;
1834
- }
1835
- const { data } = annotation;
1836
- const activateHandleIndex = data.handles
1837
- ? data.handles.activeHandleIndex
1838
- : undefined;
1839
- const near = this._imagePointNearToolOrHandle(element, annotation, canvasCoords, 6);
1840
- const nearToolAndNotMarkedActive = near && !annotation.highlighted;
1841
- const notNearToolAndMarkedActive = !near && annotation.highlighted;
1842
- if (nearToolAndNotMarkedActive || notNearToolAndMarkedActive) {
1843
- annotation.highlighted = !annotation.highlighted;
1844
- annotationsNeedToBeRedrawn = true;
1845
- }
1846
- else if (data.handles &&
1847
- data.handles.activeHandleIndex !== activateHandleIndex) {
1848
- annotationsNeedToBeRedrawn = true;
1849
- }
1850
- }
1851
- return annotationsNeedToBeRedrawn;
1852
- };
1853
- this.isSuvScaled = AnnotationTool.isSuvScaled;
1854
- if (toolProps.configuration?.getTextLines) {
1855
- this.configuration.getTextLines = toolProps.configuration.getTextLines;
1856
- }
1857
- if (toolProps.configuration?.statsCalculator) {
1858
- this.configuration.statsCalculator =
1859
- toolProps.configuration.statsCalculator;
1860
- }
1861
- }
1862
- getHandleNearImagePoint(element, annotation, canvasCoords, proximity) {
1863
- const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
1864
- const { viewport } = enabledElement;
1865
- const { data } = annotation;
1866
- const { isCanvasAnnotation } = data;
1867
- const { points, textBox } = data.handles;
1868
- if (textBox) {
1869
- const { worldBoundingBox } = textBox;
1870
- if (worldBoundingBox) {
1871
- const canvasBoundingBox = {
1872
- topLeft: viewport.worldToCanvas(worldBoundingBox.topLeft),
1873
- topRight: viewport.worldToCanvas(worldBoundingBox.topRight),
1874
- bottomLeft: viewport.worldToCanvas(worldBoundingBox.bottomLeft),
1875
- bottomRight: viewport.worldToCanvas(worldBoundingBox.bottomRight),
1876
- };
1877
- if (canvasCoords[0] >= canvasBoundingBox.topLeft[0] &&
1878
- canvasCoords[0] <= canvasBoundingBox.bottomRight[0] &&
1879
- canvasCoords[1] >= canvasBoundingBox.topLeft[1] &&
1880
- canvasCoords[1] <= canvasBoundingBox.bottomRight[1]) {
1881
- data.handles.activeHandleIndex = null;
1882
- return textBox;
1883
- }
1884
- }
1885
- }
1886
- for (let i = 0; i < points?.length; i++) {
1887
- const point = points[i];
1888
- const annotationCanvasCoordinate = isCanvasAnnotation
1889
- ? point.slice(0, 2)
1890
- : viewport.worldToCanvas(point);
1891
- const near = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec2.distance */ .Zc.distance(canvasCoords, annotationCanvasCoordinate) < proximity;
1892
- if (near === true) {
1893
- data.handles.activeHandleIndex = i;
1894
- return point;
1895
- }
1896
- }
1897
- data.handles.activeHandleIndex = null;
1898
- }
1899
- getLinkedTextBoxStyle(specifications, annotation) {
1900
- return {
1901
- visibility: this.getStyle('textBoxVisibility', specifications, annotation),
1902
- fontFamily: this.getStyle('textBoxFontFamily', specifications, annotation),
1903
- fontSize: this.getStyle('textBoxFontSize', specifications, annotation),
1904
- color: this.getStyle('textBoxColor', specifications, annotation),
1905
- shadow: this.getStyle('textBoxShadow', specifications, annotation),
1906
- background: this.getStyle('textBoxBackground', specifications, annotation),
1907
- lineWidth: this.getStyle('textBoxLinkLineWidth', specifications, annotation),
1908
- lineDash: this.getStyle('textBoxLinkLineDash', specifications, annotation),
1909
- textBoxBorderRadius: this.getStyle('textBoxBorderRadius', specifications, annotation),
1910
- textBoxMargin: this.getStyle('textBoxMargin', specifications, annotation),
1911
- textBoxLinkLineColor: this.getStyle('textBoxLinkLineColor', specifications, annotation),
1912
- };
1913
- }
1914
- static isSuvScaled(viewport, targetId, imageId) {
1915
- if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
1916
- const volumeId = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getVolumeId(targetId);
1917
- const volume = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(volumeId);
1918
- return volume?.scaling?.PT !== undefined;
1919
- }
1920
- const scalingModule = imageId && _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.metaData.get('scalingModule', imageId);
1921
- return typeof scalingModule?.suvbw === 'number';
1922
- }
1923
- getAnnotationStyle(context) {
1924
- const { annotation, styleSpecifier } = context;
1925
- const getStyle = (property) => this.getStyle(property, styleSpecifier, annotation);
1926
- const { annotationUID } = annotation;
1927
- const visibility = (0,_stateManagement_annotation_annotationVisibility__WEBPACK_IMPORTED_MODULE_4__.isAnnotationVisible)(annotationUID);
1928
- const locked = (0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_3__.isAnnotationLocked)(annotationUID);
1929
- const lineWidth = getStyle('lineWidth');
1930
- const lineDash = getStyle('lineDash');
1931
- const angleArcLineDash = getStyle('angleArcLineDash');
1932
- const color = getStyle('color');
1933
- const markerSize = getStyle('markerSize');
1934
- const shadow = getStyle('shadow');
1935
- const textboxStyle = this.getLinkedTextBoxStyle(styleSpecifier, annotation);
1936
- return {
1937
- visibility,
1938
- locked,
1939
- color,
1940
- lineWidth,
1941
- lineDash,
1942
- lineOpacity: 1,
1943
- fillColor: color,
1944
- fillOpacity: 0,
1945
- shadow,
1946
- textbox: textboxStyle,
1947
- markerSize,
1948
- angleArcLineDash,
1949
- };
1950
- }
1951
- _imagePointNearToolOrHandle(element, annotation, canvasCoords, proximity) {
1952
- const handleNearImagePoint = this.getHandleNearImagePoint(element, annotation, canvasCoords, proximity);
1953
- if (handleNearImagePoint) {
1954
- return true;
1955
- }
1956
- const toolNewImagePoint = this.isPointNearTool(element, annotation, canvasCoords, proximity, 'mouse');
1957
- if (toolNewImagePoint) {
1958
- return true;
1959
- }
1960
- }
1961
- static createAnnotationState(annotation, deleting) {
1962
- const { data, annotationUID } = annotation;
1963
- return {
1964
- annotationUID,
1965
- data: (0,_utilities_safeStructuredClone__WEBPACK_IMPORTED_MODULE_10__/* .safeStructuredClone */ .W)(data),
1966
- deleting,
1967
- };
1968
- }
1969
- static createAnnotationMemo(element, annotation, options) {
1970
- if (!annotation) {
1971
- return;
1972
- }
1973
- const { newAnnotation, deleting = newAnnotation ? false : undefined } = options || {};
1974
- const { annotationUID } = annotation;
1975
- const state = AnnotationTool.createAnnotationState(annotation, deleting);
1976
- const annotationMemo = {
1977
- restoreMemo: () => {
1978
- const newState = AnnotationTool.createAnnotationState(annotation, deleting);
1979
- const { viewport } = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element) || {};
1980
- viewport?.setViewReference(annotation.metadata);
1981
- if (state.deleting === true) {
1982
- state.deleting = false;
1983
- Object.assign(annotation.data, state.data);
1984
- if (annotation.data.contour) {
1985
- const annotationData = annotation.data;
1986
- annotationData.contour.polyline = state.data.contour.pointsManager.points;
1987
- delete state.data.contour.pointsManager;
1988
- if (annotationData.segmentation) {
1989
- (0,_utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_9__.addContourSegmentationAnnotation)(annotation);
1990
- }
1991
- }
1992
- state.data = newState.data;
1993
- (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.addAnnotation)(annotation, element);
1994
- (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__.setAnnotationSelected)(annotation.annotationUID, true);
1995
- viewport?.render();
1996
- return;
1997
- }
1998
- if (state.deleting === false) {
1999
- state.deleting = true;
2000
- state.data = newState.data;
2001
- (0,_stateManagement_annotation_annotationSelection__WEBPACK_IMPORTED_MODULE_8__.setAnnotationSelected)(annotation.annotationUID);
2002
- (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.removeAnnotation)(annotation.annotationUID);
2003
- viewport?.render();
2004
- return;
2005
- }
2006
- const currentAnnotation = (0,_stateManagement_annotation_annotationState__WEBPACK_IMPORTED_MODULE_5__.getAnnotation)(annotationUID);
2007
- if (!currentAnnotation) {
2008
- console.warn('No current annotation');
2009
- return;
2010
- }
2011
- Object.assign(currentAnnotation.data, state.data);
2012
- if (currentAnnotation.data.contour) {
2013
- currentAnnotation.data
2014
- .contour.polyline = state.data.contour.pointsManager.points;
2015
- }
2016
- state.data = newState.data;
2017
- currentAnnotation.invalidated = true;
2018
- (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_6__.triggerAnnotationModified)(currentAnnotation, element, _enums_ChangeTypes__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A.History);
2019
- },
2020
- id: annotationUID,
2021
- operationType: 'annotation',
2022
- };
2023
- DefaultHistoryMemo.push(annotationMemo);
2024
- return annotationMemo;
2025
- }
2026
- createMemo(element, annotation, options) {
2027
- this.memo ||= AnnotationTool.createAnnotationMemo(element, annotation, options);
2028
- }
2029
- startGroupRecording() {
2030
- DefaultHistoryMemo.startGroupRecording();
2031
- }
2032
- endGroupRecording() {
2033
- DefaultHistoryMemo.endGroupRecording();
2034
- }
2035
- static hydrateBase(ToolClass, enabledElement, points, options = {}) {
2036
- if (!enabledElement) {
2037
- return null;
2038
- }
2039
- const { viewport } = enabledElement;
2040
- const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
2041
- const camera = viewport.getCamera();
2042
- const viewPlaneNormal = options.viewplaneNormal ?? camera.viewPlaneNormal;
2043
- const viewUp = options.viewUp ?? camera.viewUp;
2044
- const instance = options.toolInstance || new ToolClass();
2045
- let referencedImageId;
2046
- let finalViewPlaneNormal = viewPlaneNormal;
2047
- let finalViewUp = viewUp;
2048
- if (options.referencedImageId) {
2049
- referencedImageId = options.referencedImageId;
2050
- finalViewPlaneNormal = undefined;
2051
- finalViewUp = undefined;
2052
- }
2053
- else {
2054
- if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.StackViewport) {
2055
- const closestImageIndex = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities.getClosestStackImageIndexForPoint(points[0], viewport);
2056
- if (closestImageIndex !== undefined) {
2057
- referencedImageId = viewport.getImageIds()[closestImageIndex];
2058
- }
2059
- }
2060
- else if (viewport instanceof _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.BaseVolumeViewport) {
2061
- referencedImageId = instance.getReferencedImageId(viewport, points[0], viewPlaneNormal, viewUp);
2062
- }
2063
- else {
2064
- throw new Error('Unsupported viewport type');
2065
- }
2066
- }
2067
- return {
2068
- FrameOfReferenceUID,
2069
- referencedImageId,
2070
- viewPlaneNormal: finalViewPlaneNormal,
2071
- viewUp: finalViewUp,
2072
- instance,
2073
- viewport,
2074
- };
2075
- }
2076
- }
2077
- AnnotationTool.toolName = 'AnnotationTool';
2078
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AnnotationTool);
2079
-
2080
-
2081
1781
  /***/ }),
2082
1782
 
2083
1783
  /***/ 36320:
@@ -35500,7 +35500,7 @@ function uuidv4() {
35500
35500
 
35501
35501
  "use strict";
35502
35502
  /* unused harmony export version */
35503
- const version = '4.15.28';
35503
+ const version = '4.15.29';
35504
35504
 
35505
35505
 
35506
35506
  /***/ }),
@@ -44405,8 +44405,6 @@ function createBidirectionalToolData(bidirectionalData, viewport) {
44405
44405
  /* unused harmony exports restoreMemo, createRleMemo */
44406
44406
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
44407
44407
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49906);
44408
- /* harmony import */ var _enums_Events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94021);
44409
-
44410
44408
 
44411
44409
 
44412
44410
  const { VoxelManager, RLEVoxelMap } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;