@cornerstonejs/tools 2.0.0-beta.20 → 2.0.0-beta.21
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.
- package/dist/esm/cursors/SVGCursorDescriptor.d.ts +1 -1
- package/dist/esm/cursors/SVGCursorDescriptor.js +7 -0
- package/dist/esm/cursors/SVGMouseCursor.d.ts +1 -1
- package/dist/esm/drawingSvg/draw.d.ts +2 -1
- package/dist/esm/drawingSvg/drawArrow.d.ts +1 -1
- package/dist/esm/drawingSvg/drawCircle.d.ts +1 -1
- package/dist/esm/drawingSvg/drawEllipse.d.ts +1 -1
- package/dist/esm/drawingSvg/drawEllipse.js +1 -0
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHandle.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHandles.d.ts +1 -1
- package/dist/esm/drawingSvg/drawHeight.d.ts +3 -0
- package/dist/esm/drawingSvg/drawHeight.js +42 -0
- package/dist/esm/drawingSvg/drawLine.d.ts +1 -1
- package/dist/esm/drawingSvg/drawLink.d.ts +1 -1
- package/dist/esm/drawingSvg/drawLinkedTextBox.d.ts +1 -1
- package/dist/esm/drawingSvg/drawPath.d.ts +1 -1
- package/dist/esm/drawingSvg/drawPolyline.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRect.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRect.js +1 -0
- package/dist/esm/drawingSvg/drawRectByCoordinates.d.ts +1 -1
- package/dist/esm/drawingSvg/drawRedactionRect.d.ts +3 -1
- package/dist/esm/drawingSvg/drawTextBox.d.ts +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.d.ts +1 -1
- package/dist/esm/drawingSvg/getSvgDrawingHelper.js +1 -1
- package/dist/esm/drawingSvg/index.d.ts +2 -1
- package/dist/esm/drawingSvg/index.js +2 -1
- package/dist/esm/enums/ToolBindings.d.ts +3 -1
- package/dist/esm/enums/ToolBindings.js +2 -0
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.d.ts +1 -1
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyUp.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDown.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownActivate.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDownAnnotationAction.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseDrag.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseMove.d.ts +1 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseWheel.d.ts +2 -1
- package/dist/esm/eventDispatchers/mouseEventHandlers/mouseWheel.js +15 -2
- package/dist/esm/eventDispatchers/shared/getActiveToolForKeyboardEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForMouseEvent.js +3 -4
- package/dist/esm/eventDispatchers/shared/getActiveToolForTouchEvent.d.ts +1 -1
- package/dist/esm/eventDispatchers/shared/getActiveToolForTouchEvent.js +1 -1
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForKeyboardEvents.d.ts +2 -2
- package/dist/esm/eventDispatchers/shared/getToolsWithActionsForMouseEvent.d.ts +4 -3
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForMouseEvent.d.ts +3 -3
- package/dist/esm/eventDispatchers/shared/getToolsWithModesForTouchEvent.d.ts +2 -2
- package/dist/esm/eventDispatchers/touchEventHandlers/touchDrag.d.ts +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStart.d.ts +1 -1
- package/dist/esm/eventDispatchers/touchEventHandlers/touchStartActivate.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/annotationRemovedListener.d.ts +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +3 -3
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.d.ts +1 -1
- package/dist/esm/eventListeners/mouse/getMouseEventPoints.js +4 -1
- package/dist/esm/eventListeners/mouse/mouseDownListener.js +9 -1
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +6 -6
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +3 -3
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +2 -2
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.js +3 -2
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.js +5 -5
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.d.ts +1 -1
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.js +4 -2
- package/dist/esm/eventListeners/touch/getTouchEventPoints.d.ts +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/stateManagement/annotation/AnnotationRenderingEngine.d.ts +20 -0
- package/dist/esm/stateManagement/annotation/AnnotationRenderingEngine.js +112 -0
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts +3 -3
- package/dist/esm/stateManagement/annotation/annotationLocking.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/annotationState.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/annotationVisibility.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/ToolStyle.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/getFont.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/config/getState.d.ts +1 -1
- package/dist/esm/stateManagement/annotation/config/helpers.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/helpers/state.d.ts +2 -2
- package/dist/esm/stateManagement/annotation/utilities/defineProperties.d.ts +1 -1
- package/dist/esm/stateManagement/index.d.ts +3 -3
- package/dist/esm/stateManagement/index.js +2 -2
- package/dist/esm/{tools/displayTools → stateManagement/segmentation}/SegmentationRenderingEngine.d.ts +3 -3
- package/dist/esm/{tools/displayTools → stateManagement/segmentation}/SegmentationRenderingEngine.js +14 -17
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +12 -12
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +27 -19
- package/dist/esm/stateManagement/segmentation/activeSegmentation.d.ts +5 -4
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js +12 -5
- package/dist/esm/stateManagement/segmentation/addRepresentationData.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/{addRepresentation.js → addSegmentationRepresentation.js} +6 -6
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +9 -0
- package/dist/esm/stateManagement/segmentation/addSegmentations.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/config/index.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/config/index.js +2 -2
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +2 -2
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.d.ts +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.js +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.d.ts +5 -5
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +12 -12
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +3 -7
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +8 -53
- package/dist/esm/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getSegmentationRepresentationRenderingConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/helpers/{getRepresentationRenderingConfig.js → getSegmentationRepresentationRenderingConfig.js} +2 -2
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/validateSegmentationInput.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/index.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/index.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.js +12 -21
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.js +2 -6
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.js +8 -13
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.js +2 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +4 -3
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +2 -2
- package/dist/esm/stateManagement/segmentation/polySeg/computeAndAddRepresentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/removeSegmentationRepresentations.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/{removeRepresentationsFromViewport.js → removeSegmentationRepresentations.js} +9 -6
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +2 -2
- package/dist/esm/stateManagement/segmentation/segmentLocking.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/segmentLocking.js +2 -2
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +16 -16
- package/dist/esm/stateManagement/segmentation/segmentationState.js +30 -30
- package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +7 -3
- package/dist/esm/store/SynchronizerManager/Synchronizer.js +2 -1
- package/dist/esm/store/SynchronizerManager/createSynchronizer.d.ts +3 -3
- package/dist/esm/store/SynchronizerManager/createSynchronizer.js +1 -1
- package/dist/esm/store/SynchronizerManager/getAllSynchronizers.d.ts +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizer.d.ts +1 -1
- package/dist/esm/store/SynchronizerManager/getSynchronizersForViewport.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.d.ts +3 -3
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +5 -2
- package/dist/esm/store/ToolGroupManager/createToolGroup.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/destroyToolGroup.js +1 -0
- package/dist/esm/store/ToolGroupManager/getAllToolGroups.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroup.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupForViewport.d.ts +1 -1
- package/dist/esm/store/ToolGroupManager/getToolGroupsWithToolName.d.ts +1 -1
- package/dist/esm/store/addEnabledElement.d.ts +1 -1
- package/dist/esm/store/addEnabledElement.js +1 -1
- package/dist/esm/store/addTool.js +0 -3
- package/dist/esm/store/filterMoveableAnnotationTools.d.ts +1 -1
- package/dist/esm/store/filterToolsWithAnnotationsForElement.d.ts +1 -1
- package/dist/esm/store/filterToolsWithMoveableHandles.d.ts +1 -1
- package/dist/esm/store/removeEnabledElement.d.ts +1 -1
- package/dist/esm/store/removeEnabledElement.js +1 -1
- package/dist/esm/store/state.d.ts +4 -3
- package/dist/esm/store/state.js +1 -1
- package/dist/esm/synchronizers/callbacks/areViewportsCoplanar .d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/cameraSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/callbacks/imageSliceSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/callbacks/presentationViewSyncCallback.d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/slabThicknessSyncCallback.d.ts +1 -1
- package/dist/esm/synchronizers/callbacks/voiSyncCallback.d.ts +5 -2
- package/dist/esm/synchronizers/callbacks/zoomPanSyncCallback.d.ts +2 -2
- package/dist/esm/synchronizers/synchronizers/createCameraPositionSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createImageSliceSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +2 -2
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.js +1 -1
- package/dist/esm/synchronizers/synchronizers/createSlabThicknessSynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createVOISynchronizer.d.ts +1 -1
- package/dist/esm/synchronizers/synchronizers/createZoomPanSynchronizer.d.ts +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.d.ts +4 -6
- package/dist/esm/tools/AdvancedMagnifyViewport.js +1 -1
- package/dist/esm/tools/AdvancedMagnifyViewportManager.d.ts +3 -2
- package/dist/esm/tools/AdvancedMagnifyViewportManager.js +1 -1
- package/dist/esm/tools/AnnotationEraserTool.d.ts +1 -1
- package/dist/esm/tools/CrosshairsTool.d.ts +5 -5
- package/dist/esm/tools/CrosshairsTool.js +4 -3
- package/dist/esm/tools/MIPJumpToClickTool.d.ts +1 -2
- package/dist/esm/tools/MIPJumpToClickTool.js +2 -3
- package/dist/esm/tools/MagnifyTool.d.ts +2 -3
- package/dist/esm/tools/OrientationMarkerTool.d.ts +41 -58
- package/dist/esm/tools/OrientationMarkerTool.js +8 -7
- package/dist/esm/tools/OverlayGridTool.d.ts +2 -4
- package/dist/esm/tools/OverlayGridTool.js +1 -1
- package/dist/esm/tools/PanTool.d.ts +1 -1
- package/dist/esm/tools/PanTool.js +5 -0
- package/dist/esm/tools/PlanarRotateTool.d.ts +3 -1
- package/dist/esm/tools/PlanarRotateTool.js +18 -4
- package/dist/esm/tools/ReferenceCursors.d.ts +2 -5
- package/dist/esm/tools/ReferenceLinesTool.d.ts +4 -6
- package/dist/esm/tools/ReferenceLinesTool.js +1 -1
- package/dist/esm/tools/ScaleOverlayTool.d.ts +7 -9
- package/dist/esm/tools/ScaleOverlayTool.js +1 -2
- package/dist/esm/tools/SculptorTool/CircleSculptCursor.d.ts +4 -4
- package/dist/esm/tools/SculptorTool.d.ts +1 -1
- package/dist/esm/tools/SegmentationIntersectionTool.d.ts +2 -2
- package/dist/esm/tools/StackScrollTool.d.ts +2 -1
- package/dist/esm/tools/StackScrollTool.js +17 -3
- package/dist/esm/tools/StackScrollToolMouseWheelTool.d.ts +1 -2
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js +1 -2
- package/dist/esm/tools/TrackballRotateTool.d.ts +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +4 -0
- package/dist/esm/tools/VolumeRotateMouseWheelTool.d.ts +2 -3
- package/dist/esm/tools/WindowLevelRegionTool.d.ts +3 -3
- package/dist/esm/tools/WindowLevelRegionTool.js +1 -3
- package/dist/esm/tools/WindowLevelTool.d.ts +1 -1
- package/dist/esm/tools/WindowLevelTool.js +12 -7
- package/dist/esm/tools/ZoomTool.d.ts +2 -2
- package/dist/esm/tools/ZoomTool.js +2 -2
- package/dist/esm/tools/annotation/AngleTool.d.ts +5 -7
- package/dist/esm/tools/annotation/ArrowAnnotateTool.d.ts +5 -7
- package/dist/esm/tools/annotation/BidirectionalTool.d.ts +5 -7
- package/dist/esm/tools/annotation/CircleROITool.d.ts +5 -7
- package/dist/esm/tools/annotation/CircleROITool.js +8 -5
- package/dist/esm/tools/annotation/CobbAngleTool.d.ts +5 -7
- package/dist/esm/tools/annotation/DragProbeTool.d.ts +3 -5
- package/dist/esm/tools/annotation/DragProbeTool.js +0 -5
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +5 -7
- package/dist/esm/tools/annotation/EllipticalROITool.js +8 -3
- package/dist/esm/tools/annotation/HeightTool.d.ts +36 -0
- package/dist/esm/tools/annotation/HeightTool.js +435 -0
- package/dist/esm/tools/annotation/KeyImageTool.d.ts +4 -6
- package/dist/esm/tools/annotation/LengthTool.d.ts +5 -7
- package/dist/esm/tools/annotation/LengthTool.js +7 -5
- package/dist/esm/tools/annotation/LivewireContourTool.d.ts +3 -4
- package/dist/esm/tools/annotation/LivewireContourTool.js +2 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.d.ts +21 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +155 -113
- package/dist/esm/tools/annotation/ProbeTool.d.ts +4 -6
- package/dist/esm/tools/annotation/ProbeTool.js +14 -29
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +5 -5
- package/dist/esm/tools/annotation/RectangleROITool.js +7 -3
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.d.ts +1 -1
- package/dist/esm/tools/annotation/SplineROITool.d.ts +1 -3
- package/dist/esm/tools/annotation/SplineROITool.js +2 -2
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.d.ts +5 -7
- package/dist/esm/tools/annotation/VideoRedactionTool.d.ts +4 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/CardinalSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/CubicSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/QuadraticSpline.d.ts +1 -1
- package/dist/esm/tools/annotation/splines/Spline.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.d.ts +3 -3
- package/dist/esm/tools/base/AnnotationDisplayTool.js +3 -9
- package/dist/esm/tools/base/AnnotationTool.d.ts +3 -14
- package/dist/esm/tools/base/BaseTool.d.ts +5 -5
- package/dist/esm/tools/base/BaseTool.js +1 -1
- package/dist/esm/tools/base/ContourBaseTool.d.ts +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js +3 -3
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +10 -10
- package/dist/esm/tools/displayTools/Contour/contourConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.d.ts +2 -2
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +2 -1
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +2 -2
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +4 -4
- package/dist/esm/tools/displayTools/Contour/contourHandler/utils.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js +2 -2
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.d.ts +1 -1
- package/dist/esm/tools/displayTools/Labelmap/addLabelmapToElement.js +3 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +5 -5
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +10 -8
- package/dist/esm/tools/displayTools/Labelmap/validateLabelmap.d.ts +2 -2
- package/dist/esm/tools/displayTools/Surface/surfaceConfig.d.ts +1 -1
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.d.ts +2 -2
- package/dist/esm/tools/distancePointToContour.d.ts +1 -1
- package/dist/esm/tools/index.d.ts +2 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/segmentation/BrushTool.js +5 -5
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.d.ts +20 -15
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +199 -67
- package/dist/esm/tools/segmentation/CircleScissorsTool.d.ts +3 -3
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +10 -3
- package/dist/esm/tools/segmentation/PaintFillTool.d.ts +1 -1
- package/dist/esm/tools/segmentation/PaintFillTool.js +15 -14
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +20 -10
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +174 -55
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.d.ts +3 -3
- package/dist/esm/tools/segmentation/RectangleScissorsTool.d.ts +4 -3
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +8 -5
- package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +2 -2
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +2 -2
- package/dist/esm/tools/segmentation/SphereScissorsTool.d.ts +3 -2
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +12 -4
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.d.ts +4 -5
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js +3 -1
- package/dist/esm/tools/segmentation/strategies/compositions/determineSegmentIndex.js +6 -3
- package/dist/esm/tools/segmentation/strategies/compositions/dynamicThreshold.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/islandRemoval.js +1 -1
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/tools/segmentation/strategies/compositions/regionFill.js +6 -3
- package/dist/esm/tools/segmentation/strategies/compositions/setValue.js +1 -1
- package/dist/esm/tools/segmentation/strategies/eraseRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js +10 -7
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.d.ts +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +7 -24
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +9 -2
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.d.ts +3 -3
- package/dist/esm/tools/segmentation/strategies/utils/stackVolumeCheck.js +0 -3
- package/dist/esm/types/AnnotationGroupSelector.d.ts +1 -1
- package/dist/esm/types/AnnotationRenderContext.d.ts +3 -2
- package/dist/esm/types/AnnotationStyle.d.ts +2 -2
- package/dist/esm/types/AnnotationTypes.d.ts +3 -3
- package/dist/esm/types/BoundsIJK.d.ts +1 -1
- package/dist/esm/types/CINETypes.d.ts +1 -0
- package/dist/esm/types/CalculatorTypes.d.ts +1 -1
- package/dist/esm/types/CardinalSplineProps.d.ts +1 -1
- package/dist/esm/types/ClosestPoint.d.ts +1 -1
- package/dist/esm/types/ContourAnnotation.d.ts +1 -1
- package/dist/esm/types/ContourSegmentationAnnotation.d.ts +2 -2
- package/dist/esm/types/ControlPointInfo.d.ts +1 -1
- package/dist/esm/types/EventTypes.d.ts +13 -12
- package/dist/esm/types/FloodFillTypes.d.ts +2 -2
- package/dist/esm/types/IAnnotationManager.d.ts +3 -3
- package/dist/esm/types/IDistance.d.ts +1 -1
- package/dist/esm/types/IPoints.d.ts +2 -2
- package/dist/esm/types/ISetToolModeOptions.d.ts +2 -2
- package/dist/esm/types/ISpline.d.ts +1 -1
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +3 -3
- package/dist/esm/types/IToolClassReference.d.ts +3 -3
- package/dist/esm/types/IToolGroup.d.ts +8 -8
- package/dist/esm/types/ITouchPoints.d.ts +2 -2
- package/dist/esm/types/InteractionTypes.d.ts +1 -1
- package/dist/esm/types/InternalToolTypes.d.ts +4 -4
- package/dist/esm/types/InterpolationTypes.d.ts +3 -3
- package/dist/esm/types/JumpToSliceOptions.d.ts +1 -1
- package/dist/esm/types/LabelmapToolOperationData.d.ts +3 -2
- package/dist/esm/types/PlanarBoundingBox.d.ts +1 -1
- package/dist/esm/types/SVGDrawingHelper.d.ts +1 -1
- package/dist/esm/types/ScrollOptions.d.ts +1 -1
- package/dist/esm/types/SegmentationStateTypes.d.ts +7 -6
- package/dist/esm/types/SplineCurveSegment.d.ts +1 -1
- package/dist/esm/types/SplineLineSegment.d.ts +1 -1
- package/dist/esm/types/ToolAction.d.ts +1 -1
- package/dist/esm/types/ToolHandle.d.ts +1 -1
- package/dist/esm/types/ToolProps.d.ts +1 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +34 -12
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/utilities/annotationFrameRange.d.ts +1 -1
- package/dist/esm/utilities/annotationHydration.d.ts +3 -2
- package/dist/esm/utilities/cine/playClip.d.ts +6 -2
- package/dist/esm/utilities/cine/playClip.js +53 -6
- package/dist/esm/utilities/cine/state.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/addContourSegmentationAnnotation.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/areSameSegment.d.ts +1 -1
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +2 -2
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts +1 -1
- package/dist/esm/utilities/contours/AnnotationToPointData.d.ts +1 -1
- package/dist/esm/utilities/contours/areCoplanarContours.d.ts +1 -1
- package/dist/esm/utilities/contours/findHandlePolylineIndex.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.d.ts +1 -1
- package/dist/esm/utilities/contours/interpolation/interpolate.d.ts +1 -1
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.d.ts +1 -1
- package/dist/esm/utilities/contours/updateContourPolyline.d.ts +1 -1
- package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.d.ts +3 -2
- package/dist/esm/utilities/dynamicVolume/generateImageFromTimeData.js +31 -23
- package/dist/esm/utilities/dynamicVolume/getDataInTime.d.ts +1 -1
- package/dist/esm/utilities/dynamicVolume/getDataInTime.js +14 -9
- package/dist/esm/utilities/getAnnotationNearPoint.d.ts +1 -1
- package/dist/esm/utilities/getCalibratedUnits.d.ts +0 -6
- package/dist/esm/utilities/getCalibratedUnits.js +13 -4
- package/dist/esm/utilities/getPixelValueUnits.d.ts +2 -1
- package/dist/esm/utilities/getPixelValueUnits.js +1 -0
- package/dist/esm/utilities/getSphereBoundsInfo.d.ts +1 -1
- package/dist/esm/utilities/getToolsWithModesForElement.d.ts +1 -1
- package/dist/esm/utilities/getVOIMultipliers.d.ts +1 -1
- package/dist/esm/utilities/index.d.ts +1 -3
- package/dist/esm/utilities/index.js +1 -3
- package/dist/esm/utilities/livewire/LiveWirePath.d.ts +1 -1
- package/dist/esm/utilities/livewire/LivewireScissors.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/distanceToPoint.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/distanceToPointSquared.d.ts +1 -1
- package/dist/esm/utilities/math/aabb/intersectAABB.d.ts +1 -1
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.d.ts +2 -2
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +1 -1
- package/dist/esm/utilities/math/basic/Calculator.d.ts +1 -1
- package/dist/esm/utilities/math/circle/getCanvasCircleCorners.d.ts +1 -1
- package/dist/esm/utilities/math/circle/getCanvasCircleRadius.d.ts +1 -1
- package/dist/esm/utilities/math/line/distanceToPointSquared.d.ts +1 -1
- package/dist/esm/utilities/math/midPoint.d.ts +1 -1
- package/dist/esm/utilities/math/point/mirror.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/addCanvasPointsToArray.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/combinePolyline.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getAABB.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getLinesIntersection.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getNormal2.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/getNormal3.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/intersectPolyline.d.ts +1 -1
- package/dist/esm/utilities/math/polyline/planarFreehandROIInternalTypes.d.ts +2 -2
- package/dist/esm/utilities/math/sphere/pointInSphere.d.ts +1 -1
- package/dist/esm/utilities/orientation/getOrientationStringLPS.d.ts +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.d.ts +1 -1
- package/dist/esm/utilities/planar/filterAnnotationsWithinPlane.d.ts +3 -0
- package/dist/esm/utilities/planar/filterAnnotationsWithinPlane.js +26 -0
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.d.ts +1 -1
- package/dist/esm/utilities/planar/index.d.ts +3 -1
- package/dist/esm/utilities/planar/index.js +3 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolation/algorithms/bspline.d.ts +1 -1
- package/dist/esm/utilities/planarFreehandROITool/interpolation/interpolateSegmentPoints.d.ts +1 -1
- package/dist/esm/utilities/planarFreehandROITool/smoothAnnotation.d.ts +2 -2
- package/dist/esm/utilities/planarFreehandROITool/smoothPoints.d.ts +11 -3
- package/dist/esm/utilities/polyData/utils.d.ts +1 -1
- package/dist/esm/utilities/scroll.d.ts +4 -3
- package/dist/esm/utilities/scroll.js +3 -10
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.d.ts +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.d.ts +2 -11
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/createMergedLabelmapForIndex.d.ts +1 -1
- package/dist/esm/utilities/segmentation/createMergedLabelmapForIndex.js +7 -7
- package/dist/esm/utilities/segmentation/floodFill.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getDefaultRepresentationConfig.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.js +8 -5
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.d.ts +1 -1
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.js +7 -4
- package/dist/esm/utilities/segmentation/getUniqueSegmentIndices.js +4 -5
- package/dist/esm/utilities/segmentation/index.d.ts +2 -2
- package/dist/esm/utilities/segmentation/index.js +2 -2
- package/dist/esm/utilities/segmentation/isValidRepresentationConfig.d.ts +1 -1
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.d.ts +1 -1
- package/dist/esm/utilities/segmentation/rectangleROIThresholdVolumeByRange.js +3 -2
- package/dist/esm/utilities/segmentation/segmentContourAction.d.ts +1 -1
- package/dist/esm/utilities/segmentation/segmentContourAction.js +4 -4
- package/dist/esm/utilities/segmentation/thresholdSegmentationByRange.d.ts +2 -2
- package/dist/esm/utilities/segmentation/thresholdSegmentationByRange.js +24 -17
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.d.ts +3 -3
- package/dist/esm/utilities/segmentation/thresholdVolumeByRange.js +21 -12
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.d.ts +3 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +7 -5
- package/dist/esm/utilities/segmentation/utilities.d.ts +12 -2
- package/dist/esm/utilities/segmentation/utilities.js +5 -6
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +30 -25
- package/dist/esm/utilities/stackPrefetch/stackPrefetch.js +3 -8
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js +2 -3
- package/dist/esm/utilities/stackPrefetch/state.d.ts +20 -1
- package/dist/esm/utilities/touch/index.d.ts +1 -1
- package/dist/esm/utilities/triggerAnnotationRender.d.ts +0 -20
- package/dist/esm/utilities/triggerAnnotationRender.js +1 -112
- package/dist/esm/utilities/viewport/isViewportPreScaled.d.ts +1 -1
- package/dist/esm/utilities/viewport/isViewportPreScaled.js +2 -5
- package/dist/esm/utilities/viewport/jumpToSlice.d.ts +1 -1
- package/dist/esm/utilities/viewport/jumpToSlice.js +4 -6
- package/dist/esm/utilities/voi/colorbar/ColorbarCanvas.d.ts +2 -2
- package/dist/esm/utilities/voi/colorbar/ViewportColorbar.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/ViewportColorbar.js +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarCanvasProps.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarCommonProps.d.ts +1 -1
- package/dist/esm/utilities/voi/colorbar/types/ColorbarProps.d.ts +3 -3
- package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.d.ts +8 -0
- package/dist/esm/utilities/voi/windowlevel/extractWindowLevelRegionToolData.js +4 -10
- package/dist/esm/widgets/types/index.d.ts +2 -2
- package/dist/esm/workers/polySegConverters.js +65 -32
- package/dist/umd/78.index.js +1 -1
- package/dist/umd/78.index.js.map +1 -1
- package/dist/umd/985.index.js +1 -1
- package/dist/umd/985.index.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -7
- package/dist/esm/stateManagement/segmentation/addRepresentation.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addRepresentations.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addRepresentations.js +0 -9
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationRenderingConfig.d.ts +0 -2
- package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.d.ts +0 -2
- package/dist/esm/utilities/pointInShapeCallback.d.ts +0 -18
- package/dist/esm/utilities/pointInShapeCallback.js +0 -82
- package/dist/esm/utilities/pointInSurroundingSphereCallback.d.ts +0 -4
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +0 -63
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.d.ts +0 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.js +0 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Segmentation } from '../../types/SegmentationStateTypes';
|
|
1
|
+
import type { Segmentation } from '../../types/SegmentationStateTypes';
|
|
2
2
|
export default function getDefaultRepresentationConfig(segmentation: Segmentation): import("../../types/LabelmapTypes").LabelmapConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
|
-
import { getSegmentation,
|
|
2
|
+
import { getSegmentation, getSegmentationRepresentationsForSegmentation, getCurrentLabelmapImageIdForViewport, } from '../../stateManagement/segmentation/segmentationState';
|
|
3
3
|
import { isVolumeSegmentation } from '../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
4
4
|
export function getSegmentIndexAtLabelmapBorder(segmentationId, worldPoint, { viewport, searchRadius }) {
|
|
5
5
|
const segmentation = getSegmentation(segmentationId);
|
|
@@ -16,20 +16,23 @@ export function getSegmentIndexAtLabelmapBorder(segmentationId, worldPoint, { vi
|
|
|
16
16
|
const onEdge = isSegmentOnEdgeCanvas(canvasPoint, segmentIndex, viewport, imageData, searchRadius);
|
|
17
17
|
return onEdge ? segmentIndex : undefined;
|
|
18
18
|
}
|
|
19
|
-
const segmentationImageId =
|
|
19
|
+
const segmentationImageId = getCurrentLabelmapImageIdForViewport(viewport.id, segmentationId);
|
|
20
20
|
const currentImageId = viewport.getCurrentImageId();
|
|
21
21
|
const image = cache.getImage(segmentationImageId);
|
|
22
22
|
if (!image) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
const segmentationRepresentations =
|
|
25
|
+
const segmentationRepresentations = getSegmentationRepresentationsForSegmentation(segmentation.segmentationId);
|
|
26
26
|
const { segmentationRepresentationUID } = segmentationRepresentations[0];
|
|
27
27
|
const segmentationActor = viewport.getActor(segmentationRepresentationUID);
|
|
28
28
|
const imageData = segmentationActor?.actor.getMapper().getInputData();
|
|
29
29
|
const indexIJK = utilities.transformWorldToIndex(imageData, worldPoint);
|
|
30
30
|
const dimensions = imageData.getDimensions();
|
|
31
31
|
const voxelManager = (imageData.voxelManager ||
|
|
32
|
-
utilities.VoxelManager.
|
|
32
|
+
utilities.VoxelManager.createScalarVolumeVoxelManager({
|
|
33
|
+
dimensions,
|
|
34
|
+
scalarData: imageData.getPointData().getScalars().getData(),
|
|
35
|
+
}));
|
|
33
36
|
const segmentIndex = voxelManager.getAtIJKPoint(indexIJK);
|
|
34
37
|
const onEdge = isSegmentOnEdgeIJK(indexIJK, dimensions, voxelManager, segmentIndex);
|
|
35
38
|
return onEdge ? segmentIndex : undefined;
|
|
@@ -58,7 +61,7 @@ function isSegmentOnEdgeIJK(indexIJK, dimensions, voxelManager, segmentIndex, se
|
|
|
58
61
|
indexIJK[1] + deltaJ,
|
|
59
62
|
indexIJK[2] + deltaK,
|
|
60
63
|
];
|
|
61
|
-
return voxelManager.getAtIJK(
|
|
64
|
+
return voxelManager.getAtIJK(neighborIJK[0], neighborIJK[1], neighborIJK[2]);
|
|
62
65
|
};
|
|
63
66
|
return isSegmentOnEdge(getNeighborIndex, segmentIndex, searchRadius);
|
|
64
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import { SegmentationRepresentations } from '../../enums';
|
|
3
|
-
import { Segmentation } from '../../types';
|
|
3
|
+
import type { Segmentation } from '../../types';
|
|
4
4
|
type Options = {
|
|
5
5
|
representationType?: SegmentationRepresentations;
|
|
6
6
|
viewport?: Types.IViewport;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
2
|
import { SegmentationRepresentations } from '../../enums';
|
|
3
|
-
import { getSegmentation,
|
|
3
|
+
import { getSegmentation, getSegmentationRepresentationsForSegmentation, getCurrentLabelmapImageIdForViewport, } from '../../stateManagement/segmentation/segmentationState';
|
|
4
4
|
import { isVolumeSegmentation } from '../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
5
5
|
import { getAnnotation } from '../../stateManagement';
|
|
6
6
|
import { isPointInsidePolyline3D } from '../math/polyline';
|
|
@@ -31,19 +31,22 @@ export function getSegmentIndexAtWorldForLabelmap(segmentation, worldPoint, { vi
|
|
|
31
31
|
const segmentIndex = segmentationVolume.imageData.getScalarValueFromWorld(worldPoint);
|
|
32
32
|
return segmentIndex;
|
|
33
33
|
}
|
|
34
|
-
const segmentationImageId =
|
|
34
|
+
const segmentationImageId = getCurrentLabelmapImageIdForViewport(viewport.id, segmentation.segmentationId);
|
|
35
35
|
const image = cache.getImage(segmentationImageId);
|
|
36
36
|
if (!image) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const segmentationRepresentations =
|
|
39
|
+
const segmentationRepresentations = getSegmentationRepresentationsForSegmentation(segmentation.segmentationId);
|
|
40
40
|
const { segmentationRepresentationUID } = segmentationRepresentations[0];
|
|
41
41
|
const segmentationActor = viewport.getActor(segmentationRepresentationUID);
|
|
42
42
|
const imageData = segmentationActor?.actor.getMapper().getInputData();
|
|
43
43
|
const indexIJK = utilities.transformWorldToIndex(imageData, worldPoint);
|
|
44
44
|
const dimensions = imageData.getDimensions();
|
|
45
45
|
const voxelManager = (imageData.voxelManager ||
|
|
46
|
-
utilities.VoxelManager.
|
|
46
|
+
utilities.VoxelManager.createScalarVolumeVoxelManager({
|
|
47
|
+
dimensions,
|
|
48
|
+
scalarData: imageData.getPointData().getScalars().getData(),
|
|
49
|
+
}));
|
|
47
50
|
const segmentIndex = voxelManager.getAtIJKPoint(indexIJK);
|
|
48
51
|
return segmentIndex;
|
|
49
52
|
}
|
|
@@ -63,17 +63,16 @@ function handleLabelmapSegmentation(segmentation, segmentationId) {
|
|
|
63
63
|
}
|
|
64
64
|
function addVolumeSegmentIndices(keySet, segmentationId) {
|
|
65
65
|
const volume = cache.getVolume(segmentationId);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
keySet.add(segmentIndex);
|
|
66
|
+
volume.voxelManager.forEach(({ value }) => {
|
|
67
|
+
if (value !== 0) {
|
|
68
|
+
keySet.add(value);
|
|
70
69
|
}
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
function addImageSegmentIndices(keySet, imageIds) {
|
|
74
73
|
imageIds.forEach((segmentationImageId) => {
|
|
75
74
|
const image = cache.getImage(segmentationImageId);
|
|
76
|
-
const scalarData = image.
|
|
75
|
+
const scalarData = image.voxelManager.getScalarData();
|
|
77
76
|
scalarData.forEach((segmentIndex) => {
|
|
78
77
|
if (segmentIndex !== 0) {
|
|
79
78
|
keySet.add(segmentIndex);
|
|
@@ -4,7 +4,7 @@ import createMergedLabelmapForIndex from './createMergedLabelmapForIndex';
|
|
|
4
4
|
import isValidRepresentationConfig from './isValidRepresentationConfig';
|
|
5
5
|
import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
|
|
6
6
|
import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
|
|
7
|
-
import { triggerSegmentationRender } from './triggerSegmentationRender';
|
|
7
|
+
import { triggerSegmentationRender, triggerSegmentationRenderBySegmentationId } from './triggerSegmentationRender';
|
|
8
8
|
import floodFill from './floodFill';
|
|
9
9
|
import { getBrushSizeForToolGroup, setBrushSizeForToolGroup } from './brushSizeForToolGroup';
|
|
10
10
|
import { getBrushThresholdForToolGroup, setBrushThresholdForToolGroup } from './brushThresholdForToolGroup';
|
|
@@ -18,4 +18,4 @@ import { getSegmentIndexAtWorldPoint } from './getSegmentIndexAtWorldPoint';
|
|
|
18
18
|
import { getSegmentIndexAtLabelmapBorder } from './getSegmentIndexAtLabelmapBorder';
|
|
19
19
|
import { getHoveredContourSegmentationAnnotation } from './getHoveredContourSegmentationAnnotation';
|
|
20
20
|
import { getBrushToolInstances } from './utilities';
|
|
21
|
-
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, thresholdSegmentationByRange, contourAndFindLargestBidirectional, createBidirectionalToolData, segmentContourAction, invalidateBrushCursor, getUniqueSegmentIndices, getSegmentIndexAtWorldPoint, getSegmentIndexAtLabelmapBorder, getHoveredContourSegmentationAnnotation, getBrushToolInstances, };
|
|
21
|
+
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, triggerSegmentationRenderBySegmentationId, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, thresholdSegmentationByRange, contourAndFindLargestBidirectional, createBidirectionalToolData, segmentContourAction, invalidateBrushCursor, getUniqueSegmentIndices, getSegmentIndexAtWorldPoint, getSegmentIndexAtLabelmapBorder, getHoveredContourSegmentationAnnotation, getBrushToolInstances, };
|
|
@@ -4,7 +4,7 @@ import createMergedLabelmapForIndex from './createMergedLabelmapForIndex';
|
|
|
4
4
|
import isValidRepresentationConfig from './isValidRepresentationConfig';
|
|
5
5
|
import getDefaultRepresentationConfig from './getDefaultRepresentationConfig';
|
|
6
6
|
import createLabelmapVolumeForViewport from './createLabelmapVolumeForViewport';
|
|
7
|
-
import { triggerSegmentationRender } from './triggerSegmentationRender';
|
|
7
|
+
import { triggerSegmentationRender, triggerSegmentationRenderBySegmentationId, } from './triggerSegmentationRender';
|
|
8
8
|
import floodFill from './floodFill';
|
|
9
9
|
import { getBrushSizeForToolGroup, setBrushSizeForToolGroup, } from './brushSizeForToolGroup';
|
|
10
10
|
import { getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, } from './brushThresholdForToolGroup';
|
|
@@ -18,4 +18,4 @@ import { getSegmentIndexAtWorldPoint } from './getSegmentIndexAtWorldPoint';
|
|
|
18
18
|
import { getSegmentIndexAtLabelmapBorder } from './getSegmentIndexAtLabelmapBorder';
|
|
19
19
|
import { getHoveredContourSegmentationAnnotation } from './getHoveredContourSegmentationAnnotation';
|
|
20
20
|
import { getBrushToolInstances } from './utilities';
|
|
21
|
-
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, thresholdSegmentationByRange, contourAndFindLargestBidirectional, createBidirectionalToolData, segmentContourAction, invalidateBrushCursor, getUniqueSegmentIndices, getSegmentIndexAtWorldPoint, getSegmentIndexAtLabelmapBorder, getHoveredContourSegmentationAnnotation, getBrushToolInstances, };
|
|
21
|
+
export { thresholdVolumeByRange, createMergedLabelmapForIndex, isValidRepresentationConfig, getDefaultRepresentationConfig, createLabelmapVolumeForViewport, rectangleROIThresholdVolumeByRange, triggerSegmentationRender, triggerSegmentationRenderBySegmentationId, floodFill, getBrushSizeForToolGroup, setBrushSizeForToolGroup, getBrushThresholdForToolGroup, setBrushThresholdForToolGroup, thresholdSegmentationByRange, contourAndFindLargestBidirectional, createBidirectionalToolData, segmentContourAction, invalidateBrushCursor, getUniqueSegmentIndices, getSegmentIndexAtWorldPoint, getSegmentIndexAtLabelmapBorder, getHoveredContourSegmentationAnnotation, getBrushToolInstances, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RepresentationConfig } from '../../types/SegmentationStateTypes';
|
|
1
|
+
import type { RepresentationConfig } from '../../types/SegmentationStateTypes';
|
|
2
2
|
export default function isValidRepresentationConfig(representationType: string, config: RepresentationConfig): boolean;
|
|
@@ -9,8 +9,9 @@ function rectangleROIThresholdVolumeByRange(annotationUIDs, segmentationVolume,
|
|
|
9
9
|
_validateAnnotations(annotations);
|
|
10
10
|
let boundsIJK;
|
|
11
11
|
for (let i = 0; i < thresholdVolumeInformation.length; i++) {
|
|
12
|
-
const volumeSize = thresholdVolumeInformation[i].volume.
|
|
13
|
-
if (volumeSize === segmentationVolume.
|
|
12
|
+
const volumeSize = thresholdVolumeInformation[i].volume.voxelManager.getScalarDataLength();
|
|
13
|
+
if (volumeSize === segmentationVolume.voxelManager.getScalarDataLength() ||
|
|
14
|
+
i === 0) {
|
|
14
15
|
boundsIJK = getBoundsIJKFromRectangleAnnotations(annotations, thresholdVolumeInformation[i].volume, options);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -18,16 +18,16 @@ export default function segmentContourAction(element, configuration) {
|
|
|
18
18
|
const bidirectionals = annotationState.getAnnotations(this.toolName || BidirectionalTool.toolName, FrameOfReferenceUID);
|
|
19
19
|
let hasExistingActiveSegment = false;
|
|
20
20
|
const existingLargestBidirectionals = bidirectionals.filter((existingBidirectionalItem) => {
|
|
21
|
-
const
|
|
21
|
+
const segment = existingBidirectionalItem.data.segment;
|
|
22
22
|
if (!segment) {
|
|
23
|
-
return;
|
|
23
|
+
return false;
|
|
24
24
|
}
|
|
25
25
|
if (segment.segmentationId === segmentationId &&
|
|
26
26
|
segment.segmentIndex === segmentIndex) {
|
|
27
27
|
hasExistingActiveSegment = true;
|
|
28
28
|
existingBidirectionalItem.data.segment = segment;
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return true;
|
|
31
31
|
});
|
|
32
32
|
if (!hasExistingActiveSegment) {
|
|
33
33
|
existingLargestBidirectionals.push({
|
|
@@ -37,7 +37,7 @@ export default function segmentContourAction(element, configuration) {
|
|
|
37
37
|
let newBidirectional;
|
|
38
38
|
existingLargestBidirectionals.forEach((existingLargestBidirectional) => {
|
|
39
39
|
const segments = [];
|
|
40
|
-
const
|
|
40
|
+
const updateSegment = existingLargestBidirectional.data.segment;
|
|
41
41
|
const { segmentIndex, segmentationId } = updateSegment;
|
|
42
42
|
segments[segmentIndex] = updateSegment;
|
|
43
43
|
annotationState.removeAnnotation(existingLargestBidirectional.annotationUID);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
import { ThresholdInformation } from './utilities';
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { ThresholdInformation } from './utilities';
|
|
3
3
|
declare function thresholdSegmentationByRange(segmentationVolume: Types.IImageVolume, segmentationIndex: number, thresholdVolumeInformation: ThresholdInformation[], overlapType: number): Types.IImageVolume;
|
|
4
4
|
export default thresholdSegmentationByRange;
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { pointInShapeCallback } from '../../utilities';
|
|
2
1
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
|
-
import { getVoxelOverlap, processVolumes
|
|
2
|
+
import { getVoxelOverlap, processVolumes } from './utilities';
|
|
4
3
|
function thresholdSegmentationByRange(segmentationVolume, segmentationIndex, thresholdVolumeInformation, overlapType) {
|
|
5
|
-
const scalarData = segmentationVolume.getScalarData();
|
|
6
4
|
const { baseVolumeIdx, volumeInfoList } = processVolumes(segmentationVolume, thresholdVolumeInformation);
|
|
5
|
+
const { voxelManager } = volumeInfoList[baseVolumeIdx];
|
|
6
|
+
const refVoxelManager = voxelManager;
|
|
7
|
+
const scalarDataLength = segmentationVolume.voxelManager.getScalarDataLength();
|
|
8
|
+
const segVoxelManager = segmentationVolume.voxelManager;
|
|
7
9
|
volumeInfoList.forEach((volumeInfo) => {
|
|
8
10
|
const { volumeSize } = volumeInfo;
|
|
9
|
-
if (volumeSize ===
|
|
10
|
-
_handleSameSizeVolume(
|
|
11
|
+
if (volumeSize === scalarDataLength) {
|
|
12
|
+
_handleSameSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo);
|
|
11
13
|
}
|
|
12
14
|
else {
|
|
13
|
-
_handleDifferentSizeVolume(
|
|
15
|
+
_handleDifferentSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo, volumeInfoList, baseVolumeIdx, overlapType);
|
|
14
16
|
}
|
|
15
17
|
});
|
|
16
18
|
triggerSegmentationDataModified(segmentationVolume.volumeId);
|
|
17
19
|
return segmentationVolume;
|
|
18
20
|
}
|
|
19
|
-
function _handleDifferentSizeVolume(
|
|
21
|
+
function _handleDifferentSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo, volumeInfoList, baseVolumeIdx, overlapType) {
|
|
20
22
|
const { imageData, lower, upper, dimensions } = volumeInfo;
|
|
21
23
|
let total, overlaps, range;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const segScalarDataLength = segVoxelManager.getScalarDataLength();
|
|
25
|
+
for (let i = 0; i < segScalarDataLength; i++) {
|
|
26
|
+
if (segScalarDataLength.getAtIndex(i) === segmentationIndex) {
|
|
24
27
|
const overlapBounds = getVoxelOverlap(imageData, dimensions, volumeInfoList[baseVolumeIdx].spacing, volumeInfoList[baseVolumeIdx].imageData.getPoint(i));
|
|
25
28
|
const callbackOverlap = ({ value }) => {
|
|
26
29
|
total = total + 1;
|
|
@@ -32,19 +35,23 @@ function _handleDifferentSizeVolume(scalarData, segmentationIndex, volumeInfo, v
|
|
|
32
35
|
overlaps = 0;
|
|
33
36
|
range = { lower, upper };
|
|
34
37
|
let overlapTest = false;
|
|
35
|
-
|
|
38
|
+
segVoxelManager.forEach(callbackOverlap, {
|
|
39
|
+
imageData,
|
|
40
|
+
boundsIJK: overlapBounds,
|
|
41
|
+
});
|
|
36
42
|
overlapTest = overlapType === 0 ? overlaps > 0 : overlaps === total;
|
|
37
|
-
|
|
43
|
+
segVoxelManager.setAtIndex(i, overlapTest ? segmentationIndex : 0);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
return { total, range, overlaps };
|
|
41
47
|
}
|
|
42
|
-
function _handleSameSizeVolume(
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
function _handleSameSizeVolume(segVoxelManager, refVoxelManager, segmentationIndex, volumeInfo) {
|
|
49
|
+
const { lower, upper } = volumeInfo;
|
|
50
|
+
const scalarDataLength = segVoxelManager.getScalarDataLength();
|
|
51
|
+
for (let i = 0; i < scalarDataLength; i++) {
|
|
52
|
+
if (segVoxelManager.getAtIndex[i] === segmentationIndex) {
|
|
53
|
+
const value = refVoxelManager.getAtIndex(i);
|
|
54
|
+
segVoxelManager.setAtIndex(i, value >= lower && value <= upper ? segmentationIndex : 0);
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
2
|
-
import { BoundsIJK } from '../../types';
|
|
3
|
-
import { ThresholdInformation } from './utilities';
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { BoundsIJK } from '../../types';
|
|
3
|
+
import type { ThresholdInformation } from './utilities';
|
|
4
4
|
export type ThresholdRangeOptions = {
|
|
5
5
|
overwrite: boolean;
|
|
6
6
|
boundsIJK: BoundsIJK;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { pointInShapeCallback } from '../../utilities';
|
|
2
1
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
|
-
import { getVoxelOverlap, processVolumes
|
|
2
|
+
import { getVoxelOverlap, processVolumes } from './utilities';
|
|
4
3
|
function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation, options) {
|
|
5
4
|
const { imageData: segmentationImageData } = segmentationVolume;
|
|
6
|
-
const scalarData = segmentationVolume.getScalarData();
|
|
7
5
|
const { overwrite, boundsIJK } = options;
|
|
8
6
|
const overlapType = options?.overlapType || 0;
|
|
7
|
+
const segVoxelManager = segmentationVolume.voxelManager;
|
|
8
|
+
const scalarDataLength = segmentationVolume.voxelManager.getScalarDataLength();
|
|
9
9
|
if (overwrite) {
|
|
10
|
-
for (let i = 0; i <
|
|
11
|
-
|
|
10
|
+
for (let i = 0; i < scalarDataLength; i++) {
|
|
11
|
+
segVoxelManager.setAtIndex(i, 0);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
const { baseVolumeIdx, volumeInfoList } = processVolumes(segmentationVolume, thresholdVolumeInformation);
|
|
@@ -26,7 +26,11 @@ function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation,
|
|
|
26
26
|
overlaps = 0;
|
|
27
27
|
range = { lower, upper };
|
|
28
28
|
let overlapTest = false;
|
|
29
|
-
|
|
29
|
+
const { voxelManager } = imageData.get('voxelManager');
|
|
30
|
+
voxelManager.forEach(callbackOverlap, {
|
|
31
|
+
imageData,
|
|
32
|
+
boundsIJK: overlapBounds,
|
|
33
|
+
});
|
|
30
34
|
if (overlapType === 0) {
|
|
31
35
|
overlapTest = overlaps > 0;
|
|
32
36
|
}
|
|
@@ -36,9 +40,10 @@ function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation,
|
|
|
36
40
|
return overlapTest;
|
|
37
41
|
};
|
|
38
42
|
const testRange = (volumeInfo, pointIJK) => {
|
|
39
|
-
const { imageData,
|
|
40
|
-
const
|
|
41
|
-
const
|
|
43
|
+
const { imageData, lower, upper } = volumeInfo;
|
|
44
|
+
const voxelManager = imageData.get('voxelManager').voxelManager;
|
|
45
|
+
const offset = voxelManager.toIndex(pointIJK);
|
|
46
|
+
const value = voxelManager.getAtIndex(offset);
|
|
42
47
|
if (value <= lower || value >= upper) {
|
|
43
48
|
return false;
|
|
44
49
|
}
|
|
@@ -49,7 +54,7 @@ function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation,
|
|
|
49
54
|
const callback = ({ index, pointIJK, pointLPS }) => {
|
|
50
55
|
let insert = volumeInfoList.length > 0;
|
|
51
56
|
for (let i = 0; i < volumeInfoList.length; i++) {
|
|
52
|
-
if (volumeInfoList[i].volumeSize ===
|
|
57
|
+
if (volumeInfoList[i].volumeSize === scalarDataLength) {
|
|
53
58
|
insert = testRange(volumeInfoList[i], pointIJK);
|
|
54
59
|
}
|
|
55
60
|
else {
|
|
@@ -60,10 +65,14 @@ function thresholdVolumeByRange(segmentationVolume, thresholdVolumeInformation,
|
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
if (insert) {
|
|
63
|
-
|
|
68
|
+
segVoxelManager.setAtIndex(index, options.segmentIndex || 1);
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
|
-
|
|
71
|
+
const voxelManager = segmentationVolume.voxelManager;
|
|
72
|
+
voxelManager.forEach(callback, {
|
|
73
|
+
imageData: segmentationImageData,
|
|
74
|
+
boundsIJK,
|
|
75
|
+
});
|
|
67
76
|
triggerSegmentationDataModified(segmentationVolume.volumeId);
|
|
68
77
|
return segmentationVolume;
|
|
69
78
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function triggerSegmentationRender(
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
declare function triggerSegmentationRender(viewportId?: string): void;
|
|
2
|
+
declare function triggerSegmentationRenderBySegmentationId(segmentationId?: string): void;
|
|
3
|
+
export { triggerSegmentationRender, triggerSegmentationRenderBySegmentationId };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { segmentationRenderingEngine } from '../../
|
|
2
|
-
function triggerSegmentationRender(
|
|
3
|
-
segmentationRenderingEngine.
|
|
1
|
+
import { segmentationRenderingEngine } from '../../stateManagement/segmentation/SegmentationRenderingEngine';
|
|
2
|
+
function triggerSegmentationRender(viewportId) {
|
|
3
|
+
segmentationRenderingEngine.renderSegmentationsForViewport(viewportId);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function triggerSegmentationRenderBySegmentationId(segmentationId) {
|
|
6
|
+
segmentationRenderingEngine.renderSegmentation(segmentationId);
|
|
7
|
+
}
|
|
8
|
+
export { triggerSegmentationRender, triggerSegmentationRenderBySegmentationId };
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import { Types } from '@cornerstonejs/core';
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
2
3
|
export type ThresholdInformation = {
|
|
3
4
|
volume: Types.IImageVolume;
|
|
4
5
|
lower: number;
|
|
5
6
|
upper: number;
|
|
6
7
|
};
|
|
8
|
+
export type VolumeInfo = {
|
|
9
|
+
imageData: vtkImageData;
|
|
10
|
+
lower: number;
|
|
11
|
+
upper: number;
|
|
12
|
+
spacing: Types.Point3;
|
|
13
|
+
dimensions: Types.Point3;
|
|
14
|
+
volumeSize: number;
|
|
15
|
+
voxelManager: Types.IVoxelManager<number> | Types.IVoxelManager<Types.RGB>;
|
|
16
|
+
};
|
|
7
17
|
export declare function getBrushToolInstances(toolGroupId: string, toolName?: string): any[];
|
|
8
18
|
export declare function getVoxelOverlap(imageData: any, dimensions: any, voxelSpacing: any, voxelCenter: any): [Types.Point2, Types.Point2, null] | [Types.Point2, Types.Point2, Types.Point2];
|
|
9
19
|
export declare function processVolumes(segmentationVolume: Types.IImageVolume, thresholdVolumeInformation: ThresholdInformation[]): {
|
|
10
|
-
volumeInfoList:
|
|
20
|
+
volumeInfoList: VolumeInfo[];
|
|
11
21
|
baseVolumeIdx: number;
|
|
12
22
|
};
|
|
@@ -39,27 +39,26 @@ export function getVoxelOverlap(imageData, dimensions, voxelSpacing, voxelCenter
|
|
|
39
39
|
}
|
|
40
40
|
export function processVolumes(segmentationVolume, thresholdVolumeInformation) {
|
|
41
41
|
const { spacing: segmentationSpacing } = segmentationVolume;
|
|
42
|
-
const
|
|
42
|
+
const scalarDataLength = segmentationVolume.voxelManager.getScalarDataLength();
|
|
43
43
|
const volumeInfoList = [];
|
|
44
44
|
let baseVolumeIdx = 0;
|
|
45
45
|
for (let i = 0; i < thresholdVolumeInformation.length; i++) {
|
|
46
|
-
const { imageData, spacing, dimensions } = thresholdVolumeInformation[i].volume;
|
|
47
|
-
const volumeSize = thresholdVolumeInformation[i].volume.
|
|
48
|
-
if (volumeSize ===
|
|
46
|
+
const { imageData, spacing, dimensions, voxelManager } = thresholdVolumeInformation[i].volume;
|
|
47
|
+
const volumeSize = thresholdVolumeInformation[i].volume.voxelManager.getScalarDataLength();
|
|
48
|
+
if (volumeSize === scalarDataLength &&
|
|
49
49
|
equalsCheck(spacing, segmentationSpacing)) {
|
|
50
50
|
baseVolumeIdx = i;
|
|
51
51
|
}
|
|
52
|
-
const referenceValues = imageData.getPointData().getScalars().getData();
|
|
53
52
|
const lower = thresholdVolumeInformation[i].lower;
|
|
54
53
|
const upper = thresholdVolumeInformation[i].upper;
|
|
55
54
|
volumeInfoList.push({
|
|
56
55
|
imageData,
|
|
57
|
-
referenceValues,
|
|
58
56
|
lower,
|
|
59
57
|
upper,
|
|
60
58
|
spacing,
|
|
61
59
|
dimensions,
|
|
62
60
|
volumeSize,
|
|
61
|
+
voxelManager,
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache,
|
|
1
|
+
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, } from '@cornerstonejs/core';
|
|
2
2
|
import { addToolState, getToolState } from './state';
|
|
3
3
|
import { getStackData, requestType, priority, clearFromImageIds, getPromiseRemovedHandler, } from './stackPrefetchUtils';
|
|
4
4
|
let configuration = {
|
|
@@ -12,7 +12,10 @@ let resetPrefetchTimeout;
|
|
|
12
12
|
const resetPrefetchDelay = 5;
|
|
13
13
|
const enable = (element) => {
|
|
14
14
|
const stack = getStackData(element);
|
|
15
|
-
if (!stack
|
|
15
|
+
if (!stack) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!stack.imageIds?.length) {
|
|
16
19
|
console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
|
|
17
20
|
return;
|
|
18
21
|
}
|
|
@@ -26,6 +29,9 @@ const enable = (element) => {
|
|
|
26
29
|
};
|
|
27
30
|
function prefetch(element) {
|
|
28
31
|
const stack = getStackData(element);
|
|
32
|
+
if (!stack) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
if (!stack?.imageIds?.length) {
|
|
30
36
|
console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
|
|
31
37
|
return;
|
|
@@ -34,8 +40,9 @@ function prefetch(element) {
|
|
|
34
40
|
if (!stackPrefetchData) {
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
37
|
-
const stackPrefetch = stackPrefetchData || {};
|
|
38
|
-
stackPrefetch.enabled
|
|
43
|
+
const stackPrefetch = (stackPrefetchData || {});
|
|
44
|
+
stackPrefetch.enabled =
|
|
45
|
+
stackPrefetch.enabled && (stackPrefetch.indicesToRequest?.length ?? 0) > 0;
|
|
39
46
|
if (stackPrefetch.enabled === false) {
|
|
40
47
|
return;
|
|
41
48
|
}
|
|
@@ -99,15 +106,9 @@ function prefetch(element) {
|
|
|
99
106
|
const requestFn = (imageId, options) => imageLoader
|
|
100
107
|
.loadAndCacheImage(imageId, options)
|
|
101
108
|
.then(() => doneCallback(imageId));
|
|
102
|
-
const { useNorm16Texture, preferSizeOverAccuracy } = getCoreConfiguration().rendering;
|
|
103
|
-
const useNativeDataType = useNorm16Texture || preferSizeOverAccuracy;
|
|
104
109
|
stackPrefetch.indicesToRequest.forEach((imageIdIndex) => {
|
|
105
110
|
const imageId = stack.imageIds[imageIdIndex];
|
|
106
111
|
const options = {
|
|
107
|
-
targetBuffer: {
|
|
108
|
-
type: useNativeDataType ? undefined : 'Float32Array',
|
|
109
|
-
},
|
|
110
|
-
useNativeDataType,
|
|
111
112
|
requestType,
|
|
112
113
|
};
|
|
113
114
|
imageLoadPoolManager.addRequest(requestFn.bind(null, imageId, options), requestType, {
|
|
@@ -131,27 +132,31 @@ function onImageUpdated(e) {
|
|
|
131
132
|
const signum = (x) => (x < 0 ? -1 : 1);
|
|
132
133
|
const updateToolState = (element, usage) => {
|
|
133
134
|
const stack = getStackData(element);
|
|
134
|
-
if (!stack
|
|
135
|
+
if (!stack) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (!stack.imageIds?.length) {
|
|
135
139
|
console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
|
|
136
140
|
return;
|
|
137
141
|
}
|
|
138
142
|
const { currentImageIdIndex } = stack;
|
|
139
143
|
let { maxAfter = 2, minBefore = 2 } = configuration;
|
|
140
144
|
const { directionExtraImages = 10 } = configuration;
|
|
141
|
-
const stackPrefetchData = getToolState(element) ||
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
145
|
+
const stackPrefetchData = getToolState(element) ||
|
|
146
|
+
{
|
|
147
|
+
indicesToRequest: [],
|
|
148
|
+
currentImageIdIndex,
|
|
149
|
+
stackCount: 0,
|
|
150
|
+
enabled: true,
|
|
151
|
+
direction: 1,
|
|
152
|
+
stats: {
|
|
153
|
+
start: Date.now(),
|
|
154
|
+
imageIds: new Map(),
|
|
155
|
+
decodeTimeInMS: 0,
|
|
156
|
+
loadTimeInMS: 0,
|
|
157
|
+
totalBytes: 0,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
155
160
|
const delta = currentImageIdIndex - stackPrefetchData.currentImageIdIndex;
|
|
156
161
|
stackPrefetchData.direction = signum(delta);
|
|
157
162
|
stackPrefetchData.currentImageIdIndex = currentImageIdIndex;
|
|
@@ -12,14 +12,15 @@ function prefetch(element) {
|
|
|
12
12
|
if (!stackPrefetchData) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
const stackPrefetch = stackPrefetchData || {};
|
|
15
|
+
const stackPrefetch = (stackPrefetchData || {});
|
|
16
16
|
const stack = getStackData(element);
|
|
17
17
|
if (!stack?.imageIds?.length) {
|
|
18
18
|
console.warn('CornerstoneTools.stackPrefetch: No images in stack.');
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const { currentImageIdIndex } = stack;
|
|
22
|
-
stackPrefetch.enabled
|
|
22
|
+
stackPrefetch.enabled =
|
|
23
|
+
stackPrefetch.enabled && (stackPrefetch.indicesToRequest?.length ?? 0) > 0;
|
|
23
24
|
if (stackPrefetch.enabled === false) {
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
@@ -86,14 +87,8 @@ function prefetch(element) {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
const requestFn = (imageId, options) => imageLoader.loadAndCacheImage(imageId, options);
|
|
89
|
-
const { useNorm16Texture, preferSizeOverAccuracy } = getCoreConfiguration().rendering;
|
|
90
|
-
const useNativeDataType = useNorm16Texture || preferSizeOverAccuracy;
|
|
91
90
|
imageIdsToPrefetch.forEach((imageId) => {
|
|
92
91
|
const options = {
|
|
93
|
-
targetBuffer: {
|
|
94
|
-
type: useNativeDataType ? undefined : 'Float32Array',
|
|
95
|
-
},
|
|
96
|
-
useNativeDataType,
|
|
97
92
|
requestType,
|
|
98
93
|
};
|
|
99
94
|
imageLoadPoolManager.addRequest(requestFn.bind(null, imageId, options), requestType, {
|
|
@@ -35,7 +35,6 @@ export function getStackData(element) {
|
|
|
35
35
|
}
|
|
36
36
|
const { viewport } = enabledElement;
|
|
37
37
|
if (!(viewport instanceof StackViewport)) {
|
|
38
|
-
console.warn('stackPrefetch: element must be a StackViewport, VolumeViewport stackPrefetch not yet implemented');
|
|
39
38
|
return null;
|
|
40
39
|
}
|
|
41
40
|
return {
|
|
@@ -63,8 +62,8 @@ export function getPromiseRemovedHandler(element) {
|
|
|
63
62
|
}
|
|
64
63
|
const stackPrefetchData = getToolState(element);
|
|
65
64
|
if (!stackPrefetchData ||
|
|
66
|
-
!stackPrefetchData.
|
|
67
|
-
!stackPrefetchData.
|
|
65
|
+
!stackPrefetchData.indicesToRequest ||
|
|
66
|
+
!stackPrefetchData.indicesToRequest.length) {
|
|
68
67
|
return;
|
|
69
68
|
}
|
|
70
69
|
stackPrefetchData.indicesToRequest.push(imageIdIndex);
|