@cornerstonejs/tools 1.57.2 → 1.58.0

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 (226) hide show
  1. package/dist/cjs/drawingSvg/drawPath.js +1 -1
  2. package/dist/cjs/drawingSvg/drawPath.js.map +1 -1
  3. package/dist/cjs/enums/WorkerTypes.d.ts +1 -1
  4. package/dist/cjs/enums/WorkerTypes.js +1 -1
  5. package/dist/cjs/enums/WorkerTypes.js.map +1 -1
  6. package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +17 -0
  7. package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +112 -0
  8. package/dist/cjs/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
  9. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
  10. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
  11. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
  12. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +8 -0
  13. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +121 -0
  14. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
  15. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +3 -0
  16. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +73 -0
  17. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
  18. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +3 -0
  19. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +25 -0
  20. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
  21. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +1 -0
  22. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +41 -0
  23. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
  24. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
  25. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
  26. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
  27. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
  28. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
  29. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
  30. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
  31. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
  32. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
  33. package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
  34. package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
  35. package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
  36. package/dist/cjs/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
  37. package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
  38. package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js +5 -0
  39. package/dist/cjs/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
  40. package/dist/cjs/tools/base/BaseTool.js +3 -0
  41. package/dist/cjs/tools/base/BaseTool.js.map +1 -1
  42. package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  43. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +13 -5
  44. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  45. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
  46. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  47. package/dist/cjs/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
  48. package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js +17 -0
  49. package/dist/cjs/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
  50. package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +4 -47
  51. package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
  52. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
  53. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +7 -148
  54. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
  55. package/dist/cjs/types/PolySeg.d.ts +1 -1
  56. package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
  57. package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
  58. package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
  59. package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
  60. package/dist/cjs/utilities/math/polyline/getAABB.d.ts +3 -1
  61. package/dist/cjs/utilities/math/polyline/getAABB.js +30 -4
  62. package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -1
  63. package/dist/cjs/utilities/planar/index.d.ts +3 -1
  64. package/dist/cjs/utilities/planar/index.js +4 -1
  65. package/dist/cjs/utilities/planar/index.js.map +1 -1
  66. package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.d.ts +1 -0
  67. package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js +32 -0
  68. package/dist/cjs/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
  69. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
  70. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js +97 -47
  71. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
  72. package/dist/cjs/workers/polySegConverters.js +73 -0
  73. package/dist/cjs/workers/polySegConverters.js.map +1 -1
  74. package/dist/esm/drawingSvg/drawPath.js +1 -1
  75. package/dist/esm/drawingSvg/drawPath.js.map +1 -1
  76. package/dist/esm/enums/WorkerTypes.js +1 -1
  77. package/dist/esm/enums/WorkerTypes.js.map +1 -1
  78. package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js +91 -0
  79. package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.js.map +1 -0
  80. package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -1
  81. package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -1
  82. package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +105 -0
  83. package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js.map +1 -0
  84. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js +72 -0
  85. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.js.map +1 -0
  86. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js +21 -0
  87. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.js.map +1 -0
  88. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js +26 -0
  89. package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.js.map +1 -0
  90. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +2 -2
  91. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -1
  92. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +1 -1
  93. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -1
  94. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +1 -1
  95. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -1
  96. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +1 -1
  97. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -1
  98. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +1 -1
  99. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -1
  100. package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +1 -1
  101. package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -1
  102. package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +2 -0
  103. package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js.map +1 -1
  104. package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js +4 -0
  105. package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.js.map +1 -1
  106. package/dist/esm/tools/base/BaseTool.js +3 -0
  107. package/dist/esm/tools/base/BaseTool.js.map +1 -1
  108. package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  109. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +13 -5
  110. package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  111. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +1 -1
  112. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  113. package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +17 -0
  114. package/dist/esm/tools/displayTools/SegmentationDisplayTool.js.map +1 -1
  115. package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +3 -46
  116. package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -1
  117. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +8 -139
  118. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
  119. package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +4 -1
  120. package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -1
  121. package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +3 -0
  122. package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
  123. package/dist/esm/utilities/math/polyline/getAABB.js +30 -4
  124. package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -1
  125. package/dist/esm/utilities/planar/index.js +3 -1
  126. package/dist/esm/utilities/planar/index.js.map +1 -1
  127. package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js +28 -0
  128. package/dist/esm/utilities/planar/isPlaneIntersectingAABB.js.map +1 -0
  129. package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +92 -44
  130. package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -1
  131. package/dist/esm/workers/polySegConverters.js +74 -1
  132. package/dist/esm/workers/polySegConverters.js.map +1 -1
  133. package/dist/types/drawingSvg/drawPath.d.ts.map +1 -1
  134. package/dist/types/enums/WorkerTypes.d.ts +1 -1
  135. package/dist/types/enums/WorkerTypes.d.ts.map +1 -1
  136. package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +18 -0
  137. package/dist/types/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts.map +1 -0
  138. package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -1
  139. package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts.map +1 -1
  140. package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +9 -0
  141. package/dist/types/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts.map +1 -0
  142. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +4 -0
  143. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts.map +1 -0
  144. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +4 -0
  145. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts.map +1 -0
  146. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts +2 -0
  147. package/dist/types/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.d.ts.map +1 -0
  148. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts.map +1 -1
  149. package/dist/types/stateManagement/segmentation/triggerSegmentationEvents.d.ts.map +1 -1
  150. package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
  151. package/dist/types/store/ToolGroupManager/getToolGroupForViewport.d.ts.map +1 -1
  152. package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
  153. package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
  154. package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
  155. package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts +1 -0
  156. package/dist/types/tools/displayTools/SegmentationDisplayTool.d.ts.map +1 -1
  157. package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts.map +1 -1
  158. package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +3 -9
  159. package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
  160. package/dist/types/types/PolySeg.d.ts +1 -1
  161. package/dist/types/types/PolySeg.d.ts.map +1 -1
  162. package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts.map +1 -1
  163. package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -1
  164. package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -1
  165. package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -1
  166. package/dist/types/utilities/planar/index.d.ts +3 -1
  167. package/dist/types/utilities/planar/index.d.ts.map +1 -1
  168. package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts +2 -0
  169. package/dist/types/utilities/planar/isPlaneIntersectingAABB.d.ts.map +1 -0
  170. package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -1
  171. package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts.map +1 -1
  172. package/dist/umd/985.index.js +1 -1
  173. package/dist/umd/985.index.js.map +1 -1
  174. package/dist/umd/index.js +1 -1
  175. package/dist/umd/index.js.map +1 -1
  176. package/package.json +4 -4
  177. package/src/drawingSvg/drawPath.ts +3 -1
  178. package/src/enums/WorkerTypes.ts +1 -1
  179. package/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts +203 -0
  180. package/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +9 -2
  181. package/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts +201 -0
  182. package/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts +103 -0
  183. package/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts +38 -0
  184. package/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts +58 -0
  185. package/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +2 -2
  186. package/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +1 -1
  187. package/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +3 -8
  188. package/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +1 -1
  189. package/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +1 -1
  190. package/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +1 -1
  191. package/src/stateManagement/segmentation/triggerSegmentationEvents.ts +5 -0
  192. package/src/store/ToolGroupManager/getToolGroupForViewport.ts +8 -1
  193. package/src/tools/base/BaseTool.ts +7 -0
  194. package/src/tools/base/ContourSegmentationBaseTool.ts +5 -0
  195. package/src/tools/displayTools/Contour/contourDisplay.ts +29 -11
  196. package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +1 -1
  197. package/src/tools/displayTools/SegmentationDisplayTool.ts +26 -0
  198. package/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +3 -65
  199. package/src/tools/displayTools/Surface/surfaceDisplay.ts +12 -247
  200. package/src/types/PolySeg.ts +1 -1
  201. package/src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts +9 -1
  202. package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +4 -0
  203. package/src/utilities/math/polyline/getAABB.ts +58 -4
  204. package/src/utilities/planar/index.ts +3 -0
  205. package/src/utilities/planar/isPlaneIntersectingAABB.ts +56 -0
  206. package/src/utilities/segmentation/getUniqueSegmentIndices.ts +115 -49
  207. package/src/workers/polySegConverters.js +117 -1
  208. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -1
  209. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js +0 -27
  210. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
  211. package/dist/cjs/workers/clippingPlaneWorker.d.ts +0 -1
  212. package/dist/cjs/workers/clippingPlaneWorker.js +0 -63
  213. package/dist/cjs/workers/clippingPlaneWorker.js.map +0 -1
  214. package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js +0 -23
  215. package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js.map +0 -1
  216. package/dist/esm/workers/clippingPlaneWorker.js +0 -58
  217. package/dist/esm/workers/clippingPlaneWorker.js.map +0 -1
  218. package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts +0 -2
  219. package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts.map +0 -1
  220. package/dist/types/workers/clippingPlaneWorker.d.ts +0 -2
  221. package/dist/types/workers/clippingPlaneWorker.d.ts.map +0 -1
  222. package/dist/umd/444.index.js +0 -3
  223. package/dist/umd/444.index.js.LICENSE.txt +0 -5
  224. package/dist/umd/444.index.js.map +0 -1
  225. package/src/tools/displayTools/registerDisplayToolsWorker.ts +0 -34
  226. package/src/workers/clippingPlaneWorker.js +0 -87
