@ohif/app 3.12.0-beta.67 → 3.12.0-beta.69

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 (40) hide show
  1. package/dist/{1447.bundle.40045129a43f8dd9c901.js → 1447.bundle.0e8117bd9e72c339bd04.js} +2 -2
  2. package/dist/{2518.bundle.57c229a14e22d23db384.js → 2518.bundle.bdbd870da5355fdf502a.js} +8 -3
  3. package/dist/{319.bundle.fc959064ddf2f6978b54.js → 319.bundle.cd9383a345b9da2ba840.js} +1 -1
  4. package/dist/{3409.bundle.ded798747ea65b47c72c.js → 3409.bundle.2d77e2bddb2a19e798ed.js} +14 -1
  5. package/dist/{9819.bundle.29fb49e6d25cf486a204.js → 3613.bundle.14721af2527117f720b0.js} +492 -17
  6. package/dist/{4019.bundle.13e7f662a9e489b74a27.js → 4019.bundle.acd0f85d0467cb10d86a.js} +14 -7
  7. package/dist/{4113.bundle.d57b077bf8b22a2fffe6.js → 4113.bundle.cdb5aabbb16c44b3937d.js} +7 -11
  8. package/dist/{2345.bundle.c17b90bde0073fd7dbb6.js → 5400.bundle.eb0f5866140b5db31518.js} +5 -61
  9. package/dist/{7412.bundle.9ff692981e3c3af1dfaf.js → 7412.bundle.a8aa0b243b2a05031789.js} +660 -417
  10. package/dist/{8558.bundle.81679f1abf949872a8d7.js → 8558.bundle.29e3ea8a442b8a40e89d.js} +1 -1
  11. package/dist/{9856.bundle.4d469a7b62ac0c005da2.js → 9856.bundle.31827ec7e09a8978744c.js} +77 -10
  12. package/dist/{9892.bundle.34f911ad728a17a0ad60.js → 9892.bundle.7a23896727af274e8c43.js} +154 -457
  13. package/dist/{app.bundle.5e500cc3ae1ec8449424.js → app.bundle.fb405f7159a5d06049af.js} +28 -26
  14. package/dist/{compute.bundle.bf2d925bfc81c7f05c06.js → compute.bundle.5d0df54f99d2a555a02a.js} +3 -3
  15. package/dist/index.html +1 -1
  16. package/dist/{polySeg.bundle.1d99496fc36c90c48d48.js → polySeg.bundle.eb47d9d9105dcfbb56fc.js} +3 -3
  17. package/dist/sw.js +1 -1
  18. package/package.json +21 -21
  19. /package/dist/{1459.bundle.a3c4154b8f8a929875f6.js → 1459.bundle.6d1fa1c8fdbb81f0f359.js} +0 -0
  20. /package/dist/{147.bundle.5081555db809adebded5.js → 147.bundle.23cc8fbbd94c0b65d337.js} +0 -0
  21. /package/dist/{1604.bundle.54c4d82c28d03adab00b.js → 1604.bundle.47f2f0635a91795b3c49.js} +0 -0
  22. /package/dist/{1807.bundle.92de522ae4def176aff6.js → 1807.bundle.68fc01f6cad9998763ea.js} +0 -0
  23. /package/dist/{1919.bundle.b709d24082a089fb96f9.js → 1919.bundle.1931c96cc842a6098baa.js} +0 -0
  24. /package/dist/{213.bundle.06da551965e6495eaf22.js → 213.bundle.f9c868b449c1a68b6f35.js} +0 -0
  25. /package/dist/{2243.bundle.49e31757e1b67c1631af.js → 2243.bundle.2e464ef173f36231cf06.js} +0 -0
  26. /package/dist/{2424.bundle.b84347c7c65b70298931.js → 2424.bundle.a9eecc0e2aeb8699f135.js} +0 -0
  27. /package/dist/{414.bundle.62d7f459bd4c3888de2a.js → 414.bundle.46f922eb0a1911124a73.js} +0 -0
  28. /package/dist/{5457.bundle.74835d952cd31adf54df.js → 5457.bundle.ee43997565093fa2caec.js} +0 -0
  29. /package/dist/{5485.bundle.7b59b0105c66003eb8c5.js → 5485.bundle.a15a2f530189848c31ee.js} +0 -0
  30. /package/dist/{6027.bundle.39d04080242ce96ac848.js → 6027.bundle.8971d7d4eec7b0b4cfb7.js} +0 -0
  31. /package/dist/{6201.bundle.568aac152c31949d09a4.js → 6201.bundle.cc73f3d377cacd418cb0.js} +0 -0
  32. /package/dist/{6991.bundle.a0f689bfa5ad3f3ee4a8.js → 6991.bundle.77f5d56a53a04f524bc3.js} +0 -0
  33. /package/dist/{7197.bundle.c0d2f4d7071f1d49223f.js → 7197.bundle.364e03cf01a6b56217f9.js} +0 -0
  34. /package/dist/{7431.bundle.859d7586ac7a86c27fb8.js → 7431.bundle.6dee1ec831da974a7433.js} +0 -0
  35. /package/dist/{7639.bundle.3bae54d7c31bb87eb68e.js → 7639.bundle.e6024d8f644419db89ff.js} +0 -0
  36. /package/dist/{810.bundle.536730c2c4702996ce35.js → 810.bundle.0806263ecf7902133c17.js} +0 -0
  37. /package/dist/{85.bundle.1848a6604cfd55f08b91.js → 85.bundle.de54be0dcfcc960c45a0.js} +0 -0
  38. /package/dist/{8815.bundle.c6b394394ee3e5dda949.js → 8815.bundle.4fe4069d6c0a8d9b95cb.js} +0 -0
  39. /package/dist/{934.bundle.3cbbd88355500a623dcb.js → 934.bundle.5aef917dada6d51ac96b.js} +0 -0
  40. /package/dist/{9862.bundle.30916d7d975475c609a1.js → 9862.bundle.dc627e5f01fc4698a00f.js} +0 -0
@@ -2970,7 +2970,7 @@ __webpack_require__.r(__webpack_exports__);
2970
2970
  /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(13369);
2971
2971
  /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_9__);
2972
2972
  /* harmony import */ var _stateManagement_annotation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47807);
2973
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(83673);
2973
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(55126);
2974
2974
  /* harmony import */ var _tools_annotation_splines__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(3040);
2975
2975
  /* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(49975);
2976
2976
  /* harmony import */ var _tools_annotation_VideoRedactionTool__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(11811);
@@ -5741,7 +5741,7 @@ function getSurfaceRepresentationUID(segmentationId, segmentIndex) {
5741
5741
 
5742
5742
  /***/ }),
5743
5743
 
5744
- /***/ 83673:
5744
+ /***/ 55126:
5745
5745
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5746
5746
 
5747
5747
  "use strict";
@@ -5783,7 +5783,7 @@ __webpack_require__.d(__webpack_exports__, {
5783
5783
  strategies: () => (/* reexport */ strategies),
5784
5784
  triggerSegmentationEvents: () => (/* reexport */ triggerSegmentationEvents),
5785
5785
  updateSegmentations: () => (/* reexport */ updateSegmentations),
5786
- utilities: () => (/* reexport */ utilities_namespaceObject)
5786
+ utilities: () => (/* reexport */ utilities)
5787
5787
  });
5788
5788
 
5789
5789
  // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js
@@ -5818,23 +5818,6 @@ __webpack_require__.d(config_namespaceObject, {
5818
5818
  visibility: () => (segmentationVisibility_namespaceObject)
5819
5819
  });
5820
5820
 
5821
- // NAMESPACE OBJECT: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/index.js
5822
- var utilities_namespaceObject = {};
5823
- __webpack_require__.r(utilities_namespaceObject);
5824
- __webpack_require__.d(utilities_namespaceObject, {
5825
- convertContourHoles: () => (convertContourHoles),
5826
- decimateContours: () => (decimateContours),
5827
- extractSegmentPolylines: () => (extractSegmentPolylines),
5828
- getAnnotationMapFromSegmentation: () => (getAnnotationMapFromSegmentation),
5829
- getAnnotationsUIDMapFromSegmentation: () => (getAnnotationsUIDMapFromSegmentation/* getAnnotationsUIDMapFromSegmentation */.B),
5830
- getViewportAssociatedToSegmentation: () => (getViewportAssociatedToSegmentation/* getViewportAssociatedToSegmentation */.IN),
5831
- getViewportWithMatchingViewPlaneNormal: () => (getViewportAssociatedToSegmentation/* getViewportWithMatchingViewPlaneNormal */.W8),
5832
- removeCompleteContourAnnotation: () => (removeCompleteContourAnnotation),
5833
- removeContourHoles: () => (removeContourHoles),
5834
- removeContourIslands: () => (removeContourIslands),
5835
- smoothContours: () => (smoothContours)
5836
- });
5837
-
5838
5821
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js + 1 modules
5839
5822
  var removeSegmentationRepresentations = __webpack_require__(53662);
