@ohif/app 3.8.0 → 3.9.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{117.bundle.77cc4e62d0de5d843e2e.js → 117.bundle.a80b1511ef4b302fb7cc.js} +10 -12
  2. package/dist/{164.bundle.b101cb64d04a22453984.js → 164.bundle.1da1cadb56951caef1d6.js} +9 -13
  3. package/dist/{206.bundle.e1ea316389b21006d3df.js → 206.bundle.87e4481bb6a89230b7cf.js} +2 -2
  4. package/dist/{236.bundle.f774cdc955890e6cdac9.js → 236.bundle.4ca7987e1d57f60ec13a.js} +326 -5
  5. package/dist/{416.bundle.9b0d7559344fd02c9e08.js → 35.bundle.0168d78bfad0cb784112.js} +378 -45
  6. package/dist/{203.bundle.3581da3a32a0b720d3a7.js → 806.bundle.50e039eb624382ee1fce.js} +538 -450
  7. package/dist/{889.bundle.b6231f995fd098f7e3f9.js → 889.bundle.89437e456d399b69abfd.js} +1 -1
  8. package/dist/{app.bundle.a05edb830ad2ecd67aac.js → app.bundle.0c97d14d514173bc9fab.js} +77 -61
  9. package/dist/index.html +1 -1
  10. package/dist/{polySeg.bundle.4442dd3318266fddf4d0.js → polySeg.bundle.1799686b019040500219.js} +3 -3
  11. package/dist/{suv-peak-worker.bundle.348c016f7f973d05f2d2.js → suv-peak-worker.bundle.25f8b85eab9ec06da48d.js} +3 -3
  12. package/dist/sw.js +1 -1
  13. package/package.json +18 -18
  14. /package/dist/{188.bundle.f2b81ec70ae344f57183.js → 188.bundle.64cbb89e31abbf29a023.js} +0 -0
  15. /package/dist/{321.bundle.39a76114e54cd9833c43.js → 321.bundle.f32564ab711ebc0b4e86.js} +0 -0
  16. /package/dist/{325.bundle.5012b0285b6baadd1884.js → 325.bundle.fee9192f88d50d6ce342.js} +0 -0
  17. /package/dist/{342.bundle.36ee082163b01284eeba.js → 342.bundle.340982440de15f540a89.js} +0 -0
  18. /package/dist/{41.bundle.64e0da470e235cfac4bb.js → 41.bundle.72b910ddbbd70b2f4c98.js} +0 -0
  19. /package/dist/{448.bundle.35b8f8e262fa954026df.js → 448.bundle.75e67836d79e932aa18c.js} +0 -0
  20. /package/dist/{473.bundle.11f707c8170ade2eb56a.js → 473.bundle.6cd4be953853f35b29c3.js} +0 -0
  21. /package/dist/{483.bundle.581b242d7b90866fdfb9.js → 483.bundle.a353efc5a5dd563c903c.js} +0 -0
  22. /package/dist/{487.bundle.79aff4db7df5f383b423.js → 487.bundle.fa9fc23fc410e1fa2efd.js} +0 -0
  23. /package/dist/{544.bundle.3542927ec15c3f688c8d.js → 544.bundle.b005b8c8b9b08aaa3324.js} +0 -0
  24. /package/dist/{574.bundle.4b059c95cd34efdc9cb3.js → 574.bundle.8b2767c9b74fa0c9b04b.js} +0 -0
  25. /package/dist/{594.bundle.c292423defd9581bfbe3.js → 594.bundle.64b244e7dcfd3d6c8984.js} +0 -0
  26. /package/dist/{633.bundle.e258ba4843985e67336a.js → 633.bundle.e2b7f645729f12ba0d78.js} +0 -0
  27. /package/dist/{669.bundle.64309c677c5ca188348c.js → 669.bundle.03a5bd6ba84103d03fdd.js} +0 -0
  28. /package/dist/{699.bundle.b9666b1d4ddf7e8577ee.js → 699.bundle.b50bfe586c0064d6fe8a.js} +0 -0
  29. /package/dist/{7.bundle.94692aed50fe4ba2e2f5.js → 7.bundle.9c9caceecb366e3233ca.js} +0 -0
  30. /package/dist/{722.bundle.52eb61926d08a08793fe.js → 722.bundle.2547630541b670f10d6e.js} +0 -0
  31. /package/dist/{724.bundle.72aef9dfca69ae057d37.js → 724.bundle.c5b6e5542a4668715b33.js} +0 -0
  32. /package/dist/{783.bundle.11d774eb13ffc74cdca5.js → 783.bundle.2e302abe4156a13530f8.js} +0 -0
  33. /package/dist/{862.bundle.9897a9b748078d53f9ab.js → 862.bundle.4a0bd82b803ba158018f.js} +0 -0
  34. /package/dist/{905.bundle.cd3e2b347340dd47a1b0.js → 905.bundle.7017e78259e57eda8915.js} +0 -0
  35. /package/dist/{907.bundle.723a425dedf8147243d2.js → 907.bundle.6695db6c5f1906d48b81.js} +0 -0
  36. /package/dist/{94.bundle.33ca3bc10aa42716dbbb.js → 94.bundle.8411670658df7253a77a.js} +0 -0
  37. /package/dist/{961.bundle.2c4663737c970764a41e.js → 961.bundle.4aa46c7f78124df1a7cb.js} +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[203],{
1
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[806],{
2
2
 
3
3
  /***/ 93858:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -2511,6 +2511,128 @@ class AdvancedMagnifyViewportManager {
2511
2511
 
2512
2512
 
2513
2513
 
2514
+ /***/ }),
2515
+
2516
+ /***/ 16639:
2517
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2518
+
2519
+ "use strict";
2520
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2521
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
2522
+ /* harmony export */ });
2523
+ /* harmony import */ var _cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92136);
2524
+ /* harmony import */ var _distancePointToContour__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7783);
2525
+ /* harmony import */ var _drawingSvg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2746);
2526
+ /* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73047);
2527
+
2528
+
2529
+
2530
+
2531
+ class CircleSculptCursor {
2532
+ constructor() {
2533
+ this.toolInfo = {
2534
+ toolSize: null,
2535
+ maxToolSize: null,
2536
+ };
2537
+ }
2538
+ static { this.shapeName = 'Circle'; }
2539
+ renderShape(svgDrawingHelper, canvasLocation, options) {
2540
+ const circleUID = '0';
2541
+ (0,_drawingSvg__WEBPACK_IMPORTED_MODULE_2__.drawCircle)(svgDrawingHelper, 'SculptorTool', circleUID, canvasLocation, this.toolInfo.toolSize, options);
2542
+ }
2543
+ pushHandles(viewport, sculptData) {
2544
+ const { points, mouseCanvasPoint } = sculptData;
2545
+ const pushedHandles = { first: undefined, last: undefined };
2546
+ for (let i = 0; i < points.length; i++) {
2547
+ const handleCanvasPoint = viewport.worldToCanvas(points[i]);
2548
+ const distanceToHandle = _utilities_math__WEBPACK_IMPORTED_MODULE_3__.point.distanceToPoint(handleCanvasPoint, mouseCanvasPoint);
2549
+ if (distanceToHandle > this.toolInfo.toolSize) {
2550
+ continue;
2551
+ }
2552
+ this.pushOneHandle(i, distanceToHandle, sculptData);
2553
+ if (pushedHandles.first === undefined) {
2554
+ pushedHandles.first = i;
2555
+ pushedHandles.last = i;
2556
+ }
2557
+ else {
2558
+ pushedHandles.last = i;
2559
+ }
2560
+ }
2561
+ return pushedHandles;
2562
+ }
2563
+ configureToolSize(evt) {
2564
+ const toolInfo = this.toolInfo;
2565
+ if (toolInfo.toolSize && toolInfo.maxToolSize) {
2566
+ return;
2567
+ }
2568
+ const eventData = evt.detail;
2569
+ const element = eventData.element;
2570
+ const minDim = Math.min(element.clientWidth, element.clientHeight);
2571
+ const maxRadius = minDim / 12;
2572
+ toolInfo.toolSize = maxRadius;
2573
+ toolInfo.maxToolSize = maxRadius;
2574
+ }
2575
+ updateToolSize(canvasCoords, viewport, activeAnnotation) {
2576
+ const toolInfo = this.toolInfo;
2577
+ const radius = (0,_distancePointToContour__WEBPACK_IMPORTED_MODULE_1__/* .distancePointToContour */ .X)(viewport, activeAnnotation, canvasCoords);
2578
+ if (radius > 0) {
2579
+ toolInfo.toolSize = Math.min(toolInfo.maxToolSize, radius);
2580
+ }
2581
+ }
2582
+ getMaxSpacing(minSpacing) {
2583
+ return Math.max(this.toolInfo.toolSize / 4, minSpacing);
2584
+ }
2585
+ getInsertPosition(previousIndex, nextIndex, sculptData) {
2586
+ let insertPosition;
2587
+ const { points, element, mouseCanvasPoint } = sculptData;
2588
+ const toolSize = this.toolInfo.toolSize;
2589
+ const enabledElement = (0,_cornerstonejs_core__WEBPACK_IMPORTED_MODULE_0__.getEnabledElement)(element);
2590
+ const { viewport } = enabledElement;
2591
+ const previousCanvasPoint = viewport.worldToCanvas(points[previousIndex]);
2592
+ const nextCanvasPoint = viewport.worldToCanvas(points[nextIndex]);
2593
+ const midPoint = [
2594
+ (previousCanvasPoint[0] + nextCanvasPoint[0]) / 2.0,
2595
+ (previousCanvasPoint[1] + nextCanvasPoint[1]) / 2.0,
2596
+ ];
2597
+ const distanceToMidPoint = _utilities_math__WEBPACK_IMPORTED_MODULE_3__.point.distanceToPoint(mouseCanvasPoint, midPoint);
2598
+ if (distanceToMidPoint < toolSize) {
2599
+ const directionUnitVector = {
2600
+ x: (midPoint[0] - mouseCanvasPoint[0]) / distanceToMidPoint,
2601
+ y: (midPoint[1] - mouseCanvasPoint[1]) / distanceToMidPoint,
2602
+ };
2603
+ insertPosition = [
2604
+ mouseCanvasPoint[0] + toolSize * directionUnitVector.x,
2605
+ mouseCanvasPoint[1] + toolSize * directionUnitVector.y,
2606
+ ];
2607
+ }
2608
+ else {
2609
+ insertPosition = midPoint;
2610
+ }
2611
+ const worldPosition = viewport.canvasToWorld(insertPosition);
2612
+ return worldPosition;
2613
+ }
2614
+ pushOneHandle(i, distanceToHandle, sculptData) {
2615
+ const { points, mousePoint } = sculptData;
2616
+ const toolSize = this.toolInfo.toolSize;
2617
+ const handle = points[i];
2618
+ const directionUnitVector = {
2619
+ x: (handle[0] - mousePoint[0]) / distanceToHandle,
2620
+ y: (handle[1] - mousePoint[1]) / distanceToHandle,
2621
+ z: (handle[2] - mousePoint[2]) / distanceToHandle,
2622
+ };
2623
+ const position = {
2624
+ x: mousePoint[0] + toolSize * directionUnitVector.x,
2625
+ y: mousePoint[1] + toolSize * directionUnitVector.y,
2626
+ z: mousePoint[2] + toolSize * directionUnitVector.z,
2627
+ };
2628
+ handle[0] = position.x;
2629
+ handle[1] = position.y;
2630
+ handle[2] = position.z;
2631
+ }
2632
+ }
2633
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CircleSculptCursor);
2634
+
2635
+
2514
2636
  /***/ }),