@@ -1,58 +0,0 @@
1
- import { expose } from 'comlink';
2
- import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';
3
- import vtkClipClosedSurface from '@kitware/vtk.js/Filters/General/ClipClosedSurface';
4
- import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
5
- const obj = {
6
- clipSurfaceWithPlanes({ planesInfo, pointsAndPolys }, progressCallback, updateCacheCallback) {
7
- const numberOfPlanes = planesInfo.length;
8
- const clippingFilter = vtkClipClosedSurface.newInstance({
9
- clippingPlanes: [],
10
- activePlaneId: 2,
11
- passPointData: false,
12
- });
13
- clippingFilter.setGenerateOutline(true);
14
- clippingFilter.setGenerateFaces(false);
15
- const plane1 = vtkPlane.newInstance();
16
- const plane2 = vtkPlane.newInstance();
17
- try {
18
- for (const [index, planeInfo] of planesInfo.entries()) {
19
- const { sliceIndex, planes } = planeInfo;
20
- const polyDataResults = new Map();
21
- for (const polyDataInfo of pointsAndPolys) {
22
- const { points, polys, id } = polyDataInfo;
23
- const surfacePolyData = vtkPolyData.newInstance();
24
- surfacePolyData.getPoints().setData(points, 3);
25
- surfacePolyData.getPolys().setData(polys, 3);
26
- clippingFilter.setInputData(surfacePolyData);
27
- const clippingPlanes = [plane1, plane2];
28
- plane1.setOrigin(planes[0].origin);
29
- plane1.setNormal(planes[0].normal);
30
- plane2.setOrigin(planes[1].origin);
31
- plane2.setNormal(planes[1].normal);
32
- clippingFilter.setClippingPlanes(clippingPlanes);
33
- clippingFilter.update();
34
- const polyData = clippingFilter.getOutputData();
35
- if (polyData) {
36
- polyDataResults.set(id, {
37
- points: polyData.getPoints().getData(),
38
- lines: polyData.getLines().getData(),
39
- });
40
- }
41
- }
42
- progressCallback({ progress: (index + 1) / numberOfPlanes });
43
- updateCacheCallback({ sliceIndex, polyDataResults });
44
- }
45
- }
46
- catch (e) {
47
- console.error('Error during processing', e);
48
- }
49
- finally {
50
- pointsAndPolys = null;
51
- clippingFilter.delete();
52
- plane1.delete();
53
- plane2.delete();
54
- }
55
- },
56
- };
57
- expose(obj);
58
- //# sourceMappingURL=clippingPlaneWorker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clippingPlaneWorker.js","sourceRoot":"","sources":["../../../src/workers/clippingPlaneWorker.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,QAAQ,MAAM,wCAAwC,CAAC;AAC9D,OAAO,oBAAoB,MAAM,mDAAmD,CAAC;AACrF,OAAO,WAAW,MAAM,2CAA2C,CAAC;AAEpE,MAAM,GAAG,GAAG;IAYV,qBAAqB,CACnB,EAAE,UAAU,EAAE,cAAc,EAAE,EAC9B,gBAAgB,EAChB,mBAAmB;QAEnB,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;QACzC,MAAM,cAAc,GAAG,oBAAoB,CAAC,WAAW,CAAC;YACtD,cAAc,EAAE,EAAE;YAClB,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;QACH,cAAc,CAAC,kBAAkB,CAAC,IAAI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E,CAAC;oBAExB,MAAM,QAAQ,GAAG,cAAc,CAAC,aAAa,EAAE,CAAC;oBAEhD,IAAI,QAAQ,EAAE;wBACZ,eAAe,CAAC,GAAG,CAAC,EAAE,EAAE;4BACtB,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE;4BACtC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE;yBACrC,CAAC,CAAC;qBACJ;iBACF;gBAED,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC,CAAC;gBAE7D,mBAAmB,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;aACtD;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;SAC7C;gBAAS;YAER,cAAc,GAAG,IAAI,CAAC;YACtB,cAAc,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;IACH,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,GAAG,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function registerDisplayToolsWorker(): void;
2
- //# sourceMappingURL=registerDisplayToolsWorker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerDisplayToolsWorker.d.ts","sourceRoot":"","sources":["../../../../src/tools/displayTools/registerDisplayToolsWorker.ts"],"names":[],"mappings":"AAIA,wBAAgB,0BAA0B,SA6BzC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=clippingPlaneWorker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clippingPlaneWorker.d.ts","sourceRoot":"","sources":["../../../src/workers/clippingPlaneWorker.js"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- /*! For license information please see 444.index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@kitware/vtk.js/Common/DataModel/Plane"),require("@kitware/vtk.js/Filters/General/ClipClosedSurface"),require("@kitware/vtk.js/Common/DataModel/PolyData")):"function"==typeof define&&define.amd?define(["@kitware/vtk.js/Common/DataModel/Plane","@kitware/vtk.js/Filters/General/ClipClosedSurface","@kitware/vtk.js/Common/DataModel/PolyData"],t):"object"==typeof exports?exports.cornerstoneTools3D=t(require("@kitware/vtk.js/Common/DataModel/Plane"),require("@kitware/vtk.js/Filters/General/ClipClosedSurface"),require("@kitware/vtk.js/Common/DataModel/PolyData")):e.cornerstoneTools3D=t(e["@kitware/vtk.js/Common/DataModel/Plane"],e["@kitware/vtk.js/Filters/General/ClipClosedSurface"],e["@kitware/vtk.js/Common/DataModel/PolyData"])}(self,((e,t,n)=>(()=>{"use strict";var r={864:t=>{t.exports=e},70:e=>{e.exports=n},448:e=>{e.exports=t}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return r[e](n,n.exports,o),n.exports}return o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:t=>s(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return l(e,t),[n,[n]]},deserialize:e=>(e.start(),m(e,[],undefined))}],["throw",{canHandle:e=>s(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function l(t,n=globalThis,o=["*"]){n.addEventListener("message",(function s(i){if(!i||!i.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(o,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:u,type:p,path:f}=Object.assign({path:[]},i.data),d=(i.data.argumentList||[]).map(k);let m;try{const n=f.slice(0,-1).reduce(((e,t)=>e[t]),t),r=f.reduce(((e,t)=>e[t]),t);switch(p){case"GET":m=r;break;case"SET":n[f.slice(-1)[0]]=k(i.data.value),m=!0;break;case"APPLY":m=r.apply(n,d);break;case"CONSTRUCT":m=function(t){return Object.assign(t,{[e]:!0})}(new r(...d));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;l(t,n),m=function(e,t){return y.set(e,t),e}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch((e=>({value:e,[a]:0}))).then((e=>{const[a,o]=v(e);n.postMessage(Object.assign(Object.assign({},a),{id:u}),o),"RELEASE"===p&&(n.removeEventListener("message",s),c(n),r in t&&"function"==typeof t[r]&&t[r]())})).catch((e=>{const[t,r]=v({value:new TypeError("Unserializable return value"),[a]:0});n.postMessage(Object.assign(Object.assign({},t),{id:u}),r)}))})),n.start&&n.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e){return h(e,{type:"RELEASE"}).then((()=>{c(e)}))}const f=new WeakMap,d="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(f.get(e)||0)-1;f.set(e,t),0===t&&p(e)}));function m(e,r=[],a=function(){}){let o=!1;const s=new Proxy(a,{get(t,a){if(u(o),a===n)return()=>{!function(e){d&&d.unregister(e)}(s),p(e),o=!0};if("then"===a){if(0===r.length)return{then:()=>s};const t=h(e,{type:"GET",path:r.map((e=>e.toString()))}).then(k);return t.then.bind(t)}return m(e,[...r,a])},set(t,n,a){u(o);const[s,i]=v(a);return h(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:s},i).then(k)},apply(n,a,s){u(o);const i=r[r.length-1];if(i===t)return h(e,{type:"ENDPOINT"}).then(k);if("bind"===i)return m(e,r.slice(0,-1));const[l,c]=g(s);return h(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:l},c).then(k)},construct(t,n){u(o);const[a,s]=g(n);return h(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:a},s).then(k)}});return function(e,t){const n=(f.get(t)||0)+1;f.set(t,n),d&&d.register(e,t,e)}(s,e),s}function g(e){const t=e.map(v);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const y=new WeakMap;function v(e){for(const[t,n]of i)if(n.canHandle(e)){const[r,a]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},a]}return[{type:"RAW",value:e},y.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function h(e,t,n){return new Promise((r=>{const a=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===a&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:a},t),n)}))}var w=o(864),b=o.n(w),E=o(448),P=o.n(E),C=o(70),j=o.n(C);l({clipSurfaceWithPlanes(e,t,n){let{planesInfo:r,pointsAndPolys:a}=e;const o=r.length,s=P().newInstance({clippingPlanes:[],activePlaneId:2,passPointData:!1});s.setGenerateOutline(!0),s.setGenerateFaces(!1);const i=b().newInstance(),l=b().newInstance();try{for(const[e,c]of r.entries()){const{sliceIndex:r,planes:u}=c,p=new Map;for(const e of a){const{points:t,polys:n,id:r}=e,a=j().newInstance();a.getPoints().setData(t,3),a.getPolys().setData(n,3),s.setInputData(a);const o=[i,l];i.setOrigin(u[0].origin),i.setNormal(u[0].normal),l.setOrigin(u[1].origin),l.setNormal(u[1].normal),s.setClippingPlanes(o),s.update();const c=s.getOutputData();c&&p.set(r,{points:c.getPoints().getData(),lines:c.getLines().getData()})}t({progress:(e+1)/o}),n({sliceIndex:r,polyDataResults:p})}}catch(e){console.error("Error during processing",e)}finally{a=null,s.delete(),i.delete(),l.delete()}}})})(),{}})()));
3
- //# sourceMappingURL=444.index.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
@@ -1 +0,0 @@
1
- {"version":3,"file":"444.index.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,0CAA2CA,QAAQ,qDAAsDA,QAAQ,8CACzH,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,yCAA0C,oDAAqD,6CAA8CJ,GAC3H,iBAAZC,QACdA,QAA4B,mBAAID,EAAQG,QAAQ,0CAA2CA,QAAQ,qDAAsDA,QAAQ,8CAEjKJ,EAAyB,mBAAIC,EAAQD,EAAK,0CAA2CA,EAAK,qDAAsDA,EAAK,6CACtJ,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAkCC,sCCT9EP,EAAOD,QAAUM,UCAjBL,EAAOD,QAAUQ,WCAjBP,EAAOD,QAAUO,ICCbE,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaZ,QAGrB,IAAIC,EAASQ,EAAyBE,GAAY,CAGjDX,QAAS,CAAC,GAOX,OAHAc,EAAoBH,GAAUV,EAAQA,EAAOD,QAASU,GAG/CT,EAAOD,OACf,QCrBAU,EAAoBK,EAAKd,IACxB,IAAIe,EAASf,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Ae4B,kBAAkB1B,GACjCF,EAAe6B,SAEf,MAAMC,EAAW9B,EAAe+B,gBAE5BD,GACFf,EAAgBlF,IAAIf,EAAI,CACtBmG,OAAQa,EAAST,YAAYW,UAC7BC,MAAOH,EAASI,WAAWF,WAGjC,CAEArC,EAAiB,CAAEwC,UAAWzB,EAAQ,GAAKX,IAE3CH,EAAoB,CAAEiB,aAAYE,mBACpC,CACF,CAAE,MAAOqB,GACPxH,QAAQ6B,MAAM,0BAA2B2F,EAC3C,CAAE,QAEAtC,EAAiB,KACjBE,EAAeqC,SACf9B,EAAO8B,SACP5B,EAAO4B,QACT,CACF","sources":["webpack://cornerstoneTools3D/webpack/universalModuleDefinition","webpack://cornerstoneTools3D/external umd \"@kitware/vtk.js/Common/DataModel/Plane\"","webpack://cornerstoneTools3D/external umd \"@kitware/vtk.js/Common/DataModel/PolyData\"","webpack://cornerstoneTools3D/external umd \"@kitware/vtk.js/Filters/General/ClipClosedSurface\"","webpack://cornerstoneTools3D/webpack/bootstrap","webpack://cornerstoneTools3D/webpack/runtime/compat get default export","webpack://cornerstoneTools3D/webpack/runtime/define property getters","webpack://cornerstoneTools3D/webpack/runtime/hasOwnProperty shorthand","webpack://cornerstoneTools3D/../../node_modules/comlink/dist/esm/comlink.mjs","webpack://cornerstoneTools3D/./src/workers/clippingPlaneWorker.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@kitware/vtk.js/Common/DataModel/Plane\"), require(\"@kitware/vtk.js/Filters/General/ClipClosedSurface\"), require(\"@kitware/vtk.js/Common/DataModel/PolyData\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@kitware/vtk.js/Common/DataModel/Plane\", \"@kitware/vtk.js/Filters/General/ClipClosedSurface\", \"@kitware/vtk.js/Common/DataModel/PolyData\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cornerstoneTools3D\"] = factory(require(\"@kitware/vtk.js/Common/DataModel/Plane\"), require(\"@kitware/vtk.js/Filters/General/ClipClosedSurface\"), require(\"@kitware/vtk.js/Common/DataModel/PolyData\"));\n\telse\n\t\troot[\"cornerstoneTools3D\"] = factory(root[\"@kitware/vtk.js/Common/DataModel/Plane\"], root[\"@kitware/vtk.js/Filters/General/ClipClosedSurface\"], root[\"@kitware/vtk.js/Common/DataModel/PolyData\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__864__, __WEBPACK_EXTERNAL_MODULE__448__, __WEBPACK_EXTERNAL_MODULE__70__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__864__;","module.exports = __WEBPACK_EXTERNAL_MODULE__70__;","module.exports = __WEBPACK_EXTERNAL_MODULE__448__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst proxyMarker = Symbol(\"Comlink.proxy\");\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\nconst finalizer = Symbol(\"Comlink.finalizer\");\nconst throwMarker = Symbol(\"Comlink.thrown\");\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n};\n/**\n * Allows customizing the serialization of certain values.\n */\nconst transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n]);\nfunction isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n}\nfunction expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n}\nfunction isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n}\nfunction closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n}\nfunction wrap(ep, target) {\n return createProxy(ep, [], target);\n}\nfunction throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\nfunction releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n}\nconst proxyCounter = new WeakMap();\nconst proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\nfunction registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n}\nfunction unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n}\nfunction createProxy(ep, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n}\nfunction myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n}\nfunction processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\nconst transferCache = new WeakMap();\nfunction transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n}\nfunction proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n}\nfunction windowEndpoint(w, context = globalThis, targetOrigin = \"*\") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\nfunction toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\nfunction fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n}\nfunction requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l);\n resolve(ev.data);\n });\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n}\nfunction generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n}\n\nexport { createEndpoint, expose, finalizer, proxy, proxyMarker, releaseProxy, transfer, transferHandlers, windowEndpoint, wrap };\n//# sourceMappingURL=comlink.mjs.map\n","import { expose } from 'comlink';\nimport vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';\nimport vtkClipClosedSurface from '@kitware/vtk.js/Filters/General/ClipClosedSurface';\nimport vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';\n\nconst obj = {\n /**\n * Clips a 3D surface using provided planes and updates the cache and progress.\n * The function takes in information about the planes and the polygon data, and applies a clipping filter.\n * It then updates the cache and progress based on the processed data.\n *\n * @param clipInfo - Contains information about the planes and the polygon data.\n * @param updateProgress - Callback function to update the progress of the clipping process.\n * @param updateCache - Callback function to update the cache with the clipped data.\n *\n * @throws Will throw an error if the clipping process encounters an issue.\n */\n clipSurfaceWithPlanes(\n { planesInfo, pointsAndPolys },\n progressCallback,\n updateCacheCallback\n ) {\n const numberOfPlanes = planesInfo.length;\n const clippingFilter = vtkClipClosedSurface.newInstance({\n clippingPlanes: [],\n activePlaneId: 2,\n passPointData: false,\n });\n clippingFilter.setGenerateOutline(true);\n clippingFilter.setGenerateFaces(false);\n\n const plane1 = vtkPlane.newInstance();\n const plane2 = vtkPlane.newInstance();\n\n try {\n for (const [index, planeInfo] of planesInfo.entries()) {\n const { sliceIndex, planes } = planeInfo;\n\n const polyDataResults = new Map();\n for (const polyDataInfo of pointsAndPolys) {\n const { points, polys, id } = polyDataInfo;\n\n const surfacePolyData = vtkPolyData.newInstance();\n surfacePolyData.getPoints().setData(points, 3);\n surfacePolyData.getPolys().setData(polys, 3);\n\n clippingFilter.setInputData(surfacePolyData);\n\n // Reusable array for clipping planes\n const clippingPlanes = [plane1, plane2];\n\n // Directly update plane instances\n plane1.setOrigin(planes[0].origin);\n plane1.setNormal(planes[0].normal);\n plane2.setOrigin(planes[1].origin);\n plane2.setNormal(planes[1].normal);\n\n clippingFilter.setClippingPlanes(clippingPlanes);\n clippingFilter.update();\n\n const polyData = clippingFilter.getOutputData();\n\n if (polyData) {\n polyDataResults.set(id, {\n points: polyData.getPoints().getData(),\n lines: polyData.getLines().getData(),\n });\n }\n }\n\n progressCallback({ progress: (index + 1) / numberOfPlanes });\n\n updateCacheCallback({ sliceIndex, polyDataResults });\n }\n } catch (e) {\n console.error('Error during processing', e);\n } finally {\n // Cleanup on completion\n pointsAndPolys = null;\n clippingFilter.delete();\n plane1.delete();\n plane2.delete();\n }\n },\n};\n\nexpose(obj);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__864__","__WEBPACK_EXTERNAL_MODULE__448__","__WEBPACK_EXTERNAL_MODULE__70__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","proxyMarker","Symbol","createEndpoint","releaseProxy","finalizer","throwMarker","isObject","val","transferHandlers","Map","canHandle","serialize","port1","port2","MessageChannel","expose","deserialize","port","start","createProxy","target","value","serialized","Error","isError","message","name","stack","assign","ep","globalThis","allowedOrigins","addEventListener","callback","ev","data","origin","allowedOrigin","RegExp","test","isAllowedOrigin","console","warn","id","type","path","argumentList","map","fromWireValue","returnValue","parent","slice","reduce","rawValue","apply","proxy","transfers","transferCache","set","transfer","Promise","resolve","catch","then","wireValue","transferables","toWireValue","postMessage","removeEventListener","closeEndPoint","error","TypeError","endpoint","constructor","isMessagePort","close","throwIfProxyReleased","isReleased","releaseEndpoint","requestResponseMessage","proxyCounter","WeakMap","proxyFinalizers","FinalizationRegistry","newCount","isProxyReleased","Proxy","_target","unregister","unregisterProxy","length","r","p","toString","bind","_thisArg","rawArgumentList","last","processArguments","construct","register","registerProxy","processed","v","arr","Array","concat","handler","serializedValue","msg","fill","Math","floor","random","Number","MAX_SAFE_INTEGER","join","l","clipSurfaceWithPlanes","_ref","progressCallback","updateCacheCallback","planesInfo","pointsAndPolys","numberOfPlanes","clippingFilter","vtkClipClosedSurface","clippingPlanes","activePlaneId","passPointData","setGenerateOutline","setGenerateFaces","plane1","vtkPlane","plane2","index","planeInfo","entries","sliceIndex","planes","polyDataResults","polyDataInfo","points","polys","surfacePolyData","vtkPolyData","getPoints","setData","getPolys","setInputData","setOrigin","setNormal","normal","setClippingPlanes","update","polyData","getOutputData","getData","lines","getLines","progress","e","delete"],"sourceRoot":""}
@@ -1,34 +0,0 @@
1
- import { getWebWorkerManager } from '@cornerstonejs/core';
2
-
3
- let registered = false;
4
-
5
- export function registerDisplayToolsWorker() {
6
- if (registered) {
7
- return;
8
- }
9
-
10
- registered = true;
11
-
12
- const workerFn = () => {
13
- // @ts-ignore
14
- return new Worker(
15
- // @ts-ignore
16
- new URL('../../workers/clippingPlaneWorker', import.meta.url),
17
- {
18
- name: 'displayTools',
19
- }
20
- );
21
- };
22
-
23
- const workerManager = getWebWorkerManager();
24
-
25
- const options = {
26
- maxWorkerInstances: 1, // Todo, make this configurable
27
- autoTerminateOnIdle: {
28
- enabled: true,
29
- idleTimeThreshold: 2000,
30
- },
31
- };
32
-
33
- workerManager.registerWorker('displayTools', workerFn, options);
34
- }
@@ -1,87 +0,0 @@
1
- import { expose } from 'comlink';
2
- import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane';
3
- import vtkClipClosedSurface from '@kitware/vtk.js/Filters/General/ClipClosedSurface';
4
- import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
5
-
6
- const obj = {
7
- /**
8
- * Clips a 3D surface using provided planes and updates the cache and progress.
9
- * The function takes in information about the planes and the polygon data, and applies a clipping filter.
10
- * It then updates the cache and progress based on the processed data.
11
- *
12
- * @param clipInfo - Contains information about the planes and the polygon data.
13
- * @param updateProgress - Callback function to update the progress of the clipping process.
14
- * @param updateCache - Callback function to update the cache with the clipped data.
15
- *
16
- * @throws Will throw an error if the clipping process encounters an issue.
17
- */
18
- clipSurfaceWithPlanes(
19
- { planesInfo, pointsAndPolys },
20
- progressCallback,
21
- updateCacheCallback
22
- ) {
23
- const numberOfPlanes = planesInfo.length;
24
- const clippingFilter = vtkClipClosedSurface.newInstance({
25
- clippingPlanes: [],
26
- activePlaneId: 2,
27
- passPointData: false,
28
- });
29
- clippingFilter.setGenerateOutline(true);
30
- clippingFilter.setGenerateFaces(false);
31
-
32
- const plane1 = vtkPlane.newInstance();
33
- const plane2 = vtkPlane.newInstance();
34
-
35
- try {
36
- for (const [index, planeInfo] of planesInfo.entries()) {
37
- const { sliceIndex, planes } = planeInfo;
38
-
39
- const polyDataResults = new Map();
40
- for (const polyDataInfo of pointsAndPolys) {
41
- const { points, polys, id } = polyDataInfo;
42
-
43
- const surfacePolyData = vtkPolyData.newInstance();
44
- surfacePolyData.getPoints().setData(points, 3);
45
- surfacePolyData.getPolys().setData(polys, 3);
46
-
47
- clippingFilter.setInputData(surfacePolyData);
48
-
49
- // Reusable array for clipping planes
50
- const clippingPlanes = [plane1, plane2];
51
-
52
- // Directly update plane instances
53
- plane1.setOrigin(planes[0].origin);
54
- plane1.setNormal(planes[0].normal);
55
- plane2.setOrigin(planes[1].origin);
56
- plane2.setNormal(planes[1].normal);
57
-
58
- clippingFilter.setClippingPlanes(clippingPlanes);
59
- clippingFilter.update();
60
-
61
- const polyData = clippingFilter.getOutputData();
62
-
63
- if (polyData) {
64
- polyDataResults.set(id, {
65
- points: polyData.getPoints().getData(),
66
- lines: polyData.getLines().getData(),
67
- });
68
- }
69
- }
70
-
71
- progressCallback({ progress: (index + 1) / numberOfPlanes });
72
-
73
- updateCacheCallback({ sliceIndex, polyDataResults });
74
- }
75
- } catch (e) {
76
- console.error('Error during processing', e);
77
- } finally {
78
- // Cleanup on completion
79
- pointsAndPolys = null;
80
- clippingFilter.delete();
81
- plane1.delete();
82
- plane2.delete();
83
- }
84
- },
85
- };
86
-
87
- expose(obj);