5840
5823
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/addSegmentationRepresentationsToViewport.js
@@ -5988,389 +5971,16 @@ function hasCustomStyle(specifier) {
5988
5971
 
5989
5972
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/segmentIndex.js
5990
5973
  var segmentation_segmentIndex = __webpack_require__(70930);
5991
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getAnnotationsUIDMapFromSegmentation.js
5992
- var getAnnotationsUIDMapFromSegmentation = __webpack_require__(98484);
5993
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getViewportAssociatedToSegmentation.js
5994
- var getViewportAssociatedToSegmentation = __webpack_require__(16493);
5995
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
5996
- var annotationState = __webpack_require__(82056);
5997
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getAnnotationMapFromSegmentation.js
5998
-
5999
- function getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
6000
- const annotationMap = contourRepresentationData.annotationUIDsMap;
6001
- const segmentIndices = options.segmentIndices?.length
6002
- ? options.segmentIndices
6003
- : Array.from(annotationMap.keys());
6004
- const annotationUIDsInSegmentMap = new Map();
6005
- segmentIndices.forEach((index) => {
6006
- const annotationUIDsInSegment = annotationMap.get(index);
6007
- let uids = Array.from(annotationUIDsInSegment);
6008
- uids = uids.filter((uid) => !(0,annotationState.getAnnotation)(uid).parentAnnotationUID);
6009
- const annotations = uids.map((uid) => {
6010
- const annotation = (0,annotationState.getAnnotation)(uid);
6011
- const hasChildAnnotations = annotation.childAnnotationUIDs?.length;
6012
- const childPolylinesInformation = hasChildAnnotations &&
6013
- annotation.childAnnotationUIDs.map((childUID) => {
6014
- const childAnnotation = (0,annotationState.getAnnotation)(childUID);
6015
- return {
6016
- polyline: childAnnotation.data.contour.polyline,
6017
- isClosed: childAnnotation.data.contour.closed,
6018
- };
6019
- });
6020
- const holesClosed = hasChildAnnotations &&
6021
- childPolylinesInformation.map((childInfo) => childInfo.isClosed);
6022
- const childPolylines = hasChildAnnotations &&
6023
- childPolylinesInformation.map((childInfo) => childInfo.polyline);
6024
- return {
6025
- polyline: annotation.data.contour.polyline,
6026
- isClosed: annotation.data.contour.closed,
6027
- annotationUID: annotation.annotationUID,
6028
- referencedImageId: annotation.metadata.referencedImageId,
6029
- holesPolyline: childPolylines,
6030
- holesUIDs: annotation.childAnnotationUIDs,
6031
- holesClosed,
6032
- };
6033
- });
6034
- annotationUIDsInSegmentMap.set(index, annotations);
6035
- });
6036
- return { segmentIndices, annotationUIDsInSegmentMap };
6037
- }
6038
-
6039
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
6040
- var getSegmentation = __webpack_require__(33283);
6041
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
6042
- var contourSegmentation = __webpack_require__(56534);
6043
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getPolylineMap.js
6044
-
6045
- function closePolyline(polyline, closed) {
6046
- if (!polyline || polyline.length === 0) {
6047
- return [];
6048
- }
6049
- if (!closed) {
6050
- return [...polyline];
6051
- }
6052
- const firstPoint = polyline[0];
6053
- const lastPoint = polyline[polyline.length - 1];
6054
- const isAlreadyClosed = firstPoint[0] === lastPoint[0] &&
6055
- firstPoint[1] === lastPoint[1] &&
6056
- firstPoint[2] === lastPoint[2];
6057
- if (isAlreadyClosed) {
6058
- return [...polyline];
6059
- }
6060
- return [...polyline, firstPoint];
6061
- }
6062
- function getPolylinesMap(contourRepresentationData, segmentIndex) {
6063
- const { annotationUIDsInSegmentMap } = getAnnotationMapFromSegmentation(contourRepresentationData);
6064
- if (!annotationUIDsInSegmentMap.has(segmentIndex)) {
6065
- console.warn(`No contour information found for segmentIndex ${segmentIndex}`);
6066
- return;
6067
- }
6068
- const polylines = new Map();
6069
- const annotationsInfo = annotationUIDsInSegmentMap.get(segmentIndex);
6070
- for (const annotationInfo of annotationsInfo) {
6071
- polylines.set(annotationInfo.annotationUID, closePolyline(annotationInfo.polyline, annotationInfo.isClosed));
6072
- for (let i = 0; i < annotationInfo.holesUIDs?.length; i++) {
6073
- polylines.set(annotationInfo.holesUIDs[i], closePolyline(annotationInfo.holesPolyline[i], annotationInfo.holesClosed[i]));
6074
- }
6075
- }
6076
- return polylines;
6077
- }
6078
-
6079
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/extractSegmentPolylines.js
6080
-
6081
-
6082
-
6083
-
6084
-
6085
- function extractSegmentPolylines(segmentationId, segmentIndex) {
6086
- const viewports = (0,getViewportAssociatedToSegmentation/* getViewportsAssociatedToSegmentation */.xT)(segmentationId);
6087
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6088
- if (!segmentation) {
6089
- return;
6090
- }
6091
- if (!segmentation.representationData.Contour) {
6092
- return;
6093
- }
6094
- const contourRepresentationData = segmentation.representationData
6095
- .Contour;
6096
- const { annotationUIDsMap } = contourRepresentationData;
6097
- if (!annotationUIDsMap) {
6098
- return;
6099
- }
6100
- if (!annotationUIDsMap.get(segmentIndex)) {
6101
- return;
6102
- }
6103
- const polyLinesMap = getPolylinesMap(contourRepresentationData, segmentIndex);
6104
- if (!polyLinesMap) {
6105
- return;
6106
- }
6107
- const keys = Array.from(polyLinesMap?.keys());
6108
- const polylinesCanvasMap = new Map();
6109
- for (const key of keys) {
6110
- const annotation = (0,annotationState.getAnnotation)(key);
6111
- const viewport = (0,getViewportAssociatedToSegmentation/* getViewportWithMatchingViewPlaneNormal */.W8)(viewports, annotation);
6112
- polylinesCanvasMap.set(key, (0,contourSegmentation.convertContourPolylineToCanvasSpace)(polyLinesMap.get(key), viewport));
6113
- }
6114
- return polylinesCanvasMap;
6115
- }
6116
-
6117
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/math/polyline/decimate.js
6118
- var decimate = __webpack_require__(99944);
6119
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/decimateContours.js
6120
-
6121
-
6122
-
6123
-
6124
-
6125
- function decimateContours(segmentationId, segmentIndex, options = { epsilon: 0.1 }) {
6126
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6127
- if (!segmentation) {
6128
- console.warn(`Invalid segmentation given ${segmentationId}`);
6129
- return;
6130
- }
6131
- if (!segmentation.representationData.Contour) {
6132
- console.warn(`No contour representation found for segmentation ${segmentationId}`);
6133
- return;
6134
- }
6135
- const viewports = (0,getViewportAssociatedToSegmentation/* getViewportsAssociatedToSegmentation */.xT)(segmentationId);
6136
- if (!viewports) {
6137
- console.warn('No viewport associated to the segmentation found');
6138
- return;
6139
- }
6140
- const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
6141
- if (!polylinesCanvasMap) {
6142
- console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6143
- return;
6144
- }
6145
- const keys = Array.from(polylinesCanvasMap?.keys());
6146
- for (const annotationUID of keys) {
6147
- const annotation = (0,annotationState.getAnnotation)(annotationUID);
6148
- if (!annotation) {
6149
- continue;
6150
- }
6151
- const polylineCanvas = polylinesCanvasMap.get(annotationUID);
6152
- const decimatedPolyline2D = (0,decimate/* default */.A)(polylineCanvas, options.epsilon);
6153
- const viewport = (0,getViewportAssociatedToSegmentation/* getViewportWithMatchingViewPlaneNormal */.W8)(viewports, annotation);
6154
- if (viewport) {
6155
- annotation.data.contour.polyline = decimatedPolyline2D.map((point2D) => viewport.canvasToWorld(point2D));
6156
- (0,annotationState.invalidateAnnotation)(annotation);
6157
- }
6158
- }
6159
- }
6160
-
6161
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/removeCompleteContourAnnotation.js
6162
-
6163
-
6164
- function removeCompleteContourAnnotation(annotation) {
6165
- if (!annotation) {
6166
- return;
6167
- }
6168
- if (annotation.parentAnnotationUID) {
6169
- (0,annotationState.clearParentAnnotation)(annotation);
6170
- }
6171
- (0,annotationState.removeAnnotation)(annotation.annotationUID);
6172
- (0,contourSegmentation.removeContourSegmentationAnnotation)(annotation);
6173
- }
6174
-
6175
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js + 6 modules
6176
- var contours = __webpack_require__(6936);
6177
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/removeContourHoles.js
6178
-
6179
-
6180
-
6181
-
6182
-
6183
- function removeContourHoles(segmentationId, segmentIndex) {
6184
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6185
- if (!segmentation) {
6186
- console.warn(`Invalid segmentation given ${segmentationId}`);
6187
- return;
6188
- }
6189
- if (!segmentation.representationData.Contour) {
6190
- console.warn(`No contour representation found for segmentation ${segmentationId}`);
6191
- return;
6192
- }
6193
- const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
6194
- if (!polylinesCanvasMap) {
6195
- console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6196
- return;
6197
- }
6198
- const keys = Array.from(polylinesCanvasMap?.keys());
6199
- const polylines = keys.map((key) => polylinesCanvasMap.get(key));
6200
- const holeDetectionResults = (0,contours.findContourHoles)(polylines);
6201
- if (holeDetectionResults?.length > 0) {
6202
- holeDetectionResults.forEach((hole) => {
6203
- hole.holeIndexes.forEach((index) => {
6204
- const annotation = (0,annotationState.getAnnotation)(keys[index]);
6205
- removeCompleteContourAnnotation(annotation);
6206
- });
6207
- });
6208
- }
6209
- }
6210
-
6211
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/findIslands.js
6212
- var findIslands = __webpack_require__(76617);
6213
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/removeContourIslands.js
6214
-
6215
-
6216
-
6217
-
6218
-
6219
- function removeContourIslands(segmentationId, segmentIndex, options = { threshold: 3 }) {
6220
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6221
- if (!segmentation) {
6222
- console.warn(`Invalid segmentation given ${segmentationId}`);
6223
- return;
6224
- }
6225
- if (!segmentation.representationData.Contour) {
6226
- console.warn(`No contour representation found for segmentation ${segmentationId}`);
6227
- return;
6228
- }
6229
- const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
6230
- if (!polylinesCanvasMap) {
6231
- console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6232
- return;
6233
- }
6234
- const keys = Array.from(polylinesCanvasMap?.keys());
6235
- const polylines = keys.map((key) => polylinesCanvasMap.get(key));
6236
- const islands = (0,findIslands/* default */.A)(polylines, options.threshold);
6237
- if (islands?.length > 0) {
6238
- islands.forEach((index) => {
6239
- const annotation = (0,annotationState.getAnnotation)(keys[index]);
6240
- removeCompleteContourAnnotation(annotation);
6241
- });
6242
- }
6243
- }
6244
-
6245
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.js
6246
- var interpolateSegmentPoints = __webpack_require__(61768);
6247
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/smoothContours.js
6248
-
6249
-
6250
-
6251
- function smoothContours(segmentationId, segmentIndex, options = { knotsRatioPercentage: 30 }) {
6252
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6253
- if (!segmentation) {
6254
- console.warn(`Invalid segmentation given ${segmentationId}`);
6255
- return;
6256
- }
6257
- if (!segmentation.representationData.Contour) {
6258
- console.warn(`No contour representation found for segmentation ${segmentationId}`);
6259
- return;
6260
- }
6261
- const contourRepresentationData = segmentation.representationData
6262
- .Contour;
6263
- const { annotationUIDsMap } = contourRepresentationData;
6264
- if (!annotationUIDsMap) {
6265
- console.warn(`No contours found for segmentation ${segmentationId}`);
6266
- return;
6267
- }
6268
- if (!annotationUIDsMap.has(segmentIndex)) {
6269
- console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6270
- return;
6271
- }
6272
- const annotationList = annotationUIDsMap.get(segmentIndex);
6273
- annotationList.forEach((annotationUID) => {
6274
- const annotation = (0,annotationState.getAnnotation)(annotationUID);
6275
- if (!annotation) {
6276
- return;
6277
- }
6278
- const polyline = annotation.data.contour.polyline;
6279
- if (!polyline || polyline.length < 3) {
6280
- return;
6281
- }
6282
- const smoothedPolyline = (0,interpolateSegmentPoints/* default */.A)(polyline, 0, polyline.length - 1, options.knotsRatioPercentage);
6283
- annotation.data.contour.polyline = smoothedPolyline;
6284
- });
6285
- }
6286
-
6287
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/convertContourHoles.js
6288
-
6289
-
6290
-
6291
-
6292
- function convertContourHoles(segmentationId, segmentIndex, targetSegmentationId, targetSegmentationIndex) {
6293
- const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6294
- if (!segmentation) {
6295
- console.warn(`Invalid segmentation given ${segmentationId}`);
6296
- return;
6297
- }
6298
- if (!segmentation.representationData.Contour) {
6299
- console.warn(`No contour representation found for segmentation ${segmentationId}`);
6300
- return;
6301
- }
6302
- const { annotationUIDsMap } = segmentation?.representationData.Contour || {};
6303
- if (!annotationUIDsMap) {
6304
- console.warn(`No annotation map found for segmentation ${segmentationId}`);
6305
- return;
6306
- }
6307
- const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
6308
- if (!annotationsUIDsSet) {
6309
- console.warn(`Segmentation index ${segmentIndex} has no annotations in segmentation ${segmentationId}`);
6310
- return;
6311
- }
6312
- let targetUIDsSet;
6313
- if (targetSegmentationId && typeof targetSegmentationIndex === 'number') {
6314
- const targetSegmentation = (0,getSegmentation/* getSegmentation */.T)(targetSegmentationId);
6315
- if (!targetSegmentation) {
6316
- console.warn(`Target segmentation ${targetSegmentationId} does not exist.`);
6317
- return;
6318
- }
6319
- if (!targetSegmentation.representationData.Contour) {
6320
- console.warn(`No contour representation found for target segmentation ${targetSegmentationId}`);
6321
- return;
6322
- }
6323
- targetUIDsSet =
6324
- targetSegmentation.representationData.Contour.annotationUIDsMap.get(targetSegmentationIndex);
6325
- if (!targetUIDsSet) {
6326
- targetUIDsSet = new Set();
6327
- targetSegmentation.representationData.Contour.annotationUIDsMap.set(targetSegmentationIndex, targetUIDsSet);
6328
- }
6329
- }
6330
- const polylinesCanvasMap = extractSegmentPolylines(segmentationId, segmentIndex);
6331
- if (!polylinesCanvasMap) {
6332
- console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6333
- return;
6334
- }
6335
- const keys = Array.from(polylinesCanvasMap?.keys());
6336
- const polylines = keys.map((key) => polylinesCanvasMap.get(key));
6337
- const holeDetectionResults = (0,contours.findContourHoles)(polylines);
6338
- if (holeDetectionResults?.length > 0) {
6339
- holeDetectionResults.forEach((hole) => {
6340
- hole.holeIndexes.forEach((index) => {
6341
- const annotation = (0,annotationState.getAnnotation)(keys[index]);
6342
- (0,annotationState.clearParentAnnotation)(annotation);
6343
- if (targetSegmentationId &&
6344
- typeof targetSegmentationIndex === 'number') {
6345
- targetUIDsSet.add(annotation.annotationUID);
6346
- }
6347
- else {
6348
- annotationsUIDsSet.add(annotation.annotationUID);
6349
- }
6350
- });
6351
- });
6352
- }
6353
- }
6354
-
6355
- ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/index.js
6356
-
6357
-
6358
-
6359
-
6360
-
6361
-
6362
-
6363
-
6364
-
6365
-
6366
-
6367
-
5974
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/index.js
5975
+ var utilities = __webpack_require__(31994);
6368
5976
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/convertStackToVolumeLabelmap.js
6369
5977
  var convertStackToVolumeLabelmap = __webpack_require__(6273);