2515
2637
 
2516
2638
  /***/ 30911:
@@ -4956,7 +5078,7 @@ class ContourSegmentationBaseTool extends ContourBaseTool {
4956
5078
  const defaultContourConfig = {
4957
5079
  renderOutline: true,
4958
5080
  outlineWidthAutoGenerated: 3,
4959
- outlineWidthActive: 2,
5081
+ outlineWidthActive: 1,
4960
5082
  outlineWidthInactive: 1,
4961
5083
  outlineOpacity: 1,
4962
5084
  outlineOpacityInactive: 0.85,
@@ -4964,7 +5086,7 @@ const defaultContourConfig = {
4964
5086
  outlineDashInactive: undefined,
4965
5087
  outlineDashAutoGenerated: '5,3',
4966
5088
  activeSegmentOutlineWidthDelta: 0,
4967
- renderFill: true,
5089
+ renderFill: false,
4968
5090
  fillAlpha: 0.5,
4969
5091
  fillAlphaInactive: 0.3,
4970
5092
  fillAlphaAutoGenerated: 0.3,
@@ -4977,7 +5099,7 @@ function getDefaultContourConfig() {
4977
5099
 
4978
5100
  /***/ }),
4979
5101
 
4980
- /***/ 69714:
5102
+ /***/ 57784:
4981
5103
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4982
5104
 
4983
5105
  "use strict";
@@ -4995,21 +5117,45 @@ var SegmentationRepresentations = __webpack_require__(83946);
4995
5117
  var segmentationState = __webpack_require__(30322);
4996
5118
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/store/ToolGroupManager/index.js
4997
5119
  var ToolGroupManager = __webpack_require__(52610);
4998
- // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray.js
4999
- var DataArray = __webpack_require__(45128);
5000
- // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/AppendPolyData.js
5001
- var AppendPolyData = __webpack_require__(28136);
5002
- // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Actor.js
5003
- var Actor = __webpack_require__(48987);
5004
- // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Mapper.js
5005
- var Mapper = __webpack_require__(22745);
5120
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/index.js
5121
+ var stateManagement = __webpack_require__(95778);
5122
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/removeContourFromElement.js
5123
+
5124
+
5125
+ function removeContourFromElement(segmentationRepresentationUID, toolGroupId, removeFromCache = false) {
5126
+ const segmentationRepresentation = (0,segmentationState.getSegmentationRepresentationByUID)(toolGroupId, segmentationRepresentationUID);
5127
+ const { segmentationId } = segmentationRepresentation;
5128
+ const segmentation = (0,segmentationState.getSegmentation)(segmentationId);
5129
+ const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
5130
+ annotationUIDsMap.forEach((annotationSet) => {
5131
+ annotationSet.forEach((annotationUID) => {
5132
+ (0,stateManagement/* removeAnnotation */.O8)(annotationUID);
5133
+ });
5134
+ });
5135
+ }
5136
+ /* harmony default export */ const Contour_removeContourFromElement = (removeContourFromElement);
5137
+
5138
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourHandler/contourConfigCache.js
5139
+ const configCachePerSegmentationRepresentationUID = new Map();
5140
+ function getConfigCache(segmentationRepresentationUID) {
5141
+ return configCachePerSegmentationRepresentationUID.get(segmentationRepresentationUID);
5142
+ }
5143
+ function setConfigCache(segmentationRepresentationUID, config) {
5144
+ configCachePerSegmentationRepresentationUID.set(segmentationRepresentationUID, config);
5145
+ }
5146
+ function deleteConfigCache(segmentationRepresentationUID) {
5147
+ configCachePerSegmentationRepresentationUID.delete(segmentationRepresentationUID);
5148
+ }
5149
+
5150
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/index.js + 31 modules
5151
+ var stateManagement_segmentation = __webpack_require__(63421);
5006
5152
  // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/CellArray.js
5007
5153
  var CellArray = __webpack_require__(24768);
5008
5154
  // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Points.js
5009
5155
  var Points = __webpack_require__(18310);
5010
5156
  // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 9 modules
5011
5157
  var PolyData = __webpack_require__(27398);
5012
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/vtkContour/utils.js
5158
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourHandler/utils.js
5013
5159
 
5014
5160
 
5015
5161
 
@@ -5040,15 +5186,15 @@ function validateGeometry(geometry) {
5040
5186
  }
5041
5187
  function getPolyData(contourSet) {
5042
5188
  const pointArray = [];
5043
- const points = Points/* default.newInstance */.Ay.newInstance();
5044
- const lines = CellArray/* default.newInstance */.Ay.newInstance();
5189
+ const points = vtkPoints.newInstance();
5190
+ const lines = vtkCellArray.newInstance();
5045
5191
  let pointIndex = 0;
5046
5192
  contourSet.getContours().forEach((contour) => {
5047
5193
  const pointList = contour.getPoints();
5048
5194
  const flatPoints = contour.getFlatPointsArray();
5049
5195
  const type = contour.getType();
5050
5196
  const pointIndexes = pointList.map((_, pointListIndex) => pointListIndex + pointIndex);
5051
- if (type === esm.Enums.ContourType.CLOSED_PLANAR) {
5197
+ if (type === Enums.ContourType.CLOSED_PLANAR) {
5052
5198
  pointIndexes.push(pointIndexes[0]);
5053
5199
  }
5054
5200
  const linePoints = Float32Array.from(flatPoints);
@@ -5057,116 +5203,37 @@ function getPolyData(contourSet) {
5057
5203
  pointIndex = pointIndex + pointList.length;
5058
5204
  });
5059
5205
  points.setData(pointArray, 3);
5060
- const polygon = PolyData/* default.newInstance */.Ay.newInstance();
5206
+ const polygon = vtkPolyData.newInstance();
5061
5207
  polygon.setPoints(points);
5062
5208
  polygon.setLines(lines);
5063
5209
  return polygon;
5064
5210
  }
5065
5211
 
5066
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/vtkContour/contourConfigCache.js
5067
- const configCachePerSegmentationRepresentationUID = new Map();
5068
- function getConfigCache(segmentationRepresentationUID) {
5069
- return configCachePerSegmentationRepresentationUID.get(segmentationRepresentationUID);
5070
- }
5071
- function setConfigCache(segmentationRepresentationUID, config) {
5072
- configCachePerSegmentationRepresentationUID.set(segmentationRepresentationUID, config);
5073
- }
5074
- function deleteConfigCache(segmentationRepresentationUID) {
5075
- configCachePerSegmentationRepresentationUID.delete(segmentationRepresentationUID);
5076
- }
5077
-
5078
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js
5079
-
5212
+ // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/utilities/contourSegmentation/index.js
5213
+ var contourSegmentation = __webpack_require__(7259);
5214
+ ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js
5080
5215
 
5081
5216
 
5082
5217
 
5083
5218
 
5084
5219
 
5085
5220
 
5086
- function addContourSetsToElement(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, contourActorUID) {
5087
- const { segmentationRepresentationUID, segmentsHidden } = contourRepresentation;
5088
- const appendPolyData = AppendPolyData/* default.newInstance */.Ay.newInstance();
5089
- const scalarToColorMap = new Map();
5090
- const segmentSpecificMap = new Map();
5091
- geometryIds.forEach((geometryId) => {
5092
- const geometry = esm.cache.getGeometry(geometryId);
5093
- if (!geometry) {
5094
- console.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
5095
- return;
5096
- }
5097
- const segmentIndex = geometry.data.getSegmentIndex();
5098
- validateGeometry(geometry);
5099
- const segmentSpecificConfig = getSegmentSpecificConfig(contourRepresentation, geometryId, segmentIndex);
5100
- const contourSet = geometry.data;
5101
- const polyData = getPolyData(contourSet);
5102
- const color = contourSet.getColor();
5103
- const size = polyData.getPoints().getNumberOfPoints();
5104
- const scalars = DataArray/* default.newInstance */.Ay.newInstance({
5105
- size: size * 4,
5106
- numberOfComponents: 4,
5107
- dataType: 'Uint8Array',
5108
- });
5109
- for (let i = 0; i < size; ++i) {
5110
- scalars.setTuple(i, [...color, 255]);
5111
- }
5112
- polyData.getPointData().setScalars(scalars);
5113
- if (segmentSpecificConfig) {
5114
- segmentSpecificMap.set(segmentIndex, segmentSpecificConfig);
5115
- }
5116
- scalarToColorMap.set(segmentIndex, [
5117
- ...color,
5118
- segmentsHidden.has(segmentIndex) ? 0 : 255,
5119
- ]);
5120
- segmentIndex === 0
5121
- ? appendPolyData.setInputData(polyData)
5122
- : appendPolyData.addInputData(polyData);
5123
- });
5124
- const polyDataOutput = appendPolyData.getOutputData();
5125
- const outlineWidthActive = contourRepresentationConfig.representations.CONTOUR.outlineWidthActive;
5126
- const mapper = Mapper/* default.newInstance */.Ay.newInstance();
5127
- mapper.setInputData(polyDataOutput);
5128
- const actor = Actor/* default.newInstance */.Ay.newInstance();
5129
- actor.setMapper(mapper);
5130
- actor.getProperty().setLineWidth(outlineWidthActive);
5131
- setConfigCache(segmentationRepresentationUID, Object.assign({}, getConfigCache(segmentationRepresentationUID), {
5132
- segmentsHidden: new Set(segmentsHidden),
5133
- segmentSpecificMap,
5134
- outlineWidthActive,
5135
- }));
5136
- actor.setForceOpaque(true);
5137
- viewport.addActor({
5138
- uid: contourActorUID,
5139
- actor: actor,
5140
- });
5141
- viewport.resetCamera();
5142
- viewport.render();
5221
+ function handleContourSegmentation(viewport, geometryIds, annotationUIDsMap, contourRepresentation, contourRepresentationConfig) {
5222
+ const addOrUpdateFn = annotationUIDsMap.size
5223
+ ? updateContourSets
5224
+ : addContourSetsToElement;
5225
+ addOrUpdateFn(viewport, geometryIds, contourRepresentation, contourRepresentationConfig);
5143
5226
  }
5144
-
5145
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js
5146
-
5147
-
5148
-
5149
- function updateVTKContourSets(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, contourActorUID) {
5227
+ function updateContourSets(viewport, geometryIds, contourRepresentation, contourRepresentationConfig) {
5150
5228
  const { segmentationRepresentationUID, segmentsHidden } = contourRepresentation;
5151
5229
  const newContourConfig = contourRepresentationConfig.representations.CONTOUR;
5152
5230
  const cachedConfig = getConfigCache(segmentationRepresentationUID);
5153
- const contourSetsActor = viewport.getActor(contourActorUID);
5154
- if (!contourSetsActor) {
5155
- console.warn(`No contour actor found for actorUID ${contourActorUID}. Skipping render.`);
5156
- return;
5157
- }
5158
- const { actor } = contourSetsActor;
5159
5231
  const newOutlineWithActive = newContourConfig.outlineWidthActive;
5160
5232
  if (cachedConfig?.outlineWidthActive !== newOutlineWithActive) {
5161
- actor
5162
- .getProperty()
5163
- .setLineWidth(newOutlineWithActive);
5164
5233
  setConfigCache(segmentationRepresentationUID, Object.assign({}, cachedConfig, {
5165
5234
  outlineWidthActive: newOutlineWithActive,
5166
5235
  }));
5167
5236
  }
5168
- const mapper = actor.getMapper();
5169
- const lut = mapper.getLookupTable();
5170
5237
  const segmentsToSetToInvisible = [];
5171
5238
  const segmentsToSetToVisible = [];
5172
5239
  for (const segmentIndex of segmentsHidden) {
@@ -5182,12 +5249,11 @@ function updateVTKContourSets(viewport, geometryIds, contourRepresentation, cont
5182
5249
  const mergedInvisibleSegments = Array.from(cachedConfig.segmentsHidden)
5183
5250
  .filter((segmentIndex) => !segmentsToSetToVisible.includes(segmentIndex))
5184
5251
  .concat(segmentsToSetToInvisible);
5185
- const { contourSets, segmentSpecificConfigs } = geometryIds.reduce((acc, geometryId) => {
5252
+ const { segmentSpecificConfigs } = geometryIds.reduce((acc, geometryId) => {
5186
5253
  const geometry = esm.cache.getGeometry(geometryId);
5187
5254
  const { data: contourSet } = geometry;
5188
5255
  const segmentIndex = contourSet.getSegmentIndex();
5189
5256
  const segmentSpecificConfig = getSegmentSpecificConfig(contourRepresentation, geometryId, segmentIndex);
5190
- acc.contourSets.push(contourSet);
5191
5257
  acc.segmentSpecificConfigs[segmentIndex] = segmentSpecificConfig ?? {};
5192
5258
  return acc;
5193
5259
  }, { contourSets: [], segmentSpecificConfigs: {} });
@@ -5196,72 +5262,75 @@ function updateVTKContourSets(viewport, geometryIds, contourRepresentation, cont
5196
5262
  ...segmentsToSetToVisible,
5197
5263
  ];
5198
5264
  const hasCustomSegmentSpecificConfig = Object.values(segmentSpecificConfigs).some((config) => Object.keys(config).length > 0);
5199
- let polyDataModified = false;
5200
5265
  if (affectedSegments.length || hasCustomSegmentSpecificConfig) {
5201
- const appendPolyData = mapper.getInputData();
5202
- const appendScalars = appendPolyData.getPointData().getScalars();
5203
- const appendScalarsData = appendScalars.getData();
5204
- let offset = 0;
5205
- contourSets.forEach((contourSet) => {
5206
- const segmentIndex = contourSet.getSegmentIndex();
5207
- const size = contourSet.getTotalNumberOfPoints();
5208
- if (affectedSegments.includes(segmentIndex) ||
5209
- segmentSpecificConfigs[segmentIndex]?.fillAlpha) {
5210
- const color = contourSet.getColor();
5211
- let visibility = mergedInvisibleSegments.includes(segmentIndex)
5212
- ? 0
5213
- : 255;
5214
- const segmentConfig = segmentSpecificConfigs[segmentIndex];
5215
- if (segmentConfig.fillAlpha !== undefined) {
5216
- visibility = segmentConfig.fillAlpha * 255;
5217
- }
5218
- for (let i = 0; i < size; ++i) {
5219
- appendScalarsData[offset + i * 4] = color[0];
5220
- appendScalarsData[offset + i * 4 + 1] = color[1];
5221
- appendScalarsData[offset + i * 4 + 2] = color[2];
5222
- appendScalarsData[offset + i * 4 + 3] = visibility;
5223
- }
5224
- polyDataModified = true;
5225
- }
5226
- offset = offset + size * 4;
5227
- });
5228
- if (polyDataModified) {
5229
- appendPolyData.modified();
5230
- }
5231
5266
  setConfigCache(segmentationRepresentationUID, Object.assign({}, cachedConfig, {
5232
5267
  segmentsHidden: new Set(segmentsHidden),
5233
5268
  }));
5234
- mapper.setLookupTable(lut);
5235
5269
  }
5236
5270
  viewport.render();
5237
5271
  }
5238
-
5239
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js
5240
-
5241
-
5242
- function addOrUpdateVTKContourSets(viewport, geometryIds, contourRepresentation, contourRepresentationConfig) {
5243
- const { segmentationRepresentationUID } = contourRepresentation;
5244
- const actorUID = `CONTOUR_${segmentationRepresentationUID}`;
5245
- const actor = viewport.getActor(actorUID);
5246
- const addOrUpdateFn = actor ? updateVTKContourSets : addContourSetsToElement;
5247
- addOrUpdateFn(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, actorUID);
5272
+ function addContourSetsToElement(viewport, geometryIds, contourRepresentation, contourRepresentationConfig) {
5273
+ const { segmentationRepresentationUID, segmentationId, segmentsHidden } = contourRepresentation;
5274
+ const segmentSpecificMap = new Map();
5275
+ geometryIds.forEach((geometryId) => {
5276
+ const geometry = esm.cache.getGeometry(geometryId);
5277
+ if (!geometry) {
5278
+ console.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
5279
+ return;
5280
+ }
5281
+ const segmentIndex = geometry.data.getSegmentIndex();
5282
+ validateGeometry(geometry);
5283
+ const segmentSpecificConfig = getSegmentSpecificConfig(contourRepresentation, geometryId, segmentIndex);
5284
+ const contourSet = geometry.data;
5285
+ contourSet.contours.forEach((contour) => {
5286
+ const { points, color, id } = contour;
5287
+ const contourSegmentationAnnotation = {
5288
+ annotationUID: esm.utilities.uuidv4(),
5289
+ data: {
5290
+ contour: {
5291
+ closed: true,
5292
+ polyline: points,
5293
+ },
5294
+ segmentation: {
5295
+ segmentationId,
5296
+ segmentIndex,
5297
+ color,
5298
+ id,
5299
+ },
5300
+ handles: {},
5301
+ },
5302
+ handles: {},
5303
+ highlighted: false,
5304
+ autoGenerated: false,
5305
+ invalidated: false,
5306
+ isLocked: false,
5307
+ isVisible: true,
5308
+ metadata: {
5309
+ referencedImageId: viewport.getCurrentImageId(),
5310
+ toolName: 'PlanarFreehandContourSegmentationTool',
5311
+ FrameOfReferenceUID: viewport.getFrameOfReferenceUID(),
5312
+ viewPlaneNormal: viewport.getCamera().viewPlaneNormal,
5313
+ },
5314
+ };
5315
+ const annotationGroupSelector = viewport.element;
5316
+ (0,stateManagement/* addAnnotation */.lC)(contourSegmentationAnnotation, annotationGroupSelector);
5317
+ (0,contourSegmentation.addContourSegmentationAnnotation)(contourSegmentationAnnotation);
5318
+ });
5319
+ if (segmentSpecificConfig) {
5320
+ segmentSpecificMap.set(segmentIndex, segmentSpecificConfig);
5321
+ }
5322
+ });
5323
+ const outlineWidthActive = contourRepresentationConfig.representations.CONTOUR.outlineWidthActive;
5324
+ setConfigCache(segmentationRepresentationUID, Object.assign({}, getConfigCache(segmentationRepresentationUID), {
5325
+ segmentsHidden: new Set(segmentsHidden),
5326
+ segmentSpecificMap,
5327
+ outlineWidthActive,
5328
+ }));
5329
+ viewport.resetCamera();
5330
+ viewport.render();
5248
5331
  }
5249
5332
 
5250
- ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/removeContourFromElement.js
5251
-
5252
- function removeContourFromElement(element, segmentationRepresentationUID, removeFromCache = false) {
5253
- const enabledElement = (0,esm.getEnabledElement)(element);
5254
- const { viewport } = enabledElement;
5255
- const actorEntries = viewport.getActors();
5256
- const actorUIDsToRemove = actorEntries
5257
- .map(({ uid }) => uid.includes(segmentationRepresentationUID) ? uid : undefined)
5258
- .filter(Boolean);
5259
- viewport.removeActors(actorUIDsToRemove);
5260
- }
5261
- /* harmony default export */ const Contour_removeContourFromElement = (removeContourFromElement);
5262
5333
 
5263
- // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/stateManagement/segmentation/index.js + 31 modules
5264
- var stateManagement_segmentation = __webpack_require__(63421);
5265
5334
  ;// CONCATENATED MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Contour/contourDisplay.js
5266
5335
 
5267
5336
 
@@ -5300,11 +5369,12 @@ async function render(viewport, representationConfig, toolGroupConfig) {
5300
5369
  viewport,
5301
5370
  });
5302
5371
  }
5303
- const { geometryIds } = contourData;
5304
- if (!geometryIds?.length || !(viewport instanceof esm.BaseVolumeViewport)) {
5372
+ if (!contourData) {
5305
5373
  return;
5306
5374
  }
5307
- addOrUpdateVTKContourSets(viewport, geometryIds, representationConfig, toolGroupConfig);
5375
+ if (contourData?.geometryIds?.length) {
5376
+ handleContourSegmentation(viewport, contourData.geometryIds, contourData.annotationUIDsMap, representationConfig, toolGroupConfig);
5377
+ }
5308
5378
  }
5309
5379
  function _removeContourFromToolGroupViewports(toolGroupId, segmentationRepresentationUID) {
5310
5380
  const toolGroup = (0,ToolGroupManager.getToolGroup)(toolGroupId);
@@ -5315,7 +5385,7 @@ function _removeContourFromToolGroupViewports(toolGroupId, segmentationRepresent
5315
5385
  for (const viewportInfo of viewportsInfo) {
5316
5386
  const { viewportId, renderingEngineId } = viewportInfo;
5317
5387
  const enabledElement = (0,esm.getEnabledElementByIds)(viewportId, renderingEngineId);
5318
- Contour_removeContourFromElement(enabledElement.viewport.element, segmentationRepresentationUID);
5388
+ Contour_removeContourFromElement(segmentationRepresentationUID, toolGroupId);
5319
5389
  }
5320
5390
  }
5321
5391
  /* harmony default export */ const contourDisplay = ({
@@ -5643,6 +5713,36 @@ function getDefaultSurfaceConfig() {
5643
5713
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getDefaultSurfaceConfig);
5644
5714
 
5645
5715
 
5716
+ /***/ }),
5717
+
5718
+ /***/ 7783:
5719
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5720
+
5721
+ "use strict";
5722
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5723
+ /* harmony export */ X: () => (/* binding */ distancePointToContour)
5724
+ /* harmony export */ });
5725
+ /* harmony import */ var _utilities_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73047);
5726
+
5727
+ const distancePointToContour = (viewport, annotation, coords) => {
5728
+ if (!annotation?.data?.contour?.polyline?.length) {
5729
+ return;
5730
+ }
5731
+ const { polyline } = annotation.data.contour;
5732
+ const { length } = polyline;
5733
+ let distance = Infinity;
5734
+ for (let i = 0; i < length; i++) {
5735
+ const canvasPoint = viewport.worldToCanvas(polyline[i]);
5736
+ const distanceToPoint = _utilities_math__WEBPACK_IMPORTED_MODULE_0__.point.distanceToPoint(canvasPoint, coords);
5737
+ distance = Math.min(distance, distanceToPoint);
5738
+ }
5739
+ if (distance === Infinity || isNaN(distance)) {
5740
+ return;
5741
+ }
5742
+ return distance;
5743
+ };
5744
+
5745
+
5646
5746
  /***/ }),
5647
5747
 
5648
5748
  /***/ 57439:
@@ -9649,292 +9749,48 @@ var vtkEdgeLocator = {
9649
9749
 
9650
9750
  /***/ }),
9651
9751
 
9652
- /***/ 28136:
9752
+ /***/ 68749:
9653
9753
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9654
9754
 
9655
9755
  "use strict";
9656
9756
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9657
- /* harmony export */ Ay: () => (/* binding */ vtkAppendPolyData$1)
9757
+ /* harmony export */ A: () => (/* binding */ vtkCaseTable)
9658
9758
  /* harmony export */ });
9659
- /* unused harmony exports extend, newInstance */
9660
- /* harmony import */ var _macros2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50906);
9661
- /* harmony import */ var _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45128);
9662
- /* harmony import */ var _Common_Core_Points_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18310);
9663
- /* harmony import */ var _Common_DataModel_PolyData_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27398);
9664
- /* harmony import */ var _Common_DataModel_DataSetAttributes_Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94884);
9665
- /* harmony import */ var _Common_Core_DataArray_Constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82946);
9759
+ // ----------------------------------------------------------------------------
9760
+ // Marching squares case functions (using lines to generate the 2D tessellation).
9761
+ // For each case, a list of edge ids that form the triangles. A -1 marks the
9762
+ // end of the list of edges. Edges are taken three at a time to generate
9763
+ // triangle points.
9764
+ // ----------------------------------------------------------------------------
9765
+ const MARCHING_SQUARES_CASES = [[-1, -1, -1, -1, -1] /* 0 */, [0, 3, -1, -1, -1] /* 1 */, [1, 0, -1, -1, -1] /* 2 */, [1, 3, -1, -1, -1] /* 3 */, [2, 1, -1, -1, -1] /* 4 */, [0, 3, 2, 1, -1] /* 5 */, [2, 0, -1, -1, -1] /* 6 */, [2, 3, -1, -1, -1] /* 7 */, [3, 2, -1, -1, -1] /* 8 */, [0, 2, -1, -1, -1] /* 9 */, [1, 0, 3, 2, -1] /* 10 */, [1, 2, -1, -1, -1] /* 11 */, [3, 1, -1, -1, -1] /* 12 */, [0, 1, -1, -1, -1] /* 13 */, [3, 0, -1, -1, -1] /* 14 */, [-1, -1, -1, -1, -1] /* 15 */];
9666
9766
 
