@cornerstonejs/tools 1.32.3 → 1.34.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 (260) hide show
  1. package/dist/cjs/eventListeners/index.d.ts +2 -2
  2. package/dist/cjs/eventListeners/index.js +2 -1
  3. package/dist/cjs/eventListeners/index.js.map +1 -1
  4. package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.d.ts +5 -0
  5. package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +143 -0
  6. package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -0
  7. package/dist/cjs/eventListeners/segmentation/index.d.ts +2 -1
  8. package/dist/cjs/eventListeners/segmentation/index.js +3 -1
  9. package/dist/cjs/eventListeners/segmentation/index.js.map +1 -1
  10. package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js +31 -5
  11. package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
  12. package/dist/cjs/store/SynchronizerManager/Synchronizer.d.ts +1 -0
  13. package/dist/cjs/store/SynchronizerManager/Synchronizer.js +17 -1
  14. package/dist/cjs/store/SynchronizerManager/Synchronizer.js.map +1 -1
  15. package/dist/cjs/store/addEnabledElement.js +1 -0
  16. package/dist/cjs/store/addEnabledElement.js.map +1 -1
  17. package/dist/cjs/store/removeEnabledElement.js +2 -0
  18. package/dist/cjs/store/removeEnabledElement.js.map +1 -1
  19. package/dist/cjs/synchronizers/callbacks/areViewportsCoplanar .d.ts +1 -1
  20. package/dist/cjs/synchronizers/callbacks/areViewportsCoplanar .js.map +1 -1
  21. package/dist/cjs/synchronizers/callbacks/{stackImageSyncCallback.d.ts → imageSliceSyncCallback.d.ts} +1 -1
  22. package/dist/cjs/synchronizers/callbacks/{stackImageSyncCallback.js → imageSliceSyncCallback.js} +8 -4
  23. package/dist/cjs/synchronizers/callbacks/{stackImageSyncCallback.js.map → imageSliceSyncCallback.js.map} +1 -1
  24. package/dist/cjs/synchronizers/index.d.ts +3 -2
  25. package/dist/cjs/synchronizers/index.js +5 -3
  26. package/dist/cjs/synchronizers/index.js.map +1 -1
  27. package/dist/cjs/synchronizers/synchronizers/{createStackImageSynchronizer.d.ts → createImageSliceSynchronizer.d.ts} +1 -1
  28. package/dist/cjs/synchronizers/synchronizers/createImageSliceSynchronizer.js +17 -0
  29. package/dist/cjs/synchronizers/synchronizers/createImageSliceSynchronizer.js.map +1 -0
  30. package/dist/cjs/synchronizers/synchronizers/index.d.ts +3 -2
  31. package/dist/cjs/synchronizers/synchronizers/index.js +5 -3
  32. package/dist/cjs/synchronizers/synchronizers/index.js.map +1 -1
  33. package/dist/cjs/tools/annotation/CircleROITool.js +3 -1
  34. package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
  35. package/dist/cjs/tools/annotation/EllipticalROITool.js +1 -1
  36. package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
  37. package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -1
  38. package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js +23 -10
  39. package/dist/cjs/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
  40. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.d.ts +1 -1
  41. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +36 -22
  42. package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  43. package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js +6 -5
  44. package/dist/cjs/tools/displayTools/Labelmap/validateRepresentationData.js.map +1 -1
  45. package/dist/cjs/tools/segmentation/BrushTool.js +40 -45
  46. package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
  47. package/dist/cjs/tools/segmentation/CircleScissorsTool.d.ts +4 -2
  48. package/dist/cjs/tools/segmentation/CircleScissorsTool.js +18 -17
  49. package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
  50. package/dist/cjs/tools/segmentation/PaintFillTool.js +28 -5
  51. package/dist/cjs/tools/segmentation/PaintFillTool.js.map +1 -1
  52. package/dist/cjs/tools/segmentation/RectangleScissorsTool.d.ts +3 -1
  53. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js +15 -16
  54. package/dist/cjs/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  55. package/dist/cjs/tools/segmentation/SphereScissorsTool.d.ts +4 -2
  56. package/dist/cjs/tools/segmentation/SphereScissorsTool.js +20 -20
  57. package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
  58. package/dist/cjs/tools/segmentation/strategies/eraseCircle.d.ts +2 -10
  59. package/dist/cjs/tools/segmentation/strategies/eraseCircle.js.map +1 -1
  60. package/dist/cjs/tools/segmentation/strategies/eraseRectangle.d.ts +4 -8
  61. package/dist/cjs/tools/segmentation/strategies/eraseRectangle.js +4 -20
  62. package/dist/cjs/tools/segmentation/strategies/eraseRectangle.js.map +1 -1
  63. package/dist/cjs/tools/segmentation/strategies/eraseSphere.d.ts +2 -10
  64. package/dist/cjs/tools/segmentation/strategies/eraseSphere.js.map +1 -1
  65. package/dist/cjs/tools/segmentation/strategies/fillCircle.d.ts +3 -11
  66. package/dist/cjs/tools/segmentation/strategies/fillCircle.js +57 -32
  67. package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
  68. package/dist/cjs/tools/segmentation/strategies/fillRectangle.d.ts +2 -7
  69. package/dist/cjs/tools/segmentation/strategies/fillRectangle.js +16 -8
  70. package/dist/cjs/tools/segmentation/strategies/fillRectangle.js.map +1 -1
  71. package/dist/cjs/tools/segmentation/strategies/fillSphere.d.ts +2 -10
  72. package/dist/cjs/tools/segmentation/strategies/fillSphere.js +31 -17
  73. package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
  74. package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.d.ts +9 -0
  75. package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js +43 -0
  76. package/dist/cjs/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -0
  77. package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +2 -2
  78. package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js +2 -2
  79. package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
  80. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +5 -0
  81. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js +13 -0
  82. package/dist/cjs/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -0
  83. package/dist/cjs/types/LabelmapToolOperationData.d.ts +14 -0
  84. package/dist/cjs/types/LabelmapToolOperationData.js +3 -0
  85. package/dist/cjs/types/LabelmapToolOperationData.js.map +1 -0
  86. package/dist/cjs/types/LabelmapTypes.d.ts +5 -1
  87. package/dist/cjs/types/index.d.ts +2 -1
  88. package/dist/cjs/utilities/math/ellipse/pointInEllipse.d.ts +7 -9
  89. package/dist/cjs/utilities/math/ellipse/pointInEllipse.js +19 -11
  90. package/dist/cjs/utilities/math/ellipse/pointInEllipse.js.map +1 -1
  91. package/dist/esm/eventListeners/index.js +2 -2
  92. package/dist/esm/eventListeners/index.js.map +1 -1
  93. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +115 -0
  94. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js.map +1 -0
  95. package/dist/esm/eventListeners/segmentation/index.js +2 -1
  96. package/dist/esm/eventListeners/segmentation/index.js.map +1 -1
  97. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +32 -6
  98. package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
  99. package/dist/esm/store/SynchronizerManager/Synchronizer.js +17 -1
  100. package/dist/esm/store/SynchronizerManager/Synchronizer.js.map +1 -1
  101. package/dist/esm/store/addEnabledElement.js +2 -1
  102. package/dist/esm/store/addEnabledElement.js.map +1 -1
  103. package/dist/esm/store/removeEnabledElement.js +2 -0
  104. package/dist/esm/store/removeEnabledElement.js.map +1 -1
  105. package/dist/esm/synchronizers/callbacks/areViewportsCoplanar .js.map +1 -1
  106. package/dist/esm/synchronizers/callbacks/{stackImageSyncCallback.js → imageSliceSyncCallback.js} +8 -4
  107. package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.js.map +1 -0
  108. package/dist/esm/synchronizers/index.js +3 -2
  109. package/dist/esm/synchronizers/index.js.map +1 -1
  110. package/dist/esm/synchronizers/synchronizers/createImageSliceSynchronizer.js +11 -0
  111. package/dist/esm/synchronizers/synchronizers/createImageSliceSynchronizer.js.map +1 -0
  112. package/dist/esm/synchronizers/synchronizers/index.js +3 -2
  113. package/dist/esm/synchronizers/synchronizers/index.js.map +1 -1
  114. package/dist/esm/tools/annotation/CircleROITool.js +4 -2
  115. package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
  116. package/dist/esm/tools/annotation/EllipticalROITool.js +1 -1
  117. package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
  118. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +24 -11
  119. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js.map +1 -1
  120. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +36 -22
  121. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
  122. package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js +6 -5
  123. package/dist/esm/tools/displayTools/Labelmap/validateRepresentationData.js.map +1 -1
  124. package/dist/esm/tools/segmentation/BrushTool.js +38 -29
  125. package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
  126. package/dist/esm/tools/segmentation/CircleScissorsTool.js +27 -15
  127. package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
  128. package/dist/esm/tools/segmentation/PaintFillTool.js +28 -5
  129. package/dist/esm/tools/segmentation/PaintFillTool.js.map +1 -1
  130. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +26 -17
  131. package/dist/esm/tools/segmentation/RectangleScissorsTool.js.map +1 -1
  132. package/dist/esm/tools/segmentation/SphereScissorsTool.js +28 -17
  133. package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
  134. package/dist/esm/tools/segmentation/strategies/eraseCircle.js.map +1 -1
  135. package/dist/esm/tools/segmentation/strategies/eraseRectangle.js +4 -20
  136. package/dist/esm/tools/segmentation/strategies/eraseRectangle.js.map +1 -1
  137. package/dist/esm/tools/segmentation/strategies/eraseSphere.js.map +1 -1
  138. package/dist/esm/tools/segmentation/strategies/fillCircle.js +56 -31
  139. package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
  140. package/dist/esm/tools/segmentation/strategies/fillRectangle.js +16 -8
  141. package/dist/esm/tools/segmentation/strategies/fillRectangle.js.map +1 -1
  142. package/dist/esm/tools/segmentation/strategies/fillSphere.js +32 -18
  143. package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
  144. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +40 -0
  145. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js.map +1 -0
  146. package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js +2 -2
  147. package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
  148. package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js +9 -0
  149. package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js.map +1 -0
  150. package/dist/esm/types/LabelmapToolOperationData.js +2 -0
  151. package/dist/esm/types/LabelmapToolOperationData.js.map +1 -0
  152. package/dist/esm/utilities/math/ellipse/pointInEllipse.js +19 -11
  153. package/dist/esm/utilities/math/ellipse/pointInEllipse.js.map +1 -1
  154. package/dist/types/eventListeners/index.d.ts +2 -2
  155. package/dist/types/eventListeners/index.d.ts.map +1 -1
  156. package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts +6 -0
  157. package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -0
  158. package/dist/types/eventListeners/segmentation/index.d.ts +2 -1
  159. package/dist/types/eventListeners/segmentation/index.d.ts.map +1 -1
  160. package/dist/types/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts.map +1 -1
  161. package/dist/types/store/SynchronizerManager/Synchronizer.d.ts +1 -0
  162. package/dist/types/store/SynchronizerManager/Synchronizer.d.ts.map +1 -1
  163. package/dist/types/store/addEnabledElement.d.ts.map +1 -1
  164. package/dist/types/store/removeEnabledElement.d.ts.map +1 -1
  165. package/dist/types/synchronizers/callbacks/areViewportsCoplanar .d.ts +1 -1
  166. package/dist/types/synchronizers/callbacks/areViewportsCoplanar .d.ts.map +1 -1
  167. package/dist/types/synchronizers/callbacks/{stackImageSyncCallback.d.ts → imageSliceSyncCallback.d.ts} +2 -2
  168. package/dist/types/synchronizers/callbacks/imageSliceSyncCallback.d.ts.map +1 -0
  169. package/dist/types/synchronizers/index.d.ts +3 -2
  170. package/dist/types/synchronizers/index.d.ts.map +1 -1
  171. package/dist/types/synchronizers/synchronizers/createImageSliceSynchronizer.d.ts +3 -0
  172. package/dist/types/synchronizers/synchronizers/createImageSliceSynchronizer.d.ts.map +1 -0
  173. package/dist/types/synchronizers/synchronizers/index.d.ts +3 -2
  174. package/dist/types/synchronizers/synchronizers/index.d.ts.map +1 -1
  175. package/dist/types/tools/annotation/CircleROITool.d.ts.map +1 -1
  176. package/dist/types/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -1
  177. package/dist/types/tools/displayTools/Labelmap/addLabelmapToElement.d.ts.map +1 -1
  178. package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts +1 -1
  179. package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
  180. package/dist/types/tools/displayTools/Labelmap/validateRepresentationData.d.ts.map +1 -1
  181. package/dist/types/tools/segmentation/BrushTool.d.ts.map +1 -1
  182. package/dist/types/tools/segmentation/CircleScissorsTool.d.ts +4 -2
  183. package/dist/types/tools/segmentation/CircleScissorsTool.d.ts.map +1 -1
  184. package/dist/types/tools/segmentation/PaintFillTool.d.ts.map +1 -1
  185. package/dist/types/tools/segmentation/RectangleScissorsTool.d.ts +3 -1
  186. package/dist/types/tools/segmentation/RectangleScissorsTool.d.ts.map +1 -1
  187. package/dist/types/tools/segmentation/SphereScissorsTool.d.ts +4 -2
  188. package/dist/types/tools/segmentation/SphereScissorsTool.d.ts.map +1 -1
  189. package/dist/types/tools/segmentation/strategies/eraseCircle.d.ts +2 -10
  190. package/dist/types/tools/segmentation/strategies/eraseCircle.d.ts.map +1 -1
  191. package/dist/types/tools/segmentation/strategies/eraseRectangle.d.ts +4 -8
  192. package/dist/types/tools/segmentation/strategies/eraseRectangle.d.ts.map +1 -1
  193. package/dist/types/tools/segmentation/strategies/eraseSphere.d.ts +2 -10
  194. package/dist/types/tools/segmentation/strategies/eraseSphere.d.ts.map +1 -1
  195. package/dist/types/tools/segmentation/strategies/fillCircle.d.ts +3 -11
  196. package/dist/types/tools/segmentation/strategies/fillCircle.d.ts.map +1 -1
  197. package/dist/types/tools/segmentation/strategies/fillRectangle.d.ts +2 -7
  198. package/dist/types/tools/segmentation/strategies/fillRectangle.d.ts.map +1 -1
  199. package/dist/types/tools/segmentation/strategies/fillSphere.d.ts +2 -10
  200. package/dist/types/tools/segmentation/strategies/fillSphere.d.ts.map +1 -1
  201. package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts +10 -0
  202. package/dist/types/tools/segmentation/strategies/utils/getStrategyData.d.ts.map +1 -0
  203. package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +2 -2
  204. package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts.map +1 -1
  205. package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +6 -0
  206. package/dist/types/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts.map +1 -0
  207. package/dist/types/types/LabelmapToolOperationData.d.ts +15 -0
  208. package/dist/types/types/LabelmapToolOperationData.d.ts.map +1 -0
  209. package/dist/types/types/LabelmapTypes.d.ts +5 -1
  210. package/dist/types/types/LabelmapTypes.d.ts.map +1 -1
  211. package/dist/types/types/index.d.ts +2 -1
  212. package/dist/types/types/index.d.ts.map +1 -1
  213. package/dist/types/utilities/math/ellipse/pointInEllipse.d.ts +7 -9
  214. package/dist/types/utilities/math/ellipse/pointInEllipse.d.ts.map +1 -1
  215. package/dist/umd/index.js +1 -1
  216. package/dist/umd/index.js.map +1 -1
  217. package/package.json +3 -3
  218. package/src/eventListeners/index.ts +2 -0
  219. package/src/eventListeners/segmentation/imageChangeEventListener.ts +215 -0
  220. package/src/eventListeners/segmentation/index.ts +2 -0
  221. package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +70 -9
  222. package/src/store/SynchronizerManager/Synchronizer.ts +28 -3
  223. package/src/store/addEnabledElement.ts +2 -0
  224. package/src/store/removeEnabledElement.ts +3 -0
  225. package/src/synchronizers/callbacks/areViewportsCoplanar .ts +2 -2
  226. package/src/synchronizers/callbacks/{stackImageSyncCallback.ts → imageSliceSyncCallback.ts} +16 -8
  227. package/src/synchronizers/index.ts +5 -1
  228. package/src/synchronizers/synchronizers/{createStackImageSynchronizer.ts → createImageSliceSynchronizer.ts} +8 -5
  229. package/src/synchronizers/synchronizers/index.ts +4 -1
  230. package/src/tools/annotation/CircleROITool.ts +5 -5
  231. package/src/tools/annotation/EllipticalROITool.ts +1 -1
  232. package/src/tools/displayTools/Labelmap/addLabelmapToElement.ts +51 -22
  233. package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +65 -35
  234. package/src/tools/displayTools/Labelmap/validateRepresentationData.ts +17 -11
  235. package/src/tools/segmentation/BrushTool.ts +78 -39
  236. package/src/tools/segmentation/CircleScissorsTool.ts +46 -29
  237. package/src/tools/segmentation/PaintFillTool.ts +45 -8
  238. package/src/tools/segmentation/RectangleScissorsTool.ts +41 -31
  239. package/src/tools/segmentation/SphereScissorsTool.ts +46 -28
  240. package/src/tools/segmentation/strategies/eraseCircle.ts +3 -11
  241. package/src/tools/segmentation/strategies/eraseRectangle.ts +13 -42
  242. package/src/tools/segmentation/strategies/eraseSphere.ts +2 -10
  243. package/src/tools/segmentation/strategies/fillCircle.ts +93 -61
  244. package/src/tools/segmentation/strategies/fillRectangle.ts +31 -22
  245. package/src/tools/segmentation/strategies/fillSphere.ts +51 -41
  246. package/src/tools/segmentation/strategies/utils/getStrategyData.ts +58 -0
  247. package/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +3 -2
  248. package/src/tools/segmentation/strategies/utils/stackVolumeCheck.ts +33 -0
  249. package/src/types/LabelmapToolOperationData.ts +27 -0
  250. package/src/types/LabelmapTypes.ts +16 -1
  251. package/src/types/index.ts +8 -0
  252. package/src/utilities/math/ellipse/pointInEllipse.ts +43 -22
  253. package/dist/cjs/synchronizers/synchronizers/createStackImageSynchronizer.js +0 -15
  254. package/dist/cjs/synchronizers/synchronizers/createStackImageSynchronizer.js.map +0 -1
  255. package/dist/esm/synchronizers/callbacks/stackImageSyncCallback.js.map +0 -1
  256. package/dist/esm/synchronizers/synchronizers/createStackImageSynchronizer.js +0 -9
  257. package/dist/esm/synchronizers/synchronizers/createStackImageSynchronizer.js.map +0 -1
  258. package/dist/types/synchronizers/callbacks/stackImageSyncCallback.d.ts.map +0 -1
  259. package/dist/types/synchronizers/synchronizers/createStackImageSynchronizer.d.ts +0 -3
  260. package/dist/types/synchronizers/synchronizers/createStackImageSynchronizer.d.ts.map +0 -1
