@cornerstonejs/tools 5.0.0-beta.1 → 5.0.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 (285) hide show
  1. package/dist/esm/config.d.ts +4 -0
  2. package/dist/esm/drawingSvg/drawPath.d.ts +3 -0
  3. package/dist/esm/drawingSvg/drawPath.js +4 -1
  4. package/dist/esm/eventListeners/keyboard/keyDownListener.js +2 -2
  5. package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
  6. package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +19 -1
  7. package/dist/esm/eventListeners/mouse/mouseDoubleClickListener.js +8 -1
  8. package/dist/esm/eventListeners/mouse/mouseDownListener.js +37 -5
  9. package/dist/esm/eventListeners/mouse/mouseMoveListener.js +3 -0
  10. package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +60 -92
  11. package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +49 -21
  12. package/dist/esm/eventListeners/segmentation/labelmap/performStackLabelmapUpdate.js +7 -13
  13. package/dist/esm/eventListeners/segmentation/labelmap/performVolumeLabelmapUpdate.js +44 -18
  14. package/dist/esm/eventListeners/touch/getTouchEventPoints.js +27 -4
  15. package/dist/esm/eventListeners/touch/touchStartListener.js +27 -9
  16. package/dist/esm/eventListeners/wheel/wheelListener.js +5 -1
  17. package/dist/esm/index.d.ts +2 -2
  18. package/dist/esm/index.js +2 -2
  19. package/dist/esm/init.js +2 -0
  20. package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js +10 -4
  21. package/dist/esm/stateManagement/segmentation/SegmentationRenderingEngine.js +23 -20
  22. package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.d.ts +12 -0
  23. package/dist/esm/stateManagement/segmentation/SegmentationRepresentationDisplayRegistry.js +7 -0
  24. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +1 -10
  25. package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +28 -149
  26. package/dist/esm/stateManagement/segmentation/addColorLUT.js +7 -1
  27. package/dist/esm/stateManagement/segmentation/getCurrentLabelmapImageIdForViewport.js +16 -1
  28. package/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js +9 -7
  29. package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.d.ts +1 -1
  30. package/dist/esm/stateManagement/segmentation/helpers/getSegmentationActor.js +3 -2
  31. package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.d.ts +5 -0
  32. package/dist/esm/stateManagement/segmentation/helpers/getViewportLabelmapRenderMode.js +58 -0
  33. package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.d.ts +52 -0
  34. package/dist/esm/stateManagement/segmentation/helpers/labelmapImageMapperSupport.js +246 -0
  35. package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.d.ts +1 -0
  36. package/dist/esm/stateManagement/segmentation/helpers/labelmapSegmentationState.js +1 -0
  37. package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +12 -1
  38. package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +3 -3
  39. package/dist/esm/stateManagement/segmentation/labelmapModel/index.d.ts +9 -0
  40. package/dist/esm/stateManagement/segmentation/labelmapModel/index.js +7 -0
  41. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.d.ts +54 -0
  42. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapEditTransaction.js +224 -0
  43. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.d.ts +6 -0
  44. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageIdMapping.js +39 -0
  45. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.d.ts +23 -0
  46. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapImageReferenceResolver.js +269 -0
  47. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.d.ts +15 -0
  48. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLayerStore.js +160 -0
  49. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.d.ts +4 -0
  50. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapLegacyAdapter.js +42 -0
  51. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.d.ts +11 -0
  52. package/dist/esm/stateManagement/segmentation/labelmapModel/labelmapSegmentBindings.js +73 -0
  53. package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.d.ts +17 -0
  54. package/dist/esm/stateManagement/segmentation/labelmapModel/normalizeLabelmapSegmentationData.js +75 -0
  55. package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.d.ts +5 -0
  56. package/dist/esm/stateManagement/segmentation/labelmapModel/privateLabelmap.js +106 -0
  57. package/dist/esm/stateManagement/segmentation/models/SegmentModel.d.ts +11 -0
  58. package/dist/esm/stateManagement/segmentation/models/SegmentModel.js +19 -0
  59. package/dist/esm/stateManagement/segmentation/models/SegmentationModel.d.ts +12 -0
  60. package/dist/esm/stateManagement/segmentation/models/SegmentationModel.js +23 -0
  61. package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.js +6 -10
  62. package/dist/esm/stateManagement/segmentation/segmentIndex.js +24 -0
  63. package/dist/esm/stateManagement/segmentation/segmentationEventManager.js +2 -9
  64. package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -1
  65. package/dist/esm/stateManagement/segmentation/segmentationState.js +4 -1
  66. package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +3 -1
  67. package/dist/esm/store/state.js +2 -1
  68. package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.js +12 -3
  69. package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.js +5 -2
  70. package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.js +51 -3
  71. package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +1 -1
  72. package/dist/esm/tools/AdvancedMagnifyTool.js +4 -1
  73. package/dist/esm/tools/CrosshairsTool.d.ts +4 -0
  74. package/dist/esm/tools/CrosshairsTool.js +95 -41
  75. package/dist/esm/tools/MagnifyTool.js +3 -1
  76. package/dist/esm/tools/OrientationControllerTool.d.ts +45 -0
  77. package/dist/esm/tools/OrientationControllerTool.js +454 -0
  78. package/dist/esm/tools/OrientationMarkerTool.js +4 -4
  79. package/dist/esm/tools/PanTool.js +26 -3
  80. package/dist/esm/tools/PlanarRotateTool.js +19 -4
  81. package/dist/esm/tools/ReferenceCursors.js +7 -1
  82. package/dist/esm/tools/SculptorTool/CircleSculptCursor.js +1 -1
  83. package/dist/esm/tools/TrackballRotateTool.js +3 -2
  84. package/dist/esm/tools/VolumeCroppingControlTool.d.ts +10 -35
  85. package/dist/esm/tools/VolumeCroppingControlTool.js +179 -699
  86. package/dist/esm/tools/VolumeCroppingTool.d.ts +34 -32
  87. package/dist/esm/tools/VolumeCroppingTool.js +813 -532
  88. package/dist/esm/tools/WindowLevelTool.d.ts +2 -1
  89. package/dist/esm/tools/WindowLevelTool.js +48 -4
  90. package/dist/esm/tools/ZoomTool.d.ts +8 -0
  91. package/dist/esm/tools/ZoomTool.js +92 -11
  92. package/dist/esm/tools/annotation/AngleTool.js +38 -32
  93. package/dist/esm/tools/annotation/ArrowAnnotateTool.js +30 -28
  94. package/dist/esm/tools/annotation/BidirectionalTool.js +51 -49
  95. package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -0
  96. package/dist/esm/tools/annotation/CircleROITool.js +89 -51
  97. package/dist/esm/tools/annotation/CobbAngleTool.js +1 -1
  98. package/dist/esm/tools/annotation/DragProbeTool.js +1 -1
  99. package/dist/esm/tools/annotation/ETDRSGridTool.js +1 -1
  100. package/dist/esm/tools/annotation/EllipticalROITool.js +46 -39
  101. package/dist/esm/tools/annotation/HeightTool.js +1 -1
  102. package/dist/esm/tools/annotation/KeyImageTool.js +11 -11
  103. package/dist/esm/tools/annotation/LabelTool.js +37 -35
  104. package/dist/esm/tools/annotation/LengthTool.js +35 -33
  105. package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +6 -4
  106. package/dist/esm/tools/annotation/LivewireContourTool.js +4 -8
  107. package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +6 -4
  108. package/dist/esm/tools/annotation/PlanarFreehandROITool.js +3 -4
  109. package/dist/esm/tools/annotation/ProbeTool.js +66 -56
  110. package/dist/esm/tools/annotation/RectangleROITool.js +48 -37
  111. package/dist/esm/tools/annotation/RegionSegmentPlusTool.js +1 -1
  112. package/dist/esm/tools/annotation/RegionSegmentTool.js +1 -1
  113. package/dist/esm/tools/annotation/SplineContourSegmentationTool.js +1 -1
  114. package/dist/esm/tools/annotation/SplineROITool.js +60 -56
  115. package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +1 -1
  116. package/dist/esm/tools/annotation/UltrasoundPleuraBLineTool/UltrasoundPleuraBLineTool.js +57 -55
  117. package/dist/esm/tools/annotation/VideoRedactionTool.js +1 -1
  118. package/dist/esm/tools/base/AnnotationDisplayTool.js +9 -6
  119. package/dist/esm/tools/base/AnnotationTool.js +2 -1
  120. package/dist/esm/tools/base/BaseTool.js +16 -10
  121. package/dist/esm/tools/base/ContourSegmentationBaseTool.js +1 -1
  122. package/dist/esm/tools/base/GrowCutBaseTool.js +2 -2
  123. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +2 -4
  124. package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +15 -85
  125. package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.d.ts +5 -0
  126. package/dist/esm/tools/displayTools/Labelmap/labelmapActorStyle.js +191 -0
  127. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +4 -3
  128. package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +48 -209
  129. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.d.ts +3 -0
  130. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/createLabelmapRenderPlan.js +51 -0
  131. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.d.ts +4 -0
  132. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/index.js +3 -0
  133. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.d.ts +14 -0
  134. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/legacyVolumePlan.js +143 -0
  135. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.d.ts +40 -0
  136. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/planarGenericVolumeLabelmap.js +79 -0
  137. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.d.ts +3 -0
  138. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/removeLabelmapRepresentationFromViewport.js +18 -0
  139. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.d.ts +9 -0
  140. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/resolveLabelmapRenderPlan.js +56 -0
  141. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.d.ts +11 -0
  142. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/stackImagePlan.js +35 -0
  143. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.d.ts +48 -0
  144. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/types.js +0 -0
  145. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.d.ts +13 -0
  146. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan/volumeSliceImageMapperPlan.js +34 -0
  147. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.d.ts +2 -0
  148. package/dist/esm/tools/displayTools/Labelmap/labelmapRenderPlan.js +1 -0
  149. package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.d.ts +8 -0
  150. package/dist/esm/tools/displayTools/Labelmap/labelmapRepresentationUID.js +18 -0
  151. package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js +2 -2
  152. package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.d.ts +3 -0
  153. package/dist/esm/tools/displayTools/Labelmap/removeLabelmapRepresentationData.js +16 -0
  154. package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.d.ts +2 -0
  155. package/dist/esm/tools/displayTools/Labelmap/syncStackLabelmapActors.js +135 -0
  156. package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.d.ts +16 -0
  157. package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.js +267 -0
  158. package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.d.ts +27 -0
  159. package/dist/esm/tools/displayTools/Labelmap/volumeLabelmapSliceData.js +185 -0
  160. package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.d.ts +1 -0
  161. package/dist/esm/tools/displayTools/registerBuiltInSegmentationRepresentationDisplays.js +16 -0
  162. package/dist/esm/tools/index.d.ts +2 -1
  163. package/dist/esm/tools/index.js +2 -1
  164. package/dist/esm/tools/segmentation/BrushTool.d.ts +9 -2
  165. package/dist/esm/tools/segmentation/BrushTool.js +123 -26
  166. package/dist/esm/tools/segmentation/CircleScissorsTool.js +19 -36
  167. package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +2 -3
  168. package/dist/esm/tools/segmentation/LabelmapBaseTool.js +77 -46
  169. package/dist/esm/tools/segmentation/LabelmapEditWithContour.js +3 -3
  170. package/dist/esm/tools/segmentation/PaintFillTool.js +11 -4
  171. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +2 -0
  172. package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +16 -8
  173. package/dist/esm/tools/segmentation/RectangleScissorsTool.js +13 -6
  174. package/dist/esm/tools/segmentation/SegmentBidirectionalTool.js +63 -61
  175. package/dist/esm/tools/segmentation/SegmentSelectTool.js +4 -4
  176. package/dist/esm/tools/segmentation/SphereScissorsTool.js +11 -31
  177. package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +7 -0
  178. package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +47 -24
  179. package/dist/esm/tools/segmentation/strategies/compositions/circularCursor.js +49 -21
  180. package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +2 -2
  181. package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +5 -1
  182. package/dist/esm/tools/segmentation/strategies/compositions/islandRemovalComposition.js +2 -2
  183. package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
  184. package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +14 -6
  185. package/dist/esm/tools/segmentation/strategies/fillCircle.d.ts +3 -1
  186. package/dist/esm/tools/segmentation/strategies/fillCircle.js +38 -31
  187. package/dist/esm/tools/segmentation/strategies/fillSphere.js +11 -3
  188. package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.d.ts +4 -0
  189. package/dist/esm/tools/segmentation/strategies/utils/crossLayerErase.js +23 -0
  190. package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +1 -1
  191. package/dist/esm/tools/segmentation/strategies/utils/handleUseSegmentCenterIndex.js +12 -11
  192. package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.d.ts +4 -0
  193. package/dist/esm/tools/segmentation/strategies/utils/labelmapOverlap.js +41 -0
  194. package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.d.ts +3 -0
  195. package/dist/esm/tools/segmentation/strategies/utils/overwritePolicy.js +31 -0
  196. package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.d.ts +3 -0
  197. package/dist/esm/tools/segmentation/strategies/utils/segmentSeparation.js +38 -0
  198. package/dist/esm/tools/segmentation/utils/LazyBrushEditController.d.ts +19 -0
  199. package/dist/esm/tools/segmentation/utils/LazyBrushEditController.js +55 -0
  200. package/dist/esm/tools/segmentation/utils/lazyBrushPreview.d.ts +3 -0
  201. package/dist/esm/tools/segmentation/utils/lazyBrushPreview.js +34 -0
  202. package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.d.ts +3 -0
  203. package/dist/esm/tools/segmentation/utils/shouldUseLazyLabelmapEditing.js +42 -0
  204. package/dist/esm/types/ISynchronizerEventHandler.d.ts +2 -1
  205. package/dist/esm/types/LabelmapToolOperationData.d.ts +5 -0
  206. package/dist/esm/types/LabelmapTypes.d.ts +29 -6
  207. package/dist/esm/types/SegmentationStateTypes.d.ts +6 -0
  208. package/dist/esm/utilities/calibrateImageSpacing.js +17 -2
  209. package/dist/esm/utilities/contours/AnnotationToPointData.js +1 -1
  210. package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.d.ts +7 -0
  211. package/dist/esm/utilities/draw3D/addLine3DBetweenPoints.js +34 -0
  212. package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.d.ts +6 -0
  213. package/dist/esm/utilities/draw3D/calculateAdaptiveSphereRadius.js +7 -0
  214. package/dist/esm/utilities/draw3D/index.d.ts +2 -0
  215. package/dist/esm/utilities/draw3D/index.js +2 -0
  216. package/dist/esm/utilities/drawing/getTextBoxCoordsCanvas.js +22 -14
  217. package/dist/esm/utilities/getCenterAndRadiusInCanvas.d.ts +6 -0
  218. package/dist/esm/utilities/getCenterAndRadiusInCanvas.js +26 -0
  219. package/dist/esm/utilities/getEllipseWorldCoordinates.d.ts +2 -0
  220. package/dist/esm/utilities/getEllipseWorldCoordinates.js +26 -0
  221. package/dist/esm/utilities/getSphereBoundsInfo.js +5 -1
  222. package/dist/esm/utilities/getViewportICamera.d.ts +4 -0
  223. package/dist/esm/utilities/getViewportICamera.js +23 -0
  224. package/dist/esm/utilities/getViewportsForAnnotation.js +5 -1
  225. package/dist/esm/utilities/index.d.ts +2 -1
  226. package/dist/esm/utilities/index.js +2 -1
  227. package/dist/esm/utilities/interactionDragCoordinator.d.ts +5 -0
  228. package/dist/esm/utilities/interactionDragCoordinator.js +16 -0
  229. package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +9 -7
  230. package/dist/esm/utilities/pointInSurroundingSphereCallback.js +8 -1
  231. package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +121 -118
  232. package/dist/esm/utilities/segmentation/SegmentStatsCalculator.js +5 -4
  233. package/dist/esm/utilities/segmentation/VolumetricCalculator.js +1 -1
  234. package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
  235. package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentation.js +1 -1
  236. package/dist/esm/utilities/segmentation/getReferenceVolumeForSegmentationVolume.js +11 -2
  237. package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +36 -17
  238. package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +42 -25
  239. package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +3 -30
  240. package/dist/esm/utilities/segmentation/index.d.ts +2 -1
  241. package/dist/esm/utilities/segmentation/index.js +2 -1
  242. package/dist/esm/utilities/segmentation/utilsForWorker.js +6 -2
  243. package/dist/esm/utilities/segmentation/validateLabelmap.js +1 -1
  244. package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +0 -1
  245. package/dist/esm/utilities/touch/index.js +3 -2
  246. package/dist/esm/utilities/viewportCapabilities.d.ts +16 -0
  247. package/dist/esm/utilities/viewportCapabilities.js +18 -0
  248. package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.d.ts +1 -1
  249. package/dist/esm/utilities/viewportFilters/filterViewportsWithParallelNormals.js +12 -4
  250. package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.d.ts +1 -1
  251. package/dist/esm/utilities/viewportFilters/filterViewportsWithSameOrientation.js +11 -4
  252. package/dist/esm/utilities/viewportFilters/getViewportIdsWithToolToRender.js +1 -1
  253. package/dist/esm/utilities/viewportPresentation.d.ts +3 -0
  254. package/dist/esm/utilities/viewportPresentation.js +26 -0
  255. package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.d.ts +6 -0
  256. package/dist/esm/utilities/volumeCropping/computePlanePlaneIntersection.js +37 -0
  257. package/dist/esm/utilities/volumeCropping/constants.d.ts +31 -0
  258. package/dist/esm/utilities/volumeCropping/constants.js +31 -0
  259. package/dist/esm/utilities/volumeCropping/copyClippingPlanes.d.ts +2 -0
  260. package/dist/esm/utilities/volumeCropping/copyClippingPlanes.js +6 -0
  261. package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.d.ts +9 -0
  262. package/dist/esm/utilities/volumeCropping/extractVolumeDirectionVectors.js +9 -0
  263. package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.d.ts +5 -0
  264. package/dist/esm/utilities/volumeCropping/findLineBoundsIntersection.js +50 -0
  265. package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.d.ts +1 -0
  266. package/dist/esm/utilities/volumeCropping/getColorKeyForPlaneIndex.js +13 -0
  267. package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.d.ts +2 -0
  268. package/dist/esm/utilities/volumeCropping/getOrientationFromNormal.js +19 -0
  269. package/dist/esm/utilities/volumeCropping/index.d.ts +9 -0
  270. package/dist/esm/utilities/volumeCropping/index.js +9 -0
  271. package/dist/esm/utilities/volumeCropping/parseCornerKey.d.ts +8 -0
  272. package/dist/esm/utilities/volumeCropping/parseCornerKey.js +11 -0
  273. package/dist/esm/utilities/volumeCropping/types.d.ts +5 -0
  274. package/dist/esm/utilities/volumeCropping/types.js +0 -0
  275. package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.d.ts +31 -0
  276. package/dist/esm/utilities/vtkjs/AnnotatedRhombicuboctahedronActor/index.js +391 -0
  277. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.d.ts +69 -0
  278. package/dist/esm/utilities/vtkjs/OrientationControllerWidget/index.js +804 -0
  279. package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.d.ts +7 -0
  280. package/dist/esm/utilities/vtkjs/RhombicuboctahedronSource/index.js +144 -0
  281. package/dist/esm/utilities/vtkjs/index.d.ts +3 -0
  282. package/dist/esm/utilities/vtkjs/index.js +3 -0
  283. package/dist/esm/version.d.ts +1 -1
  284. package/dist/esm/version.js +1 -1
  285. package/package.json +10 -9
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { AnnotationTool, BaseTool } from '../base';
2
3
  import { vec2, vec3 } from 'gl-matrix';
