@cornerstonejs/tools 1.43.7 → 1.44.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/index.d.ts +2 -2
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.d.ts +3 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +7 -2
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.d.ts +2 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js +23 -9
- package/dist/cjs/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +14 -1
- package/dist/cjs/stateManagement/segmentation/helpers/normalizeSegmentationInput.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +4 -3
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js +4 -3
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +4 -4
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +4 -3
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.js +4 -3
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +4 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +4 -3
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/KeyImageTool.js +4 -1
- package/dist/cjs/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +4 -4
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.d.ts +6 -0
- package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js +14 -0
- package/dist/cjs/tools/annotation/LivewireContourSegmentationTool.js.map +1 -0
- package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +14 -5
- package/dist/cjs/tools/annotation/LivewireContourTool.js +126 -159
- package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +8 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +24 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -0
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +16 -6
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +104 -134
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +4 -3
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineContourSegmentationTool.d.ts +8 -0
- package/dist/cjs/tools/annotation/SplineContourSegmentationTool.js +23 -0
- package/dist/cjs/tools/annotation/SplineContourSegmentationTool.js.map +1 -0
- package/dist/cjs/tools/annotation/SplineROITool.d.ts +15 -8
- package/dist/cjs/tools/annotation/SplineROITool.js +168 -240
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +5 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +4 -4
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.js +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +7 -7
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js +19 -15
- package/dist/cjs/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +15 -0
- package/dist/cjs/tools/base/AnnotationTool.js +24 -0
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourBaseTool.d.ts +19 -0
- package/dist/cjs/tools/base/ContourBaseTool.js +130 -0
- package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -0
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +18 -0
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +139 -0
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -0
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +1 -0
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +4 -1
- package/dist/cjs/tools/index.js +7 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/types/ContourAnnotation.d.ts +11 -0
- package/dist/cjs/types/ContourAnnotation.js +3 -0
- package/dist/cjs/types/ContourAnnotation.js.map +1 -0
- package/dist/cjs/types/ContourSegmentationAnnotation.d.ts +11 -0
- package/dist/cjs/types/ContourSegmentationAnnotation.js +3 -0
- package/dist/cjs/types/ContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/types/ContourTypes.d.ts +4 -1
- package/dist/cjs/types/SegmentationStateTypes.d.ts +1 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +11 -52
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/utilities/math/vec2/liangBarksyClip.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +7 -2
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +20 -7
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js +13 -1
- package/dist/esm/stateManagement/segmentation/helpers/normalizeSegmentationInput.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +4 -3
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +4 -3
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +4 -4
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +4 -3
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.js +4 -3
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +4 -1
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +4 -3
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +4 -1
- package/dist/esm/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +4 -4
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js +9 -0
- package/dist/esm/tools/annotation/LivewireContourSegmentationTool.js.map +1 -0
- package/dist/esm/tools/annotation/LivewireContourTool.js +123 -160
- package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +19 -0
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -0
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +104 -134
- 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 +4 -3
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.js +18 -0
- package/dist/esm/tools/annotation/SplineContourSegmentationTool.js.map +1 -0
- package/dist/esm/tools/annotation/SplineROITool.js +153 -227
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +5 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +4 -4
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +7 -7
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEndEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js +19 -15
- package/dist/esm/tools/annotation/planarFreehandROITool/renderMethods.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.js +24 -0
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js +122 -0
- package/dist/esm/tools/base/ContourBaseTool.js.map +1 -0
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +131 -0
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -0
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +1 -0
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/index.js +4 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/types/ContourAnnotation.js +2 -0
- package/dist/esm/types/ContourAnnotation.js.map +1 -0
- package/dist/esm/types/ContourSegmentationAnnotation.js +2 -0
- package/dist/esm/types/ContourSegmentationAnnotation.js.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts +3 -1
- package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/config/segmentationVisibility.d.ts +2 -1
- package/dist/types/stateManagement/segmentation/config/segmentationVisibility.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/helpers/normalizeSegmentationInput.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ArrowAnnotateTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CircleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CobbAngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/DragProbeTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/KeyImageTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LengthTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LivewireContourSegmentationTool.d.ts +7 -0
- package/dist/types/tools/annotation/LivewireContourSegmentationTool.d.ts.map +1 -0
- package/dist/types/tools/annotation/LivewireContourTool.d.ts +14 -5
- package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +9 -0
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -0
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts +16 -6
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/RectangleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineContourSegmentationTool.d.ts +9 -0
- package/dist/types/tools/annotation/SplineContourSegmentationTool.d.ts.map +1 -0
- package/dist/types/tools/annotation/SplineROITool.d.ts +15 -8
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/openContourEndEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/renderMethods.d.ts.map +1 -1
- package/dist/types/tools/base/AnnotationTool.d.ts +15 -0
- package/dist/types/tools/base/AnnotationTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourBaseTool.d.ts +20 -0
- package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -0
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +19 -0
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -0
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
- package/dist/types/tools/index.d.ts +4 -1
- package/dist/types/tools/index.d.ts.map +1 -1
- package/dist/types/types/ContourAnnotation.d.ts +12 -0
- package/dist/types/types/ContourAnnotation.d.ts.map +1 -0
- package/dist/types/types/ContourSegmentationAnnotation.d.ts +12 -0
- package/dist/types/types/ContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/types/ContourTypes.d.ts +4 -1
- package/dist/types/types/ContourTypes.d.ts.map +1 -1
- package/dist/types/types/SegmentationStateTypes.d.ts +1 -1
- package/dist/types/types/SegmentationStateTypes.d.ts.map +1 -1
- package/dist/types/types/ToolSpecificAnnotationTypes.d.ts +11 -52
- package/dist/types/types/ToolSpecificAnnotationTypes.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +3 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/math/vec2/liangBarksyClip.d.ts +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +11 -2
- package/src/stateManagement/segmentation/config/segmentationVisibility.ts +52 -6
- package/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts +27 -1
- package/src/tools/annotation/AngleTool.ts +4 -3
- package/src/tools/annotation/ArrowAnnotateTool.ts +4 -3
- package/src/tools/annotation/BidirectionalTool.ts +4 -4
- package/src/tools/annotation/CircleROITool.ts +4 -3
- package/src/tools/annotation/CobbAngleTool.ts +4 -3
- package/src/tools/annotation/DragProbeTool.ts +4 -1
- package/src/tools/annotation/EllipticalROITool.ts +4 -3
- package/src/tools/annotation/KeyImageTool.ts +4 -1
- package/src/tools/annotation/LengthTool.ts +4 -5
- package/src/tools/annotation/LivewireContourSegmentationTool.ts +13 -0
- package/src/tools/annotation/LivewireContourTool.ts +75 -150
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +30 -0
- package/src/tools/annotation/PlanarFreehandROITool.ts +153 -187
- package/src/tools/annotation/ProbeTool.ts +1 -1
- package/src/tools/annotation/RectangleROITool.ts +4 -3
- package/src/tools/annotation/SplineContourSegmentationTool.ts +28 -0
- package/src/tools/annotation/SplineROITool.ts +172 -282
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +7 -5
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +4 -4
- package/src/tools/annotation/planarFreehandROITool/findOpenUShapedContourVectorToPeak.ts +3 -1
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +12 -9
- package/src/tools/annotation/planarFreehandROITool/openContourEndEditLoop.ts +5 -2
- package/src/tools/annotation/planarFreehandROITool/renderMethods.ts +19 -14
- package/src/tools/base/AnnotationTool.ts +35 -0
- package/src/tools/base/ContourBaseTool.ts +226 -0
- package/src/tools/base/ContourSegmentationBaseTool.ts +276 -0
- package/src/tools/displayTools/Contour/contourDisplay.ts +1 -0
- package/src/tools/index.ts +6 -0
- package/src/types/ContourAnnotation.ts +13 -0
- package/src/types/ContourSegmentationAnnotation.ts +14 -0
- package/src/types/ContourTypes.ts +8 -1
- package/src/types/SegmentationStateTypes.ts +1 -1
- package/src/types/ToolSpecificAnnotationTypes.ts +17 -53
- package/src/types/index.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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.44.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": "0cc7cbccd489e63dbea1a855fbb72d87792b6f89"
|
|
57
57
|
}
|
package/src/index.ts
CHANGED
|
@@ -40,9 +40,12 @@ import {
|
|
|
40
40
|
EllipticalROITool,
|
|
41
41
|
CircleROITool,
|
|
42
42
|
SplineROITool,
|
|
43
|
+
SplineContourSegmentationTool,
|
|
43
44
|
BidirectionalTool,
|
|
44
45
|
PlanarFreehandROITool,
|
|
46
|
+
PlanarFreehandContourSegmentationTool,
|
|
45
47
|
LivewireContourTool,
|
|
48
|
+
LivewireContourSegmentationTool,
|
|
46
49
|
ArrowAnnotateTool,
|
|
47
50
|
KeyImageTool,
|
|
48
51
|
CrosshairsTool,
|
|
@@ -107,9 +110,12 @@ export {
|
|
|
107
110
|
EllipticalROITool,
|
|
108
111
|
CircleROITool,
|
|
109
112
|
SplineROITool,
|
|
113
|
+
SplineContourSegmentationTool,
|
|
110
114
|
BidirectionalTool,
|
|
111
115
|
PlanarFreehandROITool,
|
|
116
|
+
PlanarFreehandContourSegmentationTool,
|
|
112
117
|
LivewireContourTool,
|
|
118
|
+
LivewireContourSegmentationTool,
|
|
113
119
|
ArrowAnnotateTool,
|
|
114
120
|
AngleTool,
|
|
115
121
|
CobbAngleTool,
|
|
@@ -382,7 +382,10 @@ export default class SegmentationStateManager {
|
|
|
382
382
|
setSegmentSpecificConfig(
|
|
383
383
|
toolGroupId: string,
|
|
384
384
|
segmentationRepresentationUID: string,
|
|
385
|
-
config: SegmentSpecificRepresentationConfig
|
|
385
|
+
config: SegmentSpecificRepresentationConfig,
|
|
386
|
+
options?: {
|
|
387
|
+
clear: false;
|
|
388
|
+
}
|
|
386
389
|
): void {
|
|
387
390
|
const segmentationRepresentation = this.getSegmentationRepresentationByUID(
|
|
388
391
|
toolGroupId,
|
|
@@ -393,7 +396,13 @@ export default class SegmentationStateManager {
|
|
|
393
396
|
return;
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
segmentationRepresentation.segmentSpecificConfig
|
|
399
|
+
if (!segmentationRepresentation.segmentSpecificConfig || options?.clear) {
|
|
400
|
+
segmentationRepresentation.segmentSpecificConfig = {};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
Object.keys(config).forEach((key) => {
|
|
404
|
+
segmentationRepresentation.segmentSpecificConfig[key] = config[key];
|
|
405
|
+
});
|
|
397
406
|
}
|
|
398
407
|
|
|
399
408
|
/**
|
|
@@ -5,7 +5,7 @@ import { ToolGroupSpecificRepresentation } from '../../../types/SegmentationStat
|
|
|
5
5
|
import { triggerSegmentationRepresentationModified } from '../triggerSegmentationEvents';
|
|
6
6
|
import SegmentationRepresentations from '../../../enums/SegmentationRepresentations';
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function getUniqueSegmentIndices(segmentationId) {
|
|
9
9
|
const segmentation = SegmentationState.getSegmentation(segmentationId);
|
|
10
10
|
|
|
11
11
|
if (segmentation.type === SegmentationRepresentations.Labelmap) {
|
|
@@ -21,6 +21,10 @@ function getSegmentationIndices(segmentationId) {
|
|
|
21
21
|
}
|
|
22
22
|
return Object.keys(keySet).map((it) => parseInt(it, 10));
|
|
23
23
|
} else if (segmentation.type === SegmentationRepresentations.Contour) {
|
|
24
|
+
const annotationUIDsMap =
|
|
25
|
+
segmentation.representationData.CONTOUR?.annotationUIDsMap;
|
|
26
|
+
|
|
27
|
+
const indices = new Set(annotationUIDsMap.keys());
|
|
24
28
|
const geometryIds = segmentation.representationData.CONTOUR?.geometryIds;
|
|
25
29
|
|
|
26
30
|
if (!geometryIds) {
|
|
@@ -29,10 +33,12 @@ function getSegmentationIndices(segmentationId) {
|
|
|
29
33
|
);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
geometryIds.forEach((geometryId) => {
|
|
33
37
|
const geometry = cache.getGeometry(geometryId) as Types.IGeometry;
|
|
34
|
-
|
|
38
|
+
indices.add((geometry.data as Types.IContourSet).getSegmentIndex());
|
|
35
39
|
});
|
|
40
|
+
|
|
41
|
+
return Array.from(indices.values()).sort();
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -70,7 +76,7 @@ function setSegmentationVisibility(
|
|
|
70
76
|
|
|
71
77
|
const { segmentsHidden, segmentationId } = representation;
|
|
72
78
|
|
|
73
|
-
const indices =
|
|
79
|
+
const indices = getUniqueSegmentIndices(segmentationId);
|
|
74
80
|
|
|
75
81
|
// if visibility is set to be true, we need to remove all the segments
|
|
76
82
|
// from the segmentsHidden set, otherwise we need to add all the segments
|
|
@@ -115,9 +121,17 @@ function getSegmentationVisibility(
|
|
|
115
121
|
return;
|
|
116
122
|
}
|
|
117
123
|
|
|
118
|
-
const { segmentsHidden } = representation;
|
|
124
|
+
const { segmentsHidden, segmentationId } = representation;
|
|
125
|
+
const indices = getUniqueSegmentIndices(segmentationId);
|
|
126
|
+
|
|
127
|
+
// Create a set that contains all segments indices
|
|
128
|
+
const indicesSet = new Set(indices);
|
|
129
|
+
|
|
130
|
+
// Remove a indices that are hidden
|
|
131
|
+
segmentsHidden.forEach((segmentIndex) => indicesSet.delete(segmentIndex));
|
|
119
132
|
|
|
120
|
-
|
|
133
|
+
// Check if there is at least one segment visible
|
|
134
|
+
return !!indicesSet.size;
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
/**
|
|
@@ -160,6 +174,13 @@ function setSegmentsVisibility(
|
|
|
160
174
|
);
|
|
161
175
|
}
|
|
162
176
|
|
|
177
|
+
/**
|
|
178
|
+
* @param toolGroupId - The Id of the tool group that contains the segmentation
|
|
179
|
+
* @param segmentationRepresentationUID - The id of the segmentation representation that contains the segment
|
|
180
|
+
* @param segmentIndex - Index of the segment that will be updated
|
|
181
|
+
* @param visibility - True to show the segment or false to hide it
|
|
182
|
+
* @returns True if the segment is visible or false otherwise
|
|
183
|
+
*/
|
|
163
184
|
function setSegmentVisibility(
|
|
164
185
|
toolGroupId: string,
|
|
165
186
|
segmentationRepresentationUID: string,
|
|
@@ -186,9 +207,34 @@ function setSegmentVisibility(
|
|
|
186
207
|
);
|
|
187
208
|
}
|
|
188
209
|
|
|
210
|
+
/**
|
|
211
|
+
* @param toolGroupId - The Id of the tool group that contains the segmentation.
|
|
212
|
+
* @param segmentationRepresentationUID - The id of the segmentation representation to modify its visibility.
|
|
213
|
+
* @param segmentIndex - Index of the segment
|
|
214
|
+
* @returns True if the segment is visible or false otherwise
|
|
215
|
+
*/
|
|
216
|
+
function getSegmentVisibility(
|
|
217
|
+
toolGroupId: string,
|
|
218
|
+
segmentationRepresentationUID: string,
|
|
219
|
+
segmentIndex: number
|
|
220
|
+
): boolean {
|
|
221
|
+
const segRepresentation =
|
|
222
|
+
SegmentationState.getSegmentationRepresentationByUID(
|
|
223
|
+
toolGroupId,
|
|
224
|
+
segmentationRepresentationUID
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
if (!segRepresentation) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return !segRepresentation.segmentsHidden.has(segmentIndex);
|
|
232
|
+
}
|
|
233
|
+
|
|
189
234
|
export {
|
|
190
235
|
setSegmentationVisibility,
|
|
191
236
|
getSegmentationVisibility,
|
|
192
237
|
setSegmentVisibility,
|
|
193
238
|
setSegmentsVisibility,
|
|
239
|
+
getSegmentVisibility,
|
|
194
240
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { SegmentationRepresentations } from '../../../enums';
|
|
1
2
|
import {
|
|
2
3
|
SegmentationPublicInput,
|
|
3
4
|
Segmentation,
|
|
4
5
|
} from '../../../types/SegmentationStateTypes';
|
|
6
|
+
import type { ContourSegmentationData } from '../../../types/ContourTypes';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* It takes in a segmentation input and returns a segmentation with default values
|
|
@@ -13,6 +15,30 @@ function normalizeSegmentationInput(
|
|
|
13
15
|
segmentationInput: SegmentationPublicInput
|
|
14
16
|
): Segmentation {
|
|
15
17
|
const { segmentationId, representation } = segmentationInput;
|
|
18
|
+
const isContourRepresentation =
|
|
19
|
+
representation.type === SegmentationRepresentations.Contour;
|
|
20
|
+
let data = representation.data ? { ...representation.data } : null;
|
|
21
|
+
|
|
22
|
+
// Contour representation data is defined internally
|
|
23
|
+
data = !data && isContourRepresentation ? {} : data;
|
|
24
|
+
|
|
25
|
+
// Data cannot be undefined for labelmap and surface
|
|
26
|
+
if (!data) {
|
|
27
|
+
throw new Error('Segmentation representation data may not be undefined');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (isContourRepresentation) {
|
|
31
|
+
const contourData = <ContourSegmentationData>data;
|
|
32
|
+
|
|
33
|
+
// geometryIds will be removed in a near future. It still exist in the
|
|
34
|
+
// code for compatibility only but it is optional from now on.
|
|
35
|
+
contourData.geometryIds = contourData.geometryIds ?? [];
|
|
36
|
+
|
|
37
|
+
// Make sure annotationUIDsMap is defined because an empty contour is
|
|
38
|
+
// created before adding contour annotations to the map. Also it prevents
|
|
39
|
+
// breaking legacy code after moving from geometryIds to annotationUIDsMap.
|
|
40
|
+
contourData.annotationUIDsMap = contourData.annotationUIDsMap ?? new Map();
|
|
41
|
+
}
|
|
16
42
|
|
|
17
43
|
// Todo: we should be able to let the user pass in non-default values for
|
|
18
44
|
// cachedStats, label, activeSegmentIndex, etc.
|
|
@@ -26,7 +52,7 @@ function normalizeSegmentationInput(
|
|
|
26
52
|
activeSegmentIndex: 1,
|
|
27
53
|
representationData: {
|
|
28
54
|
[representation.type]: {
|
|
29
|
-
...
|
|
55
|
+
...data,
|
|
30
56
|
},
|
|
31
57
|
},
|
|
32
58
|
};
|
|
@@ -649,9 +649,10 @@ class AngleTool extends AnnotationTool {
|
|
|
649
649
|
|
|
650
650
|
styleSpecifier.annotationUID = annotationUID;
|
|
651
651
|
|
|
652
|
-
const lineWidth = this.
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
const { color, lineWidth, lineDash } = this.getAnnotationStyle({
|
|
653
|
+
annotation,
|
|
654
|
+
styleSpecifier,
|
|
655
|
+
});
|
|
655
656
|
|
|
656
657
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
657
658
|
|
|
@@ -703,9 +703,10 @@ class ArrowAnnotateTool extends AnnotationTool {
|
|
|
703
703
|
|
|
704
704
|
styleSpecifier.annotationUID = annotationUID;
|
|
705
705
|
|
|
706
|
-
const lineWidth = this.
|
|
707
|
-
|
|
708
|
-
|
|
706
|
+
const { color, lineWidth, lineDash } = this.getAnnotationStyle({
|
|
707
|
+
annotation,
|
|
708
|
+
styleSpecifier,
|
|
709
|
+
});
|
|
709
710
|
|
|
710
711
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
711
712
|
|
|
@@ -1064,10 +1064,10 @@ class BidirectionalTool extends AnnotationTool {
|
|
|
1064
1064
|
|
|
1065
1065
|
styleSpecifier.annotationUID = annotationUID;
|
|
1066
1066
|
|
|
1067
|
-
const lineWidth = this.
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1067
|
+
const { color, lineWidth, lineDash, shadow } = this.getAnnotationStyle({
|
|
1068
|
+
annotation,
|
|
1069
|
+
styleSpecifier,
|
|
1070
|
+
});
|
|
1071
1071
|
|
|
1072
1072
|
// If cachedStats does not exist, or the unit is missing (as part of import/hydration etc.),
|
|
1073
1073
|
// force to recalculate the stats from the points
|
|
@@ -659,9 +659,10 @@ class CircleROITool extends AnnotationTool {
|
|
|
659
659
|
|
|
660
660
|
styleSpecifier.annotationUID = annotationUID;
|
|
661
661
|
|
|
662
|
-
const lineWidth = this.
|
|
663
|
-
|
|
664
|
-
|
|
662
|
+
const { color, lineWidth, lineDash } = this.getAnnotationStyle({
|
|
663
|
+
annotation,
|
|
664
|
+
styleSpecifier,
|
|
665
|
+
});
|
|
665
666
|
|
|
666
667
|
const canvasCoordinates = points.map((p) =>
|
|
667
668
|
viewport.worldToCanvas(p)
|
|
@@ -673,9 +673,10 @@ class CobbAngleTool extends AnnotationTool {
|
|
|
673
673
|
|
|
674
674
|
styleSpecifier.annotationUID = annotationUID;
|
|
675
675
|
|
|
676
|
-
const lineWidth = this.
|
|
677
|
-
|
|
678
|
-
|
|
676
|
+
const { color, lineWidth, lineDash } = this.getAnnotationStyle({
|
|
677
|
+
annotation,
|
|
678
|
+
styleSpecifier,
|
|
679
|
+
});
|
|
679
680
|
|
|
680
681
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
681
682
|
|
|
@@ -154,7 +154,10 @@ class DragProbeTool extends ProbeTool {
|
|
|
154
154
|
|
|
155
155
|
styleSpecifier.annotationUID = annotationUID;
|
|
156
156
|
|
|
157
|
-
const color = this.
|
|
157
|
+
const { color } = this.getAnnotationStyle({
|
|
158
|
+
annotation,
|
|
159
|
+
styleSpecifier,
|
|
160
|
+
});
|
|
158
161
|
|
|
159
162
|
const modalityUnitOptions = {
|
|
160
163
|
isPreScaled: isViewportPreScaled(viewport, targetId),
|
|
@@ -774,9 +774,10 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
774
774
|
|
|
775
775
|
styleSpecifier.annotationUID = annotationUID;
|
|
776
776
|
|
|
777
|
-
const lineWidth = this.
|
|
778
|
-
|
|
779
|
-
|
|
777
|
+
const { color, lineWidth, lineDash } = this.getAnnotationStyle({
|
|
778
|
+
annotation,
|
|
779
|
+
styleSpecifier,
|
|
780
|
+
});
|
|
780
781
|
|
|
781
782
|
const canvasCoordinates = points.map((p) =>
|
|
782
783
|
viewport.worldToCanvas(p)
|
|
@@ -384,7 +384,10 @@ class KeyImageTool extends AnnotationTool {
|
|
|
384
384
|
|
|
385
385
|
styleSpecifier.annotationUID = annotationUID;
|
|
386
386
|
|
|
387
|
-
const color = this.
|
|
387
|
+
const { color } = this.getAnnotationStyle({
|
|
388
|
+
annotation,
|
|
389
|
+
styleSpecifier,
|
|
390
|
+
});
|
|
388
391
|
|
|
389
392
|
const { canvasPosition, canvasSize } = this.configuration;
|
|
390
393
|
if (canvasPosition?.length) {
|
|
@@ -645,11 +645,10 @@ class LengthTool extends AnnotationTool {
|
|
|
645
645
|
|
|
646
646
|
styleSpecifier.annotationUID = annotationUID;
|
|
647
647
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
const shadow = this.getStyle('shadow', styleSpecifier, annotation);
|
|
648
|
+
const { color, lineWidth, lineDash, shadow } = this.getAnnotationStyle({
|
|
649
|
+
annotation,
|
|
650
|
+
styleSpecifier,
|
|
651
|
+
});
|
|
653
652
|
|
|
654
653
|
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p));
|
|
655
654
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import LivewireContourTool from './LivewireContourTool';
|
|
2
|
+
|
|
3
|
+
class LivewireContourSegmentationTool extends LivewireContourTool {
|
|
4
|
+
static toolName;
|
|
5
|
+
|
|
6
|
+
protected isContourSegmentationTool(): boolean {
|
|
7
|
+
// Re-enable contour segmentation behavior disabled by LivewireContourTool
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
LivewireContourSegmentationTool.toolName = 'LivewireContourSegmentationTool';
|
|
13
|
+
export default LivewireContourSegmentationTool;
|