@ohif/app 3.9.0-beta.34 → 3.9.0-beta.35

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 (34) hide show
  1. package/dist/{117.bundle.3c4b1267961545fed330.js → 117.bundle.17ae130d2bb21ef9d31f.js} +5 -56
  2. package/dist/{121.bundle.10a6e63661e3feffdcf7.js → 121.bundle.055a3cf8c3030dac8989.js} +1 -1
  3. package/dist/{129.bundle.aeffa00fc359c6c3302f.js → 129.bundle.a0a9dbc0bc789d61e3f1.js} +2 -2
  4. package/dist/{164.bundle.02db16dcc1132b25d4ad.js → 164.bundle.e30009bee13acb6967da.js} +217 -260
  5. package/dist/{211.bundle.00af31ef3a558ab871d7.js → 211.bundle.9b5c28787d753e75007a.js} +1 -1
  6. package/dist/{236.bundle.ed0702d760569f060757.js → 236.bundle.a7e2f9e0cb3668fb6937.js} +29 -78
  7. package/dist/{370.bundle.6b8d3e94eef8e83ced67.js → 370.bundle.26738a863fd92e6b0d96.js} +4 -4
  8. package/dist/{501.bundle.f6641d4f50c6f8c54b6a.js → 501.bundle.de519580f8ba42802378.js} +128 -134
  9. package/dist/{822.bundle.1f629123cfe2f9df861d.js → 822.bundle.b3917579472530774dae.js} +2 -2
  10. package/dist/{367.bundle.498dd1c427fcbfb437e1.js → 914.bundle.2b3a856b7d41ac8298e6.js} +231 -243
  11. package/dist/{app.bundle.02add375b2062b5fdbc6.js → app.bundle.062cc78f47b0381a524f.js} +118 -125
  12. package/dist/app.bundle.css +1 -1
  13. package/dist/cornerstoneDICOMImageLoader.min.js +1 -1
  14. package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -1
  15. package/dist/index.html +1 -1
  16. package/dist/{polySeg.bundle.0b510b43f66f641bb68a.js → polySeg.bundle.9534be8b9625c55d433f.js} +1 -1
  17. package/dist/{suv-peak-worker.bundle.42afdd68a04bee2d0f4e.js → suv-peak-worker.bundle.2fc8f559d02ec7f11f6f.js} +3 -3
  18. package/dist/sw.js +1 -1
  19. package/package.json +19 -19
  20. /package/dist/{14.bundle.9b4d14b25846a32a3f92.js → 14.bundle.74ed51e9f23d30c4756e.js} +0 -0
  21. /package/dist/{140.bundle.8bf87e14b2f8a73c0808.js → 140.bundle.9aa4277ae364d4e6b2a1.js} +0 -0
  22. /package/dist/{194.bundle.a48813c253355c084c4f.js → 194.bundle.0bca18315d222b64e3b9.js} +0 -0
  23. /package/dist/{218.bundle.a759b880ba04ab0a245c.js → 218.bundle.4592ee9c04814588649d.js} +0 -0
  24. /package/dist/{363.bundle.fde0de340488759cbb08.js → 363.bundle.6954b6f7e53d137064f1.js} +0 -0
  25. /package/dist/{382.bundle.43ffd547a510e627ecb9.js → 382.bundle.753e1c9ba917db172277.js} +0 -0
  26. /package/dist/{444.bundle.a73ab0a4184585ec4f39.js → 444.bundle.c86bb3056afa4a0edd82.js} +0 -0
  27. /package/dist/{552.bundle.82767ceab03497a4c45b.js → 552.bundle.a6e956a4800ec55a56ae.js} +0 -0
  28. /package/dist/{555.bundle.0ffcf54e8f5a2871709f.js → 555.bundle.766276c23e5c7a412e42.js} +0 -0
  29. /package/dist/{717.bundle.613012c8a7150a0decd0.js → 717.bundle.ed7b18342e965b920fb1.js} +0 -0
  30. /package/dist/{799.bundle.4c98fd946d302e8271d6.js → 799.bundle.aeb9132578b347fd0284.js} +0 -0
  31. /package/dist/{806.bundle.f0371b477bf9f5a59650.js → 806.bundle.6b3d7374d0be70fde3bd.js} +0 -0
  32. /package/dist/{853.bundle.49c38ba82f8927866f55.js → 853.bundle.f8aceb7b8564c835977c.js} +0 -0
  33. /package/dist/{920.bundle.71d43ce3953964226c3b.js → 920.bundle.06732ab57daae8b1df11.js} +0 -0
  34. /package/dist/{989.bundle.5f3a4719f128f4a6e599.js → 989.bundle.b88ebd5f4aa5afe2dfd6.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[367],{
2
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[914],{
3
3
 
4
4
  /***/ 52454:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -991,81 +991,6 @@ function removeContourSegmentationAnnotation(annotation) {
991
991
  }
992
992
 
993
993
 
994
- /***/ }),
995
-
996
- /***/ 93712:
997
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
998
-
999
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1000
- /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
1001
- /* harmony export */ });
1002
- /* harmony import */ var _RectangleROIStartEndThreshold__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69405);
1003
-
1004
- function validateAnnotation(annotation) {
1005
- if (!annotation?.data) {
1006
- throw new Error('Tool data is empty');
1007
- }
1008
- if (!annotation.metadata || annotation.metadata.referenceImageId) {
1009
- throw new Error('Tool data is not associated with any imageId');
1010
- }
1011
- }
1012
- class AnnotationToPointData {
1013
- constructor() {
1014
- }
1015
- static { this.TOOL_NAMES = {}; }
1016
- static convert(annotation, index, metadataProvider) {
1017
- validateAnnotation(annotation);
1018
- const { toolName } = annotation.metadata;
1019
- const toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
1020
- if (!toolClass) {
1021
- throw new Error(`Unknown tool type: ${toolName}, cannot convert to RTSSReport`);
1022
- }
1023
- const ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
1024
- const color = [
1025
- Math.floor(Math.random() * 255),
1026
- Math.floor(Math.random() * 255),
1027
- Math.floor(Math.random() * 255),
1028
- ];
1029
- return {
1030
- ReferencedROINumber: index + 1,
1031
- ROIDisplayColor: color,
1032
- ContourSequence,
1033
- };
1034
- }
1035
- static register(toolClass) {
1036
- AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
1037
- }
1038
- }
1039
- AnnotationToPointData.register(_RectangleROIStartEndThreshold__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A);
1040
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AnnotationToPointData);
1041
-
1042
-
1043
- /***/ }),
1044
-
1045
- /***/ 14633:
1046
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1047
-
1048
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1049
- /* harmony export */ A: () => (/* binding */ areCoplanarContours)
1050
- /* harmony export */ });
1051
- /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44753);
1052
-
1053
- function areCoplanarContours(firstAnnotation, secondAnnotation) {
1054
- const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
1055
- const { viewPlaneNormal: secondViewPlaneNormal } = secondAnnotation.metadata;
1056
- const dot = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(firstViewPlaneNormal, secondViewPlaneNormal);
1057
- const parallelPlanes = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .glMatrix.equals */ .Fd.equals(1, Math.abs(dot));
1058
- if (!parallelPlanes) {
1059
- return false;
1060
- }
1061
- const { polyline: firstPolyline } = firstAnnotation.data.contour;
1062
- const { polyline: secondPolyline } = secondAnnotation.data.contour;
1063
- const firstDistance = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(firstViewPlaneNormal, firstPolyline[0]);
1064
- const secondDistance = gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .vec3.dot */ .eR.dot(firstViewPlaneNormal, secondPolyline[0]);
1065
- return gl_matrix__WEBPACK_IMPORTED_MODULE_0__/* .glMatrix.equals */ .Fd.equals(firstDistance, secondDistance);
1066
- }
1067
-
1068
-
1069
994
  /***/ }),