6370
5978
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/computeVolumeLabelmapFromStack.js
6371
5979
  var computeVolumeLabelmapFromStack = __webpack_require__(6994);
6372
5980
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 1 modules
6373
5981
  var esm = __webpack_require__(15327);
5982
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
5983
+ var getSegmentation = __webpack_require__(33283);
6374
5984
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js
6375
5985
 
6376
5986
 
@@ -6409,12 +6019,16 @@ var computeStackLabelmapFromVolume = __webpack_require__(93690);
6409
6019
  var getActiveSegmentIndex = __webpack_require__(60740);
6410
6020
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getViewportIdsWithSegmentation.js
6411
6021
  var getViewportIdsWithSegmentation = __webpack_require__(58859);
6022
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
6023
+ var annotationState = __webpack_require__(82056);
6024
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
6025
+ var contourSegmentation = __webpack_require__(56534);
6412
6026
  ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/helpers/removeSegmentAnnotations.js
6413
6027
 
6414
6028
 
6415
6029
 
6416
6030
  function removeContourSegmentAnnotations(segmentationId, segmentIndex) {
6417
- const annotationUIDsMap = (0,getAnnotationsUIDMapFromSegmentation/* getAnnotationsUIDMapFromSegmentation */.B)(segmentationId);
6031
+ const annotationUIDsMap = (0,utilities.getAnnotationsUIDMapFromSegmentation)(segmentationId);
6418
6032
  if (!annotationUIDsMap) {
6419
6033
  return;
6420
6034
  }
@@ -6425,7 +6039,7 @@ function removeContourSegmentAnnotations(segmentationId, segmentIndex) {
6425
6039
  annotationUIDs.forEach((annotationUID) => {
6426
6040
  const annotation = (0,annotationState.getAnnotation)(annotationUID);
6427
6041
  if ((0,contourSegmentation.isContourSegmentationAnnotation)(annotation)) {
6428
- removeCompleteContourAnnotation(annotation);
6042
+ (0,utilities.removeCompleteContourAnnotation)(annotation);
6429
6043
  }
6430
6044
  });
6431
6045
  }
@@ -6839,9 +6453,26 @@ __webpack_require__.r(__webpack_exports__);
6839
6453
  /* harmony export */ setSegmentIndexLocked: () => (/* binding */ setSegmentIndexLocked)
6840
6454
  /* harmony export */ });