9767
+ const EDGES = [[0, 1], [1, 3], [2, 3], [0, 2]];
9768
+ function getCase(index) {
9769
+ return MARCHING_SQUARES_CASES[index];
9770
+ }
9667
9771
 
9772
+ // Define the four edges of the pixel by the following pairs of vertices
9773
+ function getEdge(eid) {
9774
+ return EDGES[eid];
9775
+ }
9668
9776
 
9777
+ // ----------------------------------------------------------------------------
9778
+ // Static API
9779
+ // ----------------------------------------------------------------------------
9780
+ var vtkCaseTable = {
9781
+ getCase,
9782
+ getEdge
9783
+ };
9669
9784
 
9670
9785
 
9671
9786
 
9672
9787
 
9673
- const {
9674
- vtkErrorMacro
9675
- } = _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m;
9676
- function offsetCellArray(typedArray, offset) {
9677
- let currentIdx = 0;
9678
- return typedArray.map((value, index) => {
9679
- if (index === currentIdx) {
9680
- currentIdx += value + 1;
9681
- return value;
9682
- }
9683
- return value + offset;
9684
- });
9685
- }
9686
- function appendCellData(dest, src, ptOffset, cellOffset) {
9687
- dest.set(offsetCellArray(src, ptOffset), cellOffset);
9688
- }
9788
+ /***/ }),
9689
9789
 
