@cornerstonejs/tools 1.51.5 → 1.53.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 (339) 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 +3 -11
  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/ChangeTypes.d.ts +2 -1
  11. package/dist/cjs/enums/ChangeTypes.js +1 -0
  12. package/dist/cjs/enums/ChangeTypes.js.map +1 -1
  13. package/dist/cjs/eventDispatchers/keyboardEventHandlers/keyDown.js +1 -1
  14. package/dist/cjs/eventDispatchers/keyboardEventHandlers/keyDown.js.map +1 -1
  15. package/dist/cjs/eventDispatchers/shared/getActiveToolForMouseEvent.js.map +1 -1
  16. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +1 -1
  17. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +165 -78
  18. package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  19. package/dist/cjs/stateManagement/annotation/annotationState.d.ts +6 -1
  20. package/dist/cjs/stateManagement/annotation/annotationState.js +49 -1
  21. package/dist/cjs/stateManagement/annotation/annotationState.js.map +1 -1
  22. package/dist/cjs/stateManagement/annotation/helpers/state.d.ts +4 -2
  23. package/dist/cjs/stateManagement/annotation/helpers/state.js +16 -4
  24. package/dist/cjs/stateManagement/annotation/helpers/state.js.map +1 -1
  25. package/dist/cjs/stateManagement/index.d.ts +6 -1
  26. package/dist/cjs/stateManagement/index.js +6 -1
  27. package/dist/cjs/stateManagement/index.js.map +1 -1
  28. package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +3 -1
  29. package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -2
  30. package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
  31. package/dist/cjs/tools/SegmentationIntersectionTool.js +1 -1
  32. package/dist/cjs/tools/SegmentationIntersectionTool.js.map +1 -1
  33. package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.d.ts +4 -0
  34. package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js +82 -0
  35. package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js.map +1 -1
  36. package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +13 -11
  37. package/dist/cjs/tools/annotation/LivewireContourTool.js +78 -65
  38. package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
  39. package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +3 -1
  40. package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
  41. package/dist/cjs/tools/annotation/SplineROITool.d.ts +6 -3
  42. package/dist/cjs/tools/annotation/SplineROITool.js +40 -21
  43. package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
  44. package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +12 -7
  45. package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
  46. package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +24 -18
  47. package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
  48. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +16 -10
  49. package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
  50. package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js +19 -7
  51. package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
  52. package/dist/cjs/tools/annotation/splines/LinearSpline.js +1 -1
  53. package/dist/cjs/tools/annotation/splines/LinearSpline.js.map +1 -1
  54. package/dist/cjs/tools/annotation/splines/Spline.d.ts +2 -0
  55. package/dist/cjs/tools/annotation/splines/Spline.js +7 -3
  56. package/dist/cjs/tools/annotation/splines/Spline.js.map +1 -1
  57. package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
  58. package/dist/cjs/tools/base/ContourBaseTool.d.ts +1 -0
  59. package/dist/cjs/tools/base/ContourBaseTool.js +18 -1
  60. package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
  61. package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +4 -0
  62. package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  63. package/dist/cjs/tools/displayTools/Contour/contourConfig.js +1 -0
  64. package/dist/cjs/tools/displayTools/Contour/contourConfig.js.map +1 -1
  65. package/dist/cjs/types/AnnotationTypes.d.ts +2 -0
  66. package/dist/cjs/types/ContourAnnotation.d.ts +6 -0
  67. package/dist/cjs/types/ContourAnnotation.js +7 -0
  68. package/dist/cjs/types/ContourAnnotation.js.map +1 -1
  69. package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +8 -0
  70. package/dist/cjs/types/ContourTypes.d.ts +1 -0
  71. package/dist/cjs/types/EventTypes.d.ts +4 -1
  72. package/dist/cjs/types/ISpline.d.ts +1 -0
  73. package/dist/cjs/types/InterpolationTypes.d.ts +2 -0
  74. package/dist/cjs/types/SplineProps.d.ts +1 -0
  75. package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +2 -5
  76. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.d.ts +3 -0
  77. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.js +21 -0
  78. package/dist/cjs/utilities/contours/getContourHolesDataCanvas.js.map +1 -0
  79. package/dist/cjs/utilities/contours/getContourHolesDataWorld.d.ts +3 -0
  80. package/dist/cjs/utilities/contours/getContourHolesDataWorld.js +10 -0
  81. package/dist/cjs/utilities/contours/getContourHolesDataWorld.js.map +1 -0
  82. package/dist/cjs/utilities/contours/index.d.ts +4 -1
  83. package/dist/cjs/utilities/contours/index.js +7 -1
  84. package/dist/cjs/utilities/contours/index.js.map +1 -1
  85. package/dist/cjs/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js.map +1 -1
  86. package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js +2 -1
  87. package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js.map +1 -1
  88. package/dist/cjs/utilities/contours/interpolation/findAnnotationForInterpolation.js +2 -1
  89. package/dist/cjs/utilities/contours/interpolation/findAnnotationForInterpolation.js.map +1 -1
  90. package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js +3 -1
  91. package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
  92. package/dist/cjs/utilities/contours/interpolation/interpolate.d.ts +8 -0
  93. package/dist/cjs/utilities/contours/interpolation/interpolate.js +56 -42
  94. package/dist/cjs/utilities/contours/interpolation/interpolate.js.map +1 -1
  95. package/dist/cjs/utilities/contours/interpolation/selectHandles.d.ts +4 -0
  96. package/dist/cjs/utilities/contours/interpolation/selectHandles.js +170 -0
  97. package/dist/cjs/utilities/contours/interpolation/selectHandles.js.map +1 -0
  98. package/dist/cjs/utilities/contours/updateContourPolyline.d.ts +10 -0
  99. package/dist/cjs/utilities/contours/updateContourPolyline.js +64 -0
  100. package/dist/cjs/utilities/contours/updateContourPolyline.js.map +1 -0
  101. package/dist/cjs/utilities/livewire/LivewireScissors.d.ts +2 -1
  102. package/dist/cjs/utilities/livewire/LivewireScissors.js +46 -24
  103. package/dist/cjs/utilities/livewire/LivewireScissors.js.map +1 -1
  104. package/dist/cjs/utilities/math/polyline/containsPoints.d.ts +2 -0
  105. package/dist/cjs/utilities/math/polyline/containsPoints.js +16 -0
  106. package/dist/cjs/utilities/math/polyline/containsPoints.js.map +1 -0
  107. package/dist/cjs/utilities/math/polyline/getWindingDirection.d.ts +2 -0
  108. package/dist/cjs/utilities/math/polyline/getWindingDirection.js +12 -0
  109. package/dist/cjs/utilities/math/polyline/getWindingDirection.js.map +1 -0
  110. package/dist/cjs/utilities/math/polyline/index.d.ts +3 -1
  111. package/dist/cjs/utilities/math/polyline/index.js +5 -1
  112. package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
  113. package/dist/cjs/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +1 -0
  114. package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js +13 -3
  115. package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
  116. package/dist/esm/drawingSvg/drawPath.js +49 -0
  117. package/dist/esm/drawingSvg/drawPath.js.map +1 -0
  118. package/dist/esm/drawingSvg/drawPolyline.js +3 -11
  119. package/dist/esm/drawingSvg/drawPolyline.js.map +1 -1
  120. package/dist/esm/drawingSvg/index.js +2 -1
  121. package/dist/esm/drawingSvg/index.js.map +1 -1
  122. package/dist/esm/enums/ChangeTypes.js +1 -0
  123. package/dist/esm/enums/ChangeTypes.js.map +1 -1
  124. package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.js +1 -1
  125. package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.js.map +1 -1
  126. package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.js.map +1 -1
  127. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +106 -32
  128. package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
  129. package/dist/esm/stateManagement/annotation/annotationState.js +42 -1
  130. package/dist/esm/stateManagement/annotation/annotationState.js.map +1 -1
  131. package/dist/esm/stateManagement/annotation/helpers/state.js +15 -4
  132. package/dist/esm/stateManagement/annotation/helpers/state.js.map +1 -1
  133. package/dist/esm/stateManagement/index.js +2 -2
  134. package/dist/esm/stateManagement/index.js.map +1 -1
  135. package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -2
  136. package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
  137. package/dist/esm/tools/SegmentationIntersectionTool.js +1 -1
  138. package/dist/esm/tools/SegmentationIntersectionTool.js.map +1 -1
  139. package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +81 -0
  140. package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js.map +1 -1
  141. package/dist/esm/tools/annotation/LivewireContourTool.js +80 -67
  142. package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
  143. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +3 -1
  144. package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
  145. package/dist/esm/tools/annotation/SplineROITool.js +40 -22
  146. package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
  147. package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +12 -7
  148. package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
  149. package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +25 -19
  150. package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
  151. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +16 -10
  152. package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
  153. package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js +20 -8
  154. package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
  155. package/dist/esm/tools/annotation/splines/LinearSpline.js +1 -1
  156. package/dist/esm/tools/annotation/splines/LinearSpline.js.map +1 -1
  157. package/dist/esm/tools/annotation/splines/Spline.js +5 -1
  158. package/dist/esm/tools/annotation/splines/Spline.js.map +1 -1
  159. package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
  160. package/dist/esm/tools/base/ContourBaseTool.js +20 -3
  161. package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
  162. package/dist/esm/tools/base/ContourSegmentationBaseTool.js +4 -0
  163. package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
  164. package/dist/esm/tools/displayTools/Contour/contourConfig.js +1 -0
  165. package/dist/esm/tools/displayTools/Contour/contourConfig.js.map +1 -1
  166. package/dist/esm/types/ContourAnnotation.js +6 -1
  167. package/dist/esm/types/ContourAnnotation.js.map +1 -1
  168. package/dist/esm/utilities/contours/getContourHolesDataCanvas.js +15 -0
  169. package/dist/esm/utilities/contours/getContourHolesDataCanvas.js.map +1 -0
  170. package/dist/esm/utilities/contours/getContourHolesDataWorld.js +6 -0
  171. package/dist/esm/utilities/contours/getContourHolesDataWorld.js.map +1 -0
  172. package/dist/esm/utilities/contours/index.js +4 -1
  173. package/dist/esm/utilities/contours/index.js.map +1 -1
  174. package/dist/esm/utilities/contours/interpolation/acceptAutogeneratedInterpolations.js.map +1 -1
  175. package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js +2 -1
  176. package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js.map +1 -1
  177. package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js +2 -1
  178. package/dist/esm/utilities/contours/interpolation/findAnnotationForInterpolation.js.map +1 -1
  179. package/dist/esm/utilities/contours/interpolation/getInterpolationData.js +3 -1
  180. package/dist/esm/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
  181. package/dist/esm/utilities/contours/interpolation/interpolate.js +57 -43
  182. package/dist/esm/utilities/contours/interpolation/interpolate.js.map +1 -1
  183. package/dist/esm/utilities/contours/interpolation/selectHandles.js +164 -0
  184. package/dist/esm/utilities/contours/interpolation/selectHandles.js.map +1 -0
  185. package/dist/esm/utilities/contours/updateContourPolyline.js +38 -0
  186. package/dist/esm/utilities/contours/updateContourPolyline.js.map +1 -0
  187. package/dist/esm/utilities/livewire/LivewireScissors.js +46 -24
  188. package/dist/esm/utilities/livewire/LivewireScissors.js.map +1 -1
  189. package/dist/esm/utilities/math/polyline/containsPoints.js +10 -0
  190. package/dist/esm/utilities/math/polyline/containsPoints.js.map +1 -0
  191. package/dist/esm/utilities/math/polyline/getWindingDirection.js +6 -0
  192. package/dist/esm/utilities/math/polyline/getWindingDirection.js.map +1 -0
  193. package/dist/esm/utilities/math/polyline/index.js +3 -1
  194. package/dist/esm/utilities/math/polyline/index.js.map +1 -1
  195. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +13 -3
  196. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
  197. package/dist/types/drawingSvg/drawPath.d.ts +12 -0
  198. package/dist/types/drawingSvg/drawPath.d.ts.map +1 -0
  199. package/dist/types/drawingSvg/drawPolyline.d.ts +1 -1
  200. package/dist/types/drawingSvg/drawPolyline.d.ts.map +1 -1
  201. package/dist/types/drawingSvg/index.d.ts +2 -1
  202. package/dist/types/drawingSvg/index.d.ts.map +1 -1
  203. package/dist/types/enums/ChangeTypes.d.ts +2 -1
  204. package/dist/types/enums/ChangeTypes.d.ts.map +1 -1
  205. package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +1 -1
  206. package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -1
  207. package/dist/types/stateManagement/annotation/annotationState.d.ts +6 -1
  208. package/dist/types/stateManagement/annotation/annotationState.d.ts.map +1 -1
  209. package/dist/types/stateManagement/annotation/helpers/state.d.ts +4 -2
  210. package/dist/types/stateManagement/annotation/helpers/state.d.ts.map +1 -1
  211. package/dist/types/stateManagement/index.d.ts +6 -1
  212. package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +3 -1
  213. package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
  214. package/dist/types/tools/annotation/LivewireContourSegmentationTool.d.ts +4 -0
  215. package/dist/types/tools/annotation/LivewireContourSegmentationTool.d.ts.map +1 -1
  216. package/dist/types/tools/annotation/LivewireContourTool.d.ts +13 -11
  217. package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
  218. package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
  219. package/dist/types/tools/annotation/SplineROITool.d.ts +6 -3
  220. package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
  221. package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
  222. package/dist/types/tools/annotation/planarFreehandROITool/drawLoop.d.ts.map +1 -1
  223. package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
  224. package/dist/types/tools/annotation/planarFreehandROITool/renderMethods.d.ts.map +1 -1
  225. package/dist/types/tools/annotation/splines/Spline.d.ts +2 -0
  226. package/dist/types/tools/annotation/splines/Spline.d.ts.map +1 -1
  227. package/dist/types/tools/base/AnnotationTool.d.ts.map +1 -1
  228. package/dist/types/tools/base/ContourBaseTool.d.ts +1 -0
  229. package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -1
  230. package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
  231. package/dist/types/tools/displayTools/Contour/contourConfig.d.ts.map +1 -1
  232. package/dist/types/types/AnnotationTypes.d.ts +2 -0
  233. package/dist/types/types/AnnotationTypes.d.ts.map +1 -1
  234. package/dist/types/types/ContourAnnotation.d.ts +6 -0
  235. package/dist/types/types/ContourAnnotation.d.ts.map +1 -1
  236. package/dist/types/types/ContourSegmentationAnnotation.d.ts +8 -0
  237. package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -1
  238. package/dist/types/types/ContourTypes.d.ts +1 -0
  239. package/dist/types/types/ContourTypes.d.ts.map +1 -1
  240. package/dist/types/types/EventTypes.d.ts +4 -1
  241. package/dist/types/types/EventTypes.d.ts.map +1 -1
  242. package/dist/types/types/ISpline.d.ts +1 -0
  243. package/dist/types/types/ISpline.d.ts.map +1 -1
  244. package/dist/types/types/InterpolationTypes.d.ts +2 -0
  245. package/dist/types/types/InterpolationTypes.d.ts.map +1 -1
  246. package/dist/types/types/SplineProps.d.ts +1 -0
  247. package/dist/types/types/SplineProps.d.ts.map +1 -1
  248. package/dist/types/types/ToolSpecificAnnotationTypes.d.ts +2 -5
  249. package/dist/types/types/ToolSpecificAnnotationTypes.d.ts.map +1 -1
  250. package/dist/types/utilities/contours/getContourHolesDataCanvas.d.ts +4 -0
  251. package/dist/types/utilities/contours/getContourHolesDataCanvas.d.ts.map +1 -0
  252. package/dist/types/utilities/contours/getContourHolesDataWorld.d.ts +4 -0
  253. package/dist/types/utilities/contours/getContourHolesDataWorld.d.ts.map +1 -0
  254. package/dist/types/utilities/contours/index.d.ts +4 -1
  255. package/dist/types/utilities/contours/index.d.ts.map +1 -1
  256. package/dist/types/utilities/contours/interpolation/acceptAutogeneratedInterpolations.d.ts.map +1 -1
  257. package/dist/types/utilities/contours/interpolation/createPolylineToolData.d.ts.map +1 -1
  258. package/dist/types/utilities/contours/interpolation/findAnnotationForInterpolation.d.ts.map +1 -1
  259. package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts.map +1 -1
  260. package/dist/types/utilities/contours/interpolation/interpolate.d.ts +8 -0
  261. package/dist/types/utilities/contours/interpolation/interpolate.d.ts.map +1 -1
  262. package/dist/types/utilities/contours/interpolation/selectHandles.d.ts +5 -0
  263. package/dist/types/utilities/contours/interpolation/selectHandles.d.ts.map +1 -0
  264. package/dist/types/utilities/contours/updateContourPolyline.d.ts +11 -0
  265. package/dist/types/utilities/contours/updateContourPolyline.d.ts.map +1 -0
  266. package/dist/types/utilities/livewire/LivewireScissors.d.ts +2 -1
  267. package/dist/types/utilities/livewire/LivewireScissors.d.ts.map +1 -1
  268. package/dist/types/utilities/math/polyline/containsPoints.d.ts +3 -0
  269. package/dist/types/utilities/math/polyline/containsPoints.d.ts.map +1 -0
  270. package/dist/types/utilities/math/polyline/getWindingDirection.d.ts +3 -0
  271. package/dist/types/utilities/math/polyline/getWindingDirection.d.ts.map +1 -0
  272. package/dist/types/utilities/math/polyline/index.d.ts +3 -1
  273. package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
  274. package/dist/types/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +1 -0
  275. package/dist/types/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts.map +1 -1
  276. package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts.map +1 -1
  277. package/dist/umd/index.js +1 -1
  278. package/dist/umd/index.js.map +1 -1
  279. package/package.json +3 -3
  280. package/src/drawingSvg/drawPath.ts +96 -0
  281. package/src/drawingSvg/drawPolyline.ts +13 -17
  282. package/src/drawingSvg/index.ts +2 -0
  283. package/src/enums/ChangeTypes.ts +4 -0
  284. package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +1 -1
  285. package/src/eventDispatchers/shared/getActiveToolForMouseEvent.ts +1 -1
  286. package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +194 -58
  287. package/src/stateManagement/annotation/annotationState.ts +101 -0
  288. package/src/stateManagement/annotation/helpers/state.ts +33 -3
  289. package/src/stateManagement/index.js +10 -0
  290. package/src/store/ToolGroupManager/ToolGroup.ts +9 -2
  291. package/src/tools/SegmentationIntersectionTool.ts +1 -1
  292. package/src/tools/annotation/LivewireContourSegmentationTool.ts +151 -0
  293. package/src/tools/annotation/LivewireContourTool.ts +172 -114
  294. package/src/tools/annotation/PlanarFreehandROITool.ts +13 -3
  295. package/src/tools/annotation/SplineROITool.ts +78 -31
  296. package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +20 -11
  297. package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +40 -21
  298. package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +28 -13
  299. package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +28 -10
  300. package/src/tools/annotation/splines/LinearSpline.ts +1 -1
  301. package/src/tools/annotation/splines/Spline.ts +13 -1
  302. package/src/tools/base/AnnotationTool.ts +1 -0
  303. package/src/tools/base/ContourBaseTool.ts +45 -3
  304. package/src/tools/base/ContourSegmentationBaseTool.ts +6 -0
  305. package/src/tools/displayTools/Contour/contourConfig.ts +1 -0
  306. package/src/types/AnnotationTypes.ts +14 -0
  307. package/src/types/ContourAnnotation.ts +13 -0
  308. package/src/types/ContourSegmentationAnnotation.ts +38 -0
  309. package/src/types/ContourTypes.ts +3 -0
  310. package/src/types/EventTypes.ts +9 -0
  311. package/src/types/ISpline.ts +3 -0
  312. package/src/types/InterpolationTypes.ts +6 -0
  313. package/src/types/SplineProps.ts +10 -0
  314. package/src/types/ToolSpecificAnnotationTypes.ts +7 -5
  315. package/src/utilities/contours/getContourHolesDataCanvas.ts +33 -0
  316. package/src/utilities/contours/getContourHolesDataWorld.ts +19 -0
  317. package/src/utilities/contours/index.ts +6 -0
  318. package/src/utilities/contours/interpolation/acceptAutogeneratedInterpolations.ts +3 -1
  319. package/src/utilities/contours/interpolation/createPolylineToolData.ts +7 -1
  320. package/src/utilities/contours/interpolation/findAnnotationForInterpolation.ts +2 -1
  321. package/src/utilities/contours/interpolation/getInterpolationData.ts +3 -1
  322. package/src/utilities/contours/interpolation/interpolate.ts +94 -75
  323. package/src/utilities/contours/interpolation/selectHandles.ts +240 -0
  324. package/src/utilities/contours/updateContourPolyline.ts +74 -0
  325. package/src/utilities/livewire/LivewireScissors.ts +65 -53
  326. package/src/utilities/math/polyline/containsPoint.ts +1 -1
  327. package/src/utilities/math/polyline/containsPoints.ts +22 -0
  328. package/src/utilities/math/polyline/getWindingDirection.ts +14 -0
  329. package/src/utilities/math/polyline/index.ts +4 -0
  330. package/src/utilities/math/polyline/planarFreehandROIInternalTypes.ts +1 -0
  331. package/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts +39 -4
  332. package/dist/cjs/utilities/contours/PointsArray.d.ts +0 -29
  333. package/dist/cjs/utilities/contours/PointsArray.js +0 -104
  334. package/dist/cjs/utilities/contours/PointsArray.js.map +0 -1
  335. package/dist/esm/utilities/contours/PointsArray.js +0 -98
  336. package/dist/esm/utilities/contours/PointsArray.js.map +0 -1
  337. package/dist/types/utilities/contours/PointsArray.d.ts +0 -30
  338. package/dist/types/utilities/contours/PointsArray.d.ts.map +0 -1
  339. package/src/utilities/contours/PointsArray.ts +0 -165