6841
6455
  /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
6842
- /* harmony import */ var _triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(49906);
6456
+ /* harmony import */ var _annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2076);
6457
+ /* harmony import */ var _triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49906);
6458
+ /* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(31994);
6459
+
6460
+
6843
6461
 
6844
6462
 
6463
+ function _setContourSegmentationSegmentAnnotationsLocked(segmentation, segmentIndex, locked) {
6464
+ const annotationUIDsMap = (0,_utilities__WEBPACK_IMPORTED_MODULE_3__.getAnnotationsUIDMapFromSegmentation)(segmentation.segmentationId);
6465
+ if (!annotationUIDsMap) {
6466
+ return;
6467
+ }
6468
+ const annotationUIDs = annotationUIDsMap.get(segmentIndex);
6469
+ if (!annotationUIDs) {
6470
+ return;
6471
+ }
6472
+ annotationUIDs.forEach((annotationUID) => {
6473
+ (0,_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_1__.setAnnotationLocked)(annotationUID, locked);
6474
+ });
6475
+ }
6845
6476
  function isSegmentIndexLocked(segmentationId, segmentIndex) {
6846
6477
  const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
6847
6478
  if (!segmentation) {
@@ -6857,7 +6488,10 @@ function setSegmentIndexLocked(segmentationId, segmentIndex, locked = true) {
6857
6488
  }
6858
6489
  const { segments } = segmentation;
6859
6490
  segments[segmentIndex].locked = locked;
6860
- (0,_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_1__.triggerSegmentationModified)(segmentationId);
6491
+ if (segmentation?.representationData?.Contour) {
6492
+ _setContourSegmentationSegmentAnnotationsLocked(segmentation, segmentIndex, locked);
6493
+ }
6494
+ (0,_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_2__.triggerSegmentationModified)(segmentationId);
6861
6495
  }
6862
6496
  function getLockedSegmentIndices(segmentationId) {
6863
6497
  const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
@@ -7018,6 +6652,292 @@ function updateLabelmapSegmentationImageReferences(viewportId, segmentationId) {
7018
6652
  }
7019
6653
 
7020
6654
 
6655
+ /***/ }),
6656
+
6657
+ /***/ 64540:
6658
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6659
+
6660
+ "use strict";
6661
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6662
+ /* harmony export */ A: () => (/* binding */ convertContourHoles)
6663
+ /* harmony export */ });
6664
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
6665
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
6666
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
6667
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
6668
+
6669
+
6670
+
6671
+
6672
+ function convertContourHoles(segmentationId, segmentIndex, targetSegmentationId, targetSegmentationIndex) {
6673
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentation */ .T)(segmentationId);
6674
+ if (!segmentation) {
6675
+ console.warn(`Invalid segmentation given ${segmentationId}`);
6676
+ return;
6677
+ }
6678
+ if (!segmentation.representationData.Contour) {
6679
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
6680
+ return;
6681
+ }
6682
+ const { annotationUIDsMap } = segmentation?.representationData.Contour || {};
6683
+ if (!annotationUIDsMap) {
6684
+ console.warn(`No annotation map found for segmentation ${segmentationId}`);
6685
+ return;
6686
+ }
6687
+ const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
6688
+ if (!annotationsUIDsSet) {
6689
+ console.warn(`Segmentation index ${segmentIndex} has no annotations in segmentation ${segmentationId}`);
6690
+ return;
6691
+ }
6692
+ let targetUIDsSet;
6693
+ if (targetSegmentationId && typeof targetSegmentationIndex === 'number') {
6694
+ const targetSegmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentation */ .T)(targetSegmentationId);
6695
+ if (!targetSegmentation) {
6696
+ console.warn(`Target segmentation ${targetSegmentationId} does not exist.`);
6697
+ return;
6698
+ }
6699
+ if (!targetSegmentation.representationData.Contour) {
6700
+ console.warn(`No contour representation found for target segmentation ${targetSegmentationId}`);
6701
+ return;
6702
+ }
6703
+ targetUIDsSet =
6704
+ targetSegmentation.representationData.Contour.annotationUIDsMap.get(targetSegmentationIndex);
6705
+ if (!targetUIDsSet) {
6706
+ targetUIDsSet = new Set();
6707
+ targetSegmentation.representationData.Contour.annotationUIDsMap.set(targetSegmentationIndex, targetUIDsSet);
6708
+ }
6709
+ }
6710
+ const polylinesCanvasMap = (0,_extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__/* .extractSegmentPolylines */ .u)(segmentationId, segmentIndex);
6711
+ if (!polylinesCanvasMap) {
6712
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6713
+ return;
6714
+ }
6715
+ const keys = Array.from(polylinesCanvasMap?.keys());
6716
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
6717
+ const holeDetectionResults = (0,_utilities_contours__WEBPACK_IMPORTED_MODULE_0__.findContourHoles)(polylines);
6718
+ if (holeDetectionResults?.length > 0) {
6719
+ holeDetectionResults.forEach((hole) => {
6720
+ hole.holeIndexes.forEach((index) => {
6721
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.getAnnotation)(keys[index]);
6722
+ (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.clearParentAnnotation)(annotation);
6723
+ if (targetSegmentationId &&
6724
+ typeof targetSegmentationIndex === 'number') {
6725
+ targetUIDsSet.add(annotation.annotationUID);
6726
+ }
6727
+ else {
6728
+ annotationsUIDsSet.add(annotation.annotationUID);
6729
+ }
6730
+ });
6731
+ });
6732
+ }
6733
+ }
6734
+
6735
+
6736
+ /***/ }),
6737
+
6738
+ /***/ 53097:
6739
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6740
+
6741
+ "use strict";
6742
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6743
+ /* harmony export */ A: () => (/* binding */ decimateContours)
6744
+ /* harmony export */ });
6745
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
6746
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
6747
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
6748
+ /* harmony import */ var _utilities_math_polyline_decimate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(99944);
6749
+ /* harmony import */ var _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16493);
6750
+
6751
+
6752
+
6753
+
6754
+
6755
+ function decimateContours(segmentationId, segmentIndex, options = { epsilon: 0.1 }) {
6756
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
6757
+ if (!segmentation) {
6758
+ console.warn(`Invalid segmentation given ${segmentationId}`);
6759
+ return;
6760
+ }
6761
+ if (!segmentation.representationData.Contour) {
6762
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
6763
+ return;
6764
+ }
6765
+ const viewports = (0,_getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_4__/* .getViewportsAssociatedToSegmentation */ .xT)(segmentationId);
6766
+ if (!viewports) {
6767
+ console.warn('No viewport associated to the segmentation found');
6768
+ return;
6769
+ }
6770
+ const polylinesCanvasMap = (0,_extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__/* .extractSegmentPolylines */ .u)(segmentationId, segmentIndex);
6771
+ if (!polylinesCanvasMap) {
6772
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
6773
+ return;
6774
+ }
6775
+ const keys = Array.from(polylinesCanvasMap?.keys());
6776
+ for (const annotationUID of keys) {
6777
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(annotationUID);
6778
+ if (!annotation) {
6779
+ continue;
6780
+ }
6781
+ const polylineCanvas = polylinesCanvasMap.get(annotationUID);
6782
+ const decimatedPolyline2D = (0,_utilities_math_polyline_decimate__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)(polylineCanvas, options.epsilon);
6783
+ const viewport = (0,_getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_4__/* .getViewportWithMatchingViewPlaneNormal */ .W8)(viewports, annotation);
6784
+ if (viewport) {
6785
+ annotation.data.contour.polyline = decimatedPolyline2D.map((point2D) => viewport.canvasToWorld(point2D));
6786
+ (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.invalidateAnnotation)(annotation);
6787
+ }
6788
+ }
6789
+ }
6790
+
6791
+
6792
+ /***/ }),
6793
+
6794
+ /***/ 96629:
6795
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6796
+
6797
+ "use strict";
6798
+
6799
+ // EXPORTS
6800
+ __webpack_require__.d(__webpack_exports__, {
6801
+ u: () => (/* binding */ extractSegmentPolylines)
6802
+ });
6803
+
6804
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/getSegmentation.js
6805
+ var getSegmentation = __webpack_require__(33283);
6806
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js + 1 modules
6807
+ var contourSegmentation = __webpack_require__(56534);
6808
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getViewportAssociatedToSegmentation.js
6809
+ var getViewportAssociatedToSegmentation = __webpack_require__(16493);
6810
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getAnnotationMapFromSegmentation.js
6811
+ var getAnnotationMapFromSegmentation = __webpack_require__(10407);
6812
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/getPolylineMap.js
6813
+
6814
+ function closePolyline(polyline, closed) {
6815
+ if (!polyline || polyline.length === 0) {
6816
+ return [];
6817
+ }
6818
+ if (!closed) {
6819
+ return [...polyline];
6820
+ }
6821
+ const firstPoint = polyline[0];
6822
+ const lastPoint = polyline[polyline.length - 1];
6823
+ const isAlreadyClosed = firstPoint[0] === lastPoint[0] &&
6824
+ firstPoint[1] === lastPoint[1] &&
6825
+ firstPoint[2] === lastPoint[2];
6826
+ if (isAlreadyClosed) {
6827
+ return [...polyline];
6828
+ }
6829
+ return [...polyline, firstPoint];
6830
+ }
6831
+ function getPolylinesMap(contourRepresentationData, segmentIndex) {
6832
+ const { annotationUIDsInSegmentMap } = (0,getAnnotationMapFromSegmentation/* getAnnotationMapFromSegmentation */.C)(contourRepresentationData);
6833
+ if (!annotationUIDsInSegmentMap.has(segmentIndex)) {
6834
+ console.warn(`No contour information found for segmentIndex ${segmentIndex}`);
6835
+ return;
6836
+ }
6837
+ const polylines = new Map();
6838
+ const annotationsInfo = annotationUIDsInSegmentMap.get(segmentIndex);
6839
+ for (const annotationInfo of annotationsInfo) {
6840
+ polylines.set(annotationInfo.annotationUID, closePolyline(annotationInfo.polyline, annotationInfo.isClosed));
6841
+ for (let i = 0; i < annotationInfo.holesUIDs?.length; i++) {
6842
+ polylines.set(annotationInfo.holesUIDs[i], closePolyline(annotationInfo.holesPolyline[i], annotationInfo.holesClosed[i]));
6843
+ }
6844
+ }
6845
+ return polylines;
6846
+ }
6847
+
6848
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/annotation/annotationState.js
6849
+ var annotationState = __webpack_require__(82056);
6850
+ ;// ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/utilities/extractSegmentPolylines.js
6851
+
6852
+
6853
+
6854
+
6855
+
6856
+ function extractSegmentPolylines(segmentationId, segmentIndex) {
6857
+ const viewports = (0,getViewportAssociatedToSegmentation/* getViewportsAssociatedToSegmentation */.xT)(segmentationId);
6858
+ const segmentation = (0,getSegmentation/* getSegmentation */.T)(segmentationId);
6859
+ if (!segmentation) {
6860
+ return;
6861
+ }
6862
+ if (!segmentation.representationData.Contour) {
6863
+ return;
6864
+ }
6865
+ const contourRepresentationData = segmentation.representationData
6866
+ .Contour;
6867
+ const { annotationUIDsMap } = contourRepresentationData;
6868
+ if (!annotationUIDsMap) {
6869
+ return;
6870
+ }
6871
+ if (!annotationUIDsMap.get(segmentIndex)) {
6872
+ return;
6873
+ }
6874
+ const polyLinesMap = getPolylinesMap(contourRepresentationData, segmentIndex);
6875
+ if (!polyLinesMap) {
6876
+ return;
6877
+ }
6878
+ const keys = Array.from(polyLinesMap?.keys());
6879
+ const polylinesCanvasMap = new Map();
6880
+ for (const key of keys) {
6881
+ const annotation = (0,annotationState.getAnnotation)(key);
6882
+ const viewport = (0,getViewportAssociatedToSegmentation/* getViewportWithMatchingViewPlaneNormal */.W8)(viewports, annotation);
6883
+ polylinesCanvasMap.set(key, (0,contourSegmentation.convertContourPolylineToCanvasSpace)(polyLinesMap.get(key), viewport));
6884
+ }
6885
+ return polylinesCanvasMap;
6886
+ }
6887
+
6888
+
6889
+ /***/ }),
6890
+
6891
+ /***/ 10407:
6892
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6893
+
6894
+ "use strict";
6895
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6896
+ /* harmony export */ C: () => (/* binding */ getAnnotationMapFromSegmentation)
6897
+ /* harmony export */ });
6898
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
6899
+
6900
+ function getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
6901
+ const annotationMap = contourRepresentationData.annotationUIDsMap;
6902
+ const segmentIndices = options.segmentIndices?.length
6903
+ ? options.segmentIndices
6904
+ : Array.from(annotationMap.keys());
6905
+ const annotationUIDsInSegmentMap = new Map();
6906
+ segmentIndices.forEach((index) => {
6907
+ const annotationUIDsInSegment = annotationMap.get(index);
6908
+ let uids = Array.from(annotationUIDsInSegment);
6909
+ uids = uids.filter((uid) => !(0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(uid).parentAnnotationUID);
6910
+ const annotations = uids.map((uid) => {
6911
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(uid);
6912
+ const hasChildAnnotations = annotation.childAnnotationUIDs?.length;
6913
+ const childPolylinesInformation = hasChildAnnotations &&
6914
+ annotation.childAnnotationUIDs.map((childUID) => {
6915
+ const childAnnotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(childUID);
6916
+ return {
6917
+ polyline: childAnnotation.data.contour.polyline,
6918
+ isClosed: childAnnotation.data.contour.closed,
6919
+ };
6920
+ });
6921
+ const holesClosed = hasChildAnnotations &&
6922
+ childPolylinesInformation.map((childInfo) => childInfo.isClosed);
6923
+ const childPolylines = hasChildAnnotations &&
6924
+ childPolylinesInformation.map((childInfo) => childInfo.polyline);
6925
+ return {
6926
+ polyline: annotation.data.contour.polyline,
6927
+ isClosed: annotation.data.contour.closed,
6928
+ annotationUID: annotation.annotationUID,
6929
+ referencedImageId: annotation.metadata.referencedImageId,
6930
+ holesPolyline: childPolylines,
6931
+ holesUIDs: annotation.childAnnotationUIDs,
6932
+ holesClosed,
6933
+ };
6934
+ });
6935
+ annotationUIDsInSegmentMap.set(index, annotations);
6936
+ });
6937
+ return { segmentIndices, annotationUIDsInSegmentMap };
6938
+ }
6939
+
6940
+
7021
6941
  /***/ }),