3
4
  import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, EPSILON, } from '@cornerstonejs/core';
@@ -7,21 +8,22 @@ import { addAnnotation, getAnnotations, removeAnnotation, } from '../../stateMan
7
8
  import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
8
9
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
9
10
  import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state';
10
- import { drawCircle as drawCircleSvg, drawHandles as drawHandlesSvg, } from '../../drawingSvg';
11
+ import { drawCircle as drawCircleSvg, drawHandles as drawHandlesSvg, drawEllipseByCoordinates, } from '../../drawingSvg';
11
12
  import { state } from '../../store/state';
12
13
  import { ChangeTypes, Events, MeasurementType } from '../../enums';
13
14
  import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
14
15
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
15
16
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
16
17
  import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
18
+ import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
17
19
  import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
18
20
  import { getCanvasCircleCorners, getCanvasCircleRadius, } from '../../utilities/math/circle';
19
- import { pointInEllipse } from '../../utilities/math/ellipse';
21
+ import { getCanvasEllipseCorners, pointInEllipse, } from '../../utilities/math/ellipse';
20
22
  import { BasicStatsCalculator } from '../../utilities/math/basic';
21
23
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
24
+ import getEllipseWorldCoordinates from '../../utilities/getEllipseWorldCoordinates';
22
25
  const { transformWorldToIndex } = csUtils;