@@ -26,6 +26,7 @@ type CurveSegmentDistanceSquared = {
26
26
  abstract class Spline implements ISpline {
27
27
  private _controlPoints: Types.Point2[] = [];
28
28
  private _resolution: number;
29
+ private _fixedResolution: boolean;
29
30
  private _closed: boolean;
30
31
  private _invalidated = false;
31
32
  private _curveSegments: SplineCurveSegment[];
@@ -35,6 +36,7 @@ abstract class Spline implements ISpline {
35
36
  constructor(props?: SplineProps) {
36
37
  this._controlPoints = [];
37
38
  this._resolution = props?.resolution ?? 20;
39
+ this._fixedResolution = props?.fixedResolution ?? false;
38
40
  this._closed = props?.closed ?? false;
39
41
  this._invalidated = true;
40
42
  }
@@ -61,7 +63,7 @@ abstract class Spline implements ISpline {
61
63
 
62
64
  /** Set the resolution of the spline curve */
63
65
  public set resolution(resolution: number) {
64
- if (this._resolution === resolution) {
66
+ if (this._fixedResolution || this._resolution === resolution) {
65
67
  return;
66
68
  }
67
69
 
@@ -69,6 +71,16 @@ abstract class Spline implements ISpline {
69
71
  this.invalidated = true;
70
72
  }
71
73
 
74
+ /** Fixed resolution
75
+ *
76
+ * Linar spline is one of the splines that does not allow changing the resolution
77
+ * for better performance otherwise it would calculate and render 20 line segments
78
+ * instead of a single one..
79
+ */
80
+ public get fixedResolution() {
81
+ return this._fixedResolution;
82
+ }
83
+
72
84
  /** Flag that is set to true when the curve is already closed */
73
85
  public get closed(): boolean {
74
86
  return this._closed;
@@ -19,6 +19,7 @@ import {
19
19
  InteractionTypes,
20
20
  ToolProps,
21
21
  PublicToolProps,
22
+ IToolBinding,
22
23
  } from '../../types';
23
24
  import { StyleSpecifier } from '../../types/AnnotationStyle';
24
25
 
@@ -3,6 +3,7 @@ import type { Types } from '@cornerstonejs/core';
3
3
  import {
4
4
  addAnnotation,
5
5
  getAnnotations,
6
+ getChildAnnotations,
6
7
  } from '../../stateManagement/annotation/annotationState';
7
8
  import type {
8
9
  Annotation,
@@ -13,9 +14,10 @@ import type {
13
14
  SVGDrawingHelper,
14
15
  AnnotationRenderContext,
15
16
  } from '../../types';
16
- import { drawPolyline as drawPolylineSvg } from '../../drawingSvg';
17
+ import { drawPath as drawPathSvg } from '../../drawingSvg';
17
18
  import { StyleSpecifier } from '../../types/AnnotationStyle';
18
19
  import AnnotationTool from './AnnotationTool';
20
+ import { getContourHolesDataCanvas } from '../../utilities/contours';
19
21
 
20
22
  /**
21
23
  * A contour base class responsible for rendering contour instances such as
@@ -177,6 +179,37 @@ abstract class ContourBaseTool extends AnnotationTool {
177
179
  // noop method just to give a chance for child classes to override it
178
180
  }
179
181
 
182
+ /**
183
+ * Move an annotation and all its child annotations in a recursive way.
184
+ *
185
+ * That is useful when clicking on a spline contour to completely translate
186
+ * it to a different place. In that case all holes (child annotations) must
187
+ * also be translated too.
188
+ *
189
+ * @param annotation - Annotation
190
+ * @param worldPosDelta - Delta in world space
191
+ */
192
+ protected moveAnnotation(
193
+ annotation: Annotation,
194
+ worldPosDelta: Types.Point3
195
+ ): void {
196
+ const { points } = annotation.data.handles;
197
+
198
+ for (let i = 0, numPoints = points.length; i < numPoints; i++) {
199
+ const point = points[i];
200
+
201
+ point[0] += worldPosDelta[0];
202
+ point[1] += worldPosDelta[1];
203
+ point[2] += worldPosDelta[2];
204
+ }
205
+
206
+ annotation.invalidated = true;
207
+
208
+ getChildAnnotations(annotation).forEach((childAnnotation) =>
209
+ this.moveAnnotation(childAnnotation, worldPosDelta)
210
+ );
211
+ }
212
+
180
213
  /**
181
214
  * Get polyline points in world space.
182
215
  * Just to give a chance for child classes to override it.
@@ -197,6 +230,12 @@ abstract class ContourBaseTool extends AnnotationTool {
197
230
  ): boolean {
198
231
  const { enabledElement, annotationStyle, svgDrawingHelper } = renderContext;
199
232
  const annotation = renderContext.annotation as ContourAnnotation;
233
+
234
+ // Do not render the contour because it must be rendered by the parent annotation
235
+ if (annotation.parentAnnotationUID) {
236
+ return;
237
+ }
238
+
200
239
  const { annotationUID } = annotation;
201
240
  const { viewport } = enabledElement;
202
241
  const { worldToCanvas } = viewport;
@@ -206,11 +245,14 @@ abstract class ContourBaseTool extends AnnotationTool {
206
245
  const { lineWidth, lineDash, color, fillColor, fillOpacity } =
207
246
  annotationStyle;
208
247
 
209
- drawPolylineSvg(
248
+ const childContours = getContourHolesDataCanvas(annotation, viewport);
249
+ const allContours = [polylineCanvasPoints, ...childContours];
250
+
251
+ drawPathSvg(
210
252
  svgDrawingHelper,
211
253
  annotationUID,
212
254
  'contourPolyline',
213
- polylineCanvasPoints,
255
+ allContours,
214
256
  {
215
257
  color,
216
258
  lineDash,
@@ -175,6 +175,7 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
175
175
  const annotation = context.annotation as ContourSegmentationAnnotation;
176
176
  const { segmentationRepresentationUID, segmentationId, segmentIndex } =
177
177
  annotation.data.segmentation;
178
+ const segmentation = segmentationState.getSegmentation(segmentationId);
178
179
  const segmentationRepresentation =
179
180
  segmentationState.getSegmentationRepresentationByUID(
180
181
  toolGroupId,
@@ -252,6 +253,11 @@ abstract class ContourSegmentationBaseTool extends ContourBaseTool {
252
253
  fillOpacity = mergedConfig.fillAlphaInactive ?? fillOpacity;
253
254
  }
254
255
 
256
+ // Change the line thickness when the mouse is over the contour segment
257
+ if (segmentation.activeSegmentIndex === segmentIndex) {
258
+ lineWidth += mergedConfig.activeSegmentOutlineWidthDelta;
259
+ }
260
+
255
261
  lineWidth = mergedConfig.renderOutline ? lineWidth : 0;
256
262
  fillOpacity = mergedConfig.renderFill ? fillOpacity : 0;
257
263
 
@@ -10,6 +10,7 @@ const defaultContourConfig: ContourConfig = {
10
10
  outlineDashActive: undefined,
11
11
  outlineDashInactive: undefined,
12
12
  outlineDashAutoGenerated: '5,3',
13
+ activeSegmentOutlineWidthDelta: 0,
13
14
  renderFill: true,
14
15
  fillAlpha: 0.5,
15
16
  fillAlphaInactive: 0.3,
@@ -3,6 +3,20 @@ import type { Types } from '@cornerstonejs/core';
3
3
  type Annotation = {
4
4
  /** A unique identifier for this annotation */
5
5
  annotationUID?: string;
6
+ /**
7
+ * Parent annotation UID
8
+ *
9
+ * An annotation may have a parent annotation when it is, for example, a
10
+ * hole inside a contour.
11
+ */
12
+ parentAnnotationUID?: string;
13
+ /**
14
+ * Array that contains all child annotation UID
15
+ *
16
+ * An annotation may have one or more child annotations when it is contour
17
+ * and have some holes in it.
18
+ */
19
+ childAnnotationUIDs?: string[];
6
20
  /** If the annotation is being hovered over and is highlighted */
7
21
  highlighted?: boolean;
8
22
  /** If the annotation is locked for manipulation */
@@ -1,11 +1,24 @@
1
1
  import type { Types } from '@cornerstonejs/core';
2
2
  import { Annotation } from './AnnotationTypes';
3
3
 
4
+ /**
5
+ * Polyline winding direction
6
+ *
7
+ * It is defined as -1 and 1 to make it easier to change its direction multiplying
8
+ * by -1 whenever polyline.reverse() is called instead of using IF/ELSE
9
+ */
10
+ export enum ContourWindingDirection {
11
+ CounterClockwise = -1,
12
+ Unknown = 0,
13
+ Clockwise = 1,
14
+ }
15
+
4
16
  export type ContourAnnotationData = {
5
17
  data: {
6
18
  contour: {
7
19
  polyline: Types.Point3[];
8
20
  closed: boolean;
21
+ windingDirection?: ContourWindingDirection;
9
22
  };
10
23
  };
11
24
  };
@@ -1,4 +1,6 @@
1
+ import type { Types } from '@cornerstonejs/core';
1
2
  import { ContourAnnotation } from './ContourAnnotation';
3
+ // Import the type so it isn't recursive imports
2
4
 
3
5
  export type ContourSegmentationAnnotationData = {
4
6
  autoGenerated?: boolean;
@@ -8,7 +10,43 @@ export type ContourSegmentationAnnotationData = {
8
10
  segmentIndex: number;
9
11
  segmentationRepresentationUID: string;
10
12
  };
13
+ contour: {
14
+ /** The original polyline before livewire, to show comparison with
15
+ * regenerated data (eg based on spline or livewire changes).
16
+ */
17
+ originalPolyline?: Types.Point3[];
18
+ };
19
+ };
20
+ handles: {
21
+ /**
22
+ * Segmentation contours can be interpolated between slices to produce
23
+ * intermediate data. The interpolation sources are source data for
24
+ * the interpolation corresponding to the handle points. The object
25
+ * will have the kIndex assigned so that one can determine relative slice
26
+ * locations that the handles are in originally.
27
+ *
28
+ * This does NOT necessarily correspond to the handles used on the original
29
+ * source data, but is the set of point uses to interpolate the current handles.
30
+ * That is, for linear interpolation:
31
+ * ```
32
+ * handles.points[i] = linear(interpolationSources[0].getPoint(i),
33
+ * interpolationSources[1].getPoint(i));
34
+ * ```
35
+ *
36
+ * These are sometimes required for things like livewire which need to
37
+ * update the handle position with a snap to nearest live point or can
38
+ * be used as an indicator that interpolation has taken place.
39
+ */
40
+ interpolationSources?: Types.PointsManager<Types.Point3>[];
11
41
  };
42
+
43
+ /**
44
+ * This is called when interpolation is performed, and can be used to add
45
+ * data specific settings to the annotation instance.
46
+ */
47
+ onInterpolationComplete?: (
48
+ annotation: ContourSegmentationAnnotation
49
+ ) => unknown;
12
50
  };
13
51
 
14
52
  export type ContourSegmentationAnnotation = ContourAnnotation &
@@ -16,6 +16,9 @@ export type ContourConfig = {
16
16
  outlineDashActive?: string;
17
17
  /** dash style of the outline when segmentation is inactive */
18
18
  outlineDashInactive?: string;
19
+ /** delta thickness of the active segment index outline (0 means same thickness,
20
+ * 1 means 1px thicker, -1 means 1px thinner) */
21
+ activeSegmentOutlineWidthDelta?: number;
19
22
  /**
20
23
  * Dash style of the outline when segmentation is auto-generated
21
24
  */
@@ -214,6 +214,14 @@ type AnnotationInterpolationRemovedEventDetail = {
214
214
  renderingEngineId: string;
215
215
  };
216
216
 
217
+ /**
218
+ * The data that is passed to the event handler when a new contour annotation is
219
+ * completed drawing on the viewport.
220
+ */
221
+ type ContourAnnotationCompletedEventDetail = AnnotationCompletedEventDetail & {
222
+ contourHoleProcessingEnabled: boolean;
223
+ };
224
+
217
225
  /**
218
226
  * EventDetail for when a Segmentation Data is modified by a tool
219
227
  */
@@ -713,6 +721,7 @@ export {
713
721
  AnnotationInterpolationCompletedEventType,
714
722
  AnnotationInterpolationRemovedEventDetail,
715
723
  AnnotationInterpolationRemovedEventType,
724
+ ContourAnnotationCompletedEventDetail,
716
725
  SegmentationDataModifiedEventType,
717
726
  SegmentationRepresentationModifiedEventDetail,
718
727
  SegmentationRepresentationModifiedEventType,
@@ -19,6 +19,9 @@ export interface ISpline {
19
19
  /** Set the resolution of the spline curve */
20
20
  set resolution(resolution: number);
21
21
 
22
+ /** Fixed resolution (eg: Linear Spline) */
23
+ get fixedResolution(): boolean;
24
+
22
25
  /** Flag that is set to true when the curve is already closed */
23
26
  get closed(): boolean;
24
27
 
@@ -14,6 +14,8 @@ export type InterpolationViewportData = {
14
14
  /** The viewport that this interpolation is occurring within */
15
15
  viewport: Types.IViewport;
16
16
  sliceData: Types.ImageSliceData;
17
+ /** True if the interpolation data is being regenerated because of an update */
18
+ isInterpolationUpdate?: boolean;
17
19
  };
18
20
 
19
21
  export type ImageInterpolationData = {
@@ -39,4 +41,8 @@ export type AcceptInterpolationSelector = {
39
41
  * Applies just to the given segment index.
40
42
  */
41
43
  segmentIndex?: number;
44
+ /**
45
+ * Only apply to the given slice index
46
+ */
47
+ sliceIndex?: number;
42
48
  };
@@ -10,6 +10,16 @@ export type SplineProps = {
10
10
  */
11
11
  resolution?: number;
12
12
 
13
+ /**
14
+ * Fixed resolution (Linear spline)
15
+ *
16
+ * Splines with `fixedResolution` set to true shall attempt to change the
17
+ * resolution (eg: spline.resolution = 10). That is useful, for example, for
18
+ * linear splines because having more line segments between two control points
19
+ * would not change its resolution and that is why it is fixed to 0.
20
+ */
21
+ fixedResolution?: boolean;
22
+
13
23
  /** Flag that is set to true when the curve is closed */
14
24
  closed?: boolean;
15
25
  };
@@ -141,11 +141,7 @@ export type SplineROIAnnotation = ContourAnnotation & {
141
141
  export type SplineContourSegmentationAnnotation = SplineROIAnnotation &
142
142
  ContourSegmentationAnnotationData;
143
143
 
144
- export type LivewireContourAnnotation = ContourAnnotation & {
145
- data: {
146
- label?: string;
147
- };
148
- };
144
+ export type LivewireContourAnnotation = ContourAnnotation;
149
145
 
150
146
  export type LivewireContourSegmentationAnnotation = LivewireContourAnnotation &
151
147
  ContourSegmentationAnnotationData;
@@ -277,6 +273,12 @@ export type InterpolationROIAnnotation = ContourAnnotation & {
277
273
  referencedSliceIndex?: number;
278
274
  };
279
275
  interpolationUID?: string;
276
+ /**
277
+ * A flag to track updates to annotations caused by things like
278
+ * spline or livewire regeenration of the data, and which should cause further
279
+ * updates to occur (or not as the tool decides).
280
+ */
281
+ isInterpolationUpdate?: boolean;
280
282
  };
281
283
 
282
284
  export interface ArrowAnnotation extends Annotation {
@@ -0,0 +1,33 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ import type { Annotation } from '../../types';
3
+ import getContourHolesDataWorld from './getContourHolesDataWorld';
4
+
5
+ /**
6
+ * Get the polylines for the child annotations (holes)
7
+ * @param annotation - Annotation
8
+ * @param viewport - Viewport used to convert the points from world to canvas space
9
+ * @returns An array that contains all child polylines
10
+ */
11
+ export default function getContourHolesDataCanvas(
12
+ annotation: Annotation,
13
+ viewport: Types.IViewport
14
+ ): Types.Point2[][] {
15
+ const worldHoleContours = getContourHolesDataWorld(annotation);
16
+ const canvasHoleContours = [];
17
+
18
+ worldHoleContours.forEach((worldHoleContour) => {
19
+ const numPoints = worldHoleContour.length;
20
+
21
+ // Pre-allocated arrays are 3-4x faster than multiple "push()" calls
22
+ const canvasHoleContour: Types.Point2[] = new Array(numPoints);
23
+
24
+ // Using FOR loop instead of map() for better performance when processing large arrays
25
+ for (let i = 0; i < numPoints; i++) {
26
+ canvasHoleContour[i] = viewport.worldToCanvas(worldHoleContour[i]);
27
+ }
28
+
29
+ canvasHoleContours.push(canvasHoleContour);
30
+ });
31
+
32
+ return canvasHoleContours;
33
+ }
@@ -0,0 +1,19 @@
1
+ import type { Types } from '@cornerstonejs/core';
2
+ import type { Annotation, ContourAnnotation } from '../../types';
3
+ import { getAnnotation } from '../../stateManagement';
4
+
5
+ /**
6
+ * Get child polylines data in world space for contour annotations that represent the holes
7
+ * @param annotation - Annotation
8
+ * @param viewport - Viewport used to convert the points from world to canvas space
9
+ * @returns An array that contains all child polylines (holes) in world space
10
+ */
11
+ export default function getContourHolesDataWorld(
12
+ annotation: Annotation
13
+ ): Types.Point3[][] {
14
+ const childAnnotationUIDs = annotation.childAnnotationUIDs ?? [];
15
+
16
+ return childAnnotationUIDs.map(
17
+ (uid) => (getAnnotation(uid) as ContourAnnotation).data.contour.polyline
18
+ );
19
+ }
@@ -4,6 +4,9 @@ import mergePoints from './mergePoints';
4
4
  import detectContourHoles from './detectContourHoles';
5
5
  import { generateContourSetsFromLabelmap } from './generateContourSetsFromLabelmap';
6
6
  import AnnotationToPointData from './AnnotationToPointData';
7
+ import getContourHolesDataWorld from './getContourHolesDataWorld';
8
+ import getContourHolesDataCanvas from './getContourHolesDataCanvas';
9
+ import updateContourPolyline from './updateContourPolyline';
7
10
  import acceptAutogeneratedInterpolations from './interpolation/acceptAutogeneratedInterpolations';
8
11
  import * as interpolation from './interpolation';
9
12
  import findHandlePolylineIndex from './findHandlePolylineIndex';
@@ -15,6 +18,9 @@ export {
15
18
  detectContourHoles,
16
19
  generateContourSetsFromLabelmap,
17
20
  AnnotationToPointData,
21
+ getContourHolesDataWorld,
22
+ getContourHolesDataCanvas,
23
+ updateContourPolyline,
18
24
  interpolation,
19
25
  acceptAutogeneratedInterpolations,
20
26
  findHandlePolylineIndex,
@@ -1,3 +1,5 @@
1
+ import { getEnabledElement } from '@cornerstonejs/core';
2
+
1
3
  import InterpolationManager from '../../segmentation/InterpolationManager/InterpolationManager';
2
4
  import type { AcceptInterpolationSelector } from '../../../types/InterpolationTypes';
3
5
  import type AnnotationGroupSelector from '../../../types/AnnotationGroupSelector';
@@ -5,7 +7,7 @@ import type AnnotationGroupSelector from '../../../types/AnnotationGroupSelector
5
7
  /**
6
8
  * Accepts interpolated annotations, marking them as autoGenerated false.
7
9
  *
8
- * @param annotationGroupSelector - viewport or FOR to select annotations for
10
+ * @param annotationGroupSelector - viewport or FOR to select annotations on
9
11
  * @param selector - nested selection criteria
10
12
  */
11
13
  export default function acceptAutogeneratedInterpolations(
@@ -33,7 +33,13 @@ export default function createPolylineToolData(
33
33
  });
34
34
  Object.assign(annotation.data, {
35
35
  handles: {
36
- points: handlePoints || [],
36
+ points: handlePoints.points || handlePoints || [],
37
+ /**
38
+ * The interpolation sources contains the source points used for interpolating
39
+ * to generate the new handles. This allows performing other types of
40
+ * interpolation to generate the new handles, such as livewire.
41
+ */
42
+ interpolationSources: handlePoints.sources,
37
43
  activeHandleIndex: null,
38
44
  textBox: {
39
45
  hasMoved: false,
@@ -129,7 +129,8 @@ function _sliceNeedsInterpolating(
129
129
  ): boolean {
130
130
  const annotations = interpolationData.get(sliceIndex);
131
131
  return (
132
- !annotations || (annotations.length === 1 && annotations[0].autoGenerated)
132
+ !annotations?.length ||
133
+ (annotations.length === 1 && annotations[0].autoGenerated)
133
134
  );
134
135
  }
135
136
 
@@ -68,7 +68,9 @@ export default function getInterpolationData(
68
68
  }
69
69
  );
70
70
 
71
- interpolationDatas.set(i, filteredInterpolatedAnnotations);
71
+ if (filteredInterpolatedAnnotations.length) {
72
+ interpolationDatas.set(i, filteredInterpolatedAnnotations);
73
+ }
72
74
  }
73
75
 
74
76
  return interpolationDatas;