1070
995
 
1071
996
  /***/ 53891:
@@ -1094,14 +1019,92 @@ function calculatePerimeter(polyline, closed) {
1094
1019
 
1095
1020
  /***/ }),
1096
1021
 
1097
- /***/ 11716:
1022
+ /***/ 84045:
1098
1023
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1099
1024
 
1100
1025
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1101
- /* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
1102
- /* harmony export */ d1: () => (/* binding */ findContoursFromReducedSet)
1026
+ /* harmony export */ A: () => (/* binding */ findHandlePolylineIndex)
1103
1027
  /* harmony export */ });
1104
- /* unused harmony export findContours */
1028
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
1029
+ /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44753);
1030
+
1031
+
1032
+ const { isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
1033
+ function findHandlePolylineIndex(annotation, handleIndex) {
1034
+ const { polyline } = annotation.data.contour;
1035
+ const { points } = annotation.data.handles;
1036
+ const { length } = points;
1037
+ if (handleIndex === length) {
1038
+ return polyline.length;
1039
+ }
1040
+ if (handleIndex < 0) {
1041
+ handleIndex = (handleIndex + length) % length;
1042
+ }
1043
+ if (handleIndex === 0) {
1044
+ return 0;
1045
+ }
1046
+ const handle = points[handleIndex];
1047
+ const index = polyline.findIndex((point) => isEqual(handle, point));
1048
+ if (index !== -1) {
1049
+ return index;
1050
+ }
1051
+ let closestDistance = Infinity;
1052
+ return polyline.reduce((closestIndex, point, testIndex) => {
1053
+ const distance = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.squaredDistance */ .eR.squaredDistance(point, handle);
1054
+ if (distance < closestDistance) {
1055
+ closestDistance = distance;
1056
+ return testIndex;
1057
+ }
1058
+ return closestIndex;
1059
+ }, -1);
1060
+ }
1061
+
1062
+
1063
+ /***/ }),
1064
+
1065
+ /***/ 75908:
1066
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1067
+
1068
+ // ESM COMPAT FLAG
1069
+ __webpack_require__.r(__webpack_exports__);
1070
+
1071
+ // EXPORTS
1072
+ __webpack_require__.d(__webpack_exports__, {
1073
+ AnnotationToPointData: () => (/* reexport */ contours_AnnotationToPointData),
1074
+ acceptAutogeneratedInterpolations: () => (/* reexport */ acceptAutogeneratedInterpolations),
1075
+ areCoplanarContours: () => (/* reexport */ areCoplanarContours),
1076
+ calculatePerimeter: () => (/* reexport */ calculatePerimeter/* default */.A),
1077
+ contourFinder: () => (/* reexport */ contourFinder),
1078
+ detectContourHoles: () => (/* reexport */ detectContourHoles),
1079
+ findHandlePolylineIndex: () => (/* reexport */ findHandlePolylineIndex/* default */.A),
1080
+ generateContourSetsFromLabelmap: () => (/* reexport */ generateContourSetsFromLabelmap),
1081
+ getContourHolesDataCanvas: () => (/* reexport */ getContourHolesDataCanvas),
1082
+ getContourHolesDataWorld: () => (/* reexport */ getContourHolesDataWorld),
1083
+ getDeduplicatedVTKPolyDataPoints: () => (/* reexport */ getDeduplicatedVTKPolyDataPoints),
1084
+ interpolation: () => (/* reexport */ interpolation),
1085
+ updateContourPolyline: () => (/* reexport */ updateContourPolyline/* default */.A)
1086
+ });
1087
+
1088
+ // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules
1089
+ var esm = __webpack_require__(44753);
1090
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/areCoplanarContours.js
1091
+
1092
+ function areCoplanarContours(firstAnnotation, secondAnnotation) {
1093
+ const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
1094
+ const { viewPlaneNormal: secondViewPlaneNormal } = secondAnnotation.metadata;
1095
+ const dot = esm/* vec3.dot */.eR.dot(firstViewPlaneNormal, secondViewPlaneNormal);
1096
+ const parallelPlanes = esm/* glMatrix.equals */.Fd.equals(1, Math.abs(dot));
1097
+ if (!parallelPlanes) {
1098
+ return false;
1099
+ }
1100
+ const { polyline: firstPolyline } = firstAnnotation.data.contour;
1101
+ const { polyline: secondPolyline } = secondAnnotation.data.contour;
1102
+ const firstDistance = esm/* vec3.dot */.eR.dot(firstViewPlaneNormal, firstPolyline[0]);
1103
+ const secondDistance = esm/* vec3.dot */.eR.dot(firstViewPlaneNormal, secondPolyline[0]);
1104
+ return esm/* glMatrix.equals */.Fd.equals(firstDistance, secondDistance);
1105
+ }
1106
+
1107
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/contourFinder.js
1105
1108
  function findNextLink(line, lines, contourPoints) {
1106
1109
  let index = -1;
1107
1110
  lines.forEach((cell, i) => {
@@ -1160,21 +1163,59 @@ function findContours(lines) {
1160
1163
  function findContoursFromReducedSet(lines) {
1161
1164
  return findContours(lines);
1162
1165
  }
1163
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1166
+ /* harmony default export */ const contourFinder = ({
1164
1167
  findContours,
1165
1168
  findContoursFromReducedSet,
1166
1169
  });
1167
1170
 
1171
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js
1172
+ function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
1173
+ const points = polyData.getPoints();
1174
+ const lines = polyData.getLines();
1175
+ const pointsArray = new Array(points.getNumberOfPoints())
1176
+ .fill(0)
1177
+ .map((_, i) => points.getPoint(i).slice());
1178
+ const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
1179
+ const cell = lines.getCell(i * 3).slice();
1180
+ return { a: cell[0], b: cell[1] };
1181
+ });
1182
+ if (bypass) {
1183
+ return { points: pointsArray, lines: linesArray };
1184
+ }
1185
+ const newPoints = [];
1186
+ for (const [i, pt] of pointsArray.entries()) {
1187
+ const index = newPoints.findIndex((point) => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]);
1188
+ if (index >= 0) {
1189
+ linesArray.map((line) => {
1190
+ if (line.a === i) {
1191
+ line.a = index;
1192
+ }
1193
+ if (line.b === i) {
1194
+ line.b = index;
1195
+ }
1196
+ return line;
1197
+ });
1198
+ }
1199
+ else {
1200
+ const newIndex = newPoints.length;
1201
+ newPoints.push(pt);
1202
+ linesArray.map((line) => {
1203
+ if (line.a === i) {
1204
+ line.a = newIndex;
1205
+ }
1206
+ if (line.b === i) {
1207
+ line.b = newIndex;
1208
+ }
1209
+ return line;
1210
+ });
1211
+ }
1212
+ }
1213
+ const newLines = linesArray.filter((line) => line.a !== line.b);
1214
+ return { points: newPoints, lines: newLines };
1215
+ }
1216
+ /* harmony default export */ const contours_getDeduplicatedVTKPolyDataPoints = ({ getDeduplicatedVTKPolyDataPoints });
1168
1217
 