9690
- // ----------------------------------------------------------------------------
9691
- // vtkAppendPolyData methods
9692
- // ----------------------------------------------------------------------------
9790
+ /***/ 88099:
9791
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9693
9792
 
9694
- function vtkAppendPolyData(publicAPI, model) {
9695
- // Set our classname
9696
- model.classHierarchy.push('vtkAppendPolyData');
9697
- publicAPI.requestData = (inData, outData) => {
9698
- // implement requestData
9699
- const numberOfInputs = publicAPI.getNumberOfInputPorts();
9700
- if (!numberOfInputs) {
9701
- vtkErrorMacro('No input specified.');
9702
- return;
9703
- }
9704
- if (numberOfInputs === 1) {
9705
- // pass through filter
9706
- outData[0] = inData[0];
9707
- return;
9708
- }
9709
-
9710
- // Allocate output
9711
- const output = _Common_DataModel_PolyData_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"].newInstance */ .Ay.newInstance();
9712
- let numPts = 0;
9713
- let pointType = 0;
9714
- let ttype = 1;
9715
- let firstType = 1;
9716
- let numVerts = 0;
9717
- let numLines = 0;
9718
- let numStrips = 0;
9719
- let numPolys = 0;
9720
-
9721
- // Field data is propagated to output only if present in all inputs
9722
- let hasPtNormals = true; // assume present by default
9723
- let hasPtTCoords = true;
9724
- let hasPtScalars = true;
9725
- for (let i = 0; i < numberOfInputs; i++) {
9726
- const ds = inData[i];
9727
- if (!ds) {
9728
- // eslint-disable-next-line
9729
- continue;
9730
- }
9731
- const dsNumPts = ds.getPoints().getNumberOfPoints();
9732
- numPts += dsNumPts;
9733
- numVerts += ds.getVerts().getNumberOfValues();
9734
- numLines += ds.getLines().getNumberOfValues();
9735
- numStrips += ds.getStrips().getNumberOfValues();
9736
- numPolys += ds.getPolys().getNumberOfValues();
9737
- if (dsNumPts) {
9738
- if (firstType) {
9739
- firstType = 0;
9740
- pointType = ds.getPoints().getDataType();
9741
- }
9742
- ttype = ds.getPoints().getDataType();
9743
- pointType = pointType > ttype ? pointType : ttype;
9744
- }
9745
- const ptD = ds.getPointData();
9746
- if (ptD) {
9747
- hasPtNormals = hasPtNormals && ptD.getNormals() !== null;
9748
- hasPtTCoords = hasPtTCoords && ptD.getTCoords() !== null;
9749
- hasPtScalars = hasPtScalars && ptD.getScalars() !== null;
9750
- } else {
9751
- hasPtNormals = false;
9752
- hasPtTCoords = false;
9753
- hasPtScalars = false;
9754
- }
9755
- }
9756
- if (model.outputPointsPrecision === _Common_DataModel_DataSetAttributes_Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .DesiredOutputPrecision */ .kP.SINGLE) {
9757
- pointType = _Common_Core_DataArray_Constants_js__WEBPACK_IMPORTED_MODULE_5__/* .VtkDataTypes */ .JA.FLOAT;
9758
- } else if (model.outputPointsPrecision === _Common_DataModel_DataSetAttributes_Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .DesiredOutputPrecision */ .kP.DOUBLE) {
9759
- pointType = _Common_Core_DataArray_Constants_js__WEBPACK_IMPORTED_MODULE_5__/* .VtkDataTypes */ .JA.DOUBLE;
9760
- }
9761
- const points = _Common_Core_Points_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"].newInstance */ .Ay.newInstance({
9762
- dataType: pointType
9763
- });
9764
- points.setNumberOfPoints(numPts);
9765
- const pointData = points.getData();
9766
- const vertData = new Uint32Array(numVerts);
9767
- const lineData = new Uint32Array(numLines);
9768
- const stripData = new Uint32Array(numStrips);
9769
- const polyData = new Uint32Array(numPolys);
9770
- let newPtNormals = null;
9771
- let newPtTCoords = null;
9772
- let newPtScalars = null;
9773
- const lds = inData[numberOfInputs - 1];
9774
- if (hasPtNormals) {
9775
- const dsNormals = lds.getPointData().getNormals();
9776
- newPtNormals = _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance({
9777
- numberOfComponents: 3,
9778
- numberOfTuples: numPts,
9779
- size: 3 * numPts,
9780
- dataType: dsNormals.getDataType(),
9781
- name: dsNormals.getName()
9782
- });
9783
- }
9784
- if (hasPtTCoords) {
9785
- const dsTCoords = lds.getPointData().getTCoords();
9786
- newPtTCoords = _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance({
9787
- numberOfComponents: 2,
9788
- numberOfTuples: numPts,
9789
- size: 2 * numPts,
9790
- dataType: dsTCoords.getDataType(),
9791
- name: dsTCoords.getName()
9792
- });
9793
- }
9794
- if (hasPtScalars) {
9795
- const dsScalars = lds.getPointData().getScalars();
9796
- newPtScalars = _Common_Core_DataArray_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].newInstance */ .Ay.newInstance({
9797
- numberOfComponents: dsScalars.getNumberOfComponents(),
9798
- numberOfTuples: numPts,
9799
- size: numPts * dsScalars.getNumberOfComponents(),
9800
- dataType: dsScalars.getDataType(),
9801
- name: dsScalars.getName()
9802
- });
9803
- }
9804
- numPts = 0;
9805
- numVerts = 0;
9806
- numLines = 0;
9807
- numStrips = 0;
9808
- numPolys = 0;
9809
- for (let i = 0; i < numberOfInputs; i++) {
9810
- const ds = inData[i];
9811
- pointData.set(ds.getPoints().getData(), numPts * 3);
9812
- appendCellData(vertData, ds.getVerts().getData(), numPts, numVerts);
9813
- numVerts += ds.getVerts().getNumberOfValues();
9814
- appendCellData(lineData, ds.getLines().getData(), numPts, numLines);
9815
- numLines += ds.getLines().getNumberOfValues();
9816
- appendCellData(stripData, ds.getStrips().getData(), numPts, numStrips);
9817
- numStrips += ds.getStrips().getNumberOfValues();
9818
- appendCellData(polyData, ds.getPolys().getData(), numPts, numPolys);
9819
- numPolys += ds.getPolys().getNumberOfValues();
9820
- const dsPD = ds.getPointData();
9821
- if (hasPtNormals) {
9822
- const ptNorms = dsPD.getNormals();
9823
- newPtNormals.getData().set(ptNorms.getData(), numPts * 3);
9824
- }
9825
- if (hasPtTCoords) {
9826
- const ptTCoords = dsPD.getTCoords();
9827
- newPtTCoords.getData().set(ptTCoords.getData(), numPts * 2);
9828
- }
9829
- if (hasPtScalars) {
9830
- const ptScalars = dsPD.getScalars();
9831
- newPtScalars.getData().set(ptScalars.getData(), numPts * newPtScalars.getNumberOfComponents());
9832
- }
9833
- numPts += ds.getPoints().getNumberOfPoints();
9834
- }
9835
- output.setPoints(points);
9836
- output.getVerts().setData(vertData);
9837
- output.getLines().setData(lineData);
9838
- output.getStrips().setData(stripData);
9839
- output.getPolys().setData(polyData);
9840
- if (newPtNormals) {
9841
- output.getPointData().setNormals(newPtNormals);
9842
- }
9843
- if (newPtTCoords) {
9844
- output.getPointData().setTCoords(newPtTCoords);
9845
- }
9846
- if (newPtScalars) {
9847
- output.getPointData().setScalars(newPtScalars);
9848
- }
9849
- outData[0] = output;
9850
- };
9851
- }
9852
-
9853
- // ----------------------------------------------------------------------------
9854
- // Object factory
9855
- // ----------------------------------------------------------------------------
9856
-
9857
- const DEFAULT_VALUES = {
9858
- outputPointsPrecision: _Common_DataModel_DataSetAttributes_Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .DesiredOutputPrecision */ .kP.DEFAULT
9859
- };
9860
-
9861
- // ----------------------------------------------------------------------------
9862
-
9863
- function extend(publicAPI, model) {
9864
- let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
9865
- Object.assign(model, DEFAULT_VALUES, initialValues);
9866
-
9867
- // Build VTK API
9868
- _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m.setGet(publicAPI, model, ['outputPointsPrecision']);
9869
-
9870
- // Make this a VTK object
9871
- _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m.obj(publicAPI, model);
9872
-
9873
- // Also make it an algorithm with one input and one output
9874
- _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m.algo(publicAPI, model, 1, 1);
9875
-
9876
- // Object specific methods
9877
- vtkAppendPolyData(publicAPI, model);
9878
- }
9879
-
9880
- // ----------------------------------------------------------------------------
9881
-
9882
- const newInstance = _macros2_js__WEBPACK_IMPORTED_MODULE_0__.m.newInstance(extend, 'vtkAppendPolyData');
9883
-
9884
- // ----------------------------------------------------------------------------
9885
-
9886
- var vtkAppendPolyData$1 = {
9887
- newInstance,
9888
- extend
9889
- };
9890
-
9891
-
9892
-
9893
-
9894
- /***/ }),
9895
-
9896
- /***/ 68749:
9897
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9898
-
9899
- "use strict";
9900
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9901
- /* harmony export */ A: () => (/* binding */ vtkCaseTable)
9902
- /* harmony export */ });
9903
- // ----------------------------------------------------------------------------
9904
- // Marching squares case functions (using lines to generate the 2D tessellation).
9905
- // For each case, a list of edge ids that form the triangles. A -1 marks the
9906
- // end of the list of edges. Edges are taken three at a time to generate
9907
- // triangle points.
9908
- // ----------------------------------------------------------------------------
9909
- const MARCHING_SQUARES_CASES = [[-1, -1, -1, -1, -1] /* 0 */, [0, 3, -1, -1, -1] /* 1 */, [1, 0, -1, -1, -1] /* 2 */, [1, 3, -1, -1, -1] /* 3 */, [2, 1, -1, -1, -1] /* 4 */, [0, 3, 2, 1, -1] /* 5 */, [2, 0, -1, -1, -1] /* 6 */, [2, 3, -1, -1, -1] /* 7 */, [3, 2, -1, -1, -1] /* 8 */, [0, 2, -1, -1, -1] /* 9 */, [1, 0, 3, 2, -1] /* 10 */, [1, 2, -1, -1, -1] /* 11 */, [3, 1, -1, -1, -1] /* 12 */, [0, 1, -1, -1, -1] /* 13 */, [3, 0, -1, -1, -1] /* 14 */, [-1, -1, -1, -1, -1] /* 15 */];
9910
-
9911
- const EDGES = [[0, 1], [1, 3], [2, 3], [0, 2]];
9912
- function getCase(index) {
9913
- return MARCHING_SQUARES_CASES[index];
9914
- }
9915
-
9916
- // Define the four edges of the pixel by the following pairs of vertices
9917
- function getEdge(eid) {
9918
- return EDGES[eid];
9919
- }
9920
-
9921
- // ----------------------------------------------------------------------------
9922
- // Static API
9923
- // ----------------------------------------------------------------------------
9924
- var vtkCaseTable = {
9925
- getCase,
9926
- getEdge
9927
- };
9928
-
9929
-
9930
-
9931
-
9932
- /***/ }),
9933
-
9934
- /***/ 88099:
9935
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9936
-
9937
- "use strict";
9793
+ "use strict";
9938
9794
 