23
26
  class CircleROITool extends AnnotationTool {
24
- static { this.toolName = 'CircleROI'; }
25
27
  constructor(toolProps = {}, defaultToolProps = {
26
28
  supportedInteractionTypes: ['Mouse', 'Touch'],
27
29
  configuration: {
@@ -74,11 +76,28 @@ class CircleROITool extends AnnotationTool {
74
76
  const enabledElement = getEnabledElement(element);
75
77
  const { viewport } = enabledElement;
76
78
  const { points } = annotation.data.handles;
77
- const canvasHandles = points.map((p) => viewport.worldToCanvas(p));
78
- const canvasCenter = canvasHandles[0];
79
- const radius = getCanvasCircleRadius([canvasCenter, canvasHandles[1]]);
80
- const radiusPoint = getCanvasCircleRadius([canvasCenter, canvasCoords]);
81
- return Math.abs(radiusPoint - radius) < proximity / 2;
79
+ const ellipseWorldCoordinates = getEllipseWorldCoordinates(points.slice(0, 2), viewport);
80
+ const ellipseCanvasCoordinates = ellipseWorldCoordinates.map((p) => viewport.worldToCanvas(p));
81
+ const canvasCorners = getCanvasEllipseCorners(ellipseCanvasCoordinates);
82
+ const [canvasPoint1, canvasPoint2] = canvasCorners;
83
+ const minorEllipse = {
84
+ left: Math.min(canvasPoint1[0], canvasPoint2[0]) + proximity / 2,
85
+ top: Math.min(canvasPoint1[1], canvasPoint2[1]) + proximity / 2,
86
+ width: Math.abs(canvasPoint1[0] - canvasPoint2[0]) - proximity,
87
+ height: Math.abs(canvasPoint1[1] - canvasPoint2[1]) - proximity,
88
+ };
89
+ const majorEllipse = {
90
+ left: Math.min(canvasPoint1[0], canvasPoint2[0]) - proximity / 2,
91
+ top: Math.min(canvasPoint1[1], canvasPoint2[1]) - proximity / 2,
92
+ width: Math.abs(canvasPoint1[0] - canvasPoint2[0]) + proximity,
93
+ height: Math.abs(canvasPoint1[1] - canvasPoint2[1]) + proximity,
94
+ };
95
+ const pointInMinorEllipse = this._pointInEllipseCanvas(minorEllipse, canvasCoords);
96
+ const pointInMajorEllipse = this._pointInEllipseCanvas(majorEllipse, canvasCoords);
97
+ if (pointInMajorEllipse && !pointInMinorEllipse) {
98
+ return true;
99
+ }
100
+ return false;
82
101
  };
83
102
  this.toolSelectedCallback = (evt, annotation) => {
84
103
  const eventDetail = evt.detail;
@@ -376,7 +395,9 @@ class CircleROITool extends AnnotationTool {
376
395
  const { referencedImageId } = annotation.metadata;
377
396
  for (const targetId in data.cachedStats) {
378
397
  if (targetId.startsWith('imageId')) {
379
- const viewports = renderingEngine.getStackViewports();
398
+ const viewports = renderingEngine
399
+ .getViewports()
400
+ .filter(viewportSupportsImageSlices);
380
401
  const invalidatedStack = viewports.find((vp) => {
381
402
  const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
382
403
  const hasImageURI = vp.hasImageURI(referencedImageURI);
@@ -417,7 +438,9 @@ class CircleROITool extends AnnotationTool {
417
438
  }
418
439
  const dataId = `${annotationUID}-circle`;
419
440
  const circleUID = '0';
420
- drawCircleSvg(svgDrawingHelper, annotationUID, circleUID, center, radius, {
441
+ const ellipseWorldCoordinates = getEllipseWorldCoordinates([points[0], points[1]], viewport);
442
+ const ellipseCanvasCoordinates = ellipseWorldCoordinates.map((p) => viewport.worldToCanvas(p));
443
+ drawEllipseByCoordinates(svgDrawingHelper, annotationUID, circleUID, ellipseCanvasCoordinates, {
421
444
  color,
422
445
  lineDash,
423
446
  lineWidth,
@@ -480,7 +503,7 @@ class CircleROITool extends AnnotationTool {
480
503
  const { dimensions, imageData, metadata, voxelManager } = image;
481
504
  const handles = points.map((point) => imageData.worldToIndex(point));
482
505
  const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
483
- const radius = CircleROITool.calculateLengthInIndex(calibrate, handles.slice(0, 2));
506
+ const radius = _a.calculateLengthInIndex(calibrate, handles.slice(0, 2));
484
507
  const area = Math.PI * radius * radius;
485
508
  const perimeter = 2 * Math.PI * radius;
486
509
  const isEmptyArea = radius === 0;
@@ -578,50 +601,65 @@ class CircleROITool extends AnnotationTool {
578
601
  };
579
602
  this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
580
603
  }
581
- static { this.hydrate = (viewportId, points, options) => {
582
- const enabledElement = getEnabledElementByViewportId(viewportId);
583
- if (!enabledElement) {
584
- return;
604
+ _pointInEllipseCanvas(ellipse, location) {
605
+ const xRadius = ellipse.width / 2;
606
+ const yRadius = ellipse.height / 2;
607
+ if (xRadius <= 0.0 || yRadius <= 0.0) {
608
+ return false;
585
609
  }
586
- const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(CircleROITool, enabledElement, points, options);
587
- const { toolInstance, ...serializableOptions } = options || {};
588
- const annotation = {
589
- annotationUID: options?.annotationUID || csUtils.uuidv4(),
590
- data: {
591
- handles: {
592
- points,
593
- textBox: {
594
- hasMoved: false,
595
- worldPosition: [0, 0, 0],
596
- worldBoundingBox: {
597
- topLeft: [0, 0, 0],
598
- topRight: [0, 0, 0],
599
- bottomLeft: [0, 0, 0],
600
- bottomRight: [0, 0, 0],
601
- },
610
+ const center = [ellipse.left + xRadius, ellipse.top + yRadius];
611
+ const normalized = [location[0] - center[0], location[1] - center[1]];
612
+ const inEllipse = (normalized[0] * normalized[0]) / (xRadius * xRadius) +
613
+ (normalized[1] * normalized[1]) / (yRadius * yRadius) <=
614
+ 1.0;
615
+ return inEllipse;
616
+ }
617
+ }
618
+ _a = CircleROITool;
619
+ CircleROITool.toolName = 'CircleROI';
620
+ CircleROITool.hydrate = (viewportId, points, options) => {
621
+ const enabledElement = getEnabledElementByViewportId(viewportId);
622
+ if (!enabledElement) {
623
+ return;
624
+ }
625
+ const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
626
+ const { toolInstance, ...serializableOptions } = options || {};
627
+ const annotation = {
628
+ annotationUID: options?.annotationUID || csUtils.uuidv4(),
629
+ data: {
630
+ handles: {
631
+ points,
632
+ textBox: {
633
+ hasMoved: false,
634
+ worldPosition: [0, 0, 0],
635
+ worldBoundingBox: {
636
+ topLeft: [0, 0, 0],
637
+ topRight: [0, 0, 0],
638
+ bottomLeft: [0, 0, 0],
639
+ bottomRight: [0, 0, 0],
602
640
  },
603
- activeHandleIndex: null,
604
641
  },
605
- label: '',
606
- cachedStats: {},
642
+ activeHandleIndex: null,
607
643
  },
608
- highlighted: false,
609
- autoGenerated: false,
610
- invalidated: false,
611
- isLocked: false,
612
- isVisible: true,
613
- metadata: {
614
- toolName: instance.getToolName(),
615
- viewPlaneNormal,
616
- FrameOfReferenceUID,
617
- referencedImageId,
618
- ...serializableOptions,
619
- },
620
- };
621
- addAnnotation(annotation, viewport.element);
622
- triggerAnnotationRenderForViewportIds([viewport.id]);
623
- }; }
624
- }
644
+ label: '',
645
+ cachedStats: {},
646
+ },
647
+ highlighted: false,
648
+ autoGenerated: false,
649
+ invalidated: false,
650
+ isLocked: false,
651
+ isVisible: true,
652
+ metadata: {
653
+ toolName: instance.getToolName(),
654
+ viewPlaneNormal,
655
+ FrameOfReferenceUID,
656
+ referencedImageId,
657
+ ...serializableOptions,
658
+ },
659
+ };
660
+ addAnnotation(annotation, viewport.element);
661
+ triggerAnnotationRenderForViewportIds([viewport.id]);
662
+ };
625
663
  function defaultGetTextLines(data, targetId) {
626
664
  const cachedVolumeStats = data.cachedStats[targetId];
627
665
  const { radius, radiusUnit, area, mean, stdDev, max, min, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
@@ -17,7 +17,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
17
17
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
18
18
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
19
19
  class CobbAngleTool extends AnnotationTool {
20
- static { this.toolName = 'CobbAngle'; }
21
20
  constructor(toolProps = {}, defaultToolProps = {
22
21
  supportedInteractionTypes: ['Mouse', 'Touch'],
23
22
  configuration: {
@@ -650,6 +649,7 @@ class CobbAngleTool extends AnnotationTool {
650
649
  return cachedStats;
651
650
  }
652
651
  }
652
+ CobbAngleTool.toolName = 'CobbAngle';
653
653
  function defaultGetTextLines(data, targetId) {
654
654
  const cachedVolumeStats = data.cachedStats[targetId];
655
655
  const { angle } = cachedVolumeStats;
@@ -5,7 +5,6 @@ import { hideElementCursor } from '../../cursors/elementCursor';
5
5
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
6
6
  import ProbeTool from './ProbeTool';
7
7
  class DragProbeTool extends ProbeTool {
8
- static { this.toolName = 'DragProbe'; }
9
8
  constructor(toolProps = {}, defaultToolProps = {
10
9
  supportedInteractionTypes: ['Mouse', 'Touch'],
11
10
  configuration: {
@@ -116,6 +115,7 @@ class DragProbeTool extends ProbeTool {
116
115
  };
117
116
  }
118
117
  }
118
+ DragProbeTool.toolName = 'DragProbe';
119
119
  function defaultGetTextLines(data, targetId) {
120
120
  const cachedVolumeStats = data.cachedStats[targetId];
121
121
  const { index, value, modalityUnit } = cachedVolumeStats;
@@ -13,7 +13,6 @@ import { getCanvasCircleRadius } from '../../utilities/math/circle';
13
13
  import { vec3 } from 'gl-matrix';
14
14
  const CROSSHAIR_SIZE = 5;
15
15
  class ETDRSGridTool extends AnnotationTool {
16
- static { this.toolName = 'ETDRSGrid'; }
17
16
  constructor(toolProps = {}, defaultToolProps = {
18
17
  supportedInteractionTypes: ['Mouse', 'Touch'],
19
18
  configuration: {
@@ -351,4 +350,5 @@ class ETDRSGridTool extends AnnotationTool {
351
350
  return distance;
352
351
  }
353
352
  }
353
+ ETDRSGridTool.toolName = 'ETDRSGrid';
354
354
  export default ETDRSGridTool;
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { AnnotationTool } from '../base';
2
3
  import { getEnabledElement, VolumeViewport, utilities as csUtils, getEnabledElementByViewportId, EPSILON, } from '@cornerstonejs/core';
3
4
  import { getCalibratedAspect, getCalibratedLengthUnitsAndScale, } from '../../utilities/getCalibratedUnits';
@@ -15,13 +16,13 @@ import { pointInEllipse, getCanvasEllipseCorners, } from '../../utilities/math/e
15
16
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
16
17
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
17
18
  import { getPixelValueUnits } from '../../utilities/getPixelValueUnits';
19
+ import { viewportSupportsImageSlices } from '../../utilities/viewportCapabilities';
18
20
  import { isViewportPreScaled } from '../../utilities/viewport/isViewportPreScaled';
19
21
  import { BasicStatsCalculator } from '../../utilities/math/basic';
20
22
  import { vec2 } from 'gl-matrix';
21
23
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
22
24
  const { transformWorldToIndex } = csUtils;
23
25
  class EllipticalROITool extends AnnotationTool {
24
- static { this.toolName = 'EllipticalROI'; }
25
26
  constructor(toolProps = {}, defaultToolProps = {
26
27
  supportedInteractionTypes: ['Mouse', 'Touch'],
27
28
  configuration: {
@@ -417,7 +418,9 @@ class EllipticalROITool extends AnnotationTool {
417
418
  const { referencedImageId } = annotation.metadata;
418
419
  for (const targetId in data.cachedStats) {
419
420
  if (targetId.startsWith('imageId')) {
420
- const viewports = renderingEngine.getStackViewports();
421
+ const viewports = renderingEngine
422
+ .getViewports()
423
+ .filter(viewportSupportsImageSlices);
421
424
  const invalidatedStack = viewports.find((vp) => {
422
425
  const referencedImageURI = csUtils.imageIdToURI(referencedImageId);
423
426
  const hasImageURI = vp.hasImageURI(referencedImageURI);
@@ -548,11 +551,13 @@ class EllipticalROITool extends AnnotationTool {
548
551
  const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal, viewUp, worldPos1, worldPos2);
549
552
  const isEmptyArea = worldWidth === 0 && worldHeight === 0;
550
553
  const handles = [pos1Index, pos2Index];
551
- const { scale, areaUnit } = getCalibratedLengthUnitsAndScale(image, handles);
554
+ const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
555
+ const { areaUnit } = calibrate;
552
556
  const aspect = getCalibratedAspect(image);
553
- const area = Math.abs(Math.PI *
554
- (worldWidth / scale / 2) *
555
- (worldHeight / aspect / scale / 2));
557
+ const indexHandles = points.map((p) => imageData.worldToIndex(p));
558
+ const width = _a.calculateLengthInIndex(calibrate, indexHandles.slice(2, 4));
559
+ const height = _a.calculateLengthInIndex(calibrate, indexHandles.slice(0, 2));
560
+ const area = Math.abs(Math.PI * (width / 2) * (height / aspect / 2));
556
561
  const pixelUnitsOptions = {
557
562
  isPreScaled: isViewportPreScaled(viewport, targetId),
558
563
  isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
@@ -602,39 +607,6 @@ class EllipticalROITool extends AnnotationTool {
602
607
  };
603
608
  this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
604
609
  }
605
- static { this.hydrate = (viewportId, points, options) => {
606
- const enabledElement = getEnabledElementByViewportId(viewportId);
607
- if (!enabledElement) {
608
- return;
609
- }
610
- const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(EllipticalROITool, enabledElement, points, options);
611
- const { toolInstance, ...serializableOptions } = options || {};
612
- const annotation = {
613
- annotationUID: options?.annotationUID || csUtils.uuidv4(),
614
- data: {
615
- handles: {
616
- points,
617
- activeHandleIndex: null,
618
- },
619
- label: '',
620
- cachedStats: {},
621
- },
622
- highlighted: false,
623
- autoGenerated: false,
624
- invalidated: false,
625
- isLocked: false,
626
- isVisible: true,
627
- metadata: {
628
- toolName: instance.getToolName(),
629
- viewPlaneNormal,
630
- FrameOfReferenceUID,
631
- referencedImageId,
632
- ...serializableOptions,
633
- },
634
- };
635
- addAnnotation(annotation, viewport.element);
636
- triggerAnnotationRenderForViewportIds([viewport.id]);
637
- }; }
638
610
  _pointInEllipseCanvas(ellipse, location) {
639
611
  const { xRadius, yRadius, center, angle } = ellipse;
640
612
  const rotLocation = vec2.rotate(vec2.create(), location, center, -angle);
@@ -657,6 +629,41 @@ class EllipticalROITool extends AnnotationTool {
657
629
  ];
658
630
  }
659
631
  }
632
+ _a = EllipticalROITool;
633
+ EllipticalROITool.toolName = 'EllipticalROI';
634
+ EllipticalROITool.hydrate = (viewportId, points, options) => {
635
+ const enabledElement = getEnabledElementByViewportId(viewportId);
636
+ if (!enabledElement) {
637
+ return;
638
+ }
639
+ const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
640
+ const { toolInstance, ...serializableOptions } = options || {};
641
+ const annotation = {
642
+ annotationUID: options?.annotationUID || csUtils.uuidv4(),
643
+ data: {
644
+ handles: {
645
+ points,
646
+ activeHandleIndex: null,
647
+ },
648
+ label: '',
649
+ cachedStats: {},
650
+ },
651
+ highlighted: false,
652
+ autoGenerated: false,
653
+ invalidated: false,
654
+ isLocked: false,
655
+ isVisible: true,
656
+ metadata: {
657
+ toolName: instance.getToolName(),
658
+ viewPlaneNormal,
659
+ FrameOfReferenceUID,
660
+ referencedImageId,
661
+ ...serializableOptions,
662
+ },
663
+ };
664
+ addAnnotation(annotation, viewport.element);
665
+ triggerAnnotationRenderForViewportIds([viewport.id]);
666
+ };
660
667
  function defaultGetTextLines(data, targetId) {
661
668
  const cachedVolumeStats = data.cachedStats[targetId];
662
669
  const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, min } = cachedVolumeStats;
@@ -16,7 +16,6 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
16
16
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
17
17
  const { transformWorldToIndex } = csUtils;
18
18
  class HeightTool extends AnnotationTool {
19
- static { this.toolName = 'Height'; }
20
19
  constructor(toolProps = {}, defaultToolProps = {
21
20
  supportedInteractionTypes: ['Mouse', 'Touch'],
22
21
  configuration: {
@@ -380,6 +379,7 @@ class HeightTool extends AnnotationTool {
380
379
  csUtils.indexWithinDimensions(index2, dimensions));
381
380
  }
382
381
  }
382
+ HeightTool.toolName = 'Height';
383
383
  function defaultGetTextLines(data, targetId) {
384
384
  const cachedVolumeStats = data.cachedStats[targetId];
385
385
  const { height, unit } = cachedVolumeStats;
@@ -9,17 +9,6 @@ import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'
9
9
  import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
10
10
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
11
11
  class KeyImageTool extends AnnotationTool {
12
- static { this.toolName = 'KeyImage'; }
13
- static { this.dataSeries = {
14
- data: {
15
- seriesLevel: true,
16
- },
17
- }; }
18
- static { this.dataPoint = {
19
- data: {
20
- isPoint: true,
21
- },
22
- }; }
23
12
  constructor(toolProps = {}, defaultToolProps = {
24
13
  supportedInteractionTypes: ['Mouse', 'Touch'],
25
14
  configuration: {
@@ -260,6 +249,17 @@ class KeyImageTool extends AnnotationTool {
260
249
  csUtils.indexWithinDimensions(index2, dimensions));
261
250
  }
262
251
  }
252
+ KeyImageTool.toolName = 'KeyImage';
253
+ KeyImageTool.dataSeries = {
254
+ data: {
255
+ seriesLevel: true,
256
+ },
257
+ };
258
+ KeyImageTool.dataPoint = {
259
+ data: {
260
+ isPoint: true,
261
+ },
262
+ };
263
263
  function getTextCallback(doneChangingTextCallback) {
264
264
  return doneChangingTextCallback(prompt('Enter your annotation:'));
265
265
  }
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { vec2 } from 'gl-matrix';
2
3
  import { ChangeTypes, Events } from '../../enums';
3
4
  import { getEnabledElement, utilities as csUtils, getEnabledElementByViewportId, } from '@cornerstonejs/core';
@@ -11,7 +12,6 @@ import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../st
11
12
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
12
13
  import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
13
14
  class LabelTool extends AnnotationTool {
14
- static { this.toolName = 'Label'; }
15
15
  constructor(toolProps = {}, defaultToolProps = {
16
16
  supportedInteractionTypes: ['Mouse', 'Touch'],
17
17
  configuration: {
@@ -257,40 +257,6 @@ class LabelTool extends AnnotationTool {
257
257
  return renderStatus;
258
258
  };
259
259
  }
260
- static { this.hydrate = (viewportId, position, label, options) => {
261
- const enabledElement = getEnabledElementByViewportId(viewportId);
262
- if (!enabledElement) {
263
- return;
264
- }
265
- const { viewport } = enabledElement;
266
- const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
267
- const { viewPlaneNormal, viewUp } = viewport.getCamera();
268
- const instance = new this();
269
- const referencedImageId = instance.getReferencedImageId(viewport, position, viewPlaneNormal, viewUp);
270
- const annotation = {
271
- annotationUID: options?.annotationUID || csUtils.uuidv4(),
272
- data: {
273
- label,
274
- handles: {
275
- points: [position],
276
- },
277
- },
278
- highlighted: false,
279
- autoGenerated: false,
280
- invalidated: false,
281
- isLocked: false,
282
- isVisible: true,
283
- metadata: {
284
- toolName: instance.getToolName(),
285
- viewPlaneNormal,
286
- FrameOfReferenceUID,
287
- referencedImageId,
288
- ...options,
289
- },
290
- };
291
- addAnnotation(annotation, viewport.element);
292
- triggerAnnotationRenderForViewportIds([viewport.id]);
293
- }; }
294
260
  handleSelectedCallback(_evt, _annotation, _handle, _interactionType) { }
295
261
  _doneChangingTextCallback(element, annotation, updatedLabel) {
296
262
  annotation.data.label = updatedLabel;
@@ -303,6 +269,42 @@ class LabelTool extends AnnotationTool {
303
269
  csUtils.indexWithinDimensions(index2, dimensions));
304
270
  }
305
271
  }
272
+ _a = LabelTool;
273
+ LabelTool.toolName = 'Label';
274
+ LabelTool.hydrate = (viewportId, position, label, options) => {
275
+ const enabledElement = getEnabledElementByViewportId(viewportId);
276
+ if (!enabledElement) {
277
+ return;
278
+ }
279
+ const { viewport } = enabledElement;
280
+ const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
281
+ const { viewPlaneNormal, viewUp } = viewport.getCamera();
282
+ const instance = new _a();
283
+ const referencedImageId = instance.getReferencedImageId(viewport, position, viewPlaneNormal, viewUp);
284
+ const annotation = {
285
+ annotationUID: options?.annotationUID || csUtils.uuidv4(),
286
+ data: {
287
+ label,
288
+ handles: {
289
+ points: [position],
290
+ },
291
+ },
292
+ highlighted: false,
293
+ autoGenerated: false,
294
+ invalidated: false,
295
+ isLocked: false,
296
+ isVisible: true,
297
+ metadata: {
298
+ toolName: instance.getToolName(),
299
+ viewPlaneNormal,
300
+ FrameOfReferenceUID,
301
+ referencedImageId,
302
+ ...options,
303
+ },
304
+ };
305
+ addAnnotation(annotation, viewport.element);
306
+ triggerAnnotationRenderForViewportIds([viewport.id]);
307
+ };
306
308
  function getTextCallback(doneChangingTextCallback) {
307
309
  return doneChangingTextCallback(prompt('Enter your annotation:'));
308
310
  }
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { Events, ChangeTypes, MeasurementType } from '../../enums';
2
3
  import { getEnabledElement, utilities as csUtils, utilities, getEnabledElementByViewportId, } from '@cornerstonejs/core';
3
4
  import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
@@ -15,7 +16,6 @@ import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnota
15
16
  import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCursor';
16
17
  import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
17
18
  class LengthTool extends AnnotationTool {
18
- static { this.toolName = 'Length'; }
19
19
  constructor(toolProps = {}, defaultToolProps = {
20
20
  supportedInteractionTypes: ['Mouse', 'Touch'],
21
21
  configuration: {
@@ -308,36 +308,6 @@ class LengthTool extends AnnotationTool {
308
308
  };
309
309
  this._throttledCalculateCachedStats = throttle(this._calculateCachedStats, 100, { trailing: true });
310
310
  }
311
- static { this.hydrate = (viewportId, points, options) => {
312
- const enabledElement = getEnabledElementByViewportId(viewportId);
313
- if (!enabledElement) {
314
- return;
315
- }
316
- const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = this.hydrateBase(LengthTool, enabledElement, points, options);
317
- const { toolInstance, ...serializableOptions } = options || {};
318
- const annotation = {
319
- annotationUID: options?.annotationUID || utilities.uuidv4(),
320
- data: {
321
- handles: {
322
- points,
323
- },
324
- },
325
- highlighted: false,
326
- autoGenerated: false,
327
- invalidated: false,
328
- isLocked: false,
329
- isVisible: true,
330
- metadata: {
331
- toolName: instance.getToolName(),
332
- viewPlaneNormal,
333
- FrameOfReferenceUID,
334
- referencedImageId,
335
- ...serializableOptions,
336
- },
337
- };
338
- addAnnotation(annotation, viewport.element);
339
- triggerAnnotationRenderForViewportIds([viewport.id]);
340
- }; }
341
311
  handleSelectedCallback(evt, annotation, handle) {
342
312
  const eventDetail = evt.detail;
343
313
  const { element } = eventDetail;
@@ -378,8 +348,8 @@ class LengthTool extends AnnotationTool {
378
348
  const handles = data.handles.points.map((point) => imageData.worldToIndex(point));
379
349
  const calibrate = getCalibratedLengthUnitsAndScale(image, handles);
380
350
  const { unit } = calibrate;
381
- const length = LengthTool.calculateLengthInIndex(calibrate, handles);
382
- this.isHandleOutsideImage = !LengthTool.isInsideVolume(dimensions, handles);
351
+ const length = _a.calculateLengthInIndex(calibrate, handles);
352
+ this.isHandleOutsideImage = !_a.isInsideVolume(dimensions, handles);
383
353
  const namedLength = {
384
354
  name: 'length',
385
355
  value: length,
@@ -400,6 +370,38 @@ class LengthTool extends AnnotationTool {
400
370
  return cachedStats;
401
371
  }
402
372
  }
373
+ _a = LengthTool;
374
+ LengthTool.toolName = 'Length';
375
+ LengthTool.hydrate = (viewportId, points, options) => {
376
+ const enabledElement = getEnabledElementByViewportId(viewportId);
377
+ if (!enabledElement) {
378
+ return;
379
+ }
380
+ const { FrameOfReferenceUID, referencedImageId, viewPlaneNormal, instance, viewport, } = _a.hydrateBase(_a, enabledElement, points, options);
381
+ const { toolInstance, ...serializableOptions } = options || {};
382
+ const annotation = {
383
+ annotationUID: options?.annotationUID || utilities.uuidv4(),
384
+ data: {
385
+ handles: {
386
+ points,
387
+ },
388
+ },
389
+ highlighted: false,
390
+ autoGenerated: false,
391
+ invalidated: false,
392
+ isLocked: false,
393
+ isVisible: true,
394
+ metadata: {
395
+ toolName: instance.getToolName(),
396
+ viewPlaneNormal,
397
+ FrameOfReferenceUID,
398
+ referencedImageId,
399
+ ...serializableOptions,
400
+ },
401
+ };
402
+ addAnnotation(annotation, viewport.element);
403
+ triggerAnnotationRenderForViewportIds([viewport.id]);
404
+ };
403
405
  function defaultGetTextLines(data, targetId) {
404
406
  const cachedVolumeStats = data.cachedStats[targetId];
405
407
  const { length, unit } = cachedVolumeStats;
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  import { utilities as csUtils } from '@cornerstonejs/core';
2
3
  import LivewireContourTool from './LivewireContourTool';
3
4
  import { LivewirePath } from '../../utilities/livewire/LiveWirePath';
@@ -6,7 +7,6 @@ import { ChangeTypes } from '../../enums';
6
7
  import { drawPolyline as drawPolylineSvg } from '../../drawingSvg';
7
8
  import AnnotationToPointData from '../../utilities/contours/AnnotationToPointData';
8
9
  class LivewireContourSegmentationTool extends LivewireContourTool {
9
- static { this.toolName = 'LivewireContourSegmentationTool'; }
10
10
  updateInterpolatedAnnotation(annotation, enabledElement) {
11
11
  if (this.editData ||
12
12
  !annotation.invalidated ||
@@ -86,8 +86,10 @@ class LivewireContourSegmentationTool extends LivewireContourTool {
86
86
  isContourSegmentationTool() {
87
87
  return true;
88
88
  }
89
- static {
90
- AnnotationToPointData.register(this);
91
- }
92
89
  }
90
+ _a = LivewireContourSegmentationTool;
91
+ LivewireContourSegmentationTool.toolName = 'LivewireContourSegmentationTool';
92
+ (() => {
93
+ AnnotationToPointData.register(_a);
94
+ })();
93
95
  export default LivewireContourSegmentationTool;