1169
- /***/ }),
1170
-
1171
- /***/ 92806:
1172
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1173
-
1174
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1175
- /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
1176
- /* harmony export */ });
1177
- /* unused harmony export processContourHoles */
1218
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/detectContourHoles.js
1178
1219
  const getIsPointInsidePolygon = (point, vertices) => {
1179
1220
  const x = point[0];
1180
1221
  const y = point[1];
@@ -1247,67 +1288,19 @@ function processContourHoles(contours, points, useXOR = true) {
1247
1288
  }
1248
1289
  return retContours;
1249
1290
  }
1250
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ processContourHoles });
1251
-
1252
-
1253
- /***/ }),
1254
-
1255
- /***/ 84045:
1256
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1257
-
1258
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1259
- /* harmony export */ A: () => (/* binding */ findHandlePolylineIndex)
1260
- /* harmony export */ });
1261
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
1262
- /* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44753);
1263
-
1291
+ /* harmony default export */ const detectContourHoles = ({ processContourHoles });
1264
1292
 
1265
- const { isEqual } = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.utilities;
1266
- function findHandlePolylineIndex(annotation, handleIndex) {
1267
- const { polyline } = annotation.data.contour;
1268
- const { points } = annotation.data.handles;
1269
- const { length } = points;
1270
- if (handleIndex === length) {
1271
- return polyline.length;
1272
- }
1273
- if (handleIndex < 0) {
1274
- handleIndex = (handleIndex + length) % length;
1275
- }
1276
- if (handleIndex === 0) {
1277
- return 0;
1278
- }
1279
- const handle = points[handleIndex];
1280
- const index = polyline.findIndex((point) => isEqual(handle, point));
1281
- if (index !== -1) {
1282
- return index;
1283
- }
1284
- let closestDistance = Infinity;
1285
- return polyline.reduce((closestIndex, point, testIndex) => {
1286
- const distance = gl_matrix__WEBPACK_IMPORTED_MODULE_1__/* .vec3.squaredDistance */ .eR.squaredDistance(point, handle);
1287
- if (distance < closestDistance) {
1288
- closestDistance = distance;
1289
- return testIndex;
1290
- }
1291
- return closestIndex;
1292
- }, -1);
1293
- }
1294
-
1295
-
1296
- /***/ }),
1297
-
1298
- /***/ 36392:
1299
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1300
-
1301
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1302
- /* harmony export */ d: () => (/* binding */ generateContourSetsFromLabelmap)
1303
- /* harmony export */ });
1304
- /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
1305
- /* harmony import */ var _kitware_vtk_js_Filters_General_ImageMarchingSquares__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52754);
1306
- /* harmony import */ var _kitware_vtk_js_Common_Core_DataArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(45128);
1307
- /* harmony import */ var _kitware_vtk_js_Common_DataModel_ImageData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51250);
1308
- /* harmony import */ var _contours__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(75534);
1309
- /* harmony import */ var _contourFinder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11716);
1310
- /* harmony import */ var _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(83946);
1293
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 28 modules
1294
+ var dist_esm = __webpack_require__(92136);
1295
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/ImageMarchingSquares.js
1296
+ var ImageMarchingSquares = __webpack_require__(52754);
1297
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray.js
1298
+ var DataArray = __webpack_require__(45128);
1299
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/ImageData.js
1300
+ var ImageData = __webpack_require__(51250);
1301
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations.js
1302
+ var SegmentationRepresentations = __webpack_require__(83946);
1303
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js
1311
1304
 