7022
6942
 
7023
6943
  /***/ 98484:
@@ -7105,6 +7025,220 @@ function getViewportWithMatchingViewPlaneNormal(viewports, annotation, dotThresh
7105
7025
  }
7106
7026
 
7107
7027
 
7028
+ /***/ }),
7029
+
7030
+ /***/ 31994:
7031
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7032
+
7033
+ "use strict";
7034
+ __webpack_require__.r(__webpack_exports__);
7035
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7036
+ /* harmony export */ convertContourHoles: () => (/* reexport safe */ _convertContourHoles__WEBPACK_IMPORTED_MODULE_9__.A),
7037
+ /* harmony export */ decimateContours: () => (/* reexport safe */ _decimateContours__WEBPACK_IMPORTED_MODULE_3__.A),
7038
+ /* harmony export */ extractSegmentPolylines: () => (/* reexport safe */ _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_4__.u),
7039
+ /* harmony export */ getAnnotationMapFromSegmentation: () => (/* reexport safe */ _getAnnotationMapFromSegmentation__WEBPACK_IMPORTED_MODULE_2__.C),
7040
+ /* harmony export */ getAnnotationsUIDMapFromSegmentation: () => (/* reexport safe */ _getAnnotationsUIDMapFromSegmentation__WEBPACK_IMPORTED_MODULE_0__.B),
7041
+ /* harmony export */ getViewportAssociatedToSegmentation: () => (/* reexport safe */ _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_1__.IN),
7042
+ /* harmony export */ getViewportWithMatchingViewPlaneNormal: () => (/* reexport safe */ _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_1__.W8),
7043
+ /* harmony export */ removeCompleteContourAnnotation: () => (/* reexport safe */ _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_5__.v),
7044
+ /* harmony export */ removeContourHoles: () => (/* reexport safe */ _removeContourHoles__WEBPACK_IMPORTED_MODULE_6__.A),
7045
+ /* harmony export */ removeContourIslands: () => (/* reexport safe */ _removeContourIslands__WEBPACK_IMPORTED_MODULE_7__.A),
7046
+ /* harmony export */ smoothContours: () => (/* reexport safe */ _smoothContours__WEBPACK_IMPORTED_MODULE_8__.A)
7047
+ /* harmony export */ });
7048
+ /* harmony import */ var _getAnnotationsUIDMapFromSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(98484);
7049
+ /* harmony import */ var _getViewportAssociatedToSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16493);
7050
+ /* harmony import */ var _getAnnotationMapFromSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10407);
7051
+ /* harmony import */ var _decimateContours__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53097);
7052
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(96629);
7053
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38928);
7054
+ /* harmony import */ var _removeContourHoles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(19741);
7055
+ /* harmony import */ var _removeContourIslands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(85512);
7056
+ /* harmony import */ var _smoothContours__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(68362);
7057
+ /* harmony import */ var _convertContourHoles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(64540);
7058
+
7059
+
7060
+
7061
+
7062
+
7063
+
7064
+
7065
+
7066
+
7067
+
7068
+
7069
+
7070
+
7071
+ /***/ }),
7072
+
7073
+ /***/ 38928:
7074
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7075
+
7076
+ "use strict";
7077
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7078
+ /* harmony export */ v: () => (/* binding */ removeCompleteContourAnnotation)
7079
+ /* harmony export */ });
7080
+ /* harmony import */ var _utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56534);
7081
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
7082
+
7083
+
7084
+ function removeCompleteContourAnnotation(annotation) {
7085
+ if (!annotation) {
7086
+ return;
7087
+ }
7088
+ if (annotation.parentAnnotationUID) {
7089
+ (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.clearParentAnnotation)(annotation);
7090
+ }
7091
+ (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.removeAnnotation)(annotation.annotationUID);
7092
+ (0,_utilities_contourSegmentation__WEBPACK_IMPORTED_MODULE_0__.removeContourSegmentationAnnotation)(annotation);
7093
+ }
7094
+
7095
+
7096
+ /***/ }),
7097
+
7098
+ /***/ 19741:
7099
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7100
+
7101
+ "use strict";
7102
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7103
+ /* harmony export */ A: () => (/* binding */ removeContourHoles)
7104
+ /* harmony export */ });
7105
+ /* harmony import */ var _utilities_contours__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6936);
7106
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82056);
7107
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33283);
7108
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96629);
7109
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
7110
+
7111
+
7112
+
7113
+
7114
+
7115
+ function removeContourHoles(segmentationId, segmentIndex) {
7116
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_2__/* .getSegmentation */ .T)(segmentationId);
7117
+ if (!segmentation) {
7118
+ console.warn(`Invalid segmentation given ${segmentationId}`);
7119
+ return;
7120
+ }
7121
+ if (!segmentation.representationData.Contour) {
7122
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
7123
+ return;
7124
+ }
7125
+ const polylinesCanvasMap = (0,_extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_3__/* .extractSegmentPolylines */ .u)(segmentationId, segmentIndex);
7126
+ if (!polylinesCanvasMap) {
7127
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
7128
+ return;
7129
+ }
7130
+ const keys = Array.from(polylinesCanvasMap?.keys());
7131
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
7132
+ const holeDetectionResults = (0,_utilities_contours__WEBPACK_IMPORTED_MODULE_0__.findContourHoles)(polylines);
7133
+ if (holeDetectionResults?.length > 0) {
7134
+ holeDetectionResults.forEach((hole) => {
7135
+ hole.holeIndexes.forEach((index) => {
7136
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_1__.getAnnotation)(keys[index]);
7137
+ (0,_removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__/* .removeCompleteContourAnnotation */ .v)(annotation);
7138
+ });
7139
+ });
7140
+ }
7141
+ }
7142
+
7143
+
7144
+ /***/ }),
7145
+
7146
+ /***/ 85512:
7147
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7148
+
7149
+ "use strict";
7150
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7151
+ /* harmony export */ A: () => (/* binding */ removeContourIslands)
7152
+ /* harmony export */ });
7153
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
7154
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
7155
+ /* harmony import */ var _extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96629);
7156
+ /* harmony import */ var _utilities_contours_findIslands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(76617);
7157
+ /* harmony import */ var _removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38928);
7158
+
7159
+
7160
+
7161
+
7162
+
7163
+ function removeContourIslands(segmentationId, segmentIndex, options = { threshold: 3 }) {
7164
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
7165
+ if (!segmentation) {
7166
+ console.warn(`Invalid segmentation given ${segmentationId}`);
7167
+ return;
7168
+ }
7169
+ if (!segmentation.representationData.Contour) {
7170
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
7171
+ return;
7172
+ }
7173
+ const polylinesCanvasMap = (0,_extractSegmentPolylines__WEBPACK_IMPORTED_MODULE_2__/* .extractSegmentPolylines */ .u)(segmentationId, segmentIndex);
7174
+ if (!polylinesCanvasMap) {
7175
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
7176
+ return;
7177
+ }
7178
+ const keys = Array.from(polylinesCanvasMap?.keys());
7179
+ const polylines = keys.map((key) => polylinesCanvasMap.get(key));
7180
+ const islands = (0,_utilities_contours_findIslands__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)(polylines, options.threshold);
7181
+ if (islands?.length > 0) {
7182
+ islands.forEach((index) => {
7183
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(keys[index]);
7184
+ (0,_removeCompleteContourAnnotation__WEBPACK_IMPORTED_MODULE_4__/* .removeCompleteContourAnnotation */ .v)(annotation);
7185
+ });
7186
+ }
7187
+ }
7188
+
7189
+
7190
+ /***/ }),
7191
+
7192
+ /***/ 68362:
7193
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7194
+
7195
+ "use strict";
7196
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7197
+ /* harmony export */ A: () => (/* binding */ smoothContours)
7198
+ /* harmony export */ });
7199
+ /* harmony import */ var _annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82056);
7200
+ /* harmony import */ var _getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
7201
+ /* harmony import */ var _utilities_planarFreehandROITool_interpolation_interpolateSegmentPoints__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61768);
7202
+
7203
+
7204
+
7205
+ function smoothContours(segmentationId, segmentIndex, options = { knotsRatioPercentage: 30 }) {
7206
+ const segmentation = (0,_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
7207
+ if (!segmentation) {
7208
+ console.warn(`Invalid segmentation given ${segmentationId}`);
7209
+ return;
7210
+ }
7211
+ if (!segmentation.representationData.Contour) {
7212
+ console.warn(`No contour representation found for segmentation ${segmentationId}`);
7213
+ return;
7214
+ }
7215
+ const contourRepresentationData = segmentation.representationData
7216
+ .Contour;
7217
+ const { annotationUIDsMap } = contourRepresentationData;
7218
+ if (!annotationUIDsMap) {
7219
+ console.warn(`No contours found for segmentation ${segmentationId}`);
7220
+ return;
7221
+ }
7222
+ if (!annotationUIDsMap.has(segmentIndex)) {
7223
+ console.warn(`Error extracting contour data from segment ${segmentIndex} in segmentation ${segmentationId}`);
7224
+ return;
7225
+ }
7226
+ const annotationList = annotationUIDsMap.get(segmentIndex);
7227
+ annotationList.forEach((annotationUID) => {
7228
+ const annotation = (0,_annotation_annotationState__WEBPACK_IMPORTED_MODULE_0__.getAnnotation)(annotationUID);
7229
+ if (!annotation) {
7230
+ return;
7231
+ }
7232
+ const polyline = annotation.data.contour.polyline;
7233
+ if (!polyline || polyline.length < 3) {
7234
+ return;
7235
+ }
7236
+ const smoothedPolyline = (0,_utilities_planarFreehandROITool_interpolation_interpolateSegmentPoints__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)(polyline, 0, polyline.length - 1, options.knotsRatioPercentage);
7237
+ annotation.data.contour.polyline = smoothedPolyline;
7238
+ });
7239
+ }
7240
+
7241
+
7108
7242
  /***/ }),
