@cornerstonejs/tools 1.52.0 → 1.54.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 (909) hide show
  1. package/dist/cjs/drawingSvg/drawPath.d.ts +11 -0
  2. package/dist/cjs/drawingSvg/drawPath.js +55 -0
  3. package/dist/cjs/drawingSvg/drawPath.js.map +1 -0
  4. package/dist/cjs/drawingSvg/drawPolyline.d.ts +1 -1
  5. package/dist/cjs/drawingSvg/drawPolyline.js +2 -10
  6. package/dist/cjs/drawingSvg/drawPolyline.js.map +1 -1
  7. package/dist/cjs/drawingSvg/index.d.ts +2 -1
  8. package/dist/cjs/drawingSvg/index.js +3 -1
  9. package/dist/cjs/drawingSvg/index.js.map +1 -1
  10. package/dist/cjs/enums/WorkerTypes.d.ts +8 -0
  11. package/dist/cjs/enums/WorkerTypes.js +12 -0
  12. package/dist/cjs/enums/WorkerTypes.js.map +1 -0
  13. package/dist/cjs/enums/index.d.ts +2 -1
  14. package/dist/cjs/enums/index.js +3 -1
  15. package/dist/cjs/enums/index.js.map +1 -1
  16. package/dist/cjs/eventDispatchers/shared/getActiveToolForMouseEvent.js.map +1 -1
  17. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +1 -1
  18. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +171 -89
  19. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  20. package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +4 -3
  21. package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
  22. package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +58 -47
  23. package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -1
  24. package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +1 -0
  25. package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +5 -0
  26. package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
  27. package/dist/cjs/stateManagement/annotation/annotationState.d.ts +7 -1
  28. package/dist/cjs/stateManagement/annotation/annotationState.js +54 -1
  29. package/dist/cjs/stateManagement/annotation/annotationState.js.map +1 -1
  30. package/dist/cjs/stateManagement/annotation/helpers/state.d.ts +2 -1
  31. package/dist/cjs/stateManagement/annotation/helpers/state.js +14 -3
  32. package/dist/cjs/stateManagement/annotation/helpers/state.js.map +1 -1
  33. package/dist/cjs/stateManagement/index.d.ts +6 -1
  34. package/dist/cjs/stateManagement/index.js +6 -1
  35. package/dist/cjs/stateManagement/index.js.map +1 -1
  36. package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +4 -1
  37. package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
  38. package/dist/cjs/stateManagement/segmentation/addRepresentationData.d.ts +12 -0
  39. package/dist/cjs/stateManagement/segmentation/addRepresentationData.js +35 -0
  40. package/dist/cjs/stateManagement/segmentation/addRepresentationData.js.map +1 -0
  41. package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js +32 -14
  42. package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -1
  43. package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js +3 -52
  44. package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
  45. package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +9 -2
  46. package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js +44 -27
  47. package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -1
  48. package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +13 -0
  49. package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js +52 -26
  50. package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -1
  51. package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js +6 -9
  52. package/dist/cjs/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
  53. package/dist/cjs/stateManagement/segmentation/index.d.ts +3 -1
  54. package/dist/cjs/stateManagement/segmentation/index.js +5 -1
  55. package/dist/cjs/stateManagement/segmentation/index.js.map +1 -1
  56. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +2 -0
  57. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +8 -0
  58. package/dist/cjs/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -0
  59. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +2 -0
  60. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js +11 -0
  61. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js.map +1 -0
  62. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +7 -0
  63. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +162 -0
  64. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -0
  65. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +6 -0
  66. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +71 -0
  67. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -0
  68. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +6 -0
  69. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +120 -0
  70. package/dist/cjs/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -0
  71. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +4 -0
  72. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js +12 -0
  73. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js.map +1 -0
  74. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +3 -0
  75. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +52 -0
  76. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -0
  77. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +3 -0
  78. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +60 -0
  79. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -0
  80. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +5 -0
  81. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +56 -0
  82. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js.map +1 -0
  83. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +12 -0
  84. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js +94 -0
  85. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js.map +1 -0
  86. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts +1 -0
  87. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +74 -0
  88. package/dist/cjs/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js.map +1 -0
  89. package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts +2 -0
  90. package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +83 -0
  91. package/dist/cjs/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js.map +1 -0
  92. package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +3 -0
  93. package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +64 -0
  94. package/dist/cjs/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -0
  95. package/dist/cjs/stateManagement/segmentation/polySeg/index.d.ts +5 -0
  96. package/dist/cjs/stateManagement/segmentation/polySeg/index.js +12 -0
  97. package/dist/cjs/stateManagement/segmentation/polySeg/index.js.map +1 -0
  98. package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts +1 -0
  99. package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.js +27 -0
  100. package/dist/cjs/stateManagement/segmentation/polySeg/registerPolySegWorker.js.map +1 -0
  101. package/dist/cjs/stateManagement/segmentation/segmentIndex.js +4 -0
  102. package/dist/cjs/stateManagement/segmentation/segmentIndex.js.map +1 -1
  103. package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +6 -1
  104. package/dist/cjs/stateManagement/segmentation/segmentationState.js +30 -1
  105. package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
  106. package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +3 -1
  107. package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -2
  108. package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
  109. package/dist/cjs/tools/ScaleOverlayTool.js +2 -1
  110. package/dist/cjs/tools/ScaleOverlayTool.js.map +1 -1
  111. package/dist/cjs/tools/SegmentationIntersectionTool.js +1 -1
  112. package/dist/cjs/tools/SegmentationIntersectionTool.js.map +1 -1
  113. package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js +1 -1
  114. package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js.map +1 -1
  115. package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +4 -3
  116. package/dist/cjs/tools/annotation/LivewireContourTool.js +26 -26
  117. package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
  118. package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +1 -2
  119. package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +0 -11
  120. package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
  121. package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +2 -2
  122. package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
  123. package/dist/cjs/tools/annotation/ProbeTool.js +3 -0
  124. package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
  125. package/dist/cjs/tools/annotation/SplineROITool.d.ts +6 -3
  126. package/dist/cjs/tools/annotation/SplineROITool.js +37 -18
  127. package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
  128. package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +12 -7
  129. package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
  130. package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +25 -19
  131. package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
  132. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +16 -10
  133. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
  134. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
  135. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
  136. package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js +19 -7
  137. package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
  138. package/dist/cjs/tools/annotation/splines/LinearSpline.js +1 -1
  139. package/dist/cjs/tools/annotation/splines/LinearSpline.js.map +1 -1
  140. package/dist/cjs/tools/annotation/splines/Spline.d.ts +2 -0
  141. package/dist/cjs/tools/annotation/splines/Spline.js +7 -3
  142. package/dist/cjs/tools/annotation/splines/Spline.js.map +1 -1
  143. package/dist/cjs/tools/base/AnnotationTool.js +1 -1
  144. package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
  145. package/dist/cjs/tools/base/BaseTool.js.map +1 -1
  146. package/dist/cjs/tools/base/ContourBaseTool.d.ts +1 -0
  147. package/dist/cjs/tools/base/ContourBaseTool.js +18 -1
  148. package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
  149. package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +1 -2
  150. package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +28 -24
  151. package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  152. package/dist/cjs/tools/displayTools/Contour/contourConfig.js +1 -0
  153. package/dist/cjs/tools/displayTools/Contour/contourConfig.js.map +1 -1
  154. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +9 -6
  155. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  156. package/dist/cjs/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
  157. package/dist/cjs/tools/displayTools/Contour/{addContourSetsToElement.d.ts → vtkContour/addContourSetsToElement.d.ts} +1 -1
  158. package/dist/cjs/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +1 -0
  159. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +3 -0
  160. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js +14 -0
  161. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +1 -0
  162. package/dist/cjs/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +1 -0
  163. package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +3 -0
  164. package/dist/cjs/tools/displayTools/Contour/{updateContourSets.js → vtkContour/updateVTKContourSets.js} +4 -4
  165. package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +1 -0
  166. package/dist/cjs/tools/displayTools/Contour/{utils.d.ts → vtkContour/utils.d.ts} +2 -2
  167. package/dist/cjs/tools/displayTools/Contour/vtkContour/utils.js.map +1 -0
  168. package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js +1 -1
  169. package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
  170. package/dist/cjs/tools/displayTools/Labelmap/index.d.ts +2 -1
  171. package/dist/cjs/tools/displayTools/Labelmap/index.js +4 -1
  172. package/dist/cjs/tools/displayTools/Labelmap/index.js.map +1 -1
  173. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +20 -2
  174. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  175. package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.d.ts +4 -0
  176. package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.js +38 -0
  177. package/dist/cjs/tools/displayTools/Labelmap/validateLabelmap.js.map +1 -0
  178. package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts +3 -0
  179. package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +112 -0
  180. package/dist/cjs/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -0
  181. package/dist/cjs/tools/displayTools/Surface/surfaceConfig.d.ts +3 -0
  182. package/dist/cjs/tools/displayTools/Surface/surfaceConfig.js +11 -0
  183. package/dist/cjs/tools/displayTools/Surface/surfaceConfig.js.map +1 -0
  184. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +7 -0
  185. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +173 -27
  186. package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
  187. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.d.ts +1 -0
  188. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js +27 -0
  189. package/dist/cjs/tools/displayTools/registerDisplayToolsWorker.js.map +1 -0
  190. package/dist/cjs/tools/segmentation/BrushTool.js +1 -1
  191. package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
  192. package/dist/cjs/tools/segmentation/CircleScissorsTool.js +1 -1
  193. package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
  194. package/dist/cjs/tools/segmentation/PaintFillTool.js +1 -1
  195. package/dist/cjs/tools/segmentation/PaintFillTool.js.map +1 -1
  196. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js +1 -1
  197. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  198. package/dist/cjs/tools/segmentation/SegmentSelectTool.d.ts +6 -2
  199. package/dist/cjs/tools/segmentation/SegmentSelectTool.js +45 -35
  200. package/dist/cjs/tools/segmentation/SegmentSelectTool.js.map +1 -1
  201. package/dist/cjs/tools/segmentation/SphereScissorsTool.js +1 -1
  202. package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
  203. package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js +7 -5
  204. package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
  205. package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js +1 -1
  206. package/dist/cjs/tools/segmentation/strategies/compositions/regionFill.js.map +1 -1
  207. package/dist/cjs/tools/segmentation/strategies/fillSphere.js +14 -5
  208. package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
  209. package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js +21 -9
  210. package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
  211. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +5 -5
  212. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js +15 -8
  213. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -1
  214. package/dist/cjs/types/AnnotationTypes.d.ts +2 -0
  215. package/dist/cjs/types/ContourAnnotation.d.ts +6 -0
  216. package/dist/cjs/types/ContourAnnotation.js +7 -0
  217. package/dist/cjs/types/ContourAnnotation.js.map +1 -1
  218. package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +0 -1
  219. package/dist/cjs/types/ContourTypes.d.ts +1 -0
  220. package/dist/cjs/types/EventTypes.d.ts +4 -1
  221. package/dist/cjs/types/ISpline.d.ts +1 -0
  222. package/dist/cjs/types/LabelmapTypes.d.ts +5 -1
  223. package/dist/cjs/types/PolySeg.d.ts +6 -0
  224. package/dist/cjs/types/PolySeg.js +3 -0
  225. package/dist/cjs/types/PolySeg.js.map +1 -0
  226. package/dist/cjs/types/SegmentationStateTypes.d.ts +12 -2
  227. package/dist/cjs/types/SplineProps.d.ts +1 -0
  228. package/dist/cjs/types/SurfaceTypes.d.ts +1 -1
  229. package/dist/cjs/types/index.d.ts +2 -1
  230. package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js +6 -6
  231. package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
  232. package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +2 -0
  233. package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js +20 -0
  234. package/dist/cjs/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -0
  235. package/dist/cjs/utilities/contourSegmentation/areSameSegment.js +0 -2
  236. package/dist/cjs/utilities/contourSegmentation/areSameSegment.js.map +1 -1
  237. package/dist/cjs/utilities/contourSegmentation/index.d.ts +2 -0
  238. package/dist/cjs/utilities/contourSegmentation/index.js +5 -1
  239. package/dist/cjs/utilities/contourSegmentation/index.js.map +1 -1
  240. package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +2 -0
  241. package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +19 -0
  242. package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -0
  243. package/dist/cjs/utilities/contours/detectContourHoles.js.map +1 -1
  244. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +2 -2
  245. package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  246. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.d.ts +3 -0
  247. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.js +21 -0
  248. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.js.map +1 -0
  249. package/dist/cjs/utilities/contours/getContourHolesDataWorld.d.ts +3 -0
  250. package/dist/cjs/utilities/contours/getContourHolesDataWorld.js +10 -0
  251. package/dist/cjs/utilities/contours/getContourHolesDataWorld.js.map +1 -0
  252. package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts +11 -0
  253. package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.js +50 -0
  254. package/dist/cjs/utilities/contours/getDeduplicatedVTKPolyDataPoints.js.map +1 -0
  255. package/dist/cjs/utilities/contours/index.d.ts +5 -2
  256. package/dist/cjs/utilities/contours/index.js +9 -3
  257. package/dist/cjs/utilities/contours/index.js.map +1 -1
  258. package/dist/cjs/utilities/contours/updateContourPolyline.d.ts +10 -0
  259. package/dist/cjs/utilities/contours/updateContourPolyline.js +64 -0
  260. package/dist/cjs/utilities/contours/updateContourPolyline.js.map +1 -0
  261. package/dist/cjs/utilities/index.d.ts +3 -1
  262. package/dist/cjs/utilities/index.js +5 -1
  263. package/dist/cjs/utilities/index.js.map +1 -1
  264. package/dist/cjs/utilities/math/polyline/containsPoint.js.map +1 -1
  265. package/dist/cjs/utilities/math/polyline/containsPoints.d.ts +2 -0
  266. package/dist/cjs/utilities/math/polyline/containsPoints.js +16 -0
  267. package/dist/cjs/utilities/math/polyline/containsPoints.js.map +1 -0
  268. package/dist/cjs/utilities/math/polyline/getWindingDirection.d.ts +2 -0
  269. package/dist/cjs/utilities/math/polyline/getWindingDirection.js +12 -0
  270. package/dist/cjs/utilities/math/polyline/getWindingDirection.js.map +1 -0
  271. package/dist/cjs/utilities/math/polyline/index.d.ts +4 -1
  272. package/dist/cjs/utilities/math/polyline/index.js +7 -1
  273. package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
  274. package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.d.ts +2 -0
  275. package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.js +34 -0
  276. package/dist/cjs/utilities/math/polyline/isPointInsidePolyline3D.js.map +1 -0
  277. package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +1 -0
  278. package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js +0 -1
  279. package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -1
  280. package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts +1 -0
  281. package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.js +18 -0
  282. package/dist/cjs/utilities/segmentation/getHoveredContourSegmentationAnnotation.js.map +1 -0
  283. package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +7 -0
  284. package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.js +77 -0
  285. package/dist/cjs/utilities/segmentation/getSegmentAtLabelmapBorder.js.map +1 -0
  286. package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.d.ts +11 -0
  287. package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.js +82 -0
  288. package/dist/cjs/utilities/segmentation/getSegmentAtWorldPoint.js.map +1 -0
  289. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.d.ts +2 -0
  290. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js +59 -0
  291. package/dist/cjs/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -0
  292. package/dist/cjs/utilities/segmentation/index.d.ts +5 -1
  293. package/dist/cjs/utilities/segmentation/index.js +9 -1
  294. package/dist/cjs/utilities/segmentation/index.js.map +1 -1
  295. package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.d.ts +2 -0
  296. package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.js +32 -0
  297. package/dist/cjs/utilities/triggerAnnotationRenderForToolGroupIds.js.map +1 -0
  298. package/dist/cjs/workers/clippingPlaneWorker.d.ts +1 -0
  299. package/dist/cjs/workers/clippingPlaneWorker.js +63 -0
  300. package/dist/cjs/workers/clippingPlaneWorker.js.map +1 -0
  301. package/dist/cjs/workers/polySegConverters.d.ts +1 -0
  302. package/dist/cjs/workers/polySegConverters.js +267 -0
  303. package/dist/cjs/workers/polySegConverters.js.map +1 -0
  304. package/dist/esm/drawingSvg/drawPath.js +49 -0
  305. package/dist/esm/drawingSvg/drawPath.js.map +1 -0
  306. package/dist/esm/drawingSvg/drawPolyline.js +2 -10
  307. package/dist/esm/drawingSvg/drawPolyline.js.map +1 -1
  308. package/dist/esm/drawingSvg/index.js +2 -1
  309. package/dist/esm/drawingSvg/index.js.map +1 -1
  310. package/dist/esm/enums/WorkerTypes.js +10 -0
  311. package/dist/esm/enums/WorkerTypes.js.map +1 -0
  312. package/dist/esm/enums/index.js +2 -1
  313. package/dist/esm/enums/index.js.map +1 -1
  314. package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.js.map +1 -1
  315. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +112 -43
  316. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  317. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +3 -3
  318. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
  319. package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +59 -45
  320. package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -1
  321. package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +5 -0
  322. package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
  323. package/dist/esm/stateManagement/annotation/annotationState.js +46 -1
  324. package/dist/esm/stateManagement/annotation/annotationState.js.map +1 -1
  325. package/dist/esm/stateManagement/annotation/helpers/state.js +12 -2
  326. package/dist/esm/stateManagement/annotation/helpers/state.js.map +1 -1
  327. package/dist/esm/stateManagement/index.js +2 -2
  328. package/dist/esm/stateManagement/index.js.map +1 -1
  329. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +4 -1
  330. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
  331. package/dist/esm/stateManagement/segmentation/addRepresentationData.js +30 -0
  332. package/dist/esm/stateManagement/segmentation/addRepresentationData.js.map +1 -0
  333. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +32 -15
  334. package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -1
  335. package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +1 -46
  336. package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
  337. package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +42 -27
  338. package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -1
  339. package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +49 -25
  340. package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -1
  341. package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js +6 -6
  342. package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.js.map +1 -1
  343. package/dist/esm/stateManagement/segmentation/index.js +3 -1
  344. package/dist/esm/stateManagement/segmentation/index.js.map +1 -1
  345. package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js +4 -0
  346. package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.js.map +1 -0
  347. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js +7 -0
  348. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.js.map +1 -0
  349. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +142 -0
  350. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js.map +1 -0
  351. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +53 -0
  352. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js.map +1 -0
  353. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +108 -0
  354. package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js.map +1 -0
  355. package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js +8 -0
  356. package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.js.map +1 -0
  357. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +37 -0
  358. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js.map +1 -0
  359. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +45 -0
  360. package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js.map +1 -0
  361. package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +41 -0
  362. package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js.map +1 -0
  363. package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js +78 -0
  364. package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.js.map +1 -0
  365. package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +59 -0
  366. package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js.map +1 -0
  367. package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +68 -0
  368. package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js.map +1 -0
  369. package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js +47 -0
  370. package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.js.map +1 -0
  371. package/dist/esm/stateManagement/segmentation/polySeg/index.js +6 -0
  372. package/dist/esm/stateManagement/segmentation/polySeg/index.js.map +1 -0
  373. package/dist/esm/stateManagement/segmentation/polySeg/registerPolySegWorker.js +23 -0
  374. package/dist/esm/stateManagement/segmentation/polySeg/registerPolySegWorker.js.map +1 -0
  375. package/dist/esm/stateManagement/segmentation/segmentIndex.js +4 -0
  376. package/dist/esm/stateManagement/segmentation/segmentIndex.js.map +1 -1
  377. package/dist/esm/stateManagement/segmentation/segmentationState.js +28 -1
  378. package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
  379. package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -2
  380. package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
  381. package/dist/esm/tools/ScaleOverlayTool.js +2 -1
  382. package/dist/esm/tools/ScaleOverlayTool.js.map +1 -1
  383. package/dist/esm/tools/SegmentationIntersectionTool.js +1 -1
  384. package/dist/esm/tools/SegmentationIntersectionTool.js.map +1 -1
  385. package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +1 -1
  386. package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js.map +1 -1
  387. package/dist/esm/tools/annotation/LivewireContourTool.js +28 -28
  388. package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
  389. package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +0 -11
  390. package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
  391. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +3 -3
  392. package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
  393. package/dist/esm/tools/annotation/ProbeTool.js +3 -0
  394. package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
  395. package/dist/esm/tools/annotation/SplineROITool.js +37 -19
  396. package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
  397. package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +12 -7
  398. package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
  399. package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +26 -20
  400. package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
  401. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +16 -10
  402. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
  403. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
  404. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
  405. package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js +20 -8
  406. package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
  407. package/dist/esm/tools/annotation/splines/LinearSpline.js +1 -1
  408. package/dist/esm/tools/annotation/splines/LinearSpline.js.map +1 -1
  409. package/dist/esm/tools/annotation/splines/Spline.js +5 -1
  410. package/dist/esm/tools/annotation/splines/Spline.js.map +1 -1
  411. package/dist/esm/tools/base/AnnotationTool.js +1 -1
  412. package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
  413. package/dist/esm/tools/base/BaseTool.js +1 -1
  414. package/dist/esm/tools/base/BaseTool.js.map +1 -1
  415. package/dist/esm/tools/base/ContourBaseTool.js +20 -3
  416. package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
  417. package/dist/esm/tools/base/ContourSegmentationBaseTool.js +28 -24
  418. package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  419. package/dist/esm/tools/displayTools/Contour/contourConfig.js +1 -0
  420. package/dist/esm/tools/displayTools/Contour/contourConfig.js.map +1 -1
  421. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +10 -7
  422. package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  423. package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
  424. package/dist/esm/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +1 -0
  425. package/dist/esm/tools/displayTools/Contour/{addOrUpdateContourSets.js → vtkContour/addOrUpdateVTKContourSets.js} +4 -4
  426. package/dist/esm/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +1 -0
  427. package/dist/esm/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +1 -0
  428. package/dist/esm/tools/displayTools/Contour/{updateContourSets.js → vtkContour/updateVTKContourSets.js} +2 -2
  429. package/dist/esm/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +1 -0
  430. package/dist/esm/tools/displayTools/Contour/vtkContour/utils.js.map +1 -0
  431. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +1 -1
  432. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
  433. package/dist/esm/tools/displayTools/Labelmap/index.js +2 -1
  434. package/dist/esm/tools/displayTools/Labelmap/index.js.map +1 -1
  435. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +20 -2
  436. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  437. package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.js +33 -0
  438. package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.js.map +1 -0
  439. package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js +106 -0
  440. package/dist/esm/tools/displayTools/Surface/addOrUpdateSurfaceToElement.js.map +1 -0
  441. package/dist/esm/tools/displayTools/Surface/surfaceConfig.js +9 -0
  442. package/dist/esm/tools/displayTools/Surface/surfaceConfig.js.map +1 -0
  443. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +162 -28
  444. package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
  445. package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js +23 -0
  446. package/dist/esm/tools/displayTools/registerDisplayToolsWorker.js.map +1 -0
  447. package/dist/esm/tools/segmentation/BrushTool.js +1 -1
  448. package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
  449. package/dist/esm/tools/segmentation/CircleScissorsTool.js +1 -1
  450. package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
  451. package/dist/esm/tools/segmentation/PaintFillTool.js +1 -1
  452. package/dist/esm/tools/segmentation/PaintFillTool.js.map +1 -1
  453. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +1 -1
  454. package/dist/esm/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  455. package/dist/esm/tools/segmentation/SegmentSelectTool.js +47 -37
  456. package/dist/esm/tools/segmentation/SegmentSelectTool.js.map +1 -1
  457. package/dist/esm/tools/segmentation/SphereScissorsTool.js +1 -1
  458. package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
  459. package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +7 -5
  460. package/dist/esm/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
  461. package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js +1 -1
  462. package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js.map +1 -1
  463. package/dist/esm/tools/segmentation/strategies/fillSphere.js +14 -5
  464. package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
  465. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +21 -9
  466. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -1
  467. package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js +15 -7
  468. package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -1
  469. package/dist/esm/types/ContourAnnotation.js +6 -1
  470. package/dist/esm/types/ContourAnnotation.js.map +1 -1
  471. package/dist/esm/types/PolySeg.js +2 -0
  472. package/dist/esm/types/PolySeg.js.map +1 -0
  473. package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js +3 -2
  474. package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
  475. package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js +16 -0
  476. package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.js.map +1 -0
  477. package/dist/esm/utilities/contourSegmentation/areSameSegment.js +0 -2
  478. package/dist/esm/utilities/contourSegmentation/areSameSegment.js.map +1 -1
  479. package/dist/esm/utilities/contourSegmentation/index.js +2 -0
  480. package/dist/esm/utilities/contourSegmentation/index.js.map +1 -1
  481. package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +15 -0
  482. package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -0
  483. package/dist/esm/utilities/contours/detectContourHoles.js.map +1 -1
  484. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +2 -2
  485. package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -1
  486. package/dist/esm/utilities/contours/getContourHolesDataCanvas.js +15 -0
  487. package/dist/esm/utilities/contours/getContourHolesDataCanvas.js.map +1 -0
  488. package/dist/esm/utilities/contours/getContourHolesDataWorld.js +6 -0
  489. package/dist/esm/utilities/contours/getContourHolesDataWorld.js.map +1 -0
  490. package/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js +46 -0
  491. package/dist/esm/utilities/contours/getDeduplicatedVTKPolyDataPoints.js.map +1 -0
  492. package/dist/esm/utilities/contours/index.js +5 -2
  493. package/dist/esm/utilities/contours/index.js.map +1 -1
  494. package/dist/esm/utilities/contours/updateContourPolyline.js +38 -0
  495. package/dist/esm/utilities/contours/updateContourPolyline.js.map +1 -0
  496. package/dist/esm/utilities/index.js +3 -1
  497. package/dist/esm/utilities/index.js.map +1 -1
  498. package/dist/esm/utilities/math/polyline/containsPoint.js.map +1 -1
  499. package/dist/esm/utilities/math/polyline/containsPoints.js +10 -0
  500. package/dist/esm/utilities/math/polyline/containsPoints.js.map +1 -0
  501. package/dist/esm/utilities/math/polyline/getWindingDirection.js +6 -0
  502. package/dist/esm/utilities/math/polyline/getWindingDirection.js.map +1 -0
  503. package/dist/esm/utilities/math/polyline/index.js +4 -1
  504. package/dist/esm/utilities/math/polyline/index.js.map +1 -1
  505. package/dist/esm/utilities/math/polyline/isPointInsidePolyline3D.js +27 -0
  506. package/dist/esm/utilities/math/polyline/isPointInsidePolyline3D.js.map +1 -0
  507. package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js +0 -1
  508. package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -1
  509. package/dist/esm/utilities/segmentation/getHoveredContourSegmentationAnnotation.js +14 -0
  510. package/dist/esm/utilities/segmentation/getHoveredContourSegmentationAnnotation.js.map +1 -0
  511. package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.js +73 -0
  512. package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.js.map +1 -0
  513. package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.js +75 -0
  514. package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.js.map +1 -0
  515. package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +55 -0
  516. package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js.map +1 -0
  517. package/dist/esm/utilities/segmentation/index.js +5 -1
  518. package/dist/esm/utilities/segmentation/index.js.map +1 -1
  519. package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js +25 -0
  520. package/dist/esm/utilities/triggerAnnotationRenderForToolGroupIds.js.map +1 -0
  521. package/dist/esm/workers/clippingPlaneWorker.js +58 -0
  522. package/dist/esm/workers/clippingPlaneWorker.js.map +1 -0
  523. package/dist/esm/workers/polySegConverters.js +241 -0
  524. package/dist/esm/workers/polySegConverters.js.map +1 -0
  525. package/dist/types/drawingSvg/drawPath.d.ts +12 -0
  526. package/dist/types/drawingSvg/drawPath.d.ts.map +1 -0
  527. package/dist/types/drawingSvg/drawPolyline.d.ts +1 -1
  528. package/dist/types/drawingSvg/drawPolyline.d.ts.map +1 -1
  529. package/dist/types/drawingSvg/index.d.ts +2 -1
  530. package/dist/types/drawingSvg/index.d.ts.map +1 -1
  531. package/dist/types/enums/WorkerTypes.d.ts +9 -0
  532. package/dist/types/enums/WorkerTypes.d.ts.map +1 -0
  533. package/dist/types/enums/index.d.ts +2 -1
  534. package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +1 -1
  535. package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -1
  536. package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -1
  537. package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts.map +1 -1
  538. package/dist/types/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +1 -0
  539. package/dist/types/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts.map +1 -1
  540. package/dist/types/stateManagement/annotation/annotationState.d.ts +7 -1
  541. package/dist/types/stateManagement/annotation/annotationState.d.ts.map +1 -1
  542. package/dist/types/stateManagement/annotation/helpers/state.d.ts +2 -1
  543. package/dist/types/stateManagement/annotation/helpers/state.d.ts.map +1 -1
  544. package/dist/types/stateManagement/index.d.ts +6 -1
  545. package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts.map +1 -1
  546. package/dist/types/stateManagement/segmentation/addRepresentationData.d.ts +13 -0
  547. package/dist/types/stateManagement/segmentation/addRepresentationData.d.ts.map +1 -0
  548. package/dist/types/stateManagement/segmentation/addSegmentationRepresentation.d.ts.map +1 -1
  549. package/dist/types/stateManagement/segmentation/config/segmentationVisibility.d.ts.map +1 -1
  550. package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +9 -2
  551. package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts.map +1 -1
  552. package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +13 -0
  553. package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts.map +1 -1
  554. package/dist/types/stateManagement/segmentation/helpers/validateSegmentationInput.d.ts.map +1 -1
  555. package/dist/types/stateManagement/segmentation/index.d.ts +3 -1
  556. package/dist/types/stateManagement/segmentation/index.d.ts.map +1 -1
  557. package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +3 -0
  558. package/dist/types/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts.map +1 -0
  559. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +3 -0
  560. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts.map +1 -0
  561. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +8 -0
  562. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts.map +1 -0
  563. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +7 -0
  564. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts.map +1 -0
  565. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +7 -0
  566. package/dist/types/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts.map +1 -0
  567. package/dist/types/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +5 -0
  568. package/dist/types/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts.map +1 -0
  569. package/dist/types/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +4 -0
  570. package/dist/types/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts.map +1 -0
  571. package/dist/types/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +4 -0
  572. package/dist/types/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts.map +1 -0
  573. package/dist/types/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +6 -0
  574. package/dist/types/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts.map +1 -0
  575. package/dist/types/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +13 -0
  576. package/dist/types/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts.map +1 -0
  577. package/dist/types/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts +2 -0
  578. package/dist/types/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.d.ts.map +1 -0
  579. package/dist/types/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts +3 -0
  580. package/dist/types/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.d.ts.map +1 -0
  581. package/dist/types/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +4 -0
  582. package/dist/types/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts.map +1 -0
  583. package/dist/types/stateManagement/segmentation/polySeg/index.d.ts +6 -0
  584. package/dist/types/stateManagement/segmentation/polySeg/index.d.ts.map +1 -0
  585. package/dist/types/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts +2 -0
  586. package/dist/types/stateManagement/segmentation/polySeg/registerPolySegWorker.d.ts.map +1 -0
  587. package/dist/types/stateManagement/segmentation/segmentIndex.d.ts.map +1 -1
  588. package/dist/types/stateManagement/segmentation/segmentationState.d.ts +6 -1
  589. package/dist/types/stateManagement/segmentation/segmentationState.d.ts.map +1 -1
  590. package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +3 -1
  591. package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
  592. package/dist/types/tools/ScaleOverlayTool.d.ts.map +1 -1
  593. package/dist/types/tools/annotation/LivewireContourTool.d.ts +4 -3
  594. package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
  595. package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +1 -2
  596. package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
  597. package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
  598. package/dist/types/tools/annotation/ProbeTool.d.ts.map +1 -1
  599. package/dist/types/tools/annotation/SplineROITool.d.ts +6 -3
  600. package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
  601. package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
  602. package/dist/types/tools/annotation/planarFreehandROITool/drawLoop.d.ts.map +1 -1
  603. package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
  604. package/dist/types/tools/annotation/planarFreehandROITool/renderMethods.d.ts.map +1 -1
  605. package/dist/types/tools/annotation/splines/Spline.d.ts +2 -0
  606. package/dist/types/tools/annotation/splines/Spline.d.ts.map +1 -1
  607. package/dist/types/tools/base/AnnotationTool.d.ts.map +1 -1
  608. package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
  609. package/dist/types/tools/base/ContourBaseTool.d.ts +1 -0
  610. package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -1
  611. package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +1 -2
  612. package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
  613. package/dist/types/tools/displayTools/Contour/contourConfig.d.ts.map +1 -1
  614. package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
  615. package/dist/types/tools/displayTools/Contour/removeContourFromElement.d.ts.map +1 -1
  616. package/dist/types/tools/displayTools/Contour/{addContourSetsToElement.d.ts → vtkContour/addContourSetsToElement.d.ts} +1 -1
  617. package/dist/types/tools/displayTools/Contour/vtkContour/addContourSetsToElement.d.ts.map +1 -0
  618. package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +4 -0
  619. package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts.map +1 -0
  620. package/dist/types/tools/displayTools/Contour/vtkContour/contourConfigCache.d.ts.map +1 -0
  621. package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +4 -0
  622. package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts.map +1 -0
  623. package/dist/types/tools/displayTools/Contour/{utils.d.ts → vtkContour/utils.d.ts} +2 -2
  624. package/dist/types/tools/displayTools/Contour/vtkContour/utils.d.ts.map +1 -0
  625. package/dist/types/tools/displayTools/Labelmap/index.d.ts +2 -1
  626. package/dist/types/tools/displayTools/Labelmap/index.d.ts.map +1 -1
  627. package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
  628. package/dist/types/tools/displayTools/Labelmap/validateLabelmap.d.ts +5 -0
  629. package/dist/types/tools/displayTools/Labelmap/validateLabelmap.d.ts.map +1 -0
  630. package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts +4 -0
  631. package/dist/types/tools/displayTools/Surface/addOrUpdateSurfaceToElement.d.ts.map +1 -0
  632. package/dist/types/tools/displayTools/Surface/surfaceConfig.d.ts +4 -0
  633. package/dist/types/tools/displayTools/Surface/surfaceConfig.d.ts.map +1 -0
  634. package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +7 -0
  635. package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
  636. package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts +2 -0
  637. package/dist/types/tools/displayTools/registerDisplayToolsWorker.d.ts.map +1 -0
  638. package/dist/types/tools/segmentation/CircleScissorsTool.d.ts.map +1 -1
  639. package/dist/types/tools/segmentation/RectangleScissorsTool.d.ts.map +1 -1
  640. package/dist/types/tools/segmentation/SegmentSelectTool.d.ts +6 -2
  641. package/dist/types/tools/segmentation/SegmentSelectTool.d.ts.map +1 -1
  642. package/dist/types/tools/segmentation/SphereScissorsTool.d.ts.map +1 -1
  643. package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts.map +1 -1
  644. package/dist/types/tools/segmentation/strategies/fillSphere.d.ts.map +1 -1
  645. package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts.map +1 -1
  646. package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +5 -5
  647. package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts.map +1 -1
  648. package/dist/types/types/AnnotationTypes.d.ts +2 -0
  649. package/dist/types/types/AnnotationTypes.d.ts.map +1 -1
  650. package/dist/types/types/ContourAnnotation.d.ts +6 -0
  651. package/dist/types/types/ContourAnnotation.d.ts.map +1 -1
  652. package/dist/types/types/ContourSegmentationAnnotation.d.ts +0 -1
  653. package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
  654. package/dist/types/types/ContourTypes.d.ts +1 -0
  655. package/dist/types/types/ContourTypes.d.ts.map +1 -1
  656. package/dist/types/types/EventTypes.d.ts +4 -1
  657. package/dist/types/types/EventTypes.d.ts.map +1 -1
  658. package/dist/types/types/ISpline.d.ts +1 -0
  659. package/dist/types/types/ISpline.d.ts.map +1 -1
  660. package/dist/types/types/LabelmapTypes.d.ts +5 -1
  661. package/dist/types/types/LabelmapTypes.d.ts.map +1 -1
  662. package/dist/types/types/PolySeg.d.ts +7 -0
  663. package/dist/types/types/PolySeg.d.ts.map +1 -0
  664. package/dist/types/types/SegmentationStateTypes.d.ts +12 -2
  665. package/dist/types/types/SegmentationStateTypes.d.ts.map +1 -1
  666. package/dist/types/types/SplineProps.d.ts +1 -0
  667. package/dist/types/types/SplineProps.d.ts.map +1 -1
  668. package/dist/types/types/SurfaceTypes.d.ts +1 -1
  669. package/dist/types/types/SurfaceTypes.d.ts.map +1 -1
  670. package/dist/types/types/index.d.ts +2 -1
  671. package/dist/types/types/index.d.ts.map +1 -1
  672. package/dist/types/utilities/boundingBox/getBoundingBoxAroundShape.d.ts.map +1 -1
  673. package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +3 -0
  674. package/dist/types/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts.map +1 -0
  675. package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts.map +1 -1
  676. package/dist/types/utilities/contourSegmentation/index.d.ts +2 -0
  677. package/dist/types/utilities/contourSegmentation/index.d.ts.map +1 -1
  678. package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +3 -0
  679. package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -0
  680. package/dist/types/utilities/contours/detectContourHoles.d.ts.map +1 -1
  681. package/dist/types/utilities/contours/getContourHolesDataCanvas.d.ts +4 -0
  682. package/dist/types/utilities/contours/getContourHolesDataCanvas.d.ts.map +1 -0
  683. package/dist/types/utilities/contours/getContourHolesDataWorld.d.ts +4 -0
  684. package/dist/types/utilities/contours/getContourHolesDataWorld.d.ts.map +1 -0
  685. package/dist/types/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts +12 -0
  686. package/dist/types/utilities/contours/getDeduplicatedVTKPolyDataPoints.d.ts.map +1 -0
  687. package/dist/types/utilities/contours/index.d.ts +5 -2
  688. package/dist/types/utilities/contours/index.d.ts.map +1 -1
  689. package/dist/types/utilities/contours/updateContourPolyline.d.ts +11 -0
  690. package/dist/types/utilities/contours/updateContourPolyline.d.ts.map +1 -0
  691. package/dist/types/utilities/index.d.ts +3 -1
  692. package/dist/types/utilities/index.d.ts.map +1 -1
  693. package/dist/types/utilities/math/polyline/containsPoint.d.ts.map +1 -1
  694. package/dist/types/utilities/math/polyline/containsPoints.d.ts +3 -0
  695. package/dist/types/utilities/math/polyline/containsPoints.d.ts.map +1 -0
  696. package/dist/types/utilities/math/polyline/getWindingDirection.d.ts +3 -0
  697. package/dist/types/utilities/math/polyline/getWindingDirection.d.ts.map +1 -0
  698. package/dist/types/utilities/math/polyline/index.d.ts +4 -1
  699. package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
  700. package/dist/types/utilities/math/polyline/isPointInsidePolyline3D.d.ts +3 -0
  701. package/dist/types/utilities/math/polyline/isPointInsidePolyline3D.d.ts.map +1 -0
  702. package/dist/types/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +1 -0
  703. package/dist/types/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts.map +1 -1
  704. package/dist/types/utilities/segmentation/contourAndFindLargestBidirectional.d.ts.map +1 -1
  705. package/dist/types/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts +2 -0
  706. package/dist/types/utilities/segmentation/getHoveredContourSegmentationAnnotation.d.ts.map +1 -0
  707. package/dist/types/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +8 -0
  708. package/dist/types/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts.map +1 -0
  709. package/dist/types/utilities/segmentation/getSegmentAtWorldPoint.d.ts +12 -0
  710. package/dist/types/utilities/segmentation/getSegmentAtWorldPoint.d.ts.map +1 -0
  711. package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts +3 -0
  712. package/dist/types/utilities/segmentation/getUniqueSegmentIndices.d.ts.map +1 -0
  713. package/dist/types/utilities/segmentation/index.d.ts +5 -1
  714. package/dist/types/utilities/segmentation/index.d.ts.map +1 -1
  715. package/dist/types/utilities/triggerAnnotationRenderForToolGroupIds.d.ts +3 -0
  716. package/dist/types/utilities/triggerAnnotationRenderForToolGroupIds.d.ts.map +1 -0
  717. package/dist/types/workers/clippingPlaneWorker.d.ts +2 -0
  718. package/dist/types/workers/clippingPlaneWorker.d.ts.map +1 -0
  719. package/dist/types/workers/polySegConverters.d.ts +2 -0
  720. package/dist/types/workers/polySegConverters.d.ts.map +1 -0
  721. package/dist/umd/17dd54813d5acc10bf8f.wasm +0 -0
  722. package/dist/umd/444.index.js +3 -0
  723. package/dist/umd/444.index.js.LICENSE.txt +5 -0
  724. package/dist/umd/444.index.js.map +1 -0
  725. package/dist/umd/78.index.js +3 -0
  726. package/dist/umd/78.index.js.LICENSE.txt +5 -0
  727. package/dist/umd/78.index.js.map +1 -0
  728. package/dist/umd/985.index.js +2 -0
  729. package/dist/umd/985.index.js.map +1 -0
  730. package/dist/umd/index.js +1 -1
  731. package/dist/umd/index.js.map +1 -1
  732. package/package.json +5 -3
  733. package/src/drawingSvg/drawPath.ts +96 -0
  734. package/src/drawingSvg/drawPolyline.ts +12 -16
  735. package/src/drawingSvg/index.ts +2 -0
  736. package/src/enums/WorkerTypes.ts +16 -0
  737. package/src/enums/index.js +2 -0
  738. package/src/eventDispatchers/shared/getActiveToolForMouseEvent.ts +1 -1
  739. package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +204 -75
  740. package/src/eventListeners/segmentation/imageChangeEventListener.ts +3 -4
  741. package/src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts +97 -69
  742. package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +11 -0
  743. package/src/stateManagement/annotation/annotationState.ts +107 -0
  744. package/src/stateManagement/annotation/helpers/state.ts +29 -1
  745. package/src/stateManagement/index.js +10 -0
  746. package/src/stateManagement/segmentation/SegmentationStateManager.ts +4 -1
  747. package/src/stateManagement/segmentation/addRepresentationData.ts +71 -0
  748. package/src/stateManagement/segmentation/addSegmentationRepresentation.ts +39 -16
  749. package/src/stateManagement/segmentation/config/segmentationVisibility.ts +1 -59
  750. package/src/stateManagement/segmentation/convertStackToVolumeSegmentation.ts +74 -37
  751. package/src/stateManagement/segmentation/convertVolumeToStackSegmentation.ts +102 -38
  752. package/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +13 -8
  753. package/src/stateManagement/segmentation/index.ts +9 -2
  754. package/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +17 -0
  755. package/src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts +25 -0
  756. package/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +273 -0
  757. package/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +89 -0
  758. package/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +193 -0
  759. package/src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts +26 -0
  760. package/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +62 -0
  761. package/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +81 -0
  762. package/src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts +81 -0
  763. package/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts +167 -0
  764. package/src/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.ts +95 -0
  765. package/src/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.ts +123 -0
  766. package/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +97 -0
  767. package/src/stateManagement/segmentation/polySeg/index.ts +12 -0
  768. package/src/stateManagement/segmentation/polySeg/registerPolySegWorker.ts +34 -0
  769. package/src/stateManagement/segmentation/segmentIndex.ts +5 -0
  770. package/src/stateManagement/segmentation/segmentationState.ts +62 -0
  771. package/src/store/ToolGroupManager/ToolGroup.ts +9 -2
  772. package/src/tools/ScaleOverlayTool.ts +4 -1
  773. package/src/tools/SegmentationIntersectionTool.ts +1 -1
  774. package/src/tools/annotation/LivewireContourSegmentationTool.ts +1 -1
  775. package/src/tools/annotation/LivewireContourTool.ts +65 -38
  776. package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +1 -22
  777. package/src/tools/annotation/PlanarFreehandROITool.ts +8 -5
  778. package/src/tools/annotation/ProbeTool.ts +4 -0
  779. package/src/tools/annotation/SplineROITool.ts +76 -29
  780. package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +20 -11
  781. package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +42 -23
  782. package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +28 -13
  783. package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +1 -1
  784. package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +28 -10
  785. package/src/tools/annotation/splines/LinearSpline.ts +1 -1
  786. package/src/tools/annotation/splines/Spline.ts +13 -1
  787. package/src/tools/base/AnnotationTool.ts +2 -1
  788. package/src/tools/base/BaseTool.ts +1 -6
  789. package/src/tools/base/ContourBaseTool.ts +46 -4
  790. package/src/tools/base/ContourSegmentationBaseTool.ts +51 -42
  791. package/src/tools/displayTools/Contour/contourConfig.ts +1 -0
  792. package/src/tools/displayTools/Contour/contourDisplay.ts +82 -9
  793. package/src/tools/displayTools/Contour/removeContourFromElement.ts +2 -0
  794. package/src/tools/displayTools/Contour/{addContourSetsToElement.ts → vtkContour/addContourSetsToElement.ts} +1 -1
  795. package/src/tools/displayTools/Contour/{addOrUpdateContourSets.ts → vtkContour/addOrUpdateVTKContourSets.ts} +4 -4
  796. package/src/tools/displayTools/Contour/{updateContourSets.ts → vtkContour/updateVTKContourSets.ts} +2 -2
  797. package/src/tools/displayTools/Contour/{utils.ts → vtkContour/utils.ts} +1 -1
  798. package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +1 -1
  799. package/src/tools/displayTools/Labelmap/index.ts +10 -1
  800. package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +39 -4
  801. package/src/tools/displayTools/Labelmap/validateLabelmap.ts +71 -0
  802. package/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +172 -0
  803. package/src/tools/displayTools/Surface/surfaceConfig.ts +12 -0
  804. package/src/tools/displayTools/Surface/surfaceDisplay.ts +275 -35
  805. package/src/tools/displayTools/registerDisplayToolsWorker.ts +34 -0
  806. package/src/tools/segmentation/BrushTool.ts +1 -1
  807. package/src/tools/segmentation/CircleScissorsTool.ts +3 -1
  808. package/src/tools/segmentation/PaintFillTool.ts +1 -1
  809. package/src/tools/segmentation/RectangleScissorsTool.ts +3 -1
  810. package/src/tools/segmentation/SegmentSelectTool.ts +70 -75
  811. package/src/tools/segmentation/SphereScissorsTool.ts +3 -1
  812. package/src/tools/segmentation/strategies/BrushStrategy.ts +12 -9
  813. package/src/tools/segmentation/strategies/compositions/regionFill.ts +1 -1
  814. package/src/tools/segmentation/strategies/fillSphere.ts +13 -5
  815. package/src/tools/segmentation/strategies/utils/getStrategyData.ts +30 -15
  816. package/src/tools/segmentation/strategies/utils/stackVolumeCheck.ts +24 -17
  817. package/src/types/AnnotationTypes.ts +14 -0
  818. package/src/types/ContourAnnotation.ts +13 -0
  819. package/src/types/ContourSegmentationAnnotation.ts +0 -1
  820. package/src/types/ContourTypes.ts +3 -0
  821. package/src/types/EventTypes.ts +9 -0
  822. package/src/types/ISpline.ts +3 -0
  823. package/src/types/LabelmapTypes.ts +7 -1
  824. package/src/types/PolySeg.ts +7 -0
  825. package/src/types/SegmentationStateTypes.ts +20 -4
  826. package/src/types/SplineProps.ts +10 -0
  827. package/src/types/SurfaceTypes.ts +1 -1
  828. package/src/types/index.ts +3 -0
  829. package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +4 -2
  830. package/src/utilities/contourSegmentation/addContourSegmentationAnnotation.ts +29 -0
  831. package/src/utilities/contourSegmentation/areSameSegment.ts +0 -2
  832. package/src/utilities/contourSegmentation/index.ts +2 -0
  833. package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +30 -0
  834. package/src/utilities/contours/detectContourHoles.ts +2 -0
  835. package/src/utilities/contours/generateContourSetsFromLabelmap.ts +2 -2
  836. package/src/utilities/contours/getContourHolesDataCanvas.ts +33 -0
  837. package/src/utilities/contours/getContourHolesDataWorld.ts +19 -0
  838. package/src/utilities/contours/getDeduplicatedVTKPolyDataPoints.ts +66 -0
  839. package/src/utilities/contours/index.ts +8 -2
  840. package/src/utilities/contours/updateContourPolyline.ts +74 -0
  841. package/src/utilities/index.ts +4 -0
  842. package/src/utilities/math/polyline/containsPoint.ts +4 -2
  843. package/src/utilities/math/polyline/containsPoints.ts +22 -0
  844. package/src/utilities/math/polyline/getWindingDirection.ts +14 -0
  845. package/src/utilities/math/polyline/index.ts +6 -0
  846. package/src/utilities/math/polyline/isPointInsidePolyline3D.ts +56 -0
  847. package/src/utilities/math/polyline/planarFreehandROIInternalTypes.ts +1 -0
  848. package/src/utilities/segmentation/contourAndFindLargestBidirectional.ts +0 -1
  849. package/src/utilities/segmentation/getHoveredContourSegmentationAnnotation.ts +25 -0
  850. package/src/utilities/segmentation/getSegmentAtLabelmapBorder.ts +179 -0
  851. package/src/utilities/segmentation/getSegmentAtWorldPoint.ts +173 -0
  852. package/src/utilities/segmentation/getUniqueSegmentIndices.ts +76 -0
  853. package/src/utilities/segmentation/index.ts +8 -0
  854. package/src/utilities/triggerAnnotationRenderForToolGroupIds.ts +38 -0
  855. package/src/workers/clippingPlaneWorker.js +87 -0
  856. package/src/workers/polySegConverters.js +467 -0
  857. package/dist/cjs/tools/displayTools/Contour/addContourSetsToElement.js.map +0 -1
  858. package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.d.ts +0 -3
  859. package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.js +0 -14
  860. package/dist/cjs/tools/displayTools/Contour/addOrUpdateContourSets.js.map +0 -1
  861. package/dist/cjs/tools/displayTools/Contour/contourConfigCache.js.map +0 -1
  862. package/dist/cjs/tools/displayTools/Contour/updateContourSets.d.ts +0 -3
  863. package/dist/cjs/tools/displayTools/Contour/updateContourSets.js.map +0 -1
  864. package/dist/cjs/tools/displayTools/Contour/utils.js.map +0 -1
  865. package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.d.ts +0 -3
  866. package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js +0 -20
  867. package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js.map +0 -1
  868. package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.d.ts +0 -2
  869. package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js +0 -84
  870. package/dist/cjs/tools/displayTools/Surface/addSurfaceToElement.js.map +0 -1
  871. package/dist/cjs/utilities/contours/mergePoints.d.ts +0 -8
  872. package/dist/cjs/utilities/contours/mergePoints.js +0 -77
  873. package/dist/cjs/utilities/contours/mergePoints.js.map +0 -1
  874. package/dist/esm/tools/displayTools/Contour/addContourSetsToElement.js.map +0 -1
  875. package/dist/esm/tools/displayTools/Contour/addOrUpdateContourSets.js.map +0 -1
  876. package/dist/esm/tools/displayTools/Contour/contourConfigCache.js.map +0 -1
  877. package/dist/esm/tools/displayTools/Contour/updateContourSets.js.map +0 -1
  878. package/dist/esm/tools/displayTools/Contour/utils.js.map +0 -1
  879. package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js +0 -18
  880. package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js.map +0 -1
  881. package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js +0 -79
  882. package/dist/esm/tools/displayTools/Surface/addSurfaceToElement.js.map +0 -1
  883. package/dist/esm/utilities/contours/mergePoints.js +0 -73
  884. package/dist/esm/utilities/contours/mergePoints.js.map +0 -1
  885. package/dist/types/tools/displayTools/Contour/addContourSetsToElement.d.ts.map +0 -1
  886. package/dist/types/tools/displayTools/Contour/addOrUpdateContourSets.d.ts +0 -4
  887. package/dist/types/tools/displayTools/Contour/addOrUpdateContourSets.d.ts.map +0 -1
  888. package/dist/types/tools/displayTools/Contour/contourConfigCache.d.ts.map +0 -1
  889. package/dist/types/tools/displayTools/Contour/updateContourSets.d.ts +0 -4
  890. package/dist/types/tools/displayTools/Contour/updateContourSets.d.ts.map +0 -1
  891. package/dist/types/tools/displayTools/Contour/utils.d.ts.map +0 -1
  892. package/dist/types/tools/displayTools/Labelmap/validateRepresentationData.d.ts +0 -4
  893. package/dist/types/tools/displayTools/Labelmap/validateRepresentationData.d.ts.map +0 -1
  894. package/dist/types/tools/displayTools/Surface/addSurfaceToElement.d.ts +0 -3
  895. package/dist/types/tools/displayTools/Surface/addSurfaceToElement.d.ts.map +0 -1
  896. package/dist/types/utilities/contours/mergePoints.d.ts +0 -9
  897. package/dist/types/utilities/contours/mergePoints.d.ts.map +0 -1
  898. package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +0 -36
  899. package/src/tools/displayTools/Surface/addSurfaceToElement.ts +0 -115
  900. package/src/utilities/contours/mergePoints.ts +0 -108
  901. /package/dist/cjs/tools/displayTools/Contour/{addContourSetsToElement.js → vtkContour/addContourSetsToElement.js} +0 -0
  902. /package/dist/cjs/tools/displayTools/Contour/{contourConfigCache.d.ts → vtkContour/contourConfigCache.d.ts} +0 -0
  903. /package/dist/cjs/tools/displayTools/Contour/{contourConfigCache.js → vtkContour/contourConfigCache.js} +0 -0
  904. /package/dist/cjs/tools/displayTools/Contour/{utils.js → vtkContour/utils.js} +0 -0
  905. /package/dist/esm/tools/displayTools/Contour/{addContourSetsToElement.js → vtkContour/addContourSetsToElement.js} +0 -0
  906. /package/dist/esm/tools/displayTools/Contour/{contourConfigCache.js → vtkContour/contourConfigCache.js} +0 -0
  907. /package/dist/esm/tools/displayTools/Contour/{utils.js → vtkContour/utils.js} +0 -0
  908. /package/dist/types/tools/displayTools/Contour/{contourConfigCache.d.ts → vtkContour/contourConfigCache.d.ts} +0 -0
  909. /package/src/tools/displayTools/Contour/{contourConfigCache.ts → vtkContour/contourConfigCache.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import removeSegmentationsFromToolGroup from './removeSegmentationsFromToolGroup';
2
2
  import addSegmentations from './addSegmentations';
3
3
  import addSegmentationRepresentations from './addSegmentationRepresentations';
4
+ import addRepresentationData from './addRepresentationData';
4
5
  import { convertStackToVolumeSegmentation } from './convertStackToVolumeSegmentation';
5
6
  import { convertVolumeToStackSegmentation } from './convertVolumeToStackSegmentation';
6
7
  import * as activeSegmentation from './activeSegmentation';
@@ -9,5 +10,6 @@ import * as state from './segmentationState';
9
10
  import * as config from './config';
10
11
  import * as segmentIndex from './segmentIndex';
11
12
  import * as triggerSegmentationEvents from './triggerSegmentationEvents';
12
- export { state, addSegmentations, activeSegmentation, addSegmentationRepresentations, removeSegmentationsFromToolGroup, segmentLocking, config, segmentIndex, triggerSegmentationEvents, convertStackToVolumeSegmentation, convertVolumeToStackSegmentation, };
13
+ import * as polySegManager from './polySeg';
14
+ export { addSegmentations, addSegmentationRepresentations, removeSegmentationsFromToolGroup, addRepresentationData, state, activeSegmentation, segmentLocking, config, segmentIndex, triggerSegmentationEvents, convertStackToVolumeSegmentation, convertVolumeToStackSegmentation, polySegManager as polySeg, };
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,yBAAyB,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B,EAC9B,gCAAgC,EAChC,cAAc,EACd,MAAM,EACN,YAAY,EACZ,yBAAyB,EACzB,gCAAgC,EAChC,gCAAgC,GACjC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAClF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAGtF,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,yBAAyB,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,cAAc,MAAM,WAAW,CAAC;AAE5C,OAAO,EAEL,gBAAgB,EAChB,8BAA8B,EAC9B,gCAAgC,EAChC,qBAAqB,EAErB,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,MAAM,EACN,YAAY,EACZ,yBAAyB,EACzB,gCAAgC,EAChC,gCAAgC,EAChC,cAAc,IAAI,OAAO,GAC1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export function computeAndAddContourRepresentation(segmentationId, options = {}) {
2
+ throw new Error('Not implemented yet');
3
+ }
4
+ //# sourceMappingURL=computeAndAddContourRepresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeAndAddContourRepresentation.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,kCAAkC,CAChD,cAAsB,EACtB,UAAoC,EAAE;IAEtC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SegmentationRepresentations } from '../../../../enums';
2
+ import { computeAndAddRepresentation } from '../computeAndAddRepresentation';
3
+ import { computeLabelmapData } from './labelmapComputationStrategies';
4
+ export function computeAndAddLabelmapRepresentation(segmentationId, options = {}) {
5
+ return computeAndAddRepresentation(segmentationId, SegmentationRepresentations.Labelmap, () => computeLabelmapData(segmentationId, options), () => { });
6
+ }
7
+ //# sourceMappingURL=computeAndAddLabelmapRepresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeAndAddLabelmapRepresentation.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAYtE,MAAM,UAAU,mCAAmC,CACjD,cAAsB,EACtB,UAAoC,EAAE;IAEtC,OAAO,2BAA2B,CAChC,cAAc,EACd,2BAA2B,CAAC,QAAQ,EACpC,GAAG,EAAE,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,CAAC,EAClD,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { vec3 } from 'gl-matrix';
2
+ import { cache, utilities, getWebWorkerManager, volumeLoader, imageLoader, metaData, Enums, triggerEvent, eventTarget, } from '@cornerstonejs/core';
3
+ import { getAnnotation } from '../../..';
4
+ import { WorkerTypes } from '../../../../enums';
5
+ const workerManager = getWebWorkerManager();
6
+ const triggerWorkerProgress = (eventTarget, progress) => {
7
+ triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
8
+ progress,
9
+ type: WorkerTypes.POLYSEG_CONTOUR_TO_LABELMAP,
10
+ });
11
+ };
12
+ export async function convertContourToVolumeLabelmap(contourRepresentationData, options = {}) {
13
+ const { viewport } = options;
14
+ const imageIds = utilities.getViewportImageIds(viewport);
15
+ if (!imageIds) {
16
+ throw new Error('No imageIds found, labelmap computation from contour requires viewports with imageIds');
17
+ }
18
+ const segmentationVolumeId = utilities.uuidv4();
19
+ const volumeProps = utilities.generateVolumePropsFromImageIds(imageIds, segmentationVolumeId);
20
+ const { metadata, dimensions, origin, direction, spacing, scalarData } = volumeProps;
21
+ const segmentationVolume = await volumeLoader.createLocalSegmentationVolume({
22
+ dimensions,
23
+ origin,
24
+ direction,
25
+ spacing,
26
+ metadata,
27
+ imageIds: imageIds.map((imageId) => `generated://${imageId}`),
28
+ referencedImageIds: imageIds,
29
+ }, segmentationVolumeId);
30
+ const { segmentIndices, annotationUIDsInSegmentMap } = _getAnnotationMapFromSegmentation(contourRepresentationData, options);
31
+ triggerWorkerProgress(eventTarget, 0);
32
+ const newScalarData = await workerManager.executeTask('polySeg', 'convertContourToVolumeLabelmap', {
33
+ segmentIndices,
34
+ dimensions,
35
+ scalarData,
36
+ origin,
37
+ direction,
38
+ spacing,
39
+ annotationUIDsInSegmentMap,
40
+ }, {
41
+ callbacks: [
42
+ (progress) => {
43
+ triggerWorkerProgress(eventTarget, progress);
44
+ },
45
+ ],
46
+ });
47
+ triggerWorkerProgress(eventTarget, 100);
48
+ segmentationVolume.imageData
49
+ .getPointData()
50
+ .getScalars()
51
+ .setData(newScalarData);
52
+ segmentationVolume.imageData.modified();
53
+ segmentationVolume.modified();
54
+ return {
55
+ volumeId: segmentationVolume.volumeId,
56
+ };
57
+ }
58
+ export async function convertContourToStackLabelmap(contourRepresentationData, options = {}) {
59
+ if (!options.viewport) {
60
+ throw new Error('No viewport provided, labelmap computation from contour requires viewports');
61
+ }
62
+ const viewport = options.viewport;
63
+ const imageIds = viewport.getImageIds();
64
+ if (!imageIds) {
65
+ throw new Error('No imageIds found, labelmap computation from contour requires viewports with imageIds');
66
+ }
67
+ imageIds.forEach((imageId) => {
68
+ if (!cache.getImageLoadObject(imageId)) {
69
+ throw new Error('ImageIds must be cached before converting contour to labelmap');
70
+ }
71
+ });
72
+ const { imageIds: segmentationImageIds } = await imageLoader.createAndCacheDerivedSegmentationImages(imageIds);
73
+ const { segmentIndices, annotationUIDsInSegmentMap } = _getAnnotationMapFromSegmentation(contourRepresentationData, options);
74
+ const segmentationsInfo = new Map();
75
+ segmentationImageIds.forEach((segImageId, index) => {
76
+ const segImage = cache.getImage(segImageId);
77
+ const imagePlaneModule = metaData.get(Enums.MetadataModules.IMAGE_PLANE, segImageId);
78
+ let { columnCosines, rowCosines, rowPixelSpacing, columnPixelSpacing, imagePositionPatient, } = imagePlaneModule;
79
+ columnCosines = columnCosines ?? [0, 1, 0];
80
+ rowCosines = rowCosines ?? [1, 0, 0];
81
+ rowPixelSpacing = rowPixelSpacing ?? 1;
82
+ columnPixelSpacing = columnPixelSpacing ?? 1;
83
+ imagePositionPatient = imagePositionPatient ?? [0, 0, 0];
84
+ const rowCosineVec = vec3.fromValues(rowCosines[0], rowCosines[1], rowCosines[2]);
85
+ const colCosineVec = vec3.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
86
+ const scanAxisNormal = vec3.create();
87
+ vec3.cross(scanAxisNormal, rowCosineVec, colCosineVec);
88
+ const direction = [...rowCosineVec, ...colCosineVec, ...scanAxisNormal];
89
+ const spacing = [rowPixelSpacing, columnPixelSpacing, 1];
90
+ const origin = imagePositionPatient;
91
+ segmentationsInfo.set(imageIds[index], {
92
+ direction,
93
+ spacing,
94
+ origin,
95
+ scalarData: segImage.getPixelData(),
96
+ imageId: segImageId,
97
+ dimensions: [segImage.width, segImage.height, 1],
98
+ });
99
+ });
100
+ triggerWorkerProgress(eventTarget, 0);
101
+ const newSegmentationsScalarData = await workerManager.executeTask('polySeg', 'convertContourToStackLabelmap', {
102
+ segmentationsInfo,
103
+ annotationUIDsInSegmentMap,
104
+ segmentIndices,
105
+ }, {
106
+ callbacks: [
107
+ (progress) => {
108
+ triggerWorkerProgress(eventTarget, progress);
109
+ },
110
+ ],
111
+ });
112
+ triggerWorkerProgress(eventTarget, 100);
113
+ const imageIdReferenceMap = new Map();
114
+ newSegmentationsScalarData.forEach(({ scalarData }, referencedImageId) => {
115
+ const segmentationInfo = segmentationsInfo.get(referencedImageId);
116
+ const { imageId: segImageId } = segmentationInfo;
117
+ const segImage = cache.getImage(segImageId);
118
+ segImage.getPixelData().set(scalarData);
119
+ segImage.imageFrame?.pixelData?.set(scalarData);
120
+ imageIdReferenceMap.set(referencedImageId, segImageId);
121
+ });
122
+ return {
123
+ imageIdReferenceMap,
124
+ };
125
+ }
126
+ function _getAnnotationMapFromSegmentation(contourRepresentationData, options = {}) {
127
+ const annotationMap = contourRepresentationData.annotationUIDsMap;
128
+ const segmentIndices = options.segmentIndices?.length
129
+ ? options.segmentIndices
130
+ : Array.from(annotationMap.keys());
131
+ const annotationUIDsInSegmentMap = new Map();
132
+ segmentIndices.forEach((index) => {
133
+ const annotationUIDsInSegment = annotationMap.get(index);
134
+ const annotations = Array.from(annotationUIDsInSegment).map((uid) => {
135
+ const annotation = getAnnotation(uid);
136
+ return annotation;
137
+ });
138
+ annotationUIDsInSegmentMap.set(index, annotations);
139
+ });
140
+ return { segmentIndices, annotationUIDsInSegmentMap };
141
+ }
142
+ //# sourceMappingURL=convertContourToLabelmap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertContourToLabelmap.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAEL,KAAK,EACL,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OA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';
2
+ import { WorkerTypes } from '../../../../enums';
3
+ const workerManager = getWebWorkerManager();
4
+ const triggerWorkerProgress = (eventTarget, progress) => {
5
+ triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
6
+ progress,
7
+ type: WorkerTypes.POLYSEG_SURFACE_TO_LABELMAP,
8
+ });
9
+ };
10
+ export async function convertSurfaceToVolumeLabelmap(surfaceRepresentationData, segmentationVolume) {
11
+ const { geometryIds } = surfaceRepresentationData;
12
+ if (!geometryIds?.size) {
13
+ throw new Error('No geometry IDs found for surface representation');
14
+ }
15
+ const segmentsInfo = new Map();
16
+ geometryIds.forEach((geometryId, segmentIndex) => {
17
+ const geometry = cache.getGeometry(geometryId);
18
+ const geometryData = geometry.data;
19
+ const points = geometryData.getPoints();
20
+ const polys = geometryData.getPolys();
21
+ segmentsInfo.set(segmentIndex, {
22
+ points,
23
+ polys,
24
+ });
25
+ });
26
+ const { dimensions, direction, origin, spacing } = segmentationVolume;
27
+ triggerWorkerProgress(eventTarget, 0);
28
+ const newScalarData = await workerManager.executeTask('polySeg', 'convertSurfacesToVolumeLabelmap', {
29
+ segmentsInfo,
30
+ dimensions,
31
+ spacing,
32
+ direction,
33
+ origin,
34
+ }, {
35
+ callbacks: [
36
+ (progress) => {
37
+ triggerWorkerProgress(eventTarget, progress);
38
+ },
39
+ ],
40
+ });
41
+ triggerWorkerProgress(eventTarget, 100);
42
+ segmentationVolume.imageData
43
+ .getPointData()
44
+ .getScalars()
45
+ .setData(newScalarData);
46
+ segmentationVolume.imageData.modified();
47
+ segmentationVolume.modified();
48
+ return {
49
+ volumeId: segmentationVolume.volumeId,
50
+ };
51
+ }
52
+ export async function convertSurfaceToStackLabelmap() { }
53
+ //# sourceMappingURL=convertSurfaceToLabelmap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertSurfaceToLabelmap.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts"],"names":[],"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tC,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,WAAW,CACnD,SAAS,EACT,iCAAiC,EACjC;QACE,YAAY;QACZ,UAAU;QACV,OAAO;QACP,SAAS;QACT,MAAM;KACP,EACD;QACE,SAAS,EAAE;YACT,CAAC,QAAQ,EAAE,EAAE;gBACX,qBAAqB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;SACF;KACF,CACF,CAAC;IAEF,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAExC,kBAAkB,CAAC,SAAS;SACzB,YAAY,EAAE;SACd,UAAU,EAAE;SACZ,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1B,kBAAkB,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IAGxC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IAE9B,OAAO;QACL,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;KACtC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B,KAAI,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { VolumeViewport, volumeLoader, utilities, } from '@cornerstonejs/core';
2
+ import { getUniqueSegmentIndices } from '../../../../utilities/segmentation';
3
+ import { getSegmentation } from '../../segmentationState';
4
+ import { convertContourToStackLabelmap, convertContourToVolumeLabelmap, } from './convertContourToLabelmap';
5
+ import { convertSurfaceToVolumeLabelmap } from './convertSurfaceToLabelmap';
6
+ import { computeStackSegmentationFromVolume } from '../../convertVolumeToStackSegmentation';
7
+ export async function computeLabelmapData(segmentationId, options = {}) {
8
+ const segmentIndices = options.segmentIndices?.length
9
+ ? options.segmentIndices
10
+ : getUniqueSegmentIndices(segmentationId);
11
+ let rawLabelmapData;
12
+ const segmentation = getSegmentation(segmentationId);
13
+ const representationData = segmentation.representationData;
14
+ try {
15
+ if (representationData.CONTOUR) {
16
+ rawLabelmapData = await computeLabelmapFromContourSegmentation(segmentationId, {
17
+ segmentIndices,
18
+ ...options,
19
+ });
20
+ }
21
+ else if (representationData.SURFACE) {
22
+ rawLabelmapData = await computeLabelmapFromSurfaceSegmentation(segmentation.segmentationId, {
23
+ segmentIndices,
24
+ ...options,
25
+ });
26
+ }
27
+ }
28
+ catch (error) {
29
+ console.error(error);
30
+ throw error;
31
+ }
32
+ if (!rawLabelmapData) {
33
+ throw new Error('Not enough data to convert to surface, currently only support converting volume labelmap to surface if available');
34
+ }
35
+ return rawLabelmapData;
36
+ }
37
+ async function computeLabelmapFromContourSegmentation(segmentationId, options = {}) {
38
+ const isVolume = options.viewport instanceof VolumeViewport ?? true;
39
+ if (isVolume && !options.viewport) {
40
+ throw new Error('Cannot compute labelmap from contour segmentation without providing the viewport');
41
+ }
42
+ const segmentIndices = options.segmentIndices?.length
43
+ ? options.segmentIndices
44
+ : getUniqueSegmentIndices(segmentationId);
45
+ const segmentation = getSegmentation(segmentationId);
46
+ const representationData = segmentation.representationData.CONTOUR;
47
+ let result;
48
+ if (isVolume) {
49
+ result = await convertContourToVolumeLabelmap(representationData, {
50
+ segmentIndices,
51
+ segmentationRepresentationUID: options.segmentationRepresentationUID,
52
+ viewport: options.viewport,
53
+ });
54
+ }
55
+ else {
56
+ result = await convertContourToStackLabelmap(representationData, {
57
+ segmentIndices,
58
+ segmentationRepresentationUID: options.segmentationRepresentationUID,
59
+ viewport: options.viewport,
60
+ });
61
+ }
62
+ return result;
63
+ }
64
+ async function computeLabelmapFromSurfaceSegmentation(segmentationId, options = {}) {
65
+ const isVolume = options.viewport instanceof VolumeViewport ?? true;
66
+ const segmentIndices = options.segmentIndices?.length
67
+ ? options.segmentIndices
68
+ : getUniqueSegmentIndices(segmentationId);
69
+ const segmentation = getSegmentation(segmentationId);
70
+ const segmentsGeometryIds = new Map();
71
+ const representationData = segmentation.representationData.SURFACE;
72
+ representationData.geometryIds.forEach((geometryId, segmentIndex) => {
73
+ if (segmentIndices.includes(segmentIndex)) {
74
+ segmentsGeometryIds.set(segmentIndex, geometryId);
75
+ }
76
+ });
77
+ if (isVolume && !options.viewport) {
78
+ throw new Error('Cannot compute labelmap from surface segmentation without providing the viewport');
79
+ }
80
+ let segmentationVolume;
81
+ if (isVolume) {
82
+ const defaultActor = options.viewport.getDefaultActor();
83
+ const { uid: volumeId } = defaultActor;
84
+ segmentationVolume =
85
+ await volumeLoader.createAndCacheDerivedSegmentationVolume(volumeId);
86
+ }
87
+ else {
88
+ const imageIds = options.viewport.getImageIds();
89
+ const volumeId = 'generatedSegmentationVolumeId';
90
+ const volumeProps = utilities.generateVolumePropsFromImageIds(imageIds, volumeId);
91
+ delete volumeProps.imageIds;
92
+ segmentationVolume = await volumeLoader.createLocalSegmentationVolume({
93
+ ...volumeProps,
94
+ scalarData: volumeProps.scalarData,
95
+ referencedImageIds: imageIds,
96
+ }, volumeId);
97
+ }
98
+ const result = await convertSurfaceToVolumeLabelmap({ geometryIds: segmentsGeometryIds }, segmentationVolume);
99
+ if (isVolume) {
100
+ return result;
101
+ }
102
+ const stackData = (await computeStackSegmentationFromVolume({
103
+ volumeId: segmentationVolume.volumeId,
104
+ }));
105
+ return stackData;
106
+ }
107
+ export { computeLabelmapFromContourSegmentation };
108
+ //# sourceMappingURL=labelmapComputationStrategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labelmapComputationStrategies.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAA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epresentation';
3
+ import { computeSurfaceData } from './surfaceComputationStrategies';
4
+ import { updateSurfaceData } from './updateSurfaceData';
5
+ export function computeAndAddSurfaceRepresentation(segmentationId, options = {}) {
6
+ return computeAndAddRepresentation(segmentationId, SegmentationRepresentations.Surface, () => computeSurfaceData(segmentationId, options), () => updateSurfaceData(segmentationId));
7
+ }
8
+ //# sourceMappingURL=computeAndAddSurfaceRepresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeAndAddSurfaceRepresentation.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAWxD,MAAM,UAAU,kCAAkC,CAChD,cAAsB,EACtB,UAAoC,EAAE;IAEtC,OAAO,2BAA2B,CAChC,cAAc,EACd,2BAA2B,CAAC,OAAO,EACnC,GAAG,EAAE,CAAC,kBAAkB,CAAC,cAAc,EAAE,OAAO,CAAC,EACjD,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Enums, eventTarget, triggerEvent } from '@cornerstonejs/core';
2
+ import { getWebWorkerManager } from '@cornerstonejs/core';
3
+ import { getAnnotation } from '../../../annotation/annotationState';
4
+ import { WorkerTypes } from '../../../../enums';
5
+ const workerManager = getWebWorkerManager();
6
+ const triggerWorkerProgress = (eventTarget, progress) => {
7
+ triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
8
+ progress,
9
+ type: WorkerTypes.POLYSEG_CONTOUR_TO_SURFACE,
10
+ });
11
+ };
12
+ export async function convertContourToSurface(contourRepresentationData, segmentIndex) {
13
+ const { annotationUIDsMap } = contourRepresentationData;
14
+ const polylines = [];
15
+ const numPointsArray = [];
16
+ const annotationUIDs = annotationUIDsMap.get(segmentIndex);
17
+ for (const annotationUID of annotationUIDs) {
18
+ const annotation = getAnnotation(annotationUID);
19
+ const { polyline } = annotation.data.contour;
20
+ numPointsArray.push(polyline.length);
21
+ polyline.forEach((polyline) => polylines.push(...polyline));
22
+ }
23
+ triggerWorkerProgress(eventTarget, 0);
24
+ const results = await workerManager.executeTask('polySeg', 'convertContourToSurface', {
25
+ polylines,
26
+ numPointsArray,
27
+ }, {
28
+ callbacks: [
29
+ (progress) => {
30
+ triggerWorkerProgress(eventTarget, progress);
31
+ },
32
+ ],
33
+ });
34
+ triggerWorkerProgress(eventTarget, 100);
35
+ return results;
36
+ }
37
+ //# sourceMappingURL=convertContourToSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertContourToSurface.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,WAAW,CAAC,0BAA0B;KAC7C,CAAC,CAAC;AACL,CAAC,CAAC;AASF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,yBAAkD,EAClD,YAAoB;IAEpB,MAAM,EAAE,iBAAiB,EAAE,GAAG,yBAAyB,CAAC;IAGxD,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE3D,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;QAChD,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;KAC7D;IAED,qBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,WAAW,CAC7C,SAAS,EACT,yBAAyB,EACzB;QACE,SAAS;QACT,cAAc;KACf,EACD;QACE,SAAS,EAAE;YACT,CAAC,QAAQ,EAAE,EAAE;gBACX,qBAAqB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;SACF;KACF,CACF,CAAC;IAEF,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAExC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { cache, eventTarget, triggerEvent, Enums, } from '@cornerstonejs/core';
2
+ import { getWebWorkerManager } from '@cornerstonejs/core';
3
+ import { computeVolumeSegmentationFromStack } from '../../convertStackToVolumeSegmentation';
4
+ import { WorkerTypes } from '../../../../enums';
5
+ const workerManager = getWebWorkerManager();
6
+ const triggerWorkerProgress = (eventTarget, progress) => {
7
+ triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, {
8
+ progress,
9
+ type: WorkerTypes.POLYSEG_LABELMAP_TO_SURFACE,
10
+ });
11
+ };
12
+ export async function convertLabelmapToSurface(labelmapRepresentationData, segmentIndex, isVolume = true) {
13
+ let volumeId;
14
+ if (isVolume) {
15
+ volumeId = labelmapRepresentationData
16
+ .volumeId;
17
+ }
18
+ else {
19
+ const { imageIdReferenceMap } = labelmapRepresentationData;
20
+ ({ volumeId } = await computeVolumeSegmentationFromStack({
21
+ imageIdReferenceMap,
22
+ }));
23
+ }
24
+ const volume = cache.getVolume(volumeId);
25
+ const scalarData = volume.getScalarData();
26
+ const { dimensions, spacing, origin, direction } = volume;
27
+ triggerWorkerProgress(eventTarget, 0);
28
+ const results = await workerManager.executeTask('polySeg', 'convertLabelmapToSurface', {
29
+ scalarData,
30
+ dimensions,
31
+ spacing,
32
+ origin,
33
+ direction,
34
+ segmentIndex,
35
+ }, {
36
+ callbacks: [
37
+ (progress) => {
38
+ triggerWorkerProgress(eventTarget, progress);
39
+ },
40
+ ],
41
+ });
42
+ triggerWorkerProgress(eventTarget, 100);
43
+ return results;
44
+ }
45
+ //# sourceMappingURL=convertLabelmapToSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertLabelmapToSurface.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAM1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAC;AAE5C,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACtD,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE;QAC1D,QAAQ;QACR,IAAI,EAAE,WAAW,CAAC,2BAA2B;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC;AAUF,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,0BAAoD,EACpD,YAAoB,EACpB,QAAQ,GAAG,IAAI;IAEf,IAAI,QAAQ,CAAC;IACb,IAAI,QAAQ,EAAE;QACZ,QAAQ,GAAI,0BAA6D;aACtE,QAAQ,CAAC;KACb;SAAM;QACL,MAAM,EAAE,mBAAmB,EAAE,GAC3B,0BAA2D,CAAC;QAC9D,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,kCAAkC,CAAC;YACvD,mBAAmB;SACpB,CAAC,CAAC,CAAC;KACL;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;IAC1C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAE1D,qBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,WAAW,CAC7C,SAAS,EACT,0BAA0B,EAC1B;QACE,UAAU;QACV,UAAU;QACV,OAAO;QACP,MAAM;QACN,SAAS;QACT,YAAY;KACb,EACD;QACE,SAAS,EAAE;YACT,CAAC,QAAQ,EAAE,EAAE;gBACX,qBAAqB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;SACF;KACF,CACF,CAAC;IAEF,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAExC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Enums, geometryLoader } from '@cornerstonejs/core';
2
+ import { getColorForSegmentIndex } from '../../config/segmentationColor';
3
+ import { findSegmentationRepresentationByUID, getSegmentation, } from '../../segmentationState';
4
+ export async function createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesData, options = {}) {
5
+ let segmentationRepresentation, toolGroupId;
6
+ if (options.segmentationRepresentationUID) {
7
+ ({ segmentationRepresentation, toolGroupId } =
8
+ findSegmentationRepresentationByUID(options.segmentationRepresentationUID));
9
+ }
10
+ const segmentation = getSegmentation(segmentationId);
11
+ const geometryIds = new Map();
12
+ const promises = Object.keys(rawSurfacesData).map(async (index) => {
13
+ const rawSurfaceData = rawSurfacesData[index];
14
+ const segmentIndex = rawSurfaceData.segmentIndex;
15
+ const color = segmentationRepresentation;
16
+ getColorForSegmentIndex(toolGroupId, segmentationRepresentation.segmentationRepresentationUID, segmentIndex).slice(0, 3);
17
+ if (!color) {
18
+ throw new Error('No color found for segment index, unable to create surface');
19
+ }
20
+ const closedSurface = {
21
+ id: `segmentation_${segmentation.segmentationId}_surface_${segmentIndex}`,
22
+ color,
23
+ frameOfReferenceUID: 'test-frameOfReferenceUID',
24
+ data: {
25
+ points: rawSurfaceData.data.points,
26
+ polys: rawSurfaceData.data.polys,
27
+ },
28
+ };
29
+ const geometryId = closedSurface.id;
30
+ geometryIds.set(segmentIndex, geometryId);
31
+ return geometryLoader.createAndCacheGeometry(geometryId, {
32
+ type: Enums.GeometryType.SURFACE,
33
+ geometryData: closedSurface,
34
+ });
35
+ });
36
+ await Promise.all(promises);
37
+ return {
38
+ geometryIds,
39
+ };
40
+ }
41
+ //# sourceMappingURL=createAndCacheSurfacesFromRaw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAndCacheSurfacesFromRaw.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,E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E,UAAU,CAAC,CAAC;QAE1C,OAAO,cAAc,CAAC,sBAAsB,CAAC,UAAU,EAAE;YACvD,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO;YAChC,YAAY,EAAE,aAAwC;SACvD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5B,OAAO;QACL,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { getUniqueSegmentIndices } from '../../../../utilities/segmentation';
2
+ import { getSegmentation } from '../../segmentationState';
3
+ import { convertContourToSurface } from './convertContourToSurface';
4
+ import { createAndCacheSurfacesFromRaw } from './createAndCacheSurfacesFromRaw';
5
+ import { isVolumeSegmentation } from '../../../../tools/segmentation/strategies/utils/stackVolumeCheck';
6
+ import { convertLabelmapToSurface } from './convertLabelmapToSurface';
7
+ export async function computeSurfaceData(segmentationId, options = {}) {
8
+ const segmentIndices = options.segmentIndices?.length
9
+ ? options.segmentIndices
10
+ : getUniqueSegmentIndices(segmentationId);
11
+ let rawSurfacesData;
12
+ const segmentation = getSegmentation(segmentationId);
13
+ const representationData = segmentation.representationData;
14
+ try {
15
+ if (representationData.CONTOUR) {
16
+ rawSurfacesData = await computeSurfaceFromContourSegmentation(segmentationId, {
17
+ segmentIndices,
18
+ ...options,
19
+ });
20
+ }
21
+ else if (representationData.LABELMAP) {
22
+ rawSurfacesData = await computeSurfaceFromLabelmapSegmentation(segmentation.segmentationId, {
23
+ segmentIndices,
24
+ ...options,
25
+ });
26
+ }
27
+ }
28
+ catch (error) {
29
+ console.error(error);
30
+ throw error;
31
+ }
32
+ if (!rawSurfacesData) {
33
+ throw new Error('Not enough data to convert to surface, currently only support converting volume labelmap to surface if available');
34
+ }
35
+ const surfacesData = await createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesData, options);
36
+ return surfacesData;
37
+ }
38
+ async function computeSurfaceFromLabelmapSegmentation(segmentationId, options = {}) {
39
+ const segmentation = getSegmentation(segmentationId);
40
+ if (!segmentation?.representationData?.LABELMAP) {
41
+ console.warn('Only support surface update from labelmaps');
42
+ return;
43
+ }
44
+ const isVolume = isVolumeSegmentation(segmentation.representationData.LABELMAP);
45
+ const labelmapRepresentationData = segmentation.representationData.LABELMAP;
46
+ const segmentIndices = options.segmentIndices || getUniqueSegmentIndices(segmentationId);
47
+ const promises = segmentIndices.map((index) => {
48
+ const surface = convertLabelmapToSurface(labelmapRepresentationData, index, isVolume);
49
+ return surface;
50
+ });
51
+ const surfaces = await Promise.allSettled(promises);
52
+ const errors = surfaces.filter((p) => p.status === 'rejected');
53
+ if (errors.length > 0) {
54
+ console.error(errors);
55
+ throw new Error('Failed to convert labelmap to surface');
56
+ }
57
+ const rawSurfacesData = surfaces
58
+ .map((surface, index) => {
59
+ if (surface.status === 'fulfilled') {
60
+ return { segmentIndex: segmentIndices[index], data: surface.value };
61
+ }
62
+ })
63
+ .filter(Boolean);
64
+ return rawSurfacesData;
65
+ }
66
+ async function computeSurfaceFromContourSegmentation(segmentationId, options = {}) {
67
+ const segmentation = getSegmentation(segmentationId);
68
+ const contourRepresentationData = segmentation.representationData.CONTOUR;
69
+ const segmentIndices = options.segmentIndices || getUniqueSegmentIndices(segmentationId);
70
+ const promises = segmentIndices.map(async (index) => {
71
+ const surface = await convertContourToSurface(contourRepresentationData, index);
72
+ return { segmentIndex: index, data: surface };
73
+ });
74
+ const surfaces = await Promise.all(promises);
75
+ return surfaces;
76
+ }
77
+ export { computeSurfaceFromContourSegmentation, computeSurfaceFromLabelmapSegmentation, };
78
+ //# sourceMappingURL=surfaceComputationStrategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaceComputationStrategies.js","sourceRoot":"","sources":["../../../../../../src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,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