1312
1305
 
1313
1306
 
@@ -1315,11 +1308,11 @@ function findHandlePolylineIndex(annotation, handleIndex) {
1315
1308
 
1316
1309
 
1317
1310
 
1318
- const { Labelmap } = _enums_SegmentationRepresentations__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A;
1311
+ const { Labelmap } = SegmentationRepresentations/* default */.A;
1319
1312
  function generateContourSetsFromLabelmap({ segmentations }) {
1320
1313
  const { representationData, segments = [0, 1] } = segmentations;
1321
1314
  const { volumeId: segVolumeId } = representationData[Labelmap];
1322
- const vol = _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.cache.getVolume(segVolumeId);
1315
+ const vol = dist_esm.cache.getVolume(segVolumeId);
1323
1316
  if (!vol) {
1324
1317
  console.warn(`No volume found for ${segVolumeId}`);
1325
1318
  return;
@@ -1343,7 +1336,7 @@ function generateContourSetsFromLabelmap({ segmentations }) {
1343
1336
  continue;
1344
1337
  }
1345
1338
  const sliceContours = [];
1346
- const scalars = _kitware_vtk_js_Common_Core_DataArray__WEBPACK_IMPORTED_MODULE_2__/* ["default"].newInstance */ .Ay.newInstance({
1339
+ const scalars = DataArray/* default.newInstance */.Ay.newInstance({
1347
1340
  name: 'Scalars',
1348
1341
  numberOfComponents: 1,
1349
1342
  size: pixelsPerSlice * numSlices,
@@ -1365,10 +1358,10 @@ function generateContourSetsFromLabelmap({ segmentations }) {
1365
1358
  scalars.setValue(i, 0);
1366
1359
  }
1367
1360
  }
1368
- const mSquares = _kitware_vtk_js_Filters_General_ImageMarchingSquares__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance({
1361
+ const mSquares = ImageMarchingSquares/* default.newInstance */.Ay.newInstance({
1369
1362
  slice: sliceIndex,
1370
1363
  });
1371
- const imageDataCopy = _kitware_vtk_js_Common_DataModel_ImageData__WEBPACK_IMPORTED_MODULE_3__/* ["default"].newInstance */ .Ay.newInstance();
1364
+ const imageDataCopy = ImageData/* default.newInstance */.Ay.newInstance();
1372
1365
  imageDataCopy.shallowCopy(vol.imageData);
1373
1366
  imageDataCopy.getPointData().setScalars(scalars);
1374
1367
  mSquares.setInputData(imageDataCopy);
@@ -1376,9 +1369,9 @@ function generateContourSetsFromLabelmap({ segmentations }) {
1376
1369
  mSquares.setContourValues(cValues);
1377
1370
  mSquares.setMergePoints(false);
1378
1371
  const msOutput = mSquares.getOutputData();
1379
- const reducedSet = (0,_contours__WEBPACK_IMPORTED_MODULE_4__.getDeduplicatedVTKPolyDataPoints)(msOutput);
1372
+ const reducedSet = getDeduplicatedVTKPolyDataPoints(msOutput);
1380
1373
  if (reducedSet.points?.length) {
1381
- const contours = (0,_contourFinder__WEBPACK_IMPORTED_MODULE_5__/* .findContoursFromReducedSet */ .d1)(reducedSet.lines);
1374
+ const contours = findContoursFromReducedSet(reducedSet.lines);
1382
1375
  sliceContours.push({
1383
1376
  contours,
1384
1377
  polyData: reducedSet,
@@ -1418,19 +1411,61 @@ function isSliceEmptyForSegment(sliceIndex, segData, pixelsPerSlice, segIndex) {
1418
1411
  }
1419
1412
 
1420
1413
 
1414
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/RectangleROIStartEndThreshold.js
1415
+ var RectangleROIStartEndThreshold = __webpack_require__(69405);
1416
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/AnnotationToPointData.js
1421
1417
 
1422
- /***/ }),
1418
+ function validateAnnotation(annotation) {
1419
+ if (!annotation?.data) {
1420
+ throw new Error('Tool data is empty');
1421
+ }
1422
+ if (!annotation.metadata || annotation.metadata.referenceImageId) {
1423
+ throw new Error('Tool data is not associated with any imageId');
1424
+ }
1425
+ }
1426
+ class AnnotationToPointData {
1427
+ constructor() {
1428
+ }
1429
+ static { this.TOOL_NAMES = {}; }
1430
+ static convert(annotation, index, metadataProvider) {
1431
+ validateAnnotation(annotation);
1432
+ const { toolName } = annotation.metadata;
1433
+ const toolClass = AnnotationToPointData.TOOL_NAMES[toolName];
1434
+ if (!toolClass) {
1435
+ throw new Error(`Unknown tool type: ${toolName}, cannot convert to RTSSReport`);
1436
+ }
1437
+ const ContourSequence = toolClass.getContourSequence(annotation, metadataProvider);
1438
+ const color = [
1439
+ Math.floor(Math.random() * 255),
1440
+ Math.floor(Math.random() * 255),
1441
+ Math.floor(Math.random() * 255),
1442
+ ];
1443
+ return {
1444
+ ReferencedROINumber: index + 1,
1445
+ ROIDisplayColor: color,
1446
+ ContourSequence,
1447
+ };
1448
+ }
1449
+ static register(toolClass) {
1450
+ AnnotationToPointData.TOOL_NAMES[toolClass.toolName] = toolClass;
1451
+ }
1452
+ }
1453
+ AnnotationToPointData.register(RectangleROIStartEndThreshold/* default */.A);
1454
+ /* harmony default export */ const contours_AnnotationToPointData = (AnnotationToPointData);
1423
1455
 
1424
- /***/ 88267:
1425
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1456
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/index.js
1457
+ var stateManagement = __webpack_require__(95778);
1458
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getContourHolesDataWorld.js
1426
1459
 
1427
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1428
- /* harmony export */ A: () => (/* binding */ getContourHolesDataCanvas)
1429
- /* harmony export */ });
1430
- /* harmony import */ var _getContourHolesDataWorld__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(98043);
1460
+ function getContourHolesDataWorld(annotation) {
1461
+ const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
1462
+ return childAnnotationUIDs.map((uid) => (0,stateManagement/* getAnnotation */.gw)(uid).data.contour.polyline);
1463
+ }
1464
+
1465
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/getContourHolesDataCanvas.js
1431
1466
 
1432
1467
  function getContourHolesDataCanvas(annotation, viewport) {
1433
- const worldHoleContours = (0,_getContourHolesDataWorld__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(annotation);
1468
+ const worldHoleContours = getContourHolesDataWorld(annotation);
1434
1469
  const canvasHoleContours = [];
1435
1470
  worldHoleContours.forEach((worldHoleContour) => {
1436
1471
  const numPoints = worldHoleContour.length;
@@ -1443,91 +1478,37 @@ function getContourHolesDataCanvas(annotation, viewport) {
1443
1478
  return canvasHoleContours;
1444
1479
  }
1445
1480
 
1481
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/updateContourPolyline.js
1482
+ var updateContourPolyline = __webpack_require__(89111);
1483
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js
1484
+ var InterpolationManager = __webpack_require__(33836);
1485
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js
1486
+
1487
+ function acceptAutogeneratedInterpolations(annotationGroupSelector, selector) {
1488
+ InterpolationManager/* default */.A.acceptAutoGenerated(annotationGroupSelector, selector);
1489
+ }
1490
+
1491
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/interpolation/index.js
1492
+ var interpolation = __webpack_require__(69115);
1493
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/findHandlePolylineIndex.js
1494
+ var findHandlePolylineIndex = __webpack_require__(84045);
1495
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/calculatePerimeter.js
1496
+ var calculatePerimeter = __webpack_require__(53891);
1497
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js
1498
+
1446
1499
 
1447
- /***/ }),
1448
1500
 
1449
- /***/ 98043:
1450
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1451
1501
 
1452
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1453
- /* harmony export */ A: () => (/* binding */ getContourHolesDataWorld)
1454
- /* harmony export */ });
1455
- /* harmony import */ var _stateManagement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95778);
1456
1502
 
1457
- function getContourHolesDataWorld(annotation) {
1458
- const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
1459
- return childAnnotationUIDs.map((uid) => (0,_stateManagement__WEBPACK_IMPORTED_MODULE_0__/* .getAnnotation */ .gw)(uid).data.contour.polyline);
1460
- }
1461
1503
 
1462
1504
 
1463
- /***/ }),
1464
1505
 
1465
- /***/ 19866:
1466
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1467
1506
 
1468
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1469
- /* harmony export */ v: () => (/* binding */ getDeduplicatedVTKPolyDataPoints)
1470
- /* harmony export */ });
1471
- function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
1472
- const points = polyData.getPoints();
1473
- const lines = polyData.getLines();
1474
- const pointsArray = new Array(points.getNumberOfPoints())
1475
- .fill(0)
1476
- .map((_, i) => points.getPoint(i).slice());
1477
- const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
1478
- const cell = lines.getCell(i * 3).slice();
1479
- return { a: cell[0], b: cell[1] };
1480
- });
1481
- if (bypass) {
1482
- return { points: pointsArray, lines: linesArray };
1483
- }
1484
- const newPoints = [];
1485
- for (const [i, pt] of pointsArray.entries()) {
1486
- const index = newPoints.findIndex((point) => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]);
1487
- if (index >= 0) {
1488
- linesArray.map((line) => {
1489
- if (line.a === i) {
1490
- line.a = index;
1491
- }
1492
- if (line.b === i) {
1493
- line.b = index;
1494
- }
1495
- return line;
1496
- });
1497
- }
1498
- else {
1499
- const newIndex = newPoints.length;
1500
- newPoints.push(pt);
1501
- linesArray.map((line) => {
1502
- if (line.a === i) {
1503
- line.a = newIndex;
1504
- }
1505
- if (line.b === i) {
1506
- line.b = newIndex;
1507
- }
1508
- return line;
1509
- });
1510
- }
1511
- }
1512
- const newLines = linesArray.filter((line) => line.a !== line.b);
1513
- return { points: newPoints, lines: newLines };
1514
- }
1515
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ({ getDeduplicatedVTKPolyDataPoints });
1516
1507
 