7109
7243
 
7110
7244
  /***/ 50749:
@@ -8887,7 +9021,7 @@ function createZoomPanSynchronizer(synchronizerName) {
8887
9021
  /* harmony import */ var _store_ToolGroupManager__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(77609);
8888
9022
  /* harmony import */ var _utilities_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(52905);
8889
9023
  /* harmony import */ var _utilities_math_point__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(82216);
8890
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(83673);
9024
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(55126);
8891
9025
 
8892
9026
 
8893
9027
 
@@ -9929,6 +10063,7 @@ AnnotationEraserTool.toolName = 'Eraser';
9929
10063
 
9930
10064
 
9931
10065
 
10066
+
9932
10067
  const { RENDERING_DEFAULTS } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_4__.CONSTANTS;
9933
10068
  function defaultReferenceLineColor() {
9934
10069
  return 'rgb(0, 200, 0)';
@@ -11098,9 +11233,42 @@ class CrosshairsTool extends _base__WEBPACK_IMPORTED_MODULE_3__/* .AnnotationToo
11098
11233
  });
11099
11234
  }
11100
11235
  setToolCenter(toolCenter, suppressEvents = false) {
11101
- this.toolCenter = toolCenter;
11102
11236
  const viewportsInfo = this._getViewportsInfo();
11103
- (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_15__/* ["default"] */ .A)(viewportsInfo.map(({ viewportId }) => viewportId));
11237
+ viewportsInfo.map(({ renderingEngineId, viewportId }) => {
11238
+ const renderingEngine = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_4__.getRenderingEngine)(renderingEngineId);
11239
+ const viewport = renderingEngine.getViewport(viewportId);
11240
+ const camera = viewport.getCamera();
11241
+ const { focalPoint, position, viewPlaneNormal } = camera;
11242
+ const delta = [
11243
+ toolCenter[0] - focalPoint[0],
11244
+ toolCenter[1] - focalPoint[1],
11245
+ toolCenter[2] - focalPoint[2],
11246
+ ];
11247
+ const scroll = delta[0] * viewPlaneNormal[0] +
11248
+ delta[1] * viewPlaneNormal[1] +
11249
+ delta[2] * viewPlaneNormal[2];
11250
+ const scrollDelta = [
11251
+ scroll * viewPlaneNormal[0],
11252
+ scroll * viewPlaneNormal[1],
11253
+ scroll * viewPlaneNormal[2],
11254
+ ];
11255
+ const newFocalPoint = [
11256
+ focalPoint[0] + scrollDelta[0],
11257
+ focalPoint[1] + scrollDelta[1],
11258
+ focalPoint[2] + scrollDelta[2],
11259
+ ];
11260
+ const newPosition = [
11261
+ position[0] + scrollDelta[0],
11262
+ position[1] + scrollDelta[1],
11263
+ position[2] + scrollDelta[2],
11264
+ ];
11265
+ viewport.setCamera({
11266
+ focalPoint: newFocalPoint,
11267
+ position: newPosition,
11268
+ });
11269
+ viewport.render();
11270
+ });
11271
+ this.toolCenter = toolCenter;
11104
11272
  if (!suppressEvents) {
11105
11273
  (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_4__.triggerEvent)(_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_4__.eventTarget, _enums__WEBPACK_IMPORTED_MODULE_9__.Events.CROSSHAIR_TOOL_CENTER_CHANGED, {
11106
11274
  toolGroupId: this.toolGroupId,
@@ -11584,6 +11752,11 @@ class MagnifyTool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .BaseTool */ .oS
11584
11752
  magnifyToolElement.style.display = 'block';
11585
11753
  (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(viewportIdsToRender);
11586
11754
  };
11755
+ this._cancelCallback = (evt) => {
11756
+ evt.preventDefault();
11757
+ evt.stopPropagation();
11758
+ this._dragEndCallback(evt);
11759
+ };
11587
11760
  this._dragCallback = (evt) => {
11588
11761
  const eventDetail = evt.detail;
11589
11762
  const { deltaPoints, element, currentPoints } = eventDetail;
@@ -11616,7 +11789,12 @@ class MagnifyTool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .BaseTool */ .oS
11616
11789
  magnifyViewport.render();
11617
11790
  };
11618
11791
  this._dragEndCallback = (evt) => {
11619
- const { element } = evt.detail;
11792
+ let { element } = evt.detail;
11793
+ if (element === undefined) {
11794
+ const { enabledElement } = this.editData;
11795
+ const { viewport } = enabledElement;
11796
+ element = viewport.element;
11797
+ }
11620
11798
  const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_2__.getEnabledElement)(element);
11621
11799
  const { renderingEngine } = enabledElement;
11622
11800
  renderingEngine.disableElement(MAGNIFY_VIEWPORT_ID);
@@ -11633,6 +11811,7 @@ class MagnifyTool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .BaseTool */ .oS
11633
11811
  element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_UP, this._dragEndCallback);
11634
11812
  element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_DRAG, this._dragCallback);
11635
11813
  element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_CLICK, this._dragEndCallback);
