@cornerstonejs/tools 1.42.0 → 1.43.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.
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +18 -5
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/activeSegmentation.d.ts +2 -1
- package/dist/cjs/stateManagement/segmentation/activeSegmentation.js +10 -1
- package/dist/cjs/stateManagement/segmentation/activeSegmentation.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +10 -0
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js +65 -0
- package/dist/cjs/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +8 -0
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js +92 -0
- package/dist/cjs/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/index.d.ts +3 -1
- package/dist/cjs/stateManagement/segmentation/index.js +5 -1
- package/dist/cjs/stateManagement/segmentation/index.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/segmentIndex.js +5 -0
- package/dist/cjs/stateManagement/segmentation/segmentIndex.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js +8 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +2 -2
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +2 -2
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +8 -8
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +7 -7
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +2 -2
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +5 -5
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +3 -3
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +7 -7
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapConfig.js +2 -0
- package/dist/cjs/tools/displayTools/Labelmap/labelmapConfig.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +20 -4
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +2 -1
- package/dist/cjs/tools/index.js +3 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.d.ts +1 -0
- package/dist/cjs/tools/segmentation/BrushTool.js +40 -19
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js +5 -0
- package/dist/cjs/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleScissorsTool.js +5 -0
- package/dist/cjs/tools/segmentation/RectangleScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/SegmentSelectTool.d.ts +15 -0
- package/dist/cjs/tools/segmentation/SegmentSelectTool.js +105 -0
- package/dist/cjs/tools/segmentation/SegmentSelectTool.js.map +1 -0
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js +5 -0
- package/dist/cjs/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.d.ts +2 -1
- package/dist/cjs/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +12 -15
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js +30 -3
- package/dist/cjs/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js +3 -20
- package/dist/cjs/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +1 -1
- package/dist/cjs/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
- package/dist/cjs/types/LabelmapTypes.d.ts +1 -0
- package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.d.ts +4 -2
- package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js +45 -23
- package/dist/cjs/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
- package/dist/cjs/utilities/boundingBox/index.d.ts +2 -2
- package/dist/cjs/utilities/boundingBox/index.js +5 -3
- package/dist/cjs/utilities/boundingBox/index.js.map +1 -1
- package/dist/cjs/utilities/getSphereBoundsInfo.d.ts +11 -0
- package/dist/cjs/utilities/getSphereBoundsInfo.js +45 -0
- package/dist/cjs/utilities/getSphereBoundsInfo.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +4 -3
- package/dist/cjs/utilities/index.js +8 -7
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/pointInShapeCallback.d.ts +1 -1
- package/dist/cjs/utilities/pointInShapeCallback.js +1 -1
- package/dist/cjs/utilities/pointInShapeCallback.js.map +1 -1
- package/dist/cjs/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.js +2 -2
- package/dist/cjs/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.js.map +1 -1
- package/dist/cjs/utilities/rectangleROITool/index.d.ts +2 -1
- package/dist/cjs/utilities/rectangleROITool/index.js +3 -1
- package/dist/cjs/utilities/rectangleROITool/index.js.map +1 -1
- package/dist/cjs/utilities/rectangleROITool/isAxisAlignedRectangle.d.ts +2 -0
- package/dist/cjs/utilities/rectangleROITool/isAxisAlignedRectangle.js +26 -0
- package/dist/cjs/utilities/rectangleROITool/isAxisAlignedRectangle.js.map +1 -0
- package/dist/cjs/utilities/segmentation/createImageIdReferenceMap.d.ts +2 -0
- package/dist/cjs/utilities/segmentation/createImageIdReferenceMap.js +11 -0
- package/dist/cjs/utilities/segmentation/createImageIdReferenceMap.js.map +1 -0
- package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/cjs/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -1
- package/dist/cjs/utilities/segmentation/index.d.ts +3 -1
- package/dist/cjs/utilities/segmentation/index.js +5 -1
- package/dist/cjs/utilities/segmentation/index.js.map +1 -1
- package/dist/cjs/utilities/segmentation/invalidateBrushCursor.d.ts +1 -0
- package/dist/cjs/utilities/segmentation/invalidateBrushCursor.js +31 -0
- package/dist/cjs/utilities/segmentation/invalidateBrushCursor.js.map +1 -0
- package/dist/cjs/utilities/segmentation/thresholdSegmentationByRange.js.map +1 -1
- package/dist/cjs/utilities/segmentation/triggerSegmentationRender.js +8 -4
- package/dist/cjs/utilities/segmentation/triggerSegmentationRender.js.map +1 -1
- package/dist/cjs/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/utilities.js +2 -2
- package/dist/cjs/utilities/segmentation/utilities.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js +2 -5
- package/dist/cjs/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js +2 -1
- package/dist/cjs/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +18 -5
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js +10 -2
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +47 -0
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +72 -0
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/index.js +3 -1
- package/dist/esm/stateManagement/segmentation/index.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +6 -1
- package/dist/esm/stateManagement/segmentation/segmentIndex.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js +7 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +1 -1
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +1 -1
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.js +2 -0
- package/dist/esm/tools/displayTools/Labelmap/labelmapConfig.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +21 -5
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/index.js +2 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/tools/segmentation/BrushTool.js +39 -19
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +5 -0
- package/dist/esm/tools/segmentation/CircleScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +5 -0
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +100 -0
- package/dist/esm/tools/segmentation/SegmentSelectTool.js.map +1 -0
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +5 -0
- package/dist/esm/tools/segmentation/SphereScissorsTool.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/BrushStrategy.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +12 -15
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js +32 -5
- package/dist/esm/tools/segmentation/strategies/fillRectangle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillSphere.js +3 -20
- package/dist/esm/tools/segmentation/strategies/fillSphere.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
- package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js +40 -23
- package/dist/esm/utilities/boundingBox/getBoundingBoxAroundShape.js.map +1 -1
- package/dist/esm/utilities/boundingBox/index.js +2 -2
- package/dist/esm/utilities/boundingBox/index.js.map +1 -1
- package/dist/esm/utilities/getSphereBoundsInfo.js +42 -0
- package/dist/esm/utilities/getSphereBoundsInfo.js.map +1 -0
- package/dist/esm/utilities/index.js +4 -3
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/pointInShapeCallback.js +1 -1
- package/dist/esm/utilities/pointInShapeCallback.js.map +1 -1
- package/dist/esm/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.js +2 -2
- package/dist/esm/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.js.map +1 -1
- package/dist/esm/utilities/rectangleROITool/index.js +2 -1
- package/dist/esm/utilities/rectangleROITool/index.js.map +1 -1
- package/dist/esm/utilities/rectangleROITool/isAxisAlignedRectangle.js +23 -0
- package/dist/esm/utilities/rectangleROITool/isAxisAlignedRectangle.js.map +1 -0
- package/dist/esm/utilities/segmentation/createImageIdReferenceMap.js +8 -0
- package/dist/esm/utilities/segmentation/createImageIdReferenceMap.js.map +1 -0
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js +1 -1
- package/dist/esm/utilities/segmentation/createLabelmapVolumeForViewport.js.map +1 -1
- package/dist/esm/utilities/segmentation/index.js +3 -1
- package/dist/esm/utilities/segmentation/index.js.map +1 -1
- package/dist/esm/utilities/segmentation/invalidateBrushCursor.js +24 -0
- package/dist/esm/utilities/segmentation/invalidateBrushCursor.js.map +1 -0
- package/dist/esm/utilities/segmentation/thresholdSegmentationByRange.js.map +1 -1
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +8 -4
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js.map +1 -1
- package/dist/esm/utilities/segmentation/utilities.js +2 -2
- package/dist/esm/utilities/segmentation/utilities.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js +1 -1
- package/dist/esm/utilities/stackPrefetch/stackContextPrefetch.js.map +1 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js +2 -1
- package/dist/esm/utilities/stackPrefetch/stackPrefetchUtils.js.map +1 -1
- package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/activeSegmentation.d.ts +2 -1
- package/dist/types/stateManagement/segmentation/activeSegmentation.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +11 -0
- package/dist/types/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +9 -0
- package/dist/types/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/index.d.ts +3 -1
- package/dist/types/stateManagement/segmentation/index.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/segmentIndex.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts +2 -1
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/labelmapConfig.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
- package/dist/types/tools/index.d.ts +2 -1
- package/dist/types/tools/index.d.ts.map +1 -1
- package/dist/types/tools/segmentation/BrushTool.d.ts +1 -0
- package/dist/types/tools/segmentation/BrushTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/CircleScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/SegmentSelectTool.d.ts +16 -0
- package/dist/types/tools/segmentation/SegmentSelectTool.d.ts.map +1 -0
- package/dist/types/tools/segmentation/SphereScissorsTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts +2 -1
- package/dist/types/tools/segmentation/strategies/BrushStrategy.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillCircle.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillRectangle.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillSphere.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts +1 -1
- package/dist/types/tools/segmentation/strategies/utils/isWithinThreshold.d.ts.map +1 -1
- package/dist/types/types/LabelmapTypes.d.ts +1 -0
- package/dist/types/types/LabelmapTypes.d.ts.map +1 -1
- package/dist/types/utilities/boundingBox/getBoundingBoxAroundShape.d.ts +4 -2
- package/dist/types/utilities/boundingBox/getBoundingBoxAroundShape.d.ts.map +1 -1
- package/dist/types/utilities/boundingBox/index.d.ts +2 -2
- package/dist/types/utilities/boundingBox/index.d.ts.map +1 -1
- package/dist/types/utilities/getSphereBoundsInfo.d.ts +12 -0
- package/dist/types/utilities/getSphereBoundsInfo.d.ts.map +1 -0
- package/dist/types/utilities/index.d.ts +4 -3
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/utilities/pointInShapeCallback.d.ts +1 -1
- package/dist/types/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.d.ts.map +1 -1
- package/dist/types/utilities/rectangleROITool/index.d.ts +2 -1
- package/dist/types/utilities/rectangleROITool/index.d.ts.map +1 -1
- package/dist/types/utilities/rectangleROITool/isAxisAlignedRectangle.d.ts +3 -0
- package/dist/types/utilities/rectangleROITool/isAxisAlignedRectangle.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/createImageIdReferenceMap.d.ts +3 -0
- package/dist/types/utilities/segmentation/createImageIdReferenceMap.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/index.d.ts +3 -1
- package/dist/types/utilities/segmentation/index.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/invalidateBrushCursor.d.ts +2 -0
- package/dist/types/utilities/segmentation/invalidateBrushCursor.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/triggerSegmentationRender.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/types/utilities/segmentation/utilities.d.ts.map +1 -1
- package/dist/types/utilities/stackPrefetch/stackPrefetchUtils.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -4
- package/src/eventListeners/segmentation/imageChangeEventListener.ts +42 -6
- package/src/index.ts +2 -0
- package/src/stateManagement/segmentation/activeSegmentation.ts +24 -1
- package/src/stateManagement/segmentation/convertStackToVolumeSegmentation.ts +98 -0
- package/src/stateManagement/segmentation/convertVolumeToStackSegmentation.ts +153 -0
- package/src/stateManagement/segmentation/index.ts +4 -0
- package/src/stateManagement/segmentation/segmentIndex.ts +15 -2
- package/src/stateManagement/segmentation/segmentationState.ts +17 -0
- package/src/store/ToolGroupManager/ToolGroup.ts +4 -0
- package/src/tools/annotation/AngleTool.ts +1 -2
- package/src/tools/annotation/BidirectionalTool.ts +1 -1
- package/src/tools/annotation/CircleROITool.ts +1 -1
- package/src/tools/annotation/EllipticalROITool.ts +1 -1
- package/src/tools/annotation/LengthTool.ts +1 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +1 -2
- package/src/tools/annotation/ProbeTool.ts +1 -1
- package/src/tools/annotation/RectangleROITool.ts +1 -1
- package/src/tools/displayTools/Labelmap/labelmapConfig.ts +2 -0
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +39 -14
- package/src/tools/index.ts +2 -0
- package/src/tools/segmentation/BrushTool.ts +64 -33
- package/src/tools/segmentation/CircleScissorsTool.ts +9 -0
- package/src/tools/segmentation/RectangleScissorsTool.ts +10 -1
- package/src/tools/segmentation/SegmentSelectTool.ts +182 -0
- package/src/tools/segmentation/SphereScissorsTool.ts +9 -0
- package/src/tools/segmentation/strategies/BrushStrategy.ts +2 -1
- package/src/tools/segmentation/strategies/fillCircle.ts +19 -21
- package/src/tools/segmentation/strategies/fillRectangle.ts +51 -6
- package/src/tools/segmentation/strategies/fillSphere.ts +10 -38
- package/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +1 -1
- package/src/types/LabelmapTypes.ts +7 -7
- package/src/utilities/boundingBox/getBoundingBoxAroundShape.ts +88 -37
- package/src/utilities/boundingBox/index.ts +11 -2
- package/src/utilities/{pointInSurroundingSphereCallback.ts → getSphereBoundsInfo.ts} +39 -82
- package/src/utilities/index.ts +6 -3
- package/src/utilities/math/ellipse/pointInEllipse.ts +1 -1
- package/src/utilities/pointInShapeCallback.ts +2 -2
- package/src/utilities/rectangleROITool/getBoundsIJKFromRectangleAnnotations.ts +5 -2
- package/src/utilities/rectangleROITool/index.ts +2 -1
- package/src/utilities/rectangleROITool/isAxisAlignedRectangle.ts +53 -0
- package/src/utilities/segmentation/createImageIdReferenceMap.ts +23 -0
- package/src/utilities/segmentation/createLabelmapVolumeForViewport.ts +1 -1
- package/src/utilities/segmentation/index.ts +4 -0
- package/src/utilities/segmentation/invalidateBrushCursor.ts +48 -0
- package/src/utilities/segmentation/thresholdSegmentationByRange.ts +2 -2
- package/src/utilities/segmentation/triggerSegmentationRender.ts +15 -10
- package/src/utilities/segmentation/utilities.ts +5 -2
- package/src/utilities/stackPrefetch/stackContextPrefetch.ts +1 -1
- package/src/utilities/stackPrefetch/stackPrefetchUtils.ts +5 -1
- package/dist/cjs/utilities/pointInSurroundingSphereCallback.d.ts +0 -4
- package/dist/cjs/utilities/pointInSurroundingSphereCallback.js +0 -70
- package/dist/cjs/utilities/pointInSurroundingSphereCallback.js.map +0 -1
- package/dist/cjs/utilities/roundNumber.d.ts +0 -2
- package/dist/cjs/utilities/roundNumber.js +0 -30
- package/dist/cjs/utilities/roundNumber.js.map +0 -1
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js +0 -64
- package/dist/esm/utilities/pointInSurroundingSphereCallback.js.map +0 -1
- package/dist/esm/utilities/roundNumber.js +0 -28
- package/dist/esm/utilities/roundNumber.js.map +0 -1
- package/dist/types/utilities/pointInSurroundingSphereCallback.d.ts +0 -5
- package/dist/types/utilities/pointInSurroundingSphereCallback.d.ts.map +0 -1
- package/dist/types/utilities/roundNumber.d.ts +0 -3
- package/dist/types/utilities/roundNumber.d.ts.map +0 -1
- package/src/utilities/roundNumber.ts +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.43.0",
|
|
33
33
|
"comlink": "^4.4.1",
|
|
34
34
|
"lodash.clonedeep": "4.5.0",
|
|
35
35
|
"lodash.get": "^4.4.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@kitware/vtk.js": "
|
|
38
|
+
"@kitware/vtk.js": "29.3.0",
|
|
39
39
|
"@types/d3-array": "^3.0.4",
|
|
40
40
|
"@types/d3-interpolate": "^3.0.1",
|
|
41
41
|
"d3-array": "^3.2.3",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"type": "individual",
|
|
54
54
|
"url": "https://ohif.org/donate"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "1681f72fb2df75001f844a2e1728f2e9b79b6985"
|
|
57
57
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
|
|
2
|
+
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
1
3
|
import {
|
|
2
4
|
StackViewport,
|
|
3
5
|
getEnabledElement,
|
|
@@ -6,15 +8,12 @@ import {
|
|
|
6
8
|
cache,
|
|
7
9
|
utilities,
|
|
8
10
|
Types,
|
|
9
|
-
metaData,
|
|
10
11
|
} from '@cornerstonejs/core';
|
|
11
12
|
import { getToolGroupForViewport } from '../../store/ToolGroupManager';
|
|
12
13
|
import Representations from '../../enums/SegmentationRepresentations';
|
|
13
14
|
import * as SegmentationState from '../../stateManagement/segmentation/segmentationState';
|
|
14
15
|
import { LabelmapSegmentationDataStack } from '../../types/LabelmapTypes';
|
|
15
16
|
import { isVolumeSegmentation } from '../../tools/segmentation/strategies/utils/stackVolumeCheck';
|
|
16
|
-
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
|
|
17
|
-
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
18
17
|
import triggerSegmentationRender from '../../utilities/segmentation/triggerSegmentationRender';
|
|
19
18
|
|
|
20
19
|
const enable = function (element: HTMLDivElement): void {
|
|
@@ -118,6 +117,26 @@ function _imageChangeEventListener(evt) {
|
|
|
118
117
|
const currentImageId = viewport.getCurrentImageId();
|
|
119
118
|
const actors = viewport.getActors();
|
|
120
119
|
|
|
120
|
+
const segmentationFound = actors.find((actor) => {
|
|
121
|
+
if (!representationList.includes(actor.uid)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return true;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (!segmentationFound) {
|
|
129
|
+
// If the segmentation is not found, it could be because of some special cases
|
|
130
|
+
// where we are in the process of updating the volume conversion to a stack while
|
|
131
|
+
// the data is still coming in. In such situations, we should trigger the render
|
|
132
|
+
// to ensure that the segmentation actors are created, even if the data arrives late.
|
|
133
|
+
triggerSegmentationRender(toolGroup.id);
|
|
134
|
+
|
|
135
|
+
// we should return here, since there is no segmentation actor to update
|
|
136
|
+
// we will hit this function later on after the actor is created
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
121
140
|
actors.forEach((actor) => {
|
|
122
141
|
if (!representationList.includes(actor.uid)) {
|
|
123
142
|
return;
|
|
@@ -148,10 +167,27 @@ function _imageChangeEventListener(evt) {
|
|
|
148
167
|
|
|
149
168
|
const derivedImage = cache.getImage(derivedImageId);
|
|
150
169
|
|
|
151
|
-
const {
|
|
170
|
+
const { dimensions, spacing, direction } =
|
|
152
171
|
viewport.getImageDataMetadata(derivedImage);
|
|
153
172
|
|
|
154
|
-
|
|
173
|
+
const currentImage = cache.getImage(currentImageId);
|
|
174
|
+
const { origin: currentOrigin } =
|
|
175
|
+
viewport.getImageDataMetadata(currentImage);
|
|
176
|
+
|
|
177
|
+
// IMPORTANT: We need to make sure that the origin of the segmentation
|
|
178
|
+
// is the same as the current image origin. This is because due to some
|
|
179
|
+
// floating point precision issues, when coming from volume to stack
|
|
180
|
+
// the origin of the segmentation can be slightly different from the
|
|
181
|
+
// current image origin. This can cause the segmentation to be rendered
|
|
182
|
+
// in the wrong location.
|
|
183
|
+
// Todo: This will not work for segmentations that are not in the same frame
|
|
184
|
+
// of reference or derived from the same image. This can happen when we have
|
|
185
|
+
// a segmentation that happens to exist in the same space as the image but is
|
|
186
|
+
// not derived from it. We need to find a way to handle this case, but don't think
|
|
187
|
+
// it makes sense to do it for the stack viewport, as the volume viewport is designed to handle this case.
|
|
188
|
+
const originToUse = currentOrigin;
|
|
189
|
+
|
|
190
|
+
segmentationImageData.setOrigin(originToUse);
|
|
155
191
|
segmentationImageData.modified();
|
|
156
192
|
|
|
157
193
|
if (
|
|
@@ -180,7 +216,7 @@ function _imageChangeEventListener(evt) {
|
|
|
180
216
|
imageData.setDimensions(dimensions[0], dimensions[1], 1);
|
|
181
217
|
imageData.setSpacing(spacing);
|
|
182
218
|
imageData.setDirection(direction);
|
|
183
|
-
imageData.setOrigin(
|
|
219
|
+
imageData.setOrigin(originToUse);
|
|
184
220
|
imageData.getPointData().setScalars(scalarArray);
|
|
185
221
|
|
|
186
222
|
imageActor.getMapper().setInputData(imageData);
|
package/src/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
OrientationMarkerTool,
|
|
67
67
|
OverlayGridTool,
|
|
68
68
|
SegmentationIntersectionTool,
|
|
69
|
+
SegmentSelectTool,
|
|
69
70
|
} from './tools';
|
|
70
71
|
|
|
71
72
|
import VideoRedactionTool from './tools/annotation/VideoRedactionTool';
|
|
@@ -129,6 +130,7 @@ export {
|
|
|
129
130
|
RectangleROIStartEndThresholdTool,
|
|
130
131
|
BrushTool,
|
|
131
132
|
OrientationMarkerTool,
|
|
133
|
+
SegmentSelectTool,
|
|
132
134
|
// Synchronizers
|
|
133
135
|
synchronizers,
|
|
134
136
|
Synchronizer,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ToolGroupSpecificRepresentation } from '../../types/SegmentationStateTypes';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getDefaultSegmentationStateManager,
|
|
4
|
+
getSegmentation,
|
|
5
|
+
} from './segmentationState';
|
|
3
6
|
import { triggerSegmentationRepresentationModified } from './triggerSegmentationEvents';
|
|
4
7
|
|
|
5
8
|
/**
|
|
@@ -27,6 +30,25 @@ function getActiveSegmentationRepresentation(
|
|
|
27
30
|
return activeRepresentation;
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the active segmentation for a given tool group.
|
|
35
|
+
* @param toolGroupId - The ID of the tool group.
|
|
36
|
+
* @returns The active segmentation Id, or undefined if no active segmentation is found.
|
|
37
|
+
*/
|
|
38
|
+
function getActiveSegmentation(toolGroupId: string) {
|
|
39
|
+
const activeRepresentation = getActiveSegmentationRepresentation(toolGroupId);
|
|
40
|
+
|
|
41
|
+
if (!activeRepresentation) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const activeSegmentation = getSegmentation(
|
|
46
|
+
activeRepresentation.segmentationId
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return activeSegmentation;
|
|
50
|
+
}
|
|
51
|
+
|
|
30
52
|
/**
|
|
31
53
|
* Set the active segmentation for the given tool group for all its viewports
|
|
32
54
|
*
|
|
@@ -55,6 +77,7 @@ function setActiveSegmentationRepresentation(
|
|
|
55
77
|
export {
|
|
56
78
|
// get
|
|
57
79
|
getActiveSegmentationRepresentation,
|
|
80
|
+
getActiveSegmentation,
|
|
58
81
|
// set
|
|
59
82
|
setActiveSegmentationRepresentation,
|
|
60
83
|
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
volumeLoader,
|
|
3
|
+
utilities as csUtils,
|
|
4
|
+
eventTarget,
|
|
5
|
+
} from '@cornerstonejs/core';
|
|
6
|
+
import { Events, SegmentationRepresentations } from '../../enums';
|
|
7
|
+
import addSegmentations from './addSegmentations';
|
|
8
|
+
import addSegmentationRepresentations from './addSegmentationRepresentations';
|
|
9
|
+
import { triggerSegmentationRender } from '../../utilities/segmentation';
|
|
10
|
+
import { getSegmentation, removeSegmentation } from './segmentationState';
|
|
11
|
+
import { LabelmapSegmentationDataStack } from '../../types/LabelmapTypes';
|
|
12
|
+
import { triggerSegmentationDataModified } from './triggerSegmentationEvents';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Converts a stack-based segmentation to a volume-based segmentation.
|
|
16
|
+
*
|
|
17
|
+
* @param params - The parameters for the conversion.
|
|
18
|
+
* @param params.segmentationId - The segmentationId to convert.
|
|
19
|
+
* @param [params.options] - The conversion options.
|
|
20
|
+
* @param params.options.toolGroupId - The new toolGroupId to use for the segmentation.
|
|
21
|
+
* @param [params.options.volumeId] - the new volumeId to use for the segmentation. If not provided, a new ID will be generated.
|
|
22
|
+
* @param [params.options.newSegmentationId] - the new segmentationId to use for the segmentation. If not provided, a new ID will be generated.
|
|
23
|
+
* @param [params.options.removeOriginal] - Whether or not to remove the original segmentation. Defaults to true.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise that resolves when the conversion is complete.
|
|
26
|
+
*/
|
|
27
|
+
async function convertStackToVolumeSegmentation({
|
|
28
|
+
segmentationId,
|
|
29
|
+
options,
|
|
30
|
+
}: {
|
|
31
|
+
segmentationId: string;
|
|
32
|
+
options?: {
|
|
33
|
+
toolGroupId: string;
|
|
34
|
+
volumeId?: string;
|
|
35
|
+
newSegmentationId?: string;
|
|
36
|
+
removeOriginal?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}): Promise<void> {
|
|
39
|
+
const segmentation = getSegmentation(segmentationId);
|
|
40
|
+
const { toolGroupId } = options;
|
|
41
|
+
const data = segmentation.representationData
|
|
42
|
+
.LABELMAP as LabelmapSegmentationDataStack;
|
|
43
|
+
|
|
44
|
+
const imageIdReferenceMap = data.imageIdReferenceMap;
|
|
45
|
+
|
|
46
|
+
// Get the imageIds from the imageIdReferenceMap
|
|
47
|
+
const segmentationImageIds = Array.from(imageIdReferenceMap.values());
|
|
48
|
+
|
|
49
|
+
const additionalDetails = {
|
|
50
|
+
imageIdReferenceMap,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Since segmentations are already cached and are not
|
|
54
|
+
// loaded like volumes, we can create a volume out of their images
|
|
55
|
+
const volumeId = options?.volumeId;
|
|
56
|
+
|
|
57
|
+
await volumeLoader.createAndCacheVolumeFromImages(
|
|
58
|
+
volumeId,
|
|
59
|
+
segmentationImageIds,
|
|
60
|
+
{
|
|
61
|
+
additionalDetails,
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const newSegmentationId = options?.newSegmentationId ?? csUtils.uuidv4();
|
|
66
|
+
|
|
67
|
+
if (options?.removeOriginal ?? true) {
|
|
68
|
+
removeSegmentation(segmentationId);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await addSegmentations([
|
|
72
|
+
{
|
|
73
|
+
segmentationId: newSegmentationId,
|
|
74
|
+
representation: {
|
|
75
|
+
type: SegmentationRepresentations.Labelmap,
|
|
76
|
+
data: {
|
|
77
|
+
volumeId,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
await addSegmentationRepresentations(toolGroupId, [
|
|
84
|
+
{
|
|
85
|
+
segmentationId: newSegmentationId,
|
|
86
|
+
type: SegmentationRepresentations.Labelmap,
|
|
87
|
+
},
|
|
88
|
+
]);
|
|
89
|
+
|
|
90
|
+
triggerSegmentationRender(toolGroupId);
|
|
91
|
+
// Note: It is crucial to trigger the data modified event. This ensures that the
|
|
92
|
+
// old texture is updated to the GPU, especially in scenarios where it may not be getting updated.
|
|
93
|
+
eventTarget.addEventListenerOnce(Events.SEGMENTATION_RENDERED, () =>
|
|
94
|
+
triggerSegmentationDataModified(newSegmentationId)
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { convertStackToVolumeSegmentation };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Types,
|
|
3
|
+
cache,
|
|
4
|
+
utilities as csUtils,
|
|
5
|
+
eventTarget,
|
|
6
|
+
} from '@cornerstonejs/core';
|
|
7
|
+
import { Events, SegmentationRepresentations } from '../../enums';
|
|
8
|
+
import addSegmentations from './addSegmentations';
|
|
9
|
+
import addSegmentationRepresentations from './addSegmentationRepresentations';
|
|
10
|
+
import {
|
|
11
|
+
triggerSegmentationRender,
|
|
12
|
+
createImageIdReferenceMap,
|
|
13
|
+
} from '../../utilities/segmentation';
|
|
14
|
+
import { getSegmentation, removeSegmentation } from './segmentationState';
|
|
15
|
+
import { LabelmapSegmentationDataVolume } from '../../types/LabelmapTypes';
|
|
16
|
+
import { triggerSegmentationDataModified } from './triggerSegmentationEvents';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Converts a volume segmentation to a stack segmentation.
|
|
20
|
+
*
|
|
21
|
+
* @param params - The parameters for the conversion.
|
|
22
|
+
* @param params.segmentationId - The segmentationId to convert.
|
|
23
|
+
* @param [params.options] - The conversion options.
|
|
24
|
+
* @param params.options.toolGroupId - The new toolGroupId that the new segmentation will belong to.
|
|
25
|
+
* @param [params.options.newSegmentationId] - The new segmentationId to use for the segmentation. If not provided, a new ID will be generated.
|
|
26
|
+
* @param [params.options.removeOriginal] - Whether or not to remove the original segmentation. Defaults to true.
|
|
27
|
+
*
|
|
28
|
+
* @returns A promise that resolves when the conversion is complete.
|
|
29
|
+
*/
|
|
30
|
+
export async function convertVolumeToStackSegmentation({
|
|
31
|
+
segmentationId,
|
|
32
|
+
options,
|
|
33
|
+
}: {
|
|
34
|
+
segmentationId: string;
|
|
35
|
+
options?: {
|
|
36
|
+
toolGroupId: string;
|
|
37
|
+
newSegmentationId?: string;
|
|
38
|
+
removeOriginal?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}): Promise<void> {
|
|
41
|
+
const segmentation = getSegmentation(segmentationId);
|
|
42
|
+
|
|
43
|
+
const { toolGroupId } = options;
|
|
44
|
+
const data = segmentation.representationData
|
|
45
|
+
.LABELMAP as LabelmapSegmentationDataVolume;
|
|
46
|
+
|
|
47
|
+
const segmentationVolume = cache.getVolume(
|
|
48
|
+
data.volumeId
|
|
49
|
+
) as Types.IImageVolume;
|
|
50
|
+
|
|
51
|
+
const imageIdReferenceMap =
|
|
52
|
+
_getImageIdReferenceMapForStackSegmentation(segmentationVolume);
|
|
53
|
+
|
|
54
|
+
const newSegmentationId = options?.newSegmentationId ?? csUtils.uuidv4();
|
|
55
|
+
|
|
56
|
+
if (options?.removeOriginal ?? true) {
|
|
57
|
+
removeSegmentation(segmentationId);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await addSegmentations([
|
|
61
|
+
{
|
|
62
|
+
segmentationId: newSegmentationId,
|
|
63
|
+
representation: {
|
|
64
|
+
type: SegmentationRepresentations.Labelmap,
|
|
65
|
+
data: {
|
|
66
|
+
imageIdReferenceMap,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
// Add the segmentation representation to the toolgroup
|
|
72
|
+
await addSegmentationRepresentations(toolGroupId, [
|
|
73
|
+
{
|
|
74
|
+
segmentationId: newSegmentationId,
|
|
75
|
+
type: SegmentationRepresentations.Labelmap,
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
triggerSegmentationRender(toolGroupId);
|
|
80
|
+
// Note: It is crucial to trigger the data modified event. This ensures that the
|
|
81
|
+
// old texture is updated to the GPU, especially in scenarios where it may not be getting updated.
|
|
82
|
+
eventTarget.addEventListenerOnce(Events.SEGMENTATION_RENDERED, () =>
|
|
83
|
+
triggerSegmentationDataModified(newSegmentationId)
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _getImageIdReferenceMapForStackSegmentation(
|
|
88
|
+
segmentationVolume: Types.IImageVolume
|
|
89
|
+
) {
|
|
90
|
+
// There might be or might not be segmentationImageIds, if it is a volume
|
|
91
|
+
// segmentation converted from stack segmentation, there will be segmentationImageIds
|
|
92
|
+
// otherwise, if it is empty volume segmentation derived from
|
|
93
|
+
// a volume that is not a stack, there will be no segmentationImageIds
|
|
94
|
+
const segmentationImageIds = segmentationVolume.imageIds;
|
|
95
|
+
|
|
96
|
+
if (segmentationVolume.additionalDetails?.imageIdReferenceMap) {
|
|
97
|
+
// this means the segmentation volume is derived from a stack segmentation
|
|
98
|
+
// and we can use the imageIdReferenceMap from the additionalDetails
|
|
99
|
+
return segmentationVolume.additionalDetails.imageIdReferenceMap;
|
|
100
|
+
} else if (
|
|
101
|
+
segmentationVolume.referencedImageIds?.length &&
|
|
102
|
+
!segmentationVolume.referencedImageIds[0].startsWith('derived')
|
|
103
|
+
) {
|
|
104
|
+
// this means the segmentation volume is derived from a stack segmentation
|
|
105
|
+
// and we can use the referencedImageIds from the segmentationVolume
|
|
106
|
+
const referencedImageIds = segmentationVolume.referencedImageIds;
|
|
107
|
+
|
|
108
|
+
return createImageIdReferenceMap(referencedImageIds, segmentationImageIds);
|
|
109
|
+
} else {
|
|
110
|
+
// check if the segmentation volume is derived from another volume and
|
|
111
|
+
// whether if that volume has imageIds
|
|
112
|
+
const referencedVolumeId = segmentationVolume.referencedVolumeId;
|
|
113
|
+
const referencedVolume = cache.getVolume(referencedVolumeId);
|
|
114
|
+
|
|
115
|
+
if (!referencedVolume) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
'Cannot convert volumetric segmentation without referenced volume to stack segmentation yet'
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!referencedVolume?.imageIds?.length) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
'Cannot convert volumetric segmentation without imageIds to stack segmentation yet'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (referencedVolume.imageIds?.[0].startsWith('derived')) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Cannot convert volume segmentation that is derived from another segmentation
|
|
130
|
+
to stack segmentation yet, include the additionalDetails.imageIdReferenceMap
|
|
131
|
+
in the volume segmentation in case you need it for the conversion`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// if the referenced volume has imageIds, and itself is not derived from
|
|
136
|
+
// another segmentation then we can use the imageIds from the referenced volume
|
|
137
|
+
const referencedImageIds = referencedVolume.imageIds;
|
|
138
|
+
|
|
139
|
+
let segmentationImageIdsToUse = segmentationVolume.imageIds;
|
|
140
|
+
if (!segmentationImageIdsToUse?.length) {
|
|
141
|
+
// If segmentation Ids don't exist it means that the segmentation is literally
|
|
142
|
+
// just a volume so we need to assume imageIds and decache it to the _imageCache
|
|
143
|
+
// so that it can be used for the conversion
|
|
144
|
+
segmentationImageIdsToUse =
|
|
145
|
+
segmentationVolume.convertToImageSlicesAndCache();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return createImageIdReferenceMap(
|
|
149
|
+
referencedImageIds,
|
|
150
|
+
segmentationImageIdsToUse
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import removeSegmentationsFromToolGroup from './removeSegmentationsFromToolGroup';
|
|
2
2
|
import addSegmentations from './addSegmentations';
|
|
3
3
|
import addSegmentationRepresentations from './addSegmentationRepresentations';
|
|
4
|
+
import { convertStackToVolumeSegmentation } from './convertStackToVolumeSegmentation';
|
|
5
|
+
import { convertVolumeToStackSegmentation } from './convertVolumeToStackSegmentation';
|
|
4
6
|
|
|
5
7
|
import * as activeSegmentation from './activeSegmentation';
|
|
6
8
|
import * as segmentLocking from './segmentLocking';
|
|
@@ -19,4 +21,6 @@ export {
|
|
|
19
21
|
config,
|
|
20
22
|
segmentIndex,
|
|
21
23
|
triggerSegmentationEvents,
|
|
24
|
+
convertStackToVolumeSegmentation,
|
|
25
|
+
convertVolumeToStackSegmentation,
|
|
22
26
|
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { invalidateBrushCursor } from '../../utilities/segmentation/';
|
|
2
|
+
import {
|
|
3
|
+
getSegmentation,
|
|
4
|
+
getToolGroupIdsWithSegmentation,
|
|
5
|
+
} from './segmentationState';
|
|
2
6
|
import { triggerSegmentationModified } from './triggerSegmentationEvents';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* Set the active segment index for a segmentation Id. It fires a global state
|
|
6
|
-
* modified event.
|
|
10
|
+
* modified event. Also it invalidates the brush cursor for all toolGroups that
|
|
11
|
+
* has the segmentationId as active segment (since the brush cursor color
|
|
12
|
+
* should change as well)
|
|
7
13
|
*
|
|
8
14
|
* @triggers SEGMENTATION_MODIFIED
|
|
9
15
|
* @param segmentationId - The id of the segmentation that the segment belongs to.
|
|
@@ -20,6 +26,13 @@ function setActiveSegmentIndex(
|
|
|
20
26
|
|
|
21
27
|
triggerSegmentationModified(segmentationId);
|
|
22
28
|
}
|
|
29
|
+
|
|
30
|
+
// get all toolGroups that has the segmentationId as active
|
|
31
|
+
// segment and call invalidateBrushCursor on them
|
|
32
|
+
const toolGroups = getToolGroupIdsWithSegmentation(segmentationId);
|
|
33
|
+
toolGroups.forEach((toolGroupId) => {
|
|
34
|
+
invalidateBrushCursor(toolGroupId);
|
|
35
|
+
});
|
|
23
36
|
}
|
|
24
37
|
|
|
25
38
|
/**
|
|
@@ -368,6 +368,22 @@ function removeSegmentationRepresentation(
|
|
|
368
368
|
);
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Removes all segmentation representations associated with a tool group.
|
|
373
|
+
* @param toolGroupId - The ID of the tool group.
|
|
374
|
+
*/
|
|
375
|
+
function removeSegmentationRepresentations(toolGroupId: string): void {
|
|
376
|
+
const segmentationRepresentations =
|
|
377
|
+
getSegmentationRepresentations(toolGroupId) || [];
|
|
378
|
+
|
|
379
|
+
segmentationRepresentations.forEach((representation) => {
|
|
380
|
+
removeSegmentationRepresentation(
|
|
381
|
+
toolGroupId,
|
|
382
|
+
representation.segmentationRepresentationUID
|
|
383
|
+
);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
371
387
|
/**
|
|
372
388
|
* Add a color LUT to the segmentation state manager
|
|
373
389
|
* @param colorLUT - The color LUT array to add.
|
|
@@ -415,6 +431,7 @@ export {
|
|
|
415
431
|
getSegmentationRepresentations,
|
|
416
432
|
addSegmentationRepresentation,
|
|
417
433
|
removeSegmentationRepresentation,
|
|
434
|
+
removeSegmentationRepresentations,
|
|
418
435
|
// config
|
|
419
436
|
getToolGroupSpecificConfig,
|
|
420
437
|
setToolGroupSpecificConfig,
|
|
@@ -185,6 +185,10 @@ export default class ToolGroup implements IToolGroup {
|
|
|
185
185
|
* @param renderingEngineId - The rendering engine to use.
|
|
186
186
|
*/
|
|
187
187
|
public addViewport(viewportId: string, renderingEngineId?: string): void {
|
|
188
|
+
if (typeof viewportId !== 'string') {
|
|
189
|
+
throw new Error('viewportId must be defined and be a string');
|
|
190
|
+
}
|
|
191
|
+
|
|
188
192
|
const renderingEngines = getRenderingEngines();
|
|
189
193
|
|
|
190
194
|
if (!renderingEngineId && renderingEngines.length > 1) {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
17
17
|
import * as lineSegment from '../../utilities/math/line';
|
|
18
18
|
import angleBetweenLines from '../../utilities/math/angle/angleBetweenLines';
|
|
19
|
-
import roundNumber from '../../utilities
|
|
19
|
+
import { roundNumber } from '../../utilities';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
drawHandles as drawHandlesSvg,
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
} from '../../drawingSvg';
|
|
26
26
|
import { state } from '../../store';
|
|
27
27
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
28
|
-
import { getTextBoxCoordsCanvas } from '../../utilities/drawing';
|
|
29
28
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
30
29
|
import {
|
|
31
30
|
AnnotationCompletedEventDetail,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getCalibratedLengthUnits,
|
|
12
12
|
getCalibratedScale,
|
|
13
13
|
} from '../../utilities/getCalibratedUnits';
|
|
14
|
-
import roundNumber from '../../utilities
|
|
14
|
+
import { roundNumber } from '../../utilities';
|
|
15
15
|
import { AnnotationTool } from '../base';
|
|
16
16
|
import throttle from '../../utilities/throttle';
|
|
17
17
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getCalibratedScale,
|
|
16
16
|
getCalibratedAspect,
|
|
17
17
|
} from '../../utilities/getCalibratedUnits';
|
|
18
|
-
import roundNumber from '../../utilities
|
|
18
|
+
import { roundNumber } from '../../utilities';
|
|
19
19
|
import throttle from '../../utilities/throttle';
|
|
20
20
|
import {
|
|
21
21
|
addAnnotation,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getCalibratedAreaUnits,
|
|
14
14
|
getCalibratedScale,
|
|
15
15
|
} from '../../utilities/getCalibratedUnits';
|
|
16
|
-
import roundNumber from '../../utilities
|
|
16
|
+
import { roundNumber } from '../../utilities';
|
|
17
17
|
import throttle from '../../utilities/throttle';
|
|
18
18
|
import {
|
|
19
19
|
addAnnotation,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import type { Types } from '@cornerstonejs/core';
|
|
9
9
|
|
|
10
10
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
11
|
-
import roundNumber from '../../utilities
|
|
11
|
+
import { roundNumber } from '../../utilities';
|
|
12
12
|
import { AnnotationTool } from '../base';
|
|
13
13
|
import throttle from '../../utilities/throttle';
|
|
14
14
|
import {
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
getEnabledElement,
|
|
4
4
|
triggerEvent,
|
|
5
5
|
eventTarget,
|
|
6
|
-
StackViewport,
|
|
7
6
|
VolumeViewport,
|
|
8
7
|
utilities as csUtils,
|
|
9
8
|
} from '@cornerstonejs/core';
|
|
@@ -14,7 +13,7 @@ import {
|
|
|
14
13
|
getCalibratedAreaUnits,
|
|
15
14
|
getCalibratedScale,
|
|
16
15
|
} from '../../utilities/getCalibratedUnits';
|
|
17
|
-
import roundNumber from '../../utilities
|
|
16
|
+
import { roundNumber } from '../../utilities';
|
|
18
17
|
import { Events } from '../../enums';
|
|
19
18
|
import { AnnotationTool } from '../base';
|
|
20
19
|
import {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { state } from '../../store';
|
|
25
25
|
import { Events } from '../../enums';
|
|
26
26
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
27
|
-
import roundNumber from '../../utilities
|
|
27
|
+
import { roundNumber } from '../../utilities';
|
|
28
28
|
import {
|
|
29
29
|
resetElementCursor,
|
|
30
30
|
hideElementCursor,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getCalibratedAreaUnits,
|
|
14
14
|
getCalibratedScale,
|
|
15
15
|
} from '../../utilities/getCalibratedUnits';
|
|
16
|
-
import roundNumber from '../../utilities
|
|
16
|
+
import { roundNumber } from '../../utilities';
|
|
17
17
|
import throttle from '../../utilities/throttle';
|
|
18
18
|
import {
|
|
19
19
|
addAnnotation,
|
|
@@ -4,6 +4,7 @@ const defaultLabelmapConfig: LabelmapConfig = {
|
|
|
4
4
|
renderOutline: true,
|
|
5
5
|
outlineWidthActive: 3,
|
|
6
6
|
outlineWidthInactive: 2,
|
|
7
|
+
activeSegmentOutlineWidthDelta: 0,
|
|
7
8
|
renderFill: true,
|
|
8
9
|
renderFillInactive: true,
|
|
9
10
|
fillAlpha: 0.7,
|
|
@@ -24,6 +25,7 @@ function isValidLabelmapConfig(config): boolean {
|
|
|
24
25
|
typeof config.renderOutline === 'boolean' &&
|
|
25
26
|
typeof config.outlineWidthActive === 'number' &&
|
|
26
27
|
typeof config.outlineWidthInactive === 'number' &&
|
|
28
|
+
typeof config.activeSegmentOutlineWidthDelta === 'number' &&
|
|
27
29
|
typeof config.renderFill === 'boolean' &&
|
|
28
30
|
typeof config.renderFillInactive === 'boolean' &&
|
|
29
31
|
typeof config.fillAlpha === 'number' &&
|