9939
9795
  // EXPORTS
9940
9796
  __webpack_require__.d(__webpack_exports__, {
@@ -14500,7 +14356,7 @@ var vtkAnnotatedCubeActor$1 = {
14500
14356
 
14501
14357
  /***/ }),
14502
14358
 
14503
- /***/ 65373:
14359
+ /***/ 43387:
14504
14360
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14505
14361
 
14506
14362
  "use strict";
@@ -14522,10 +14378,242 @@ var DataArray = __webpack_require__(45128);
14522
14378
  var Actor = __webpack_require__(48987);
14523
14379
  // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Rendering/Core/Mapper.js
14524
14380
  var Mapper = __webpack_require__(22745);
14525
- // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/AppendPolyData.js
14526
- var AppendPolyData = __webpack_require__(28136);
14381
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/Points.js
14382
+ var Points = __webpack_require__(18310);
14527
14383
  // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/PolyData.js + 9 modules
14528
14384
  var PolyData = __webpack_require__(27398);
14385
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/DataModel/DataSetAttributes/Constants.js
14386
+ var Constants = __webpack_require__(94884);
14387
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/DataArray/Constants.js
14388
+ var DataArray_Constants = __webpack_require__(82946);
14389
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Filters/General/AppendPolyData.js
14390
+
14391
+
14392
+
14393
+
14394
+
14395
+
14396
+
14397
+ const {
14398
+ vtkErrorMacro
14399
+ } = macros2.m;
14400
+ function offsetCellArray(typedArray, offset) {
14401
+ let currentIdx = 0;
14402
+ return typedArray.map((value, index) => {
14403
+ if (index === currentIdx) {
14404
+ currentIdx += value + 1;
14405
+ return value;
14406
+ }
14407
+ return value + offset;
14408
+ });
14409
+ }
14410
+ function appendCellData(dest, src, ptOffset, cellOffset) {
14411
+ dest.set(offsetCellArray(src, ptOffset), cellOffset);
14412
+ }
14413
+
14414
+ // ----------------------------------------------------------------------------
14415
+ // vtkAppendPolyData methods
14416
+ // ----------------------------------------------------------------------------
14417
+
14418
+ function vtkAppendPolyData(publicAPI, model) {
14419
+ // Set our classname
14420
+ model.classHierarchy.push('vtkAppendPolyData');
14421
+ publicAPI.requestData = (inData, outData) => {
14422
+ // implement requestData
14423
+ const numberOfInputs = publicAPI.getNumberOfInputPorts();
14424
+ if (!numberOfInputs) {
14425
+ vtkErrorMacro('No input specified.');
14426
+ return;
14427
+ }
14428
+ if (numberOfInputs === 1) {
14429
+ // pass through filter
14430
+ outData[0] = inData[0];
14431
+ return;
14432
+ }
14433
+
14434
+ // Allocate output
14435
+ const output = PolyData/* default.newInstance */.Ay.newInstance();
14436
+ let numPts = 0;
14437
+ let pointType = 0;
14438
+ let ttype = 1;
14439
+ let firstType = 1;
14440
+ let numVerts = 0;
14441
+ let numLines = 0;
14442
+ let numStrips = 0;
14443
+ let numPolys = 0;
14444
+
14445
+ // Field data is propagated to output only if present in all inputs
14446
+ let hasPtNormals = true; // assume present by default
14447
+ let hasPtTCoords = true;
14448
+ let hasPtScalars = true;
14449
+ for (let i = 0; i < numberOfInputs; i++) {
14450
+ const ds = inData[i];
14451
+ if (!ds) {
14452
+ // eslint-disable-next-line
14453
+ continue;
14454
+ }
14455
+ const dsNumPts = ds.getPoints().getNumberOfPoints();
14456
+ numPts += dsNumPts;
14457
+ numVerts += ds.getVerts().getNumberOfValues();
14458
+ numLines += ds.getLines().getNumberOfValues();
14459
+ numStrips += ds.getStrips().getNumberOfValues();
14460
+ numPolys += ds.getPolys().getNumberOfValues();
14461
+ if (dsNumPts) {
14462
+ if (firstType) {
14463
+ firstType = 0;
14464
+ pointType = ds.getPoints().getDataType();
14465
+ }
14466
+ ttype = ds.getPoints().getDataType();
14467
+ pointType = pointType > ttype ? pointType : ttype;
14468
+ }
14469
+ const ptD = ds.getPointData();
14470
+ if (ptD) {
14471
+ hasPtNormals = hasPtNormals && ptD.getNormals() !== null;
14472
+ hasPtTCoords = hasPtTCoords && ptD.getTCoords() !== null;
14473
+ hasPtScalars = hasPtScalars && ptD.getScalars() !== null;
14474
+ } else {
14475
+ hasPtNormals = false;
14476
+ hasPtTCoords = false;
14477
+ hasPtScalars = false;
14478
+ }
14479
+ }
14480
+ if (model.outputPointsPrecision === Constants/* DesiredOutputPrecision */.kP.SINGLE) {
14481
+ pointType = DataArray_Constants/* VtkDataTypes */.JA.FLOAT;
14482
+ } else if (model.outputPointsPrecision === Constants/* DesiredOutputPrecision */.kP.DOUBLE) {
14483
+ pointType = DataArray_Constants/* VtkDataTypes */.JA.DOUBLE;
14484
+ }
14485
+ const points = Points/* default.newInstance */.Ay.newInstance({
14486
+ dataType: pointType
14487
+ });
14488
+ points.setNumberOfPoints(numPts);
14489
+ const pointData = points.getData();
14490
+ const vertData = new Uint32Array(numVerts);
14491
+ const lineData = new Uint32Array(numLines);
14492
+ const stripData = new Uint32Array(numStrips);
14493
+ const polyData = new Uint32Array(numPolys);
14494
+ let newPtNormals = null;
14495
+ let newPtTCoords = null;
14496
+ let newPtScalars = null;
14497
+ const lds = inData[numberOfInputs - 1];
14498
+ if (hasPtNormals) {
14499
+ const dsNormals = lds.getPointData().getNormals();
14500
+ newPtNormals = DataArray/* default.newInstance */.Ay.newInstance({
14501
+ numberOfComponents: 3,
14502
+ numberOfTuples: numPts,
14503
+ size: 3 * numPts,
14504
+ dataType: dsNormals.getDataType(),
14505
+ name: dsNormals.getName()
14506
+ });
14507
+ }
14508
+ if (hasPtTCoords) {
14509
+ const dsTCoords = lds.getPointData().getTCoords();
14510
+ newPtTCoords = DataArray/* default.newInstance */.Ay.newInstance({
14511
+ numberOfComponents: 2,
14512
+ numberOfTuples: numPts,
14513
+ size: 2 * numPts,
14514
+ dataType: dsTCoords.getDataType(),
14515
+ name: dsTCoords.getName()
14516
+ });
14517
+ }
14518
+ if (hasPtScalars) {
14519
+ const dsScalars = lds.getPointData().getScalars();
14520
+ newPtScalars = DataArray/* default.newInstance */.Ay.newInstance({
14521
+ numberOfComponents: dsScalars.getNumberOfComponents(),
14522
+ numberOfTuples: numPts,
14523
+ size: numPts * dsScalars.getNumberOfComponents(),
14524
+ dataType: dsScalars.getDataType(),
14525
+ name: dsScalars.getName()
14526
+ });
14527
+ }
14528
+ numPts = 0;
14529
+ numVerts = 0;
14530
+ numLines = 0;
14531
+ numStrips = 0;
14532
+ numPolys = 0;
14533
+ for (let i = 0; i < numberOfInputs; i++) {
14534
+ const ds = inData[i];
14535
+ pointData.set(ds.getPoints().getData(), numPts * 3);
14536
+ appendCellData(vertData, ds.getVerts().getData(), numPts, numVerts);
14537
+ numVerts += ds.getVerts().getNumberOfValues();
14538
+ appendCellData(lineData, ds.getLines().getData(), numPts, numLines);
14539
+ numLines += ds.getLines().getNumberOfValues();
14540
+ appendCellData(stripData, ds.getStrips().getData(), numPts, numStrips);
14541
+ numStrips += ds.getStrips().getNumberOfValues();
14542
+ appendCellData(polyData, ds.getPolys().getData(), numPts, numPolys);
14543
+ numPolys += ds.getPolys().getNumberOfValues();
14544
+ const dsPD = ds.getPointData();
14545
+ if (hasPtNormals) {
14546
+ const ptNorms = dsPD.getNormals();
14547
+ newPtNormals.getData().set(ptNorms.getData(), numPts * 3);
14548
+ }
14549
+ if (hasPtTCoords) {
14550
+ const ptTCoords = dsPD.getTCoords();
14551
+ newPtTCoords.getData().set(ptTCoords.getData(), numPts * 2);
14552
+ }
14553
+ if (hasPtScalars) {
14554
+ const ptScalars = dsPD.getScalars();
14555
+ newPtScalars.getData().set(ptScalars.getData(), numPts * newPtScalars.getNumberOfComponents());
14556
+ }
14557
+ numPts += ds.getPoints().getNumberOfPoints();
14558
+ }
14559
+ output.setPoints(points);
14560
+ output.getVerts().setData(vertData);
14561
+ output.getLines().setData(lineData);
14562
+ output.getStrips().setData(stripData);
14563
+ output.getPolys().setData(polyData);
14564
+ if (newPtNormals) {
14565
+ output.getPointData().setNormals(newPtNormals);
14566
+ }
14567
+ if (newPtTCoords) {
14568
+ output.getPointData().setTCoords(newPtTCoords);
14569
+ }
14570
+ if (newPtScalars) {
14571
+ output.getPointData().setScalars(newPtScalars);
14572
+ }
14573
+ outData[0] = output;
14574
+ };
14575
+ }
14576
+
14577
+ // ----------------------------------------------------------------------------
14578
+ // Object factory
14579
+ // ----------------------------------------------------------------------------
14580
+
14581
+ const DEFAULT_VALUES = {
14582
+ outputPointsPrecision: Constants/* DesiredOutputPrecision */.kP.DEFAULT
14583
+ };
14584
+
14585
+ // ----------------------------------------------------------------------------
14586
+
14587
+ function extend(publicAPI, model) {
14588
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
14589
+ Object.assign(model, DEFAULT_VALUES, initialValues);
14590
+
14591
+ // Build VTK API
14592
+ macros2.m.setGet(publicAPI, model, ['outputPointsPrecision']);
14593
+
14594
+ // Make this a VTK object
14595
+ macros2.m.obj(publicAPI, model);
14596
+
14597
+ // Also make it an algorithm with one input and one output
14598
+ macros2.m.algo(publicAPI, model, 1, 1);
14599
+
14600
+ // Object specific methods
14601
+ vtkAppendPolyData(publicAPI, model);
14602
+ }
14603
+
14604
+ // ----------------------------------------------------------------------------
14605
+
14606
+ const newInstance = macros2.m.newInstance(extend, 'vtkAppendPolyData');
14607
+
14608
+ // ----------------------------------------------------------------------------
14609
+
14610
+ var vtkAppendPolyData$1 = {
14611
+ newInstance,
14612
+ extend
14613
+ };
14614
+
14615
+
14616
+
14529
14617
  ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Filters/Sources/ConeSource.js
14530
14618
 
14531
14619
 
@@ -14605,7 +14693,7 @@ function vtkConeSource(publicAPI, model) {
14605
14693
  // Object factory
14606
14694
  // ----------------------------------------------------------------------------
14607
14695
 
14608
- const DEFAULT_VALUES = {
14696
+ const ConeSource_DEFAULT_VALUES = {
14609
14697
  height: 1.0,
14610
14698
  radius: 0.5,
14611
14699
  resolution: 6,
@@ -14617,9 +14705,9 @@ const DEFAULT_VALUES = {
14617
14705
 
14618
14706
  // ----------------------------------------------------------------------------
14619
14707
 
14620
- function extend(publicAPI, model) {
14708
+ function ConeSource_extend(publicAPI, model) {
14621
14709
  let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
14622
- Object.assign(model, DEFAULT_VALUES, initialValues);
14710
+ Object.assign(model, ConeSource_DEFAULT_VALUES, initialValues);
14623
14711
 
14624
14712
  // Build VTK API
14625
14713
  macros2.m.obj(publicAPI, model);
@@ -14631,13 +14719,13 @@ function extend(publicAPI, model) {
14631
14719
 
14632
14720
  // ----------------------------------------------------------------------------
14633
14721
 
14634
- const newInstance = macros2.m.newInstance(extend, 'vtkConeSource');
14722
+ const ConeSource_newInstance = macros2.m.newInstance(ConeSource_extend, 'vtkConeSource');
14635
14723
 
14636
14724
  // ----------------------------------------------------------------------------
14637
14725
 
14638
14726
  var vtkConeSource$1 = {
14639
- newInstance,
14640
- extend
14727
+ newInstance: ConeSource_newInstance,
14728
+ extend: ConeSource_extend
14641
14729
  };
14642
14730
 
14643
14731
 
@@ -14888,7 +14976,7 @@ function vtkArrowSource(publicAPI, model) {
14888
14976
 
14889
14977
  // Apply transformation to the cone
14890
14978
  MatrixBuilder/* default */.A.buildFromRadian().translate(1.0 - model.tipLength * 0.5, 0.0, 0.0).apply(conePts);
14891
- const append = AppendPolyData/* default.newInstance */.Ay.newInstance();
14979
+ const append = vtkAppendPolyData$1.newInstance();
14892
14980
  append.setInputData(cylinderPD);
14893
14981
  append.addInputData(conePD);
14894
14982
  const appendPD = append.getOutputData();
@@ -15054,7 +15142,7 @@ function vtkAxesActor(publicAPI, model) {
15054
15142
  shiftDataset(zAxis, 2, currentConfig.invert);
15055
15143
  }
15056
15144
  addColor(zAxis, ...currentConfig.color);
15057
- const source = AppendPolyData/* default.newInstance */.Ay.newInstance();
15145
+ const source = vtkAppendPolyData$1.newInstance();
15058
15146
  source.setInputData(xAxis);
15059
15147
  source.addInputData(yAxis);
15060
15148
  source.addInputData(zAxis);