@cornerstonejs/tools 1.41.0 → 1.42.1
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/eventDispatchers/keyboardEventHandlers/keyDown.js +2 -1
- package/dist/cjs/eventDispatchers/keyboardEventHandlers/keyDown.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +18 -5
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/annotationState.js +3 -0
- package/dist/cjs/stateManagement/annotation/annotationState.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/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 +8 -7
- 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/labelmapDisplay.js +10 -0
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/segmentation/BrushTool.js +8 -4
- package/dist/cjs/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/strategies/fillCircle.js +4 -6
- package/dist/cjs/tools/segmentation/strategies/fillCircle.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/index.d.ts +2 -1
- package/dist/cjs/utilities/contours/AnnotationToPointData.d.ts +11 -0
- package/dist/cjs/utilities/contours/AnnotationToPointData.js +44 -0
- package/dist/cjs/utilities/contours/AnnotationToPointData.js.map +1 -0
- package/dist/cjs/utilities/contours/RectangleROIStartEndThreshold.d.ts +6 -0
- package/dist/cjs/utilities/contours/RectangleROIStartEndThreshold.js +43 -0
- package/dist/cjs/utilities/contours/RectangleROIStartEndThreshold.js.map +1 -0
- package/dist/cjs/utilities/contours/contourFinder.d.ts +7 -0
- package/dist/cjs/utilities/contours/contourFinder.js +68 -0
- package/dist/cjs/utilities/contours/contourFinder.js.map +1 -0
- package/dist/cjs/utilities/contours/detectContourHoles.d.ts +5 -0
- package/dist/cjs/utilities/contours/detectContourHoles.js +78 -0
- package/dist/cjs/utilities/contours/detectContourHoles.js.map +1 -0
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.d.ts +4 -0
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js +124 -0
- package/dist/cjs/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +6 -0
- package/dist/cjs/utilities/contours/index.js +17 -0
- package/dist/cjs/utilities/contours/index.js.map +1 -0
- package/dist/cjs/utilities/contours/mergePoints.d.ts +8 -0
- package/dist/cjs/utilities/contours/mergePoints.js +77 -0
- package/dist/cjs/utilities/contours/mergePoints.js.map +1 -0
- package/dist/cjs/utilities/index.d.ts +4 -2
- package/dist/cjs/utilities/index.js +8 -5
- package/dist/cjs/utilities/index.js.map +1 -1
- package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.d.ts +1 -0
- package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js +31 -0
- package/dist/cjs/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -0
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.d.ts +14 -0
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.js +43 -0
- package/dist/cjs/utilities/segmentation/createBidirectionalToolData.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/findLargestBidirectional.d.ts +1 -0
- package/dist/cjs/utilities/segmentation/findLargestBidirectional.js +94 -0
- package/dist/cjs/utilities/segmentation/findLargestBidirectional.js.map +1 -0
- package/dist/cjs/utilities/segmentation/index.d.ts +5 -1
- package/dist/cjs/utilities/segmentation/index.js +9 -1
- package/dist/cjs/utilities/segmentation/index.js.map +1 -1
- package/dist/cjs/utilities/segmentation/isLineInSegment.d.ts +9 -0
- package/dist/cjs/utilities/segmentation/isLineInSegment.js +55 -0
- package/dist/cjs/utilities/segmentation/isLineInSegment.js.map +1 -0
- package/dist/cjs/utilities/segmentation/segmentContourAction.d.ts +17 -0
- package/dist/cjs/utilities/segmentation/segmentContourAction.js +122 -0
- package/dist/cjs/utilities/segmentation/segmentContourAction.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/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/eventDispatchers/keyboardEventHandlers/keyDown.js +2 -1
- package/dist/esm/eventDispatchers/keyboardEventHandlers/keyDown.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/stateManagement/annotation/annotationState.js +3 -0
- package/dist/esm/stateManagement/annotation/annotationState.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/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 +8 -7
- 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/labelmapDisplay.js +11 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/segmentation/BrushTool.js +8 -4
- package/dist/esm/tools/segmentation/BrushTool.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/fillCircle.js +4 -6
- package/dist/esm/tools/segmentation/strategies/fillCircle.js.map +1 -1
- package/dist/esm/tools/segmentation/strategies/utils/isWithinThreshold.js.map +1 -1
- package/dist/esm/utilities/contours/AnnotationToPointData.js +39 -0
- package/dist/esm/utilities/contours/AnnotationToPointData.js.map +1 -0
- package/dist/esm/utilities/contours/RectangleROIStartEndThreshold.js +41 -0
- package/dist/esm/utilities/contours/RectangleROIStartEndThreshold.js.map +1 -0
- package/dist/esm/utilities/contours/contourFinder.js +63 -0
- package/dist/esm/utilities/contours/contourFinder.js.map +1 -0
- package/dist/esm/utilities/contours/detectContourHoles.js +74 -0
- package/dist/esm/utilities/contours/detectContourHoles.js.map +1 -0
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js +117 -0
- package/dist/esm/utilities/contours/generateContourSetsFromLabelmap.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +7 -0
- package/dist/esm/utilities/contours/index.js.map +1 -0
- package/dist/esm/utilities/contours/mergePoints.js +73 -0
- package/dist/esm/utilities/contours/mergePoints.js.map +1 -0
- package/dist/esm/utilities/index.js +4 -2
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js +25 -0
- package/dist/esm/utilities/segmentation/contourAndFindLargestBidirectional.js.map +1 -0
- package/dist/esm/utilities/segmentation/createBidirectionalToolData.js +40 -0
- package/dist/esm/utilities/segmentation/createBidirectionalToolData.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/findLargestBidirectional.js +96 -0
- package/dist/esm/utilities/segmentation/findLargestBidirectional.js.map +1 -0
- package/dist/esm/utilities/segmentation/index.js +5 -1
- package/dist/esm/utilities/segmentation/index.js.map +1 -1
- package/dist/esm/utilities/segmentation/isLineInSegment.js +50 -0
- package/dist/esm/utilities/segmentation/isLineInSegment.js.map +1 -0
- package/dist/esm/utilities/segmentation/segmentContourAction.js +98 -0
- package/dist/esm/utilities/segmentation/segmentContourAction.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/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/eventDispatchers/keyboardEventHandlers/keyDown.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/annotationState.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/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/BidirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
- package/dist/types/tools/segmentation/BrushTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/strategies/fillCircle.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.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/contours/AnnotationToPointData.d.ts +12 -0
- package/dist/types/utilities/contours/AnnotationToPointData.d.ts.map +1 -0
- package/dist/types/utilities/contours/RectangleROIStartEndThreshold.d.ts +7 -0
- package/dist/types/utilities/contours/RectangleROIStartEndThreshold.d.ts.map +1 -0
- package/dist/types/utilities/contours/contourFinder.d.ts +8 -0
- package/dist/types/utilities/contours/contourFinder.d.ts.map +1 -0
- package/dist/types/utilities/contours/detectContourHoles.d.ts +6 -0
- package/dist/types/utilities/contours/detectContourHoles.d.ts.map +1 -0
- package/dist/types/utilities/contours/generateContourSetsFromLabelmap.d.ts +5 -0
- package/dist/types/utilities/contours/generateContourSetsFromLabelmap.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +7 -0
- package/dist/types/utilities/contours/index.d.ts.map +1 -0
- package/dist/types/utilities/contours/mergePoints.d.ts +9 -0
- package/dist/types/utilities/contours/mergePoints.d.ts.map +1 -0
- package/dist/types/utilities/index.d.ts +4 -2
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/contourAndFindLargestBidirectional.d.ts +2 -0
- package/dist/types/utilities/segmentation/contourAndFindLargestBidirectional.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/createBidirectionalToolData.d.ts +15 -0
- package/dist/types/utilities/segmentation/createBidirectionalToolData.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/findLargestBidirectional.d.ts +2 -0
- package/dist/types/utilities/segmentation/findLargestBidirectional.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/index.d.ts +5 -1
- package/dist/types/utilities/segmentation/index.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/isLineInSegment.d.ts +10 -0
- package/dist/types/utilities/segmentation/isLineInSegment.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/segmentContourAction.d.ts +18 -0
- package/dist/types/utilities/segmentation/segmentContourAction.d.ts.map +1 -0
- package/dist/types/utilities/segmentation/triggerSegmentationRender.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 +3 -3
- package/src/eventDispatchers/keyboardEventHandlers/keyDown.ts +7 -1
- package/src/eventListeners/segmentation/imageChangeEventListener.ts +42 -6
- package/src/stateManagement/annotation/annotationState.ts +3 -0
- 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/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 +10 -6
- 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/labelmapDisplay.ts +16 -2
- package/src/tools/segmentation/BrushTool.ts +11 -7
- package/src/tools/segmentation/strategies/fillCircle.ts +4 -7
- package/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +1 -1
- package/src/types/LabelmapTypes.ts +2 -5
- package/src/types/index.ts +2 -0
- package/src/utilities/contours/AnnotationToPointData.ts +61 -0
- package/src/utilities/contours/RectangleROIStartEndThreshold.ts +60 -0
- package/src/utilities/contours/contourFinder.ts +78 -0
- package/src/utilities/contours/detectContourHoles.ts +147 -0
- package/src/utilities/contours/generateContourSetsFromLabelmap.ts +160 -0
- package/src/utilities/contours/index.ts +14 -0
- package/src/utilities/contours/mergePoints.ts +108 -0
- package/src/utilities/index.ts +6 -1
- package/src/utilities/segmentation/contourAndFindLargestBidirectional.ts +46 -0
- package/src/utilities/segmentation/createBidirectionalToolData.ts +68 -0
- package/src/utilities/segmentation/createImageIdReferenceMap.ts +23 -0
- package/src/utilities/segmentation/findLargestBidirectional.ts +159 -0
- package/src/utilities/segmentation/index.ts +8 -0
- package/src/utilities/segmentation/isLineInSegment.ts +84 -0
- package/src/utilities/segmentation/segmentContourAction.ts +169 -0
- package/src/utilities/segmentation/thresholdSegmentationByRange.ts +2 -2
- package/src/utilities/segmentation/triggerSegmentationRender.ts +15 -10
- package/src/utilities/stackPrefetch/stackContextPrefetch.ts +1 -1
- package/src/utilities/stackPrefetch/stackPrefetchUtils.ts +5 -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/roundNumber.js +0 -28
- package/dist/esm/utilities/roundNumber.js.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.42.1",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
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.42.1",
|
|
33
33
|
"comlink": "^4.4.1",
|
|
34
34
|
"lodash.clonedeep": "4.5.0",
|
|
35
35
|
"lodash.get": "^4.4.2"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"type": "individual",
|
|
54
54
|
"url": "https://ohif.org/donate"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "14a1bff3ba983b6664529e8e829a655cc4ffda89"
|
|
57
57
|
}
|
|
@@ -34,7 +34,13 @@ export default function keyDown(evt: KeyDownEventType): void {
|
|
|
34
34
|
if (activeToolsWithEventBinding?.size) {
|
|
35
35
|
const { element } = evt.detail;
|
|
36
36
|
for (const [key, value] of [...activeToolsWithEventBinding.entries()]) {
|
|
37
|
-
|
|
37
|
+
// Calls the method that implements the action, which can be a string
|
|
38
|
+
// in which case it belongs to the tool instance, or a function
|
|
39
|
+
// Call it on the tool instance, with the element and configuration value
|
|
40
|
+
// so that the method can depend on the specific configuration in use.
|
|
41
|
+
const method =
|
|
42
|
+
typeof value.method === 'function' ? value.method : key[value.method];
|
|
43
|
+
method.call(key, element, value);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
}
|
|
@@ -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);
|
|
@@ -126,6 +126,9 @@ function getNumberOfAnnotations(
|
|
|
126
126
|
* @param annotationUID - The unique identifier for the annotation.
|
|
127
127
|
*/
|
|
128
128
|
function removeAnnotation(annotationUID: string): void {
|
|
129
|
+
if (!annotationUID) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
129
132
|
const manager = getAnnotationManager();
|
|
130
133
|
const annotation = manager.getAnnotation(annotationUID);
|
|
131
134
|
|
|
@@ -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
|
};
|
|
@@ -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 {
|
|
@@ -1348,19 +1348,23 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
|
|
1350
1350
|
function defaultGetTextLines(data, targetId): string[] {
|
|
1351
|
-
const { cachedStats } = data;
|
|
1351
|
+
const { cachedStats, label } = data;
|
|
1352
1352
|
const { length, width, unit } = cachedStats[targetId];
|
|
1353
1353
|
|
|
1354
|
+
const textLines = [];
|
|
1355
|
+
if (label) {
|
|
1356
|
+
textLines.push(label);
|
|
1357
|
+
}
|
|
1354
1358
|
if (length === undefined) {
|
|
1355
|
-
return;
|
|
1359
|
+
return textLines;
|
|
1356
1360
|
}
|
|
1357
1361
|
|
|
1358
1362
|
// spaceBetweenSlices & pixelSpacing &
|
|
1359
1363
|
// magnitude in each direction? Otherwise, this is "px"?
|
|
1360
|
-
|
|
1364
|
+
textLines.push(
|
|
1361
1365
|
`L: ${roundNumber(length)} ${unit}`,
|
|
1362
|
-
`W: ${roundNumber(width)} ${unit}
|
|
1363
|
-
|
|
1366
|
+
`W: ${roundNumber(width)} ${unit}`
|
|
1367
|
+
);
|
|
1364
1368
|
|
|
1365
1369
|
return textLines;
|
|
1366
1370
|
}
|
|
@@ -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,12 +4,13 @@ import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransf
|
|
|
4
4
|
import {
|
|
5
5
|
cache,
|
|
6
6
|
getEnabledElementByIds,
|
|
7
|
+
StackViewport,
|
|
7
8
|
Types,
|
|
8
9
|
utilities,
|
|
10
|
+
VolumeViewport,
|
|
9
11
|
} from '@cornerstonejs/core';
|
|
10
12
|
|
|
11
13
|
import Representations from '../../../enums/SegmentationRepresentations';
|
|
12
|
-
import * as SegmentationConfig from '../../../stateManagement/segmentation/config/segmentationConfig';
|
|
13
14
|
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
14
15
|
import { getToolGroup } from '../../../store/ToolGroupManager';
|
|
15
16
|
import type {
|
|
@@ -18,7 +19,6 @@ import type {
|
|
|
18
19
|
LabelmapSegmentationData,
|
|
19
20
|
} from '../../../types/LabelmapTypes';
|
|
20
21
|
import {
|
|
21
|
-
RepresentationPublicInput,
|
|
22
22
|
SegmentationRepresentationConfig,
|
|
23
23
|
ToolGroupSpecificRepresentation,
|
|
24
24
|
} from '../../../types/SegmentationStateTypes';
|
|
@@ -131,11 +131,21 @@ async function render(
|
|
|
131
131
|
} = representation;
|
|
132
132
|
|
|
133
133
|
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
134
|
+
|
|
135
|
+
if (!segmentation) {
|
|
136
|
+
console.warn('No segmentation found for segmentationId: ', segmentationId);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
const labelmapData =
|
|
135
141
|
segmentation.representationData[Representations.Labelmap];
|
|
136
142
|
|
|
137
143
|
let actorEntry = viewport.getActor(segmentationRepresentationUID);
|
|
138
144
|
if (isVolumeSegmentation(labelmapData)) {
|
|
145
|
+
if (viewport instanceof StackViewport) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
139
149
|
const { volumeId: labelmapUID } = labelmapData;
|
|
140
150
|
|
|
141
151
|
const labelmap = cache.getVolume(labelmapUID);
|
|
@@ -159,6 +169,10 @@ async function render(
|
|
|
159
169
|
|
|
160
170
|
actorEntry = viewport.getActor(segmentationRepresentationUID);
|
|
161
171
|
} else {
|
|
172
|
+
if (viewport instanceof VolumeViewport) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
162
176
|
// stack segmentation
|
|
163
177
|
const imageId = viewport.getCurrentImageId();
|
|
164
178
|
const { imageIdReferenceMap } = labelmapData;
|