1517
1508
 
1518
- /***/ }),
1519
1509
 
1520
- /***/ 65864:
1521
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1522
1510
 
1523
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1524
- /* harmony export */ A: () => (/* binding */ acceptAutogeneratedInterpolations)
1525
- /* harmony export */ });
1526
- /* harmony import */ var _segmentation_InterpolationManager_InterpolationManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33836);
1527
1511
 
1528
- function acceptAutogeneratedInterpolations(annotationGroupSelector, selector) {
1529
- _segmentation_InterpolationManager_InterpolationManager__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.acceptAutoGenerated(annotationGroupSelector, selector);
1530
- }
1531
1512
 
1532
1513
 
1533
1514
  /***/ }),
@@ -1559,7 +1540,7 @@ __webpack_require__.r(__webpack_exports__);
1559
1540
 
1560
1541
 
1561
1542
  function updateContourPolyline(annotation, polylineData, transforms, options) {
1562
- const { canvasToWorld } = transforms;
1543
+ const { canvasToWorld, worldToCanvas } = transforms;
1563
1544
  const { data } = annotation;
1564
1545
  const { targetWindingDirection } = polylineData;
1565
1546
  let { points: polyline } = polylineData;
@@ -1569,7 +1550,7 @@ function updateContourPolyline(annotation, polylineData, transforms, options) {
1569
1550
  let { closed } = polylineData;
1570
1551
  const numPoints = polyline.length;
1571
1552
  const polylineWorldPoints = new Array(numPoints);
1572
- const currentWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(polyline);
1553
+ const currentPolylineWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(polyline);
1573
1554
  const parentAnnotation = (0,_stateManagement__WEBPACK_IMPORTED_MODULE_2__/* .getParentAnnotation */ .Ay)(annotation);
1574
1555
  if (closed === undefined) {
1575
1556
  let currentClosedState = false;
@@ -1583,11 +1564,18 @@ function updateContourPolyline(annotation, polylineData, transforms, options) {
1583
1564
  ? parentAnnotation.data.contour.windingDirection * -1
1584
1565
  : targetWindingDirection;
1585
1566
  if (windingDirection === undefined) {
1586
- windingDirection = currentWindingDirection;
1567
+ windingDirection = currentPolylineWindingDirection;
1587
1568
  }
1588
- else if (windingDirection !== currentWindingDirection) {
1569
+ if (windingDirection !== currentPolylineWindingDirection) {
1589
1570
  polyline.reverse();
1590
1571
  }
1572
+ const handlePoints = data.handles.points.map((p) => worldToCanvas(p));
1573
+ if (handlePoints.length > 2) {
1574
+ const currentHandlesWindingDirection = _math__WEBPACK_IMPORTED_MODULE_1__.polyline.getWindingDirection(handlePoints);
1575
+ if (currentHandlesWindingDirection !== windingDirection) {
1576
+ data.handles.points.reverse();
1577
+ }
1578
+ }
1591
1579
  for (let i = 0; i < numPoints; i++) {
1592
1580
  polylineWorldPoints[i] = canvasToWorld(polyline[i]);
1593
1581
  }
@@ -4610,8 +4598,8 @@ __webpack_require__.d(__webpack_exports__, {
4610
4598
  A: () => (/* binding */ contourAndFindLargestBidirectional)
4611
4599
  });
4612
4600
 
4613
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js
4614
- var utilities_contours = __webpack_require__(75534);
4601
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contours/index.js + 9 modules
4602
+ var utilities_contours = __webpack_require__(75908);
4615
4603
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations.js
4616
4604
  var SegmentationRepresentations = __webpack_require__(83946);
4617
4605
  // EXTERNAL MODULE: ../../../node_modules/gl-matrix/esm/index.js + 1 modules