@cornerstonejs/tools 1.35.2 → 1.36.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/drawingSvg/drawEllipse.js +6 -42
- package/dist/cjs/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/cjs/drawingSvg/drawEllipseByCoordinates.d.ts +4 -0
- package/dist/cjs/drawingSvg/drawEllipseByCoordinates.js +53 -0
- package/dist/cjs/drawingSvg/drawEllipseByCoordinates.js.map +1 -0
- package/dist/cjs/drawingSvg/index.d.ts +2 -1
- package/dist/cjs/drawingSvg/index.js +3 -1
- package/dist/cjs/drawingSvg/index.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js +3 -0
- package/dist/cjs/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.d.ts +5 -4
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js +6 -10
- package/dist/cjs/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.d.ts +3 -0
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js +87 -0
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js +2 -29
- package/dist/cjs/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/config/segmentationColor.d.ts +4 -5
- package/dist/cjs/stateManagement/segmentation/config/segmentationColor.js.map +1 -1
- package/dist/cjs/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.d.ts +2 -0
- package/dist/cjs/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.js +19 -0
- package/dist/cjs/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.js.map +1 -0
- package/dist/cjs/stateManagement/segmentation/segmentationState.d.ts +6 -4
- package/dist/cjs/stateManagement/segmentation/segmentationState.js +6 -1
- package/dist/cjs/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +2 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +2 -12
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.js +9 -34
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.d.ts +1 -3
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +0 -33
- package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.d.ts +9 -3
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js +13 -37
- package/dist/cjs/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.d.ts +1 -3
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js +0 -32
- package/dist/cjs/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/cjs/types/SegmentationStateTypes.d.ts +5 -3
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/esm/drawingSvg/drawEllipse.js +6 -42
- package/dist/esm/drawingSvg/drawEllipse.js.map +1 -1
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.js +48 -0
- package/dist/esm/drawingSvg/drawEllipseByCoordinates.js.map +1 -0
- package/dist/esm/drawingSvg/index.js +2 -1
- package/dist/esm/drawingSvg/index.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js +3 -0
- package/dist/esm/eventListeners/segmentation/imageChangeEventListener.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +6 -10
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +49 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +2 -24
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js.map +1 -1
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.js +12 -0
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.js.map +1 -0
- package/dist/esm/stateManagement/segmentation/segmentationState.js +5 -1
- package/dist/esm/stateManagement/segmentation/segmentationState.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +2 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +3 -13
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +2 -4
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +1 -34
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +6 -33
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js.map +1 -1
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +1 -33
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js.map +1 -1
- package/dist/types/drawingSvg/drawEllipse.d.ts.map +1 -1
- package/dist/types/drawingSvg/drawEllipseByCoordinates.d.ts +5 -0
- package/dist/types/drawingSvg/drawEllipseByCoordinates.d.ts.map +1 -0
- package/dist/types/drawingSvg/index.d.ts +2 -1
- package/dist/types/drawingSvg/index.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/imageChangeEventListener.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts +5 -4
- package/dist/types/stateManagement/segmentation/SegmentationStateManager.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/addSegmentationRepresentation.d.ts +4 -0
- package/dist/types/stateManagement/segmentation/addSegmentationRepresentation.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/addSegmentationRepresentations.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/config/segmentationColor.d.ts +4 -5
- package/dist/types/stateManagement/segmentation/config/segmentationColor.d.ts.map +1 -1
- package/dist/types/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.d.ts +3 -0
- package/dist/types/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.d.ts.map +1 -0
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts +6 -4
- package/dist/types/stateManagement/segmentation/segmentationState.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts +1 -3
- package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts +9 -3
- package/dist/types/tools/displayTools/Labelmap/labelmapDisplay.d.ts.map +1 -1
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts +1 -3
- package/dist/types/tools/displayTools/Surface/surfaceDisplay.d.ts.map +1 -1
- package/dist/types/types/SegmentationStateTypes.d.ts +5 -3
- package/dist/types/types/SegmentationStateTypes.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/types/index.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/drawingSvg/drawEllipse.ts +15 -55
- package/src/drawingSvg/drawEllipseByCoordinates.ts +73 -0
- package/src/drawingSvg/index.ts +2 -0
- package/src/eventListeners/segmentation/imageChangeEventListener.ts +5 -0
- package/src/stateManagement/segmentation/SegmentationStateManager.ts +10 -17
- package/src/stateManagement/segmentation/addSegmentationRepresentation.ts +86 -0
- package/src/stateManagement/segmentation/addSegmentationRepresentations.ts +2 -43
- package/src/stateManagement/segmentation/config/segmentationColor.ts +4 -6
- package/src/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.ts +15 -0
- package/src/stateManagement/segmentation/segmentationState.ts +9 -3
- package/src/store/ToolGroupManager/ToolGroup.ts +4 -6
- package/src/tools/annotation/EllipticalROITool.ts +5 -15
- package/src/tools/annotation/SplineROITool.ts +3 -3
- package/src/tools/displayTools/Contour/contourDisplay.ts +0 -61
- package/src/tools/displayTools/Labelmap/labelmapDisplay.ts +11 -66
- package/src/tools/displayTools/Surface/surfaceDisplay.ts +0 -60
- package/src/types/SegmentationStateTypes.ts +7 -12
- package/src/types/index.ts +0 -4
|
@@ -3,49 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const setAttributesIfNecessary_1 = __importDefault(require("./setAttributesIfNecessary"));
|
|
8
|
-
const setNewAttributesIfValid_1 = __importDefault(require("./setNewAttributesIfValid"));
|
|
6
|
+
const drawEllipseByCoordinates_1 = __importDefault(require("./drawEllipseByCoordinates"));
|
|
9
7
|
function drawEllipse(svgDrawingHelper, annotationUID, ellipseUID, corner1, corner2, options = {}, dataId = '') {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, options);
|
|
16
|
-
const strokeWidth = lineWidth || width;
|
|
17
|
-
const svgns = 'http://www.w3.org/2000/svg';
|
|
18
|
-
const svgNodeHash = (0, _getHash_1.default)(annotationUID, 'ellipse', ellipseUID);
|
|
19
|
-
const existingEllipse = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
20
|
-
const w = Math.abs(corner1[0] - corner2[0]);
|
|
21
|
-
const h = Math.abs(corner1[1] - corner2[1]);
|
|
22
|
-
const xMin = Math.min(corner1[0], corner2[0]);
|
|
23
|
-
const yMin = Math.min(corner1[1], corner2[1]);
|
|
24
|
-
const center = [xMin + w / 2, yMin + h / 2];
|
|
25
|
-
const radiusX = w / 2;
|
|
26
|
-
const radiusY = h / 2;
|
|
27
|
-
const attributes = {
|
|
28
|
-
cx: `${center[0]}`,
|
|
29
|
-
cy: `${center[1]}`,
|
|
30
|
-
rx: `${radiusX}`,
|
|
31
|
-
ry: `${radiusY}`,
|
|
32
|
-
stroke: color,
|
|
33
|
-
fill: 'transparent',
|
|
34
|
-
'stroke-width': strokeWidth,
|
|
35
|
-
'stroke-dasharray': lineDash,
|
|
36
|
-
};
|
|
37
|
-
if (existingEllipse) {
|
|
38
|
-
(0, setAttributesIfNecessary_1.default)(attributes, existingEllipse);
|
|
39
|
-
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const svgEllipseElement = document.createElementNS(svgns, 'ellipse');
|
|
43
|
-
if (dataId !== '') {
|
|
44
|
-
svgEllipseElement.setAttribute('data-id', dataId);
|
|
45
|
-
}
|
|
46
|
-
(0, setNewAttributesIfValid_1.default)(attributes, svgEllipseElement);
|
|
47
|
-
svgDrawingHelper.appendNode(svgEllipseElement, svgNodeHash);
|
|
48
|
-
}
|
|
8
|
+
const top = [(corner1[0] + corner2[0]) / 2, corner1[1]];
|
|
9
|
+
const bottom = [(corner1[0] + corner2[0]) / 2, corner2[1]];
|
|
10
|
+
const left = [corner1[0], (corner1[1] + corner2[1]) / 2];
|
|
11
|
+
const right = [corner2[0], (corner1[1] + corner2[1]) / 2];
|
|
12
|
+
(0, drawEllipseByCoordinates_1.default)(svgDrawingHelper, annotationUID, ellipseUID, [bottom, top, left, right], options = {}, dataId = '');
|
|
49
13
|
}
|
|
50
14
|
exports.default = drawEllipse;
|
|
51
15
|
//# sourceMappingURL=drawEllipse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawEllipse.js","sourceRoot":"","sources":["../../../src/drawingSvg/drawEllipse.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"drawEllipse.js","sourceRoot":"","sources":["../../../src/drawingSvg/drawEllipse.ts"],"names":[],"mappings":";;;;;AAIA,0FAAkE;AAElE,SAAS,WAAW,CAClB,gBAAkC,EAClC,aAAqB,EACrB,UAAkB,EAClB,OAAqB,EACrB,OAAqB,EACrB,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE;IAEX,MAAM,GAAG,GAAiB,CAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC;IACxE,MAAM,MAAM,GAAiB,CAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC;IAC3E,MAAM,IAAI,GAAiB,CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,MAAM,KAAK,GAAiB,CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzE,IAAA,kCAAwB,EACtB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAC1B,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE,CACZ,CAAA;AACH,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { SVGDrawingHelper } from '../types';
|
|
3
|
+
declare function drawEllipseByCoordinates(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, ellipseUID: string, canvasCoordinates: [Types.Point2, Types.Point2, Types.Point2, Types.Point2], options?: {}, dataId?: string): void;
|
|
4
|
+
export default drawEllipseByCoordinates;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
2;
|
|
7
|
+
const _getHash_1 = __importDefault(require("./_getHash"));
|
|
8
|
+
const setAttributesIfNecessary_1 = __importDefault(require("./setAttributesIfNecessary"));
|
|
9
|
+
const setNewAttributesIfValid_1 = __importDefault(require("./setNewAttributesIfValid"));
|
|
10
|
+
function drawEllipseByCoordinates(svgDrawingHelper, annotationUID, ellipseUID, canvasCoordinates, options = {}, dataId = '') {
|
|
11
|
+
const { color, width, lineWidth, lineDash } = Object.assign({
|
|
12
|
+
color: 'dodgerblue',
|
|
13
|
+
width: '2',
|
|
14
|
+
lineWidth: undefined,
|
|
15
|
+
lineDash: undefined,
|
|
16
|
+
}, options);
|
|
17
|
+
const strokeWidth = lineWidth || width;
|
|
18
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
19
|
+
const svgNodeHash = (0, _getHash_1.default)(annotationUID, 'ellipse', ellipseUID);
|
|
20
|
+
const existingEllipse = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
21
|
+
const [bottom, top, left, right] = canvasCoordinates;
|
|
22
|
+
const w = Math.hypot(left[0] - right[0], left[1] - right[1]);
|
|
23
|
+
const h = Math.hypot(top[0] - bottom[0], top[1] - bottom[1]);
|
|
24
|
+
const angle = Math.atan2(left[1] - right[1], left[0] - right[0]) * 180 / Math.PI;
|
|
25
|
+
const center = [(left[0] + right[0]) / 2, (top[1] + bottom[1]) / 2];
|
|
26
|
+
const radiusX = w / 2;
|
|
27
|
+
const radiusY = h / 2;
|
|
28
|
+
const attributes = {
|
|
29
|
+
cx: `${center[0]}`,
|
|
30
|
+
cy: `${center[1]}`,
|
|
31
|
+
rx: `${radiusX}`,
|
|
32
|
+
ry: `${radiusY}`,
|
|
33
|
+
stroke: color,
|
|
34
|
+
fill: 'transparent',
|
|
35
|
+
'transform': `rotate(${angle} ${center[0]} ${center[1]})`,
|
|
36
|
+
'stroke-width': strokeWidth,
|
|
37
|
+
'stroke-dasharray': lineDash,
|
|
38
|
+
};
|
|
39
|
+
if (existingEllipse) {
|
|
40
|
+
(0, setAttributesIfNecessary_1.default)(attributes, existingEllipse);
|
|
41
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const svgEllipseElement = document.createElementNS(svgns, 'ellipse');
|
|
45
|
+
if (dataId !== '') {
|
|
46
|
+
svgEllipseElement.setAttribute('data-id', dataId);
|
|
47
|
+
}
|
|
48
|
+
(0, setNewAttributesIfValid_1.default)(attributes, svgEllipseElement);
|
|
49
|
+
svgDrawingHelper.appendNode(svgEllipseElement, svgNodeHash);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = drawEllipseByCoordinates;
|
|
53
|
+
//# sourceMappingURL=drawEllipseByCoordinates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawEllipseByCoordinates.js","sourceRoot":"","sources":["../../../src/drawingSvg/drawEllipseByCoordinates.ts"],"names":[],"mappings":";;;;;AAAA,CAAC,CAAA;AAID,0DAAkC;AAClC,0FAAkE;AAClE,w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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import draw from './draw';
|
|
2
2
|
import drawCircle from './drawCircle';
|
|
3
3
|
import drawEllipse from './drawEllipse';
|
|
4
|
+
import drawEllipseByCoordinates from './drawEllipseByCoordinates';
|
|
4
5
|
import drawHandles from './drawHandles';
|
|
5
6
|
import drawLine from './drawLine';
|
|
6
7
|
import drawPolyline from './drawPolyline';
|
|
@@ -11,4 +12,4 @@ import drawArrow from './drawArrow';
|
|
|
11
12
|
import drawRedactionRect from './drawRedactionRect';
|
|
12
13
|
import setAttributesIfNecessary from './setAttributesIfNecessary';
|
|
13
14
|
import setNewAttributesIfValid from './setNewAttributesIfValid';
|
|
14
|
-
export { draw, drawCircle, drawEllipse, drawHandles, drawLine, drawPolyline, drawLinkedTextBox, drawRect, drawTextBox, drawArrow, drawRedactionRect, setAttributesIfNecessary, setNewAttributesIfValid, };
|
|
15
|
+
export { draw, drawCircle, drawEllipse, drawEllipseByCoordinates, drawHandles, drawLine, drawPolyline, drawLinkedTextBox, drawRect, drawTextBox, drawArrow, drawRedactionRect, setAttributesIfNecessary, setNewAttributesIfValid, };
|
|
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setNewAttributesIfValid = exports.setAttributesIfNecessary = exports.drawRedactionRect = exports.drawArrow = exports.drawTextBox = exports.drawRect = exports.drawLinkedTextBox = exports.drawPolyline = exports.drawLine = exports.drawHandles = exports.drawEllipse = exports.drawCircle = exports.draw = void 0;
|
|
6
|
+
exports.setNewAttributesIfValid = exports.setAttributesIfNecessary = exports.drawRedactionRect = exports.drawArrow = exports.drawTextBox = exports.drawRect = exports.drawLinkedTextBox = exports.drawPolyline = exports.drawLine = exports.drawHandles = exports.drawEllipseByCoordinates = exports.drawEllipse = exports.drawCircle = exports.draw = void 0;
|
|
7
7
|
const draw_1 = __importDefault(require("./draw"));
|
|
8
8
|
exports.draw = draw_1.default;
|
|
9
9
|
const drawCircle_1 = __importDefault(require("./drawCircle"));
|
|
10
10
|
exports.drawCircle = drawCircle_1.default;
|
|
11
11
|
const drawEllipse_1 = __importDefault(require("./drawEllipse"));
|
|
12
12
|
exports.drawEllipse = drawEllipse_1.default;
|
|
13
|
+
const drawEllipseByCoordinates_1 = __importDefault(require("./drawEllipseByCoordinates"));
|
|
14
|
+
exports.drawEllipseByCoordinates = drawEllipseByCoordinates_1.default;
|
|
13
15
|
const drawHandles_1 = __importDefault(require("./drawHandles"));
|
|
14
16
|
exports.drawHandles = drawHandles_1.default;
|
|
15
17
|
const drawLine_1 = __importDefault(require("./drawLine"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawingSvg/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawingSvg/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAgBxB,eAhBK,cAAI,CAgBL;AAfN,8DAAsC;AAgBpC,qBAhBK,oBAAU,CAgBL;AAfZ,gEAAwC;AAgBtC,sBAhBK,qBAAW,CAgBL;AAfb,0FAAkE;AAgBhE,mCAhBK,kCAAwB,CAgBL;AAf1B,gEAAwC;AAgBtC,sBAhBK,qBAAW,CAgBL;AAfb,0DAAkC;AAgBhC,mBAhBK,kBAAQ,CAgBL;AAfV,kEAA0C;AAgBxC,uBAhBK,sBAAY,CAgBL;AAfd,4EAAoD;AAgBlD,4BAhBK,2BAAiB,CAgBL;AAfnB,0DAAkC;AAgBhC,mBAhBK,kBAAQ,CAgBL;AAfV,gEAAwC;AAgBtC,sBAhBK,qBAAW,CAgBL;AAfb,4DAAoC;AAgBlC,oBAhBK,mBAAS,CAgBL;AAfX,4EAAoD;AAgBlD,4BAhBK,2BAAiB,CAgBL;AAfnB,0FAAkE;AAgBhE,mCAhBK,kCAAwB,CAgBL;AAf1B,wFAAgE;AAgB9D,kCAhBK,iCAAuB,CAgBL"}
|
|
@@ -55,6 +55,9 @@ function _imageChangeEventListener(evt) {
|
|
|
55
55
|
const { viewportId, renderingEngineId } = eventData;
|
|
56
56
|
const { viewport } = (0, core_1.getEnabledElementByIds)(viewportId, renderingEngineId);
|
|
57
57
|
const toolGroup = (0, ToolGroupManager_1.getToolGroupForViewport)(viewportId, renderingEngineId);
|
|
58
|
+
if (!toolGroup) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
58
61
|
let toolGroupSegmentationRepresentations = SegmentationState.getSegmentationRepresentations(toolGroup.id) || [];
|
|
59
62
|
toolGroupSegmentationRepresentations =
|
|
60
63
|
toolGroupSegmentationRepresentations.filter((representation) => representation.type === SegmentationRepresentations_1.default.Labelmap);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageChangeEventListener.js","sourceRoot":"","sources":["../../../../src/eventListeners/segmentation/imageChangeEventListener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAS6B;AAC7B,mEAAuE;AACvE,0GAAsE;AACtE,wGAA0F;AAE1F,iGAAkG;AAClG,sFAAiE;AACjE,2FAAsE;AACtE,uHAA+F;AAE/F,MAAM,MAAM,GAAG,UAAU,OAAuB;IAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAEhD,IAAI,CAAC,CAAC,QAAQ,YAAY,oBAAa,CAAC,EAAE;QACxC,OAAO;KACR;IAED,OAAO,CAAC,gBAAgB,CACtB,YAAK,CAAC,MAAM,CAAC,eAAe,EAC5B,yBAA0C,CAC3C,CAAC;IAEF,OAAO,CAAC,gBAAgB,CACtB,YAAK,CAAC,MAAM,CAAC,cAAc,EAC3B,yBAA0C,CAC3C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,UAAU,OAAuB;IAC/C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAEhD,IAAI,CAAC,CAAC,QAAQ,YAAY,oBAAa,CAAC,EAAE;QACxC,OAAO;KACR;IAED,OAAO,CAAC,mBAAmB,CACzB,YAAK,CAAC,MAAM,CAAC,eAAe,EAC5B,yBAA0C,CAC3C,CAAC;IACF,OAAO,CAAC,mBAAmB,CACzB,YAAK,CAAC,MAAM,CAAC,cAAc,EAC3B,yBAA0C,CAC3C,CAAC;AACJ,CAAC,CAAC;AAYF,SAAS,yBAAyB,CAAC,GAAG;IACpC,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAsB,EACzC,UAAU,EACV,iBAAiB,CACoB,CAAC;IAExC,MAAM,SAAS,GAAG,IAAA,0CAAuB,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"imageChangeEventListener.js","sourceRoot":"","sources":["../../../../src/eventListeners/segmentation/imageChangeEventListener.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAS6B;AAC7B,mEAAuE;AACvE,0GAAsE;AACtE,wGAA0F;AAE1F,iGAAkG;AAClG,sFAAiE;AACjE,2FAAsE;AACtE,uHAA+F;AAE/F,MAAM,MAAM,GAAG,UAAU,OAAuB;IAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;IAEhD,IAAI,CAAC,CAAC,QAAQ,YAAY,oBAAa,CAAC,EAAE;QACxC,OAAO;KACR;IAED,OAAO,CAAC,gBAAgB,CACtB,YAAK,CAAC,MAAM,CAAC,eAAe,EAC5B,yBAA0C,CAC3C,CAAC;IAEF,OAAO,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CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;wBACzD,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;wBAC9B,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;wBAClC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;wBAC5B,SAAS,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;wBAEjD,UAAU,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;oBACjD,CAAC;iBACF;aACF,EACD,IAAI,EACJ,KAAK,CACN,CAAC;YAEF,IAAA,mCAAyB,EAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YACxC,OAAO;SACR;QAED,gBAAS,CAAC,sCAAsC,CAC9C,qBAAqB,EACrB,YAAY,CACb,CAAC;QACF,QAAQ,CAAC,MAAM,EAAE,CAAC;QAKlB,IAAI,GAAG,CAAC,IAAI,KAAK,YAAK,CAAC,MAAM,CAAC,cAAc,EAAE;YAE5C,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAClC,YAAK,CAAC,MAAM,CAAC,cAAc,EAC3B,yBAA0C,CAC3C,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe;IACb,MAAM;IACN,OAAO;CACR,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { RepresentationConfig, Segmentation, SegmentationRepresentationConfig, SegmentationState, SegmentSpecificRepresentationConfig, ToolGroupSpecificRepresentation, ToolGroupSpecificRepresentations } from '../../types/SegmentationStateTypes';
|
|
2
3
|
export default class SegmentationStateManager {
|
|
3
4
|
private state;
|
|
4
5
|
readonly uid: string;
|
|
5
6
|
constructor(uid?: string);
|
|
6
7
|
getState(): SegmentationState;
|
|
7
8
|
getToolGroups(): string[];
|
|
8
|
-
getColorLUT(lutIndex: number): ColorLUT | undefined;
|
|
9
|
+
getColorLUT(lutIndex: number): Types.ColorLUT | undefined;
|
|
10
|
+
getNextColorLUTIndex(): number;
|
|
9
11
|
resetState(): void;
|
|
10
12
|
getSegmentation(segmentationId: string): Segmentation | undefined;
|
|
11
13
|
addSegmentation(segmentation: Segmentation): void;
|
|
@@ -24,10 +26,9 @@ export default class SegmentationStateManager {
|
|
|
24
26
|
getSegmentSpecificConfig(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): RepresentationConfig;
|
|
25
27
|
setSegmentSpecificConfig(toolGroupId: string, segmentationRepresentationUID: string, config: SegmentSpecificRepresentationConfig): void;
|
|
26
28
|
setSegmentationRepresentationConfig(toolGroupId: string, config: SegmentationRepresentationConfig): void;
|
|
27
|
-
addColorLUT(colorLUT: ColorLUT, lutIndex: number): void;
|
|
29
|
+
addColorLUT(colorLUT: Types.ColorLUT, lutIndex: number): void;
|
|
28
30
|
removeColorLUT(colorLUTIndex: number): void;
|
|
29
31
|
_handleActiveSegmentation(toolGroupId: string, recentlyAddedOrRemovedSegmentationRepresentation: ToolGroupSpecificRepresentation): void;
|
|
30
|
-
_initDefaultColorLUTIfNecessary(): void;
|
|
31
32
|
}
|
|
32
33
|
declare const defaultSegmentationStateManager: SegmentationStateManager;
|
|
33
34
|
export { defaultSegmentationStateManager };
|
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.defaultSegmentationStateManager = void 0;
|
|
7
|
-
const core_1 = require("@cornerstonejs/core");
|
|
8
7
|
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
|
9
|
-
const
|
|
8
|
+
const core_1 = require("@cornerstonejs/core");
|
|
10
9
|
const enums_1 = require("../../enums");
|
|
11
10
|
const contourConfig_1 = __importDefault(require("../../tools/displayTools/Contour/contourConfig"));
|
|
12
11
|
const labelmapConfig_1 = __importDefault(require("../../tools/displayTools/Labelmap/labelmapConfig"));
|
|
@@ -42,6 +41,9 @@ class SegmentationStateManager {
|
|
|
42
41
|
getColorLUT(lutIndex) {
|
|
43
42
|
return this.state.colorLUT[lutIndex];
|
|
44
43
|
}
|
|
44
|
+
getNextColorLUTIndex() {
|
|
45
|
+
return this.state.colorLUT.length;
|
|
46
|
+
}
|
|
45
47
|
resetState() {
|
|
46
48
|
this.state = (0, lodash_clonedeep_1.default)(initialDefaultState);
|
|
47
49
|
}
|
|
@@ -49,7 +51,6 @@ class SegmentationStateManager {
|
|
|
49
51
|
return this.state.segmentations.find((segmentation) => segmentation.segmentationId === segmentationId);
|
|
50
52
|
}
|
|
51
53
|
addSegmentation(segmentation) {
|
|
52
|
-
this._initDefaultColorLUTIfNecessary();
|
|
53
54
|
if (this.getSegmentation(segmentation.segmentationId)) {
|
|
54
55
|
throw new Error(`Segmentation with id ${segmentation.segmentationId} already exists`);
|
|
55
56
|
}
|
|
@@ -175,9 +176,9 @@ class SegmentationStateManager {
|
|
|
175
176
|
}
|
|
176
177
|
addColorLUT(colorLUT, lutIndex) {
|
|
177
178
|
if (this.state.colorLUT[lutIndex]) {
|
|
178
|
-
console.
|
|
179
|
+
console.warn('Color LUT table already exists, overwriting');
|
|
179
180
|
}
|
|
180
|
-
this.state.colorLUT[lutIndex] = colorLUT;
|
|
181
|
+
this.state.colorLUT[lutIndex] = structuredClone(colorLUT);
|
|
181
182
|
}
|
|
182
183
|
removeColorLUT(colorLUTIndex) {
|
|
183
184
|
delete this.state.colorLUT[colorLUTIndex];
|
|
@@ -205,11 +206,6 @@ class SegmentationStateManager {
|
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
|
-
_initDefaultColorLUTIfNecessary() {
|
|
209
|
-
if (this.state.colorLUT.length === 0 || !this.state.colorLUT[0]) {
|
|
210
|
-
this.addColorLUT(COLOR_LUT_1.default, 0);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
209
|
}
|
|
214
210
|
exports.default = SegmentationStateManager;
|
|
215
211
|
const defaultSegmentationStateManager = new SegmentationStateManager('DEFAULT');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentationStateManager.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/SegmentationStateManager.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"SegmentationStateManager.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/SegmentationStateManager.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAyC;AAEzC,8CAA2D;AAE3D,uCAA0D;AAC1D,mGAAqF;AACrF,sGAAwF;AAaxF,MAAM,qBAAqB,GAAG,IAAA,wBAAwB,GAAE,CAAC;AACzD,MAAM,oBAAoB,GAAG,IAAA,uBAAuB,GAAE,CAAC;AAEvD,MAAM,eAAe,GAAqC;IACxD,2BAA2B,EAAE,IAAI;IACjC,eAAe,EAAE;QACf,CAAC,mCAA2B,CAAC,QAAQ,CAAC,EAAE,qBAAqB;QAC7D,CAAC,mCAA2B,CAAC,OAAO,CAAC,EAAE,oBAAoB;KAC5D;CACF,CAAC;AAGF,MAAM,mBAAmB,GAAsB;IAC7C,QAAQ,EAAE,EAAE;IACZ,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,EAAE;CACf,CAAC;AAQF,MAAqB,wBAAwB;IAI3C,YAAY,GAAY;QACtB,IAAI,CAAC,GAAG,EAAE;YACR,GAAG,GAAG,gBAAO,CAAC,MAAM,EAAE,CAAC;SACxB;QACD,IAAI,CAAC,KAAK,GAAG,IAAA,0BAAS,EAAC,mBAAmB,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAMD,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAMD,aAAa;QACX,OAAO,MAAM,CA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AAiC,GACrC,2BAA2B,CAAC,MAAM,CAChC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAC1C,CAAC;QAEJ,IAAI,iCAAiC,CAAC,MAAM,KAAK,CAAC,EAAE;YAClD,2BAA2B,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;YAC7C,OAAO;SACR;QAID,IAAI,gDAAgD,CAAC,MAAM,EAAE;YAC3D,2BAA2B,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;gBACrD,IACE,cAAc,CAAC,6BAA6B;oBAC5C,gDAAgD,CAAC,6BAA6B,EAC9E;oBACA,cAAc,CAAC,MAAM,GAAG,KAAK,CAAC;iBAC/B;YACH,CAAC,CAAC,CAAC;SACJ;IAGH,CAAC;CACF;AA1cD,2CA0cC;AAED,MAAM,+BAA+B,GAAG,IAAI,wBAAwB,CAAC,SAAS,CAAC,CAAC;AACvE,0EAA+B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SegmentationRepresentationConfig, RepresentationPublicInput } from '../../types/SegmentationStateTypes';
|
|
2
|
+
declare function addSegmentationRepresentation(toolGroupId: string, representationInput: RepresentationPublicInput, toolGroupSpecificConfig?: SegmentationRepresentationConfig): Promise<string>;
|
|
3
|
+
export { addSegmentationRepresentation };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.addSegmentationRepresentation = void 0;
|
|
39
|
+
const core_1 = require("@cornerstonejs/core");
|
|
40
|
+
const SegmentationRepresentations_1 = __importDefault(require("../../enums/SegmentationRepresentations"));
|
|
41
|
+
const SegmentationConfig = __importStar(require("./config/segmentationConfig"));
|
|
42
|
+
const segmentationState_1 = require("./segmentationState");
|
|
43
|
+
const getRepresentationSpecificConfig_1 = require("./helpers/getRepresentationSpecificConfig");
|
|
44
|
+
const COLOR_LUT_1 = __importDefault(require("../../constants/COLOR_LUT"));
|
|
45
|
+
function addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificConfig) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { segmentationId, options = {} } = representationInput;
|
|
48
|
+
const segmentationRepresentationUID = core_1.utilities.uuidv4();
|
|
49
|
+
const segmentsHidden = new Set();
|
|
50
|
+
const colorLUTOrIndexInput = options.colorLUTOrIndex;
|
|
51
|
+
let colorLUTIndexToUse;
|
|
52
|
+
if (typeof colorLUTOrIndexInput === 'number') {
|
|
53
|
+
colorLUTIndexToUse = colorLUTOrIndexInput;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const nextIndex = (0, segmentationState_1.getNextColorLUTIndex)();
|
|
57
|
+
const colorLUTToAdd = Array.isArray(colorLUTOrIndexInput)
|
|
58
|
+
? colorLUTOrIndexInput
|
|
59
|
+
: COLOR_LUT_1.default;
|
|
60
|
+
(0, segmentationState_1.addColorLUT)(colorLUTToAdd, nextIndex);
|
|
61
|
+
colorLUTIndexToUse = nextIndex;
|
|
62
|
+
}
|
|
63
|
+
const toolGroupSpecificRepresentation = {
|
|
64
|
+
segmentationId,
|
|
65
|
+
segmentationRepresentationUID,
|
|
66
|
+
type: SegmentationRepresentations_1.default.Labelmap,
|
|
67
|
+
segmentsHidden,
|
|
68
|
+
colorLUTIndex: colorLUTIndexToUse,
|
|
69
|
+
active: true,
|
|
70
|
+
segmentationRepresentationSpecificConfig: {},
|
|
71
|
+
segmentSpecificConfig: {},
|
|
72
|
+
config: (0, getRepresentationSpecificConfig_1.getRepresentationSpecificConfig)(representationInput),
|
|
73
|
+
};
|
|
74
|
+
if (toolGroupSpecificConfig) {
|
|
75
|
+
const currentToolGroupConfig = SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
76
|
+
const mergedConfig = core_1.utilities.deepMerge(currentToolGroupConfig, toolGroupSpecificConfig);
|
|
77
|
+
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
78
|
+
renderInactiveSegmentations: mergedConfig.renderInactiveSegmentations || true,
|
|
79
|
+
representations: Object.assign({}, mergedConfig.representations),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
(0, segmentationState_1.addSegmentationRepresentation)(toolGroupId, toolGroupSpecificRepresentation);
|
|
83
|
+
return segmentationRepresentationUID;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.addSegmentationRepresentation = addSegmentationRepresentation;
|
|
87
|
+
//# sourceMappingURL=addSegmentationRepresentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSegmentationRepresentation.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/addSegmentationRepresentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgD;AAOhD,0GAAsE;AACtE,gFAAkE;AAClE,2DAI6B;AAC7B,+FAA4F;AAC5F,0EAA8D;AAE9D,SAAe,6BAA6B,CAC1C,WAAmB,EACnB,mBAA8C,EAC9C,uBAA0D;;QAE1D,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,mBAAmB,CAAC;QAC7D,MAAM,6BAA6B,GAAG,gBAAS,CAAC,MAAM,EAAE,CAAC;QAIzD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;QAEhD,MAAM,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;QACrD,IAAI,kBAAkB,CAAC;QAEvB,IAAI,OAAO,oBAAoB,KAAK,QAAQ,EAAE;YAC5C,kBAAkB,GAAG,oBAAoB,CAAC;SAC3C;aAAM;YACL,MAAM,SAAS,GAAG,IAAA,wCAAoB,GAAE,CAAC;YACzC,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC;gBACvD,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,mBAAqB,CAAC;YAC1B,IAAA,+BAAW,EAAC,aAA+B,EAAE,SAAS,CAAC,CAAC;YACxD,kBAAkB,GAAG,SAAS,CAAC;SAChC;QAED,MAAM,+BAA+B,GAAoC;YACvE,cAAc;YACd,6BAA6B;YAC7B,IAAI,EAAE,qCAAe,CAAC,QAAQ;YAC9B,cAAc;YACd,aAAa,EAAE,kBAAkB;YACjC,MAAM,EAAE,IAAI;YACZ,wCAAwC,EAAE,EAAE;YAC5C,qBAAqB,EAAE,EAAE;YACzB,MAAM,EAAE,IAAA,iEAA+B,EAAC,mBAAmB,CAAC;SAC7D,CAAC;QAGF,IAAI,uBAAuB,EAAE;YAI3B,MAAM,sBAAsB,GAC1B,kBAAkB,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;YAE7D,MAAM,YAAY,GAAG,gBAAS,CAAC,SAAS,CACtC,sBAAsB,EACtB,uBAAuB,CACxB,CAAC;YAEF,kBAAkB,CAAC,0BAA0B,CAAC,WAAW,EAAE;gBACzD,2BAA2B,EACzB,YAAY,CAAC,2BAA2B,IAAI,IAAI;gBAClD,eAAe,oBACV,YAAY,CAAC,eAAe,CAChC;aACF,CAAC,CAAC;SACJ;QAED,IAAA,iDAAoC,EAClC,WAAW,EACX,+BAA+B,CAChC,CAAC;QAEF,OAAO,6BAA6B,CAAC;IACvC,CAAC;CAAA;AAEQ,sEAA6B"}
|
|
@@ -8,15 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const SegmentationRepresentations_1 = __importDefault(require("../../enums/SegmentationRepresentations"));
|
|
16
12
|
const ToolGroupManager_1 = require("../../store/ToolGroupManager");
|
|
17
|
-
const
|
|
18
|
-
const Contour_1 = require("../../tools/displayTools/Contour");
|
|
19
|
-
const Surface_1 = require("../../tools/displayTools/Surface");
|
|
13
|
+
const addSegmentationRepresentation_1 = require("./addSegmentationRepresentation");
|
|
20
14
|
function addSegmentationRepresentations(toolGroupId, representationInputArray, toolGroupSpecificRepresentationConfig) {
|
|
21
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
16
|
const toolGroup = (0, ToolGroupManager_1.getToolGroup)(toolGroupId);
|
|
@@ -24,32 +18,11 @@ function addSegmentationRepresentations(toolGroupId, representationInputArray, t
|
|
|
24
18
|
throw new Error(`No tool group found for toolGroupId: ${toolGroupId}`);
|
|
25
19
|
}
|
|
26
20
|
const promises = representationInputArray.map((representationInput) => {
|
|
27
|
-
return
|
|
21
|
+
return (0, addSegmentationRepresentation_1.addSegmentationRepresentation)(toolGroupId, representationInput, toolGroupSpecificRepresentationConfig);
|
|
28
22
|
});
|
|
29
23
|
const segmentationRepresentationUIDs = yield Promise.all(promises);
|
|
30
24
|
return segmentationRepresentationUIDs;
|
|
31
25
|
});
|
|
32
26
|
}
|
|
33
|
-
function _addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificRepresentationConfig) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
let segmentationRepresentationUID;
|
|
36
|
-
if (representationInput.type === SegmentationRepresentations_1.default.Labelmap) {
|
|
37
|
-
segmentationRepresentationUID =
|
|
38
|
-
yield Labelmap_1.labelmapDisplay.addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificRepresentationConfig);
|
|
39
|
-
}
|
|
40
|
-
else if (representationInput.type === SegmentationRepresentations_1.default.Contour) {
|
|
41
|
-
segmentationRepresentationUID =
|
|
42
|
-
yield Contour_1.contourDisplay.addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificRepresentationConfig);
|
|
43
|
-
}
|
|
44
|
-
else if (representationInput.type === SegmentationRepresentations_1.default.Surface) {
|
|
45
|
-
segmentationRepresentationUID =
|
|
46
|
-
yield Surface_1.surfaceDisplay.addSegmentationRepresentation(toolGroupId, representationInput, toolGroupSpecificRepresentationConfig);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
throw new Error(`The representation type ${representationInput.type} is not supported`);
|
|
50
|
-
}
|
|
51
|
-
return segmentationRepresentationUID;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
27
|
exports.default = addSegmentationRepresentations;
|
|
55
28
|
//# sourceMappingURL=addSegmentationRepresentations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addSegmentationRepresentations.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/addSegmentationRepresentations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addSegmentationRepresentations.js","sourceRoot":"","sources":["../../../../src/stateManagement/segmentation/addSegmentationRepresentations.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,mEAA4D;AAE5D,mFAAgF;AAYhF,SAAe,8BAA8B,CAC3C,WAAmB,EACnB,wBAAqD,EACrD,qCAAwE;;QAGxE,MAAM,SAAS,GAAG,IAAA,+BAAY,EAAC,WAAW,CAAC,CAAC;QAE5C,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;SACxE;QAED,MAAM,QAAQ,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE;YACpE,OAAO,IAAA,6DAA6B,EAClC,WAAW,EACX,mBAAmB,EACnB,qCAAqC,CACtC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,8BAA8B,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEnE,OAAO,8BAA8B,CAAC;IACxC,CAAC;CAAA;AAED,kBAAe,8BAA8B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function addColorLUT(colorLUT: ColorLUT, colorLUTIndex: number): void;
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare function addColorLUT(colorLUT: Types.ColorLUT, colorLUTIndex: number): void;
|
|
4
3
|
declare function setColorLUT(toolGroupId: string, segmentationRepresentationUID: string, colorLUTIndex: number): void;
|
|
5
|
-
declare function getColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): Color;
|
|
6
|
-
declare function setColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number, color: Color): void;
|
|
4
|
+
declare function getColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): Types.Color;
|
|
5
|
+
declare function setColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number, color: Types.Color): void;
|
|
7
6
|
export { getColorForSegmentIndex, addColorLUT, setColorLUT, setColorForSegmentIndex, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentationColor.js","sourceRoot":"","sources":["../../../../../src/stateManagement/segmentation/config/segmentationColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgD;
|
|
1
|
+
{"version":3,"file":"segmentationColor.js","sourceRoot":"","sources":["../../../../../src/stateManagement/segmentation/config/segmentationColor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgD;AAEhD,2GAA6F;AAC7F,4EAAyF;AAUzF,SAAS,WAAW,CAAC,QAAwB,EAAE,aAAqB;IAClE,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IAGD,IAAI,CAAC,gBAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,C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;AA2BC,0DAAuB;AAzBzB,SAAS,uBAAuB,CAC9B,WAAmB,EACnB,6BAAqC,EACrC,YAAoB,EACpB,KAAkB;IAGlB,MAAM,cAAc,GAAG,uBAAuB,CAC5C,WAAW,EACX,6BAA6B,EAC7B,YAAY,CACb,CAAC;IAGF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KAC9B;IAED,IAAA,qEAAyC,EACvC,WAAW,EACX,6BAA6B,CAC9B,CAAC;AACJ,CAAC;AAMC,0DAAuB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getRepresentationSpecificConfig = void 0;
|
|
7
|
+
const SegmentationRepresentations_1 = __importDefault(require("../../../enums/SegmentationRepresentations"));
|
|
8
|
+
const labelmapDisplay_1 = require("../../../tools/displayTools/Labelmap/labelmapDisplay");
|
|
9
|
+
function getRepresentationSpecificConfig(representationInput) {
|
|
10
|
+
const { type } = representationInput;
|
|
11
|
+
if (type === SegmentationRepresentations_1.default.Labelmap) {
|
|
12
|
+
return (0, labelmapDisplay_1.getRepresentationRenderingConfig)();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.getRepresentationSpecificConfig = getRepresentationSpecificConfig;
|
|
19
|
+
//# sourceMappingURL=getRepresentationSpecificConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRepresentationSpecificConfig.js","sourceRoot":"","sources":["../../../../../src/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.ts"],"names":[],"mappings":";;;;;;AAAA,6GAAqF;AAErF,0FAAsI;AAEtI,SAAgB,+BAA+B,CAC7C,mBAA8C;IAE9C,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAmB,CAAC;IAErC,IAAI,IAAI,KAAK,qCAA2B,CAAC,QAAQ,EAAE;QACjD,OAAO,IAAA,kDAA0B,GAAE,CAAC;KACrC;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAVD,0EAUC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import type { RepresentationConfig, Segmentation, SegmentationPublicInput, SegmentationRepresentationConfig, SegmentSpecificRepresentationConfig, ToolGroupSpecificRepresentation, ToolGroupSpecificRepresentations } from '../../types/SegmentationStateTypes';
|
|
2
3
|
declare function getDefaultSegmentationStateManager(): import("./SegmentationStateManager").default;
|
|
3
4
|
declare function getSegmentation(segmentationId: string): Segmentation | undefined;
|
|
4
5
|
declare function getSegmentations(): Segmentation[] | [];
|
|
@@ -19,6 +20,7 @@ declare function getSegmentationRepresentationByUID(toolGroupId: string, segment
|
|
|
19
20
|
declare function removeSegmentation(segmentationId: string): void;
|
|
20
21
|
declare function removeSegmentationRepresentation(toolGroupId: string, segmentationRepresentationUID: string): void;
|
|
21
22
|
declare function removeColorLUT(colorLUTIndex: number): void;
|
|
22
|
-
declare function getColorLUT(index: number): ColorLUT | undefined;
|
|
23
|
-
declare function
|
|
24
|
-
|
|
23
|
+
declare function getColorLUT(index: number): Types.ColorLUT | undefined;
|
|
24
|
+
declare function getNextColorLUTIndex(): number;
|
|
25
|
+
declare function addColorLUT(colorLUT: Types.ColorLUT, index: number): void;
|
|
26
|
+
export { getDefaultSegmentationStateManager, getSegmentation, getSegmentations, addSegmentation, removeSegmentation, getSegmentationRepresentations, addSegmentationRepresentation, removeSegmentationRepresentation, getToolGroupSpecificConfig, setToolGroupSpecificConfig, getGlobalConfig, setGlobalConfig, getSegmentationRepresentationSpecificConfig, setSegmentationRepresentationSpecificConfig, getSegmentSpecificRepresentationConfig, setSegmentSpecificRepresentationConfig, getToolGroupIdsWithSegmentation, getAllSegmentationRepresentations, getSegmentationRepresentationByUID, addColorLUT, getColorLUT, getNextColorLUTIndex, removeColorLUT, };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeColorLUT = exports.getColorLUT = exports.addColorLUT = exports.getSegmentationRepresentationByUID = exports.getAllSegmentationRepresentations = exports.getToolGroupIdsWithSegmentation = exports.setSegmentSpecificRepresentationConfig = exports.getSegmentSpecificRepresentationConfig = exports.setSegmentationRepresentationSpecificConfig = exports.getSegmentationRepresentationSpecificConfig = exports.setGlobalConfig = exports.getGlobalConfig = exports.setToolGroupSpecificConfig = exports.getToolGroupSpecificConfig = exports.removeSegmentationRepresentation = exports.addSegmentationRepresentation = exports.getSegmentationRepresentations = exports.removeSegmentation = exports.addSegmentation = exports.getSegmentations = exports.getSegmentation = exports.getDefaultSegmentationStateManager = void 0;
|
|
6
|
+
exports.removeColorLUT = exports.getNextColorLUTIndex = exports.getColorLUT = exports.addColorLUT = exports.getSegmentationRepresentationByUID = exports.getAllSegmentationRepresentations = exports.getToolGroupIdsWithSegmentation = exports.setSegmentSpecificRepresentationConfig = exports.getSegmentSpecificRepresentationConfig = exports.setSegmentationRepresentationSpecificConfig = exports.getSegmentationRepresentationSpecificConfig = exports.setGlobalConfig = exports.getGlobalConfig = exports.setToolGroupSpecificConfig = exports.getToolGroupSpecificConfig = exports.removeSegmentationRepresentation = exports.addSegmentationRepresentation = exports.getSegmentationRepresentations = exports.removeSegmentation = exports.addSegmentation = exports.getSegmentations = exports.getSegmentation = exports.getDefaultSegmentationStateManager = void 0;
|
|
7
7
|
const SegmentationStateManager_1 = require("./SegmentationStateManager");
|
|
8
8
|
const triggerSegmentationEvents_1 = require("./triggerSegmentationEvents");
|
|
9
9
|
const normalizeSegmentationInput_1 = __importDefault(require("./helpers/normalizeSegmentationInput"));
|
|
@@ -147,6 +147,11 @@ function getColorLUT(index) {
|
|
|
147
147
|
return segmentationStateManager.getColorLUT(index);
|
|
148
148
|
}
|
|
149
149
|
exports.getColorLUT = getColorLUT;
|
|
150
|
+
function getNextColorLUTIndex() {
|
|
151
|
+
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
152
|
+
return segmentationStateManager.getNextColorLUTIndex();
|
|
153
|
+
}
|
|
154
|
+
exports.getNextColorLUTIndex = getNextColorLUTIndex;
|
|
150
155
|
function addColorLUT(colorLUT, index) {
|
|
151
156
|
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
152
157
|
segmentationStateManager.addColorLUT(colorLUT, index);
|