11814
+ element.addEventListener('contextmenu', this._cancelCallback);
11636
11815
  element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.TOUCH_END, this._dragEndCallback);
11637
11816
  element.addEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.TOUCH_DRAG, this._dragCallback);
11638
11817
  };
@@ -11641,6 +11820,7 @@ class MagnifyTool extends _base__WEBPACK_IMPORTED_MODULE_0__/* .BaseTool */ .oS
11641
11820
  element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_UP, this._dragEndCallback);
11642
11821
  element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_DRAG, this._dragCallback);
11643
11822
  element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.MOUSE_CLICK, this._dragEndCallback);
11823
+ element.removeEventListener('contextmenu', this._cancelCallback);
11644
11824
  element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.TOUCH_END, this._dragEndCallback);
11645
11825
  element.removeEventListener(_enums__WEBPACK_IMPORTED_MODULE_1__.Events.TOUCH_DRAG, this._dragCallback);
11646
11826
  };
@@ -17820,6 +18000,7 @@ class ArrowAnnotateTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .Annotation
17820
18000
  }) {
17821
18001
  super(toolProps, defaultToolProps);
17822
18002
  this.addNewAnnotation = (evt) => {
18003
+ this.startGroupRecording();
17823
18004
  const eventDetail = evt.detail;
17824
18005
  const { currentPoints, element } = eventDetail;
17825
18006
  const worldPos = currentPoints.world;
@@ -17918,6 +18099,8 @@ class ArrowAnnotateTool extends _base__WEBPACK_IMPORTED_MODULE_2__/* .Annotation
17918
18099
  (0,_stateManagement_annotation_helpers_state__WEBPACK_IMPORTED_MODULE_10__.triggerAnnotationCompleted)(annotation);
17919
18100
  this.createMemo(element, annotation, { newAnnotation: !!this.memo });
17920
18101
  (0,_utilities__WEBPACK_IMPORTED_MODULE_13__.setAnnotationLabel)(annotation, element, label);
18102
+ this.endGroupRecording();
18103
+ this.doneEditMemo();
17921
18104
  (0,_utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)(viewportIdsToRender);
17922
18105
  });
17923
18106
  }
@@ -30988,7 +31171,7 @@ CircleROIStartEndThresholdTool.toolName = 'CircleROIStartEndThreshold';
30988
31171
  /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74347);
30989
31172
  /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7001);
30990
31173
  /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(58640);
30991
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(83673);
31174
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(55126);
30992
31175
  /* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(98870);
30993
31176
  /* harmony import */ var _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(23631);
30994
31177
 
@@ -31239,7 +31422,7 @@ CircleScissorsTool.toolName = 'CircleScissor';
31239
31422
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15327);
31240
31423
  /* harmony import */ var _annotation_PlanarFreehandContourSegmentationTool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37590);
31241
31424
  /* harmony import */ var _BrushTool__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(48736);