@@ -1,10 +1,15 @@
1
1
  import {
2
2
  getEnabledElement,
3
3
  addVolumesToViewports,
4
+ addImageSlicesToViewports,
4
5
  Types,
5
6
  Enums,
6
7
  } from '@cornerstonejs/core';
7
-
8
+ import {
9
+ LabelmapSegmentationData,
10
+ LabelmapSegmentationDataStack,
11
+ } from '../../../types/LabelmapTypes';
12
+ import { isVolumeSegmentation } from '../../segmentation/strategies/utils/stackVolumeCheck';
8
13
  /**
9
14
  * It adds a labelmap segmentation representation of the viewport's HTML Element.
10
15
  * NOTE: This function should not be called directly.
@@ -17,7 +22,7 @@ import {
17
22
  */
18
23
  async function addLabelmapToElement(
19
24
  element: HTMLDivElement,
20
- volumeId: string,
25
+ labelMapData: LabelmapSegmentationData,
21
26
  segmentationRepresentationUID: string
22
27
  ): Promise<void> {
23
28
  const enabledElement = getEnabledElement(element);
@@ -31,27 +36,51 @@ async function addLabelmapToElement(
31
36
  const immediateRender = false;
32
37
  const suppressEvents = true;
33
38
 
34
- // Todo: Right now we use MIP blend mode for the labelmap, since the
35
- // composite blend mode has a non linear behavior regarding fill and line
36
- // opacity. This should be changed to a custom labelmap blendMode which does
37
- // what composite does, but with a linear behavior.
38
- const volumeInputs: Types.IVolumeInput[] = [
39
- {
40
- volumeId,
41
- actorUID: segmentationRepresentationUID,
42
- visibility,
43
- blendMode: Enums.BlendModes.MAXIMUM_INTENSITY_BLEND,
44
- },
45
- ];
39
+ if (isVolumeSegmentation(labelMapData)) {
40
+ // Todo: Right now we use MIP blend mode for the labelmap, since the
41
+ // composite blend mode has a non linear behavior regarding fill and line
42
+ // opacity. This should be changed to a custom labelmap blendMode which does
43
+ // what composite does, but with a linear behavior.
44
+ const volumeInputs: Types.IVolumeInput[] = [
45
+ {
46
+ volumeId: labelMapData.volumeId,
47
+ actorUID: segmentationRepresentationUID,
48
+ visibility,
49
+ blendMode: Enums.BlendModes.MAXIMUM_INTENSITY_BLEND,
50
+ },
51
+ ];
52
+
53
+ // Add labelmap volumes to the viewports to be be rendered, but not force the render
54
+ await addVolumesToViewports(
55
+ renderingEngine,
56
+ volumeInputs,
57
+ [viewportId],
58
+ immediateRender,
59
+ suppressEvents
60
+ );
61
+ } else {
62
+ // We can use the current imageId in the viewport to get the segmentation imageId
63
+ // which later is used to create the actor and mapper.
64
+ const segmentationImageId = (
65
+ labelMapData as LabelmapSegmentationDataStack
66
+ ).imageIdReferenceMap.get(viewport.getCurrentImageId());
67
+
68
+ const stackInputs: Types.IStackInput[] = [
69
+ {
70
+ imageId: segmentationImageId,
71
+ actorUID: segmentationRepresentationUID,
72
+ },
73
+ ];
46
74
 
47
- // Add labelmap volumes to the viewports to be be rendered, but not force the render
48
- await addVolumesToViewports(
49
- renderingEngine,
50
- volumeInputs,
51
- [viewportId],
52
- immediateRender,
53
- suppressEvents
54
- );
75
+ // Add labelmap volumes to the viewports to be be rendered, but not force the render
76
+ await addImageSlicesToViewports(
77
+ renderingEngine,
78
+ stackInputs,
79
+ [viewportId],
80
+ immediateRender,
81
+ suppressEvents
82
+ );
83
+ }
55
84
  }
56
85
 
57
86
  export default addLabelmapToElement;
@@ -15,6 +15,7 @@ import { getToolGroup } from '../../../store/ToolGroupManager';
15
15
  import type {
16
16
  LabelmapConfig,
17
17
  LabelmapRenderingConfig,
18
+ LabelmapSegmentationData,
18
19
  } from '../../../types/LabelmapTypes';
19
20
  import {
20
21
  RepresentationPublicInput,
@@ -25,6 +26,7 @@ import {
25
26
  import addLabelmapToElement from './addLabelmapToElement';
26
27
 
27
28
  import removeLabelmapFromElement from './removeLabelmapFromElement';
29
+ import { isVolumeSegmentation } from '../../segmentation/strategies/utils/stackVolumeCheck';
28
30
 
29
31
  const MAX_NUMBER_COLORS = 255;
30
32
  const labelMapConfigCache = new Map();
@@ -176,7 +178,7 @@ function isSameFrameOfReference(viewport, referencedVolumeId) {
176
178
  * @param configuration - The configuration object for the labelmap.
177
179
  */
178
180
  async function render(
179
- viewport: Types.IVolumeViewport,
181
+ viewport: Types.IVolumeViewport | Types.IStackViewport,
180
182
  representation: ToolGroupSpecificRepresentation,
181
183
  toolGroupConfig: SegmentationRepresentationConfig
182
184
  ): Promise<void> {
@@ -192,29 +194,50 @@ async function render(
192
194
  const segmentation = SegmentationState.getSegmentation(segmentationId);
193
195
  const labelmapData =
194
196
  segmentation.representationData[Representations.Labelmap];
195
- const { volumeId: labelmapUID } = labelmapData;
196
197
 
197
- const labelmap = cache.getVolume(labelmapUID);
198
+ let actorEntry = viewport.getActor(segmentationRepresentationUID);
199
+ if (isVolumeSegmentation(labelmapData)) {
200
+ const { volumeId: labelmapUID } = labelmapData;
198
201
 
199
- if (!labelmap) {
200
- throw new Error(`No Labelmap found for volumeId: ${labelmapUID}`);
201
- }
202
+ const labelmap = cache.getVolume(labelmapUID);
202
203
 
203
- if (!isSameFrameOfReference(viewport, labelmapData?.referencedVolumeId)) {
204
- return;
205
- }
206
- let actorEntry = viewport.getActor(segmentationRepresentationUID);
204
+ if (!labelmap) {
205
+ throw new Error(`No Labelmap found for volumeId: ${labelmapUID}`);
206
+ }
207
207
 
208
- if (!actorEntry) {
209
- const segmentation = SegmentationState.getSegmentation(segmentationId);
210
- const { volumeId } =
211
- segmentation.representationData[Representations.Labelmap];
212
- // only add the labelmap to ToolGroup viewports if it is not already added
213
- await _addLabelmapToViewport(
214
- viewport,
215
- volumeId,
216
- segmentationRepresentationUID
217
- );
208
+ if (!isSameFrameOfReference(viewport, labelmapData?.referencedVolumeId)) {
209
+ return;
210
+ }
211
+
212
+ if (!actorEntry) {
213
+ // only add the labelmap to ToolGroup viewports if it is not already added
214
+ await _addLabelmapToViewport(
215
+ viewport,
216
+ labelmapData,
217
+ segmentationRepresentationUID
218
+ );
219
+ }
220
+
221
+ actorEntry = viewport.getActor(segmentationRepresentationUID);
222
+ } else {
223
+ // stack segmentation
224
+ const imageId = viewport.getCurrentImageId();
225
+ const { imageIdReferenceMap } = labelmapData;
226
+
227
+ // if the stack labelmap is not built for the current imageId that is
228
+ // rendered at the viewport then return
229
+ if (!imageIdReferenceMap.has(imageId)) {
230
+ return;
231
+ }
232
+
233
+ if (!actorEntry) {
234
+ // only add the labelmap to ToolGroup viewports if it is not already added
235
+ await _addLabelmapToViewport(
236
+ viewport,
237
+ labelmapData,
238
+ segmentationRepresentationUID
239
+ );
240
+ }
218
241
 
219
242
  actorEntry = viewport.getActor(segmentationRepresentationUID);
220
243
  }
@@ -264,7 +287,6 @@ function _setLabelmapColorAndOpacity(
264
287
  // the default color table uses RGB.
265
288
  const colorLUT = SegmentationState.getColorLUT(colorLUTIndex);
266
289
  const numColors = Math.min(256, colorLUT.length);
267
- const volumeActor = actorEntry.actor as Types.VolumeActor;
268
290
  const { uid: actorUID } = actorEntry;
269
291
 
270
292
  // Note: right now outlineWidth and renderOutline are not configurable
@@ -327,24 +349,32 @@ function _setLabelmapColorAndOpacity(
327
349
  }
328
350
  }
329
351
 
330
- volumeActor.getProperty().setRGBTransferFunction(0, cfun);
331
-
332
- ofun.setClamping(false);
333
- volumeActor.getProperty().setScalarOpacity(0, ofun);
352
+ const actor = actorEntry.actor as Types.Actor;
334
353
 
335
- volumeActor.getProperty().setInterpolationTypeToNearest();
354
+ // @ts-ignore
355
+ actor.getProperty().setRGBTransferFunction(0, cfun);
336
356
 
337
- volumeActor.getProperty().setUseLabelOutline(renderOutline);
357
+ ofun.setClamping(false);
338
358
 
339
- // @ts-ignore: setLabelOutlineWidth is not in the vtk.d.ts apparently
340
- volumeActor.getProperty().setLabelOutlineOpacity(outlineOpacity);
341
- volumeActor.getProperty().setLabelOutlineThickness(outlineWidth);
359
+ // @ts-ignore
360
+ actor.getProperty().setScalarOpacity(0, ofun);
361
+ // @ts-ignore
362
+ actor.getProperty().setInterpolationTypeToNearest();
363
+
364
+ if (utilities.actorIsA(actorEntry, 'vtkVolume')) {
365
+ // @ts-ignore
366
+ actor.getProperty().setUseLabelOutline(renderOutline);
367
+ // @ts-ignore
368
+ actor.getProperty().setLabelOutlineOpacity(outlineOpacity);
369
+ // @ts-ignore
370
+ actor.getProperty().setLabelOutlineThickness(outlineWidth);
371
+ }
342
372
 
343
373
  // Set visibility based on whether actor visibility is specifically asked
344
374
  // to be turned on/off (on by default) AND whether is is in active but
345
375
  // we are rendering inactive labelmap
346
376
  const visible = isActiveLabelmap || renderInactiveSegmentations;
347
- volumeActor.setVisibility(visible);
377
+ actor.setVisibility(visible);
348
378
  }
349
379
 
350
380
  function _getLabelmapConfig(
@@ -490,13 +520,13 @@ function _removeLabelmapFromToolGroupViewports(
490
520
  }
491
521
 
492
522
  async function _addLabelmapToViewport(
493
- viewport: Types.IVolumeViewport,
494
- volumeId: string,
495
- segmentationRepresentationUID: string
523
+ viewport: Types.IVolumeViewport | Types.IStackViewport,
524
+ labelmapData: LabelmapSegmentationData,
525
+ segmentationRepresentationUID
496
526
  ): Promise<void> {
497
527
  await addLabelmapToElement(
498
528
  viewport.element,
499
- volumeId,
529
+ labelmapData,
500
530
  segmentationRepresentationUID
501
531
  );
502
532
  }
@@ -1,6 +1,9 @@
1
1
  import { SegmentationPublicInput } from '../../../types/SegmentationStateTypes';
2
2
  import { cache } from '@cornerstonejs/core';
3
- import { LabelmapSegmentationData } from '../../../types/LabelmapTypes';
3
+ import type {
4
+ LabelmapSegmentationData,
5
+ LabelmapSegmentationDataVolume,
6
+ } from '../../../types/LabelmapTypes';
4
7
 
5
8
  function validate(segmentationInput: SegmentationPublicInput): void {
6
9
  if (!segmentationInput.representation.data) {
@@ -12,18 +15,21 @@ function validate(segmentationInput: SegmentationPublicInput): void {
12
15
  const representationData = segmentationInput.representation
13
16
  .data as LabelmapSegmentationData;
14
17
 
15
- if (!representationData.volumeId) {
16
- throw new Error(
17
- 'The segmentationInput.representationData.volumeId is undefined, please provide a valid representationData.volumeId'
18
+ if ('volumeId' in representationData) {
19
+ // volumetric labelmap
20
+ const cachedVolume = cache.getVolume(
21
+ (representationData as LabelmapSegmentationDataVolume).volumeId
18
22
  );
19
- }
20
-
21
- const cachedVolume = cache.getVolume(representationData.volumeId);
22
23
 
23
- if (!cachedVolume) {
24
- throw new Error(
25
- `volumeId of ${representationData.volumeId} not found in cache, you should load and cache volume before adding segmentation`
26
- );
24
+ if (!cachedVolume) {
25
+ throw new Error(
26
+ `volumeId of ${
27
+ (representationData as LabelmapSegmentationDataVolume).volumeId
28
+ } not found in cache, you should load and cache volume before adding segmentation`
29
+ );
30
+ }
31
+ } else {
32
+ // I don't think we need this check since there is no guarantee that the stack is cached.
27
33
  }
28
34
  }
29
35
 
@@ -1,4 +1,4 @@
1
- import { cache, getEnabledElement, StackViewport } from '@cornerstonejs/core';
1
+ import { utilities as csUtils, getEnabledElement } from '@cornerstonejs/core';
2
2
  import { vec3 } from 'gl-matrix';
3
3
 
4
4
  import type { Types } from '@cornerstonejs/core';
@@ -19,7 +19,7 @@ import {
19
19
  fillInsideCircle,
20
20
  } from './strategies/fillCircle';
21
21
  import { eraseInsideCircle } from './strategies/eraseCircle';
22
- import { Events, ToolModes } from '../../enums';
22
+ import { Events, ToolModes, SegmentationRepresentations } from '../../enums';
23
23
  import { drawCircle as drawCircleSvg } from '../../drawingSvg';
24
24
  import {
25
25
  resetElementCursor,
@@ -34,7 +34,11 @@ import {
34
34
  state as segmentationState,
35
35
  activeSegmentation,
36
36
  } from '../../stateManagement/segmentation';
37
- import { LabelmapSegmentationData } from '../../types/LabelmapTypes';
37
+ import {
38
+ LabelmapSegmentationDataVolume,
39
+ LabelmapSegmentationDataStack,
40
+ } from '../../types/LabelmapTypes';
41
+ import { isVolumeSegmentation } from './strategies/utils/stackVolumeCheck';
38
42
 
39
43
  /**
40
44
  * @public
@@ -42,9 +46,11 @@ import { LabelmapSegmentationData } from '../../types/LabelmapTypes';
42
46
  class BrushTool extends BaseTool {
43
47
  static toolName;
44
48
  private _editData: {
45
- segmentation: Types.IImageVolume;
46
- imageVolume: Types.IImageVolume; //
47
49
  segmentsLocked: number[]; //
50
+ segmentationRepresentationUID?: string;
51
+ imageIdReferenceMap?: Map<string, string>;
52
+ volumeId?: string;
53
+ referencedVolumeId?: string;
48
54
  } | null;
49
55
  private _hoverData?: {
50
56
  brushCursor: any;
@@ -108,10 +114,6 @@ class BrushTool extends BaseTool {
108
114
  const enabledElement = getEnabledElement(element);
109
115
  const { viewport, renderingEngine } = enabledElement;
110
116
 
111
- if (viewport instanceof StackViewport) {
112
- throw new Error('Not implemented yet');
113
- }
114
-
115
117
  const toolGroupId = this.toolGroupId;
116
118
 
117
119
  const activeSegmentationRepresentation =
@@ -122,30 +124,78 @@ class BrushTool extends BaseTool {
122
124
  );
123
125
  }
124
126
 
125
- const { segmentationId, type } = activeSegmentationRepresentation;
127
+ const { segmentationId, type, segmentationRepresentationUID } =
128
+ activeSegmentationRepresentation;
129
+
130
+ if (type === SegmentationRepresentations.Contour) {
131
+ throw new Error('Not implemented yet');
132
+ }
133
+
126
134
  const segmentsLocked = segmentLocking.getLockedSegments(segmentationId);
127
135
 
128
136
  const { representationData } =
129
137
  segmentationState.getSegmentation(segmentationId);
130
138
 
131
- // Todo: are we going to support contour editing with this tool?
132
- const { volumeId } = representationData[type] as LabelmapSegmentationData;
133
- const segmentation = cache.getVolume(volumeId);
139
+ const labelmapData =
140
+ representationData[SegmentationRepresentations.Labelmap];
134
141
 
135
- const actors = viewport.getActors();
142
+ const viewportIdsToRender = [viewport.id];
136
143
 
137
- // Note: For tools that need the source data. Assumed to use
138
- // First volume actor for now.
139
- const firstVolumeActorUID = actors[0].uid;
140
- const imageVolume = cache.getVolume(firstVolumeActorUID);
144
+ if (isVolumeSegmentation(labelmapData)) {
145
+ const { volumeId } = representationData[
146
+ type
147
+ ] as LabelmapSegmentationDataVolume;
148
+ const actors = viewport.getActors();
149
+
150
+ // Note: For tools that need the source data. Assumed to use
151
+ // First volume actor for now.
152
+ const firstVolumeActorUID = actors[0].uid;
153
+
154
+ this._editData = {
155
+ volumeId,
156
+ referencedVolumeId: firstVolumeActorUID,
157
+ segmentsLocked,
158
+ segmentationRepresentationUID,
159
+ };
160
+ } else {
161
+ const { imageIdReferenceMap } =
162
+ labelmapData as LabelmapSegmentationDataStack;
163
+
164
+ const currentImageId = viewport.getCurrentImageId();
165
+
166
+ if (!imageIdReferenceMap.get(currentImageId)) {
167
+ // if there is no stack segmentation slice for the current image
168
+ // we should not allow the user to perform any operation
169
+ return;
170
+ }
141
171
 
142
- const viewportIdsToRender = [viewport.id];
172
+ // here we should identify if we can perform sphere manipulation
173
+ // for these stack of images, if the metadata is not present
174
+ // to create a volume or if there are inconsistencies between
175
+ // the image metadata we should not allow the sphere manipulation
176
+ // and should throw an error or maybe simply just allow circle manipulation
177
+ // and not sphere manipulation
178
+ if (this.configuration.activeStrategy.includes('SPHERE')) {
179
+ console.warn(
180
+ 'Sphere manipulation is not supported for this stack of images yet'
181
+ );
182
+ return;
183
+
184
+ // Todo: add sphere manipulation support for stacks of images
185
+ // we should basically check if the stack constructs a valid volume
186
+ // meaning all the metadata is present and consistent
187
+ // then we should create a volume and use it as a reference
188
+ // ideally a tiny volume that does not exceeds the boundary of the
189
+ // sphere brush size
190
+ // csUtils.isValidVolume(referencedImageIds
191
+ }
143
192
 
144
- this._editData = {
145
- segmentation,
146
- imageVolume,
147
- segmentsLocked,
148
- };
193
+ this._editData = {
194
+ imageIdReferenceMap,
195
+ segmentsLocked,
196
+ segmentationRepresentationUID,
197
+ };
198
+ }
149
199
 
150
200
  this._activateDraw(element);
151
201
 
@@ -240,8 +290,6 @@ class BrushTool extends BaseTool {
240
290
  const enabledElement = getEnabledElement(element);
241
291
  const { renderingEngine } = enabledElement;
242
292
 
243
- const { imageVolume, segmentation, segmentsLocked } = this._editData;
244
-
245
293
  this.updateCursor(evt);
246
294
 
247
295
  const {
@@ -261,11 +309,9 @@ class BrushTool extends BaseTool {
261
309
  );
262
310
 
263
311
  const operationData = {
312
+ ...this._editData,
264
313
  points: data.handles.points,
265
- volume: segmentation, // todo: just pass the segmentationId instead
266
- imageVolume,
267
314
  segmentIndex,
268
- segmentsLocked,
269
315
  viewPlaneNormal,
270
316
  toolGroupId: this.toolGroupId,
271
317
  segmentationId,
@@ -340,7 +386,6 @@ class BrushTool extends BaseTool {
340
386
  const eventData = evt.detail;
341
387
  const { element } = eventData;
342
388
 
343
- const { imageVolume, segmentation, segmentsLocked } = this._editData;
344
389
  const {
345
390
  segmentIndex,
346
391
  segmentationId,
@@ -356,21 +401,13 @@ class BrushTool extends BaseTool {
356
401
  resetElementCursor(element);
357
402
 
358
403
  const enabledElement = getEnabledElement(element);
359
- const { viewport } = enabledElement;
360
404
 
361
- this._editData = null;
362
405
  this.updateCursor(evt);
363
406
 
364
- if (viewport instanceof StackViewport) {
365
- throw new Error('Not implemented yet');
366
- }
367
-
368
407
  const operationData = {
369
408
  points: data.handles.points,
370
- volume: segmentation,
371
- imageVolume,
409
+ ...this._editData,
372
410
  segmentIndex,
373
- segmentsLocked,
374
411
  viewPlaneNormal,
375
412
  toolGroupId: this.toolGroupId,
376
413
  segmentationId,
@@ -380,6 +417,8 @@ class BrushTool extends BaseTool {
380
417
  this.configuration.strategySpecificConfiguration,
381
418
  };
382
419
 
420
+ this._editData = null;
421
+
383
422
  this.applyActiveStrategy(enabledElement, operationData);
384
423
  };
385
424
 
@@ -1,4 +1,4 @@
1
- import { cache, getEnabledElement, StackViewport } from '@cornerstonejs/core';
1
+ import { cache, getEnabledElement } from '@cornerstonejs/core';
2
2
  import type { Types } from '@cornerstonejs/core';
3
3
 
4
4
  import { BaseTool } from '../base';
@@ -25,7 +25,12 @@ import {
25
25
  config as segmentationConfig,
26
26
  } from '../../stateManagement/segmentation';
27
27
  import { getSegmentation } from '../../stateManagement/segmentation/segmentationState';
28
- import { LabelmapSegmentationData } from '../../types/LabelmapTypes';
28
+ import {
29
+ LabelmapSegmentationData,
30
+ LabelmapSegmentationDataStack,
31
+ LabelmapSegmentationDataVolume,
32
+ } from '../../types/LabelmapTypes';
33
+ import { isVolumeSegmentation } from './strategies/utils/stackVolumeCheck';
29
34
 
30
35
  /**
31
36
  * Tool for manipulating segmentation data by drawing a circle. It acts on the
@@ -38,9 +43,12 @@ class CircleScissorsTool extends BaseTool {
38
43
  static toolName;
39
44
  editData: {
40
45
  annotation: any;
41
- segmentation: any;
42
46
  segmentIndex: number;
43
- segmentationId: string;
47
+ //
48
+ volumeId: string;
49
+ referencedVolumeId: string;
50
+ imageIdReferenceMap: Map<string, string>;
51
+ //
44
52
  segmentsLocked: number[];
45
53
  segmentColor: [number, number, number, number];
46
54
  viewportIdsToRender: string[];
@@ -49,6 +57,7 @@ class CircleScissorsTool extends BaseTool {
49
57
  newAnnotation?: boolean;
50
58
  hasMoved?: boolean;
51
59
  centerCanvas?: Array<number>;
60
+ segmentationRepresentationUID?: string;
52
61
  } | null;
53
62
  isDrawing: boolean;
54
63
  isHandleOutsideImage: boolean;
@@ -116,8 +125,13 @@ class CircleScissorsTool extends BaseTool {
116
125
  const { representationData } = getSegmentation(segmentationId);
117
126
 
118
127
  // Todo: are we going to support contour editing with rectangle scissors?
119
- const { volumeId } = representationData[type] as LabelmapSegmentationData;
120
- const segmentation = cache.getVolume(volumeId);
128
+ const labelmapData = representationData[type];
129
+
130
+ if (!labelmapData) {
131
+ throw new Error(
132
+ 'No labelmap data found for the active segmentation, create one before using scissors tool'
133
+ );
134
+ }
121
135
 
122
136
  // Todo: Used for drawing the svg only, we might not need it at all
123
137
  const annotation = {
@@ -145,7 +159,6 @@ class CircleScissorsTool extends BaseTool {
145
159
 
146
160
  this.editData = {
147
161
  annotation,
148
- segmentation,
149
162
  centerCanvas: canvasPos,
150
163
  segmentIndex,
151
164
  segmentationId,
@@ -156,7 +169,27 @@ class CircleScissorsTool extends BaseTool {
156
169
  movingTextBox: false,
157
170
  newAnnotation: true,
158
171
  hasMoved: false,
159
- };
172
+ segmentationRepresentationUID,
173
+ } as any;
174
+
175
+ if (isVolumeSegmentation(labelmapData as LabelmapSegmentationData)) {
176
+ const { volumeId } = labelmapData as LabelmapSegmentationDataVolume;
177
+ const segmentation = cache.getVolume(volumeId);
178
+
179
+ this.editData = {
180
+ ...this.editData,
181
+ volumeId,
182
+ referencedVolumeId: segmentation.referencedVolumeId,
183
+ };
184
+ } else {
185
+ const { imageIdReferenceMap } =
186
+ labelmapData as LabelmapSegmentationDataStack;
187
+
188
+ this.editData = {
189
+ ...this.editData,
190
+ imageIdReferenceMap,
191
+ };
192
+ }
160
193
 
161
194
  this._activateDraw(element);
162
195
 
@@ -221,15 +254,7 @@ class CircleScissorsTool extends BaseTool {
221
254
  const eventDetail = evt.detail;
222
255
  const { element } = eventDetail;
223
256
 
224
- const {
225
- annotation,
226
- newAnnotation,
227
- hasMoved,
228
- segmentation,
229
- segmentIndex,
230
- segmentsLocked,
231
- segmentationId,
232
- } = this.editData;
257
+ const { annotation, newAnnotation, hasMoved } = this.editData;
233
258
  const { data } = annotation;
234
259
  const { viewPlaneNormal, viewUp } = annotation.metadata;
235
260
 
@@ -244,25 +269,17 @@ class CircleScissorsTool extends BaseTool {
244
269
  resetElementCursor(element);
245
270
 
246
271
  const enabledElement = getEnabledElement(element);
247
- const { viewport } = enabledElement;
248
-
249
- this.editData = null;
250
- this.isDrawing = false;
251
-
252
- if (viewport instanceof StackViewport) {
253
- throw new Error('Not implemented yet');
254
- }
255
272
 
256
273
  const operationData = {
274
+ ...this.editData,
257
275
  points: data.handles.points,
258
- volume: segmentation,
259
- segmentIndex,
260
- segmentsLocked,
261
276
  viewPlaneNormal,
262
- segmentationId,
263
277
  viewUp,
264
278
  };
265
279
 
280
+ this.editData = null;
281
+ this.isDrawing = false;
282
+
266
283
  this.applyActiveStrategy(enabledElement, operationData);
267
284
  };
268
285