31242
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83673);
31425
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(55126);
31243
31426
  /* harmony import */ var _stateManagement_segmentation_getSegmentationRepresentation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(93210);
31244
31427
 
31245
31428
 
@@ -31378,7 +31561,7 @@ class LabelMapEditWithContourTool extends _annotation_PlanarFreehandContourSegme
31378
31561
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85817);
31379
31562
  /* harmony import */ var _enums__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(99737);
31380
31563
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49906);
31381
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83673);
31564
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(55126);
31382
31565
  /* harmony import */ var _utilities_segmentation_floodFill__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(84882);
31383
31566
  /* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(98870);
31384
31567
 
@@ -32279,7 +32462,7 @@ RectangleROIThresholdTool.toolName = 'RectangleROIThreshold';
32279
32462
  /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(74347);
32280
32463
  /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7001);
32281
32464
  /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58640);
32282
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(83673);
32465
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55126);
32283
32466
  /* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(98870);
32284
32467
  /* harmony import */ var _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(23631);
32285
32468
 
@@ -32805,7 +32988,7 @@ class SegmentBidirectionalTool extends _annotation_BidirectionalTool__WEBPACK_IM
32805
32988
  /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
32806
32989
  /* harmony export */ });
32807
32990
  /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15327);
32808
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(83673);
32991
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55126);
32809
32992
  /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85817);
32810
32993
  /* harmony import */ var _stateManagement_segmentation_triggerSegmentationEvents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49906);
32811
32994
  /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58640);
@@ -33097,7 +33280,7 @@ SegmentSelectTool.toolName = 'SegmentSelectTool';
33097
33280
  /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(74347);
33098
33281
  /* harmony import */ var _cursors_elementCursor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7001);
33099
33282
  /* harmony import */ var _utilities_triggerAnnotationRenderForViewportIds__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(58640);
33100
- /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(83673);
33283
+ /* harmony import */ var _stateManagement_segmentation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(55126);
33101
33284
  /* harmony import */ var _stateManagement_segmentation_segmentationState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(98870);
33102
33285
  /* harmony import */ var _LabelmapBaseTool__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23631);
33103
33286
 
@@ -34677,7 +34860,9 @@ function getToolStateByViewportId(viewportId) {
34677
34860
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34678
34861
  /* harmony export */ V: () => (/* binding */ addContourSegmentationAnnotation)
34679
34862
  /* harmony export */ });
34680
- /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33283);
34863
+ /* harmony import */ var _stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2076);
34864
+ /* harmony import */ var _stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33283);
34865
+
34681
34866
 
34682
34867
  function addContourSegmentationAnnotation(annotation) {
34683
34868
  if (annotation.parentAnnotationUID) {
@@ -34687,7 +34872,7 @@ function addContourSegmentationAnnotation(annotation) {
34687
34872
  throw new Error('addContourSegmentationAnnotation: annotation does not have a segmentation data');
34688
34873
  }
34689
34874
  const { segmentationId, segmentIndex } = annotation.data.segmentation;
34690
- const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_0__/* .getSegmentation */ .T)(segmentationId);
34875
+ const segmentation = (0,_stateManagement_segmentation_getSegmentation__WEBPACK_IMPORTED_MODULE_1__/* .getSegmentation */ .T)(segmentationId);
34691
34876
  if (!segmentation.representationData.Contour) {
34692
34877
  segmentation.representationData.Contour = { annotationUIDsMap: new Map() };
34693
34878
  }
@@ -34700,6 +34885,9 @@ function addContourSegmentationAnnotation(annotation) {
34700
34885
  annotationsUIDsSet = new Set();
34701
34886
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet);
34702
34887
  }
34888
+ if (segmentation.segments[segmentIndex].locked) {
34889
+ (0,_stateManagement_annotation_annotationLocking__WEBPACK_IMPORTED_MODULE_0__.setAnnotationLocked)(annotation.annotationUID, true);
34890
+ }
34703
34891
  annotationUIDsMap.set(segmentIndex, annotationsUIDsSet.add(annotation.annotationUID));
34704
34892
  }
34705
34893
 
@@ -36211,18 +36399,20 @@ function cleanupPolylines(polylines) {
36211
36399
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
36212
36400
  /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
36213
36401
  /* harmony export */ });
36402
+ /* unused harmony export calculatePerimeter */
36403
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3823);
36404
+
36214
36405
  function calculatePerimeter(polyline, closed) {
36215
36406
  let perimeter = 0;
36216
36407
  for (let i = 0; i < polyline.length - 1; i++) {
36217
36408
  const point1 = polyline[i];
36218
36409
  const point2 = polyline[i + 1];
36219
- perimeter += Math.sqrt(Math.pow(point2[0] - point1[0], 2) + Math.pow(point2[1] - point1[1], 2));
36410
+ perimeter += gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dist */ .eR.dist(point1, point2);
36220
36411
  }
36221
36412
  if (closed) {
36222
36413
  const firstPoint = polyline[0];
36223
36414
  const lastPoint = polyline[polyline.length - 1];
36224
- perimeter += Math.sqrt(Math.pow(lastPoint[0] - firstPoint[0], 2) +
36225
- Math.pow(lastPoint[1] - firstPoint[1], 2));
36415
+ perimeter += gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dist */ .eR.dist(firstPoint, lastPoint);
36226
36416
  }
36227
36417
  return perimeter;
36228
36418
  }
@@ -38287,6 +38477,59 @@ __webpack_require__.r(__webpack_exports__);
38287
38477
 
38288
38478
 
38289
38479
 
38480
+ /***/ }),
38481
+
38482
+ /***/ 61768:
38483
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
38484
+
38485
+ "use strict";
38486
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
38487
+ /* harmony export */ A: () => (/* binding */ interpolateSegmentPoints)
38488
+ /* harmony export */ });
38489
+ /* harmony import */ var _algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30269);
38490
+
38491
+ function getContinuousUniformDistributionValues(minDistributionDistance, closedInterval) {
38492
+ const result = [];
38493
+ const [intervalIni, intervalEnd] = closedInterval;
38494
+ const intervalSize = intervalEnd - intervalIni + 1;
38495
+ const intensity = Math.floor(intervalSize / minDistributionDistance);
38496
+ let x = 0;
38497
+ let continuosDistributionValue = Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
38498
+ while (continuosDistributionValue <= intervalEnd) {
38499
+ result.push(continuosDistributionValue);
38500
+ x++;
38501
+ continuosDistributionValue =
38502
+ Math.round(((intervalSize - 1) / (intensity - 1)) * x) + intervalIni;
38503
+ }
38504
+ return result;
38505
+ }
38506
+ function interpolateSegmentPoints(points, iniIndex, endIndex, knotsRatioPercentage) {
38507
+ const segmentSize = endIndex - iniIndex + 1;
38508
+ const amountOfKnots = Math.floor((knotsRatioPercentage / 100) * segmentSize) ?? 1;
38509
+ const minKnotDistance = Math.floor(segmentSize / amountOfKnots) ?? 1;
38510
+ if (isNaN(segmentSize) || !segmentSize || !minKnotDistance) {
38511
+ return points;
38512
+ }
38513
+ if (segmentSize / minKnotDistance < 2) {
38514
+ return points;
38515
+ }
38516
+ const interpolationIniIndex = Math.max(0, iniIndex);
38517
+ const interpolationEndIndex = Math.min(points.length - 1, endIndex);
38518
+ const segmentPointsUnchangedBeg = points.slice(0, interpolationIniIndex);
38519
+ const segmentPointsUnchangedEnd = points.slice(interpolationEndIndex + 1, points.length);
38520
+ const knotsIndexes = getContinuousUniformDistributionValues(minKnotDistance, [
38521
+ interpolationIniIndex,
38522
+ interpolationEndIndex,
38523
+ ]);
38524
+ const interpolatedPoints = (0,_algorithms_bspline__WEBPACK_IMPORTED_MODULE_0__/* .interpolatePoints */ .H)(points, knotsIndexes);
38525
+ return [
38526
+ ...segmentPointsUnchangedBeg,
38527
+ ...interpolatedPoints,
38528
+ ...segmentPointsUnchangedEnd,
38529
+ ];
38530
+ }
38531
+
38532
+
38290
38533
  /***/ }),
38291
38534
 
38292
38535
  /***/ 10261:
@@ -44061,7 +44304,7 @@ __webpack_require__.r(__webpack_exports__);
44061
44304
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
44062
44305
  /* harmony export */ r: () => (/* binding */ version)
44063
44306
  /* harmony export */ });
44064
- const version = '4.5.5';
44307
+ const version = '4.5.19';
44065
44308
 
44066
44309
 
44067
44310
  /***/ }),