@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
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEnabledElementByIds,
|
|
3
3
|
Types,
|
|
4
|
-
utilities as csUtils,
|
|
5
4
|
StackViewport,
|
|
6
5
|
} from '@cornerstonejs/core';
|
|
7
6
|
|
|
8
7
|
import Representations from '../../../enums/SegmentationRepresentations';
|
|
9
|
-
import * as SegmentationConfig from '../../../stateManagement/segmentation/config/segmentationConfig';
|
|
10
8
|
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
11
9
|
import { getToolGroup } from '../../../store/ToolGroupManager';
|
|
12
10
|
import {
|
|
13
|
-
RepresentationPublicInput,
|
|
14
11
|
SegmentationRepresentationConfig,
|
|
15
12
|
ToolGroupSpecificRepresentation,
|
|
16
13
|
} from '../../../types/SegmentationStateTypes';
|
|
@@ -18,63 +15,6 @@ import { addOrUpdateContourSets } from './addOrUpdateContourSets';
|
|
|
18
15
|
import removeContourFromElement from './removeContourFromElement';
|
|
19
16
|
import { deleteConfigCache } from './contourConfigCache';
|
|
20
17
|
|
|
21
|
-
/**
|
|
22
|
-
* It adds a new segmentation representation to the segmentation state
|
|
23
|
-
* @param toolGroupId - The id of the toolGroup that the segmentation
|
|
24
|
-
* belongs to
|
|
25
|
-
* @param representationInput - RepresentationPublicInput
|
|
26
|
-
* @param toolGroupSpecificConfig - The configuration that is specific to the toolGroup.
|
|
27
|
-
* @returns The segmentationRepresentationUID
|
|
28
|
-
*/
|
|
29
|
-
async function addSegmentationRepresentation(
|
|
30
|
-
toolGroupId: string,
|
|
31
|
-
representationInput: RepresentationPublicInput,
|
|
32
|
-
toolGroupSpecificConfig?: SegmentationRepresentationConfig
|
|
33
|
-
): Promise<string> {
|
|
34
|
-
const { segmentationId } = representationInput;
|
|
35
|
-
const segmentationRepresentationUID = csUtils.uuidv4();
|
|
36
|
-
// Todo: make these configurable during representation input by user
|
|
37
|
-
const segmentsHidden = new Set() as Set<number>;
|
|
38
|
-
const visibility = true;
|
|
39
|
-
const colorLUTIndex = 0;
|
|
40
|
-
const active = true;
|
|
41
|
-
const toolGroupSpecificRepresentation: ToolGroupSpecificRepresentation = {
|
|
42
|
-
segmentationId,
|
|
43
|
-
segmentationRepresentationUID,
|
|
44
|
-
type: Representations.Contour,
|
|
45
|
-
segmentsHidden,
|
|
46
|
-
colorLUTIndex,
|
|
47
|
-
active,
|
|
48
|
-
segmentationRepresentationSpecificConfig: {},
|
|
49
|
-
segmentSpecificConfig: {},
|
|
50
|
-
config: {},
|
|
51
|
-
};
|
|
52
|
-
// Update the toolGroup specific configuration
|
|
53
|
-
if (toolGroupSpecificConfig) {
|
|
54
|
-
// Since setting configuration on toolGroup will trigger a segmentationRepresentation
|
|
55
|
-
// update event, we don't want to trigger the event twice, so we suppress
|
|
56
|
-
// the first one
|
|
57
|
-
const currentToolGroupConfig =
|
|
58
|
-
SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
59
|
-
const mergedConfig = csUtils.deepMerge(
|
|
60
|
-
currentToolGroupConfig,
|
|
61
|
-
toolGroupSpecificConfig
|
|
62
|
-
);
|
|
63
|
-
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
64
|
-
renderInactiveSegmentations:
|
|
65
|
-
mergedConfig.renderInactiveSegmentations || true,
|
|
66
|
-
representations: {
|
|
67
|
-
...mergedConfig.representations,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
SegmentationState.addSegmentationRepresentation(
|
|
72
|
-
toolGroupId,
|
|
73
|
-
toolGroupSpecificRepresentation
|
|
74
|
-
);
|
|
75
|
-
return segmentationRepresentationUID;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
18
|
/**
|
|
79
19
|
* It removes a segmentation representation from the tool group's viewports and
|
|
80
20
|
* from the segmentation state
|
|
@@ -177,6 +117,5 @@ function _removeContourFromToolGroupViewports(
|
|
|
177
117
|
|
|
178
118
|
export default {
|
|
179
119
|
render,
|
|
180
|
-
addSegmentationRepresentation,
|
|
181
120
|
removeSegmentationRepresentation,
|
|
182
121
|
};
|
|
@@ -31,75 +31,14 @@ import { isVolumeSegmentation } from '../../segmentation/strategies/utils/stackV
|
|
|
31
31
|
const MAX_NUMBER_COLORS = 255;
|
|
32
32
|
const labelMapConfigCache = new Map();
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
* For each viewport, in the toolGroup it adds the segmentation labelmap
|
|
36
|
-
* representation to its viewports.
|
|
37
|
-
* @param toolGroup - the tool group that contains the viewports
|
|
38
|
-
* @param representationInput - The segmentation representation input
|
|
39
|
-
* @param toolGroupSpecificConfig - The configuration object for toolGroup
|
|
40
|
-
*
|
|
41
|
-
* @returns The UID of the new segmentation representation
|
|
42
|
-
*/
|
|
43
|
-
async function addSegmentationRepresentation(
|
|
44
|
-
toolGroupId: string,
|
|
45
|
-
representationInput: RepresentationPublicInput,
|
|
46
|
-
toolGroupSpecificConfig?: SegmentationRepresentationConfig
|
|
47
|
-
): Promise<string> {
|
|
48
|
-
const { segmentationId } = representationInput;
|
|
49
|
-
const segmentationRepresentationUID = utilities.uuidv4();
|
|
50
|
-
|
|
51
|
-
// Todo: make these configurable during representation input by user
|
|
52
|
-
const segmentsHidden = new Set() as Set<number>;
|
|
53
|
-
const colorLUTIndex = 0;
|
|
54
|
-
const active = true;
|
|
34
|
+
function getRepresentationRenderingConfig() {
|
|
55
35
|
const cfun = vtkColorTransferFunction.newInstance();
|
|
56
36
|
const ofun = vtkPiecewiseFunction.newInstance();
|
|
57
|
-
|
|
58
37
|
ofun.addPoint(0, 0);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
segmentationRepresentationUID,
|
|
63
|
-
type: Representations.Labelmap,
|
|
64
|
-
segmentsHidden,
|
|
65
|
-
colorLUTIndex,
|
|
66
|
-
active,
|
|
67
|
-
segmentationRepresentationSpecificConfig: {},
|
|
68
|
-
segmentSpecificConfig: {},
|
|
69
|
-
config: {
|
|
70
|
-
cfun,
|
|
71
|
-
ofun,
|
|
72
|
-
},
|
|
38
|
+
return {
|
|
39
|
+
ofun,
|
|
40
|
+
cfun,
|
|
73
41
|
};
|
|
74
|
-
|
|
75
|
-
// Update the toolGroup specific configuration
|
|
76
|
-
if (toolGroupSpecificConfig) {
|
|
77
|
-
// Since setting configuration on toolGroup will trigger a segmentationRepresentation
|
|
78
|
-
// update event, we don't want to trigger the event twice, so we suppress
|
|
79
|
-
// the first one
|
|
80
|
-
const currentToolGroupConfig =
|
|
81
|
-
SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
82
|
-
|
|
83
|
-
const mergedConfig = utilities.deepMerge(
|
|
84
|
-
currentToolGroupConfig,
|
|
85
|
-
toolGroupSpecificConfig
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
89
|
-
renderInactiveSegmentations:
|
|
90
|
-
mergedConfig.renderInactiveSegmentations || true,
|
|
91
|
-
representations: {
|
|
92
|
-
...mergedConfig.representations,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
SegmentationState.addSegmentationRepresentation(
|
|
98
|
-
toolGroupId,
|
|
99
|
-
toolGroupSpecificRepresentation
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
return segmentationRepresentationUID;
|
|
103
42
|
}
|
|
104
43
|
|
|
105
44
|
/**
|
|
@@ -532,7 +471,13 @@ async function _addLabelmapToViewport(
|
|
|
532
471
|
}
|
|
533
472
|
|
|
534
473
|
export default {
|
|
474
|
+
getRepresentationRenderingConfig,
|
|
475
|
+
render,
|
|
476
|
+
removeSegmentationRepresentation,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export {
|
|
480
|
+
getRepresentationRenderingConfig,
|
|
535
481
|
render,
|
|
536
|
-
addSegmentationRepresentation,
|
|
537
482
|
removeSegmentationRepresentation,
|
|
538
483
|
};
|
|
@@ -2,16 +2,13 @@ import {
|
|
|
2
2
|
cache,
|
|
3
3
|
getEnabledElementByIds,
|
|
4
4
|
Types,
|
|
5
|
-
utilities,
|
|
6
5
|
Enums,
|
|
7
6
|
} from '@cornerstonejs/core';
|
|
8
7
|
|
|
9
8
|
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
10
|
-
import * as SegmentationConfig from '../../../stateManagement/segmentation/config/segmentationConfig';
|
|
11
9
|
import Representations from '../../../enums/SegmentationRepresentations';
|
|
12
10
|
import { getToolGroup } from '../../../store/ToolGroupManager';
|
|
13
11
|
import {
|
|
14
|
-
RepresentationPublicInput,
|
|
15
12
|
SegmentationRepresentationConfig,
|
|
16
13
|
ToolGroupSpecificRepresentation,
|
|
17
14
|
} from '../../../types/SegmentationStateTypes';
|
|
@@ -19,62 +16,6 @@ import {
|
|
|
19
16
|
import removeSurfaceFromElement from './removeSurfaceFromElement';
|
|
20
17
|
import addSurfaceToElement from './addSurfaceToElement';
|
|
21
18
|
|
|
22
|
-
/**
|
|
23
|
-
* It adds a new segmentation representation to the segmentation state
|
|
24
|
-
* @param toolGroupId - The id of the toolGroup that the segmentation
|
|
25
|
-
* belongs to
|
|
26
|
-
* @param representationInput - RepresentationPublicInput
|
|
27
|
-
* @param toolGroupSpecificConfig - The configuration that is specific to the toolGroup.
|
|
28
|
-
* @returns The segmentationRepresentationUID
|
|
29
|
-
*/
|
|
30
|
-
async function addSegmentationRepresentation(
|
|
31
|
-
toolGroupId: string,
|
|
32
|
-
representationInput: RepresentationPublicInput,
|
|
33
|
-
toolGroupSpecificConfig?: SegmentationRepresentationConfig
|
|
34
|
-
): Promise<string> {
|
|
35
|
-
const { segmentationId } = representationInput;
|
|
36
|
-
const segmentationRepresentationUID = utilities.uuidv4();
|
|
37
|
-
// Todo: make these configurable during representation input by user
|
|
38
|
-
const segmentsHidden = new Set() as Set<number>;
|
|
39
|
-
const colorLUTIndex = 0;
|
|
40
|
-
const active = true;
|
|
41
|
-
const toolGroupSpecificRepresentation: ToolGroupSpecificRepresentation = {
|
|
42
|
-
segmentationId,
|
|
43
|
-
segmentationRepresentationUID,
|
|
44
|
-
type: Representations.Surface,
|
|
45
|
-
segmentsHidden,
|
|
46
|
-
colorLUTIndex,
|
|
47
|
-
active,
|
|
48
|
-
segmentationRepresentationSpecificConfig: {},
|
|
49
|
-
segmentSpecificConfig: {},
|
|
50
|
-
config: {},
|
|
51
|
-
};
|
|
52
|
-
// Update the toolGroup specific configuration
|
|
53
|
-
if (toolGroupSpecificConfig) {
|
|
54
|
-
// Since setting configuration on toolGroup will trigger a segmentationRepresentation
|
|
55
|
-
// update event, we don't want to trigger the event twice, so we suppress
|
|
56
|
-
// the first one
|
|
57
|
-
const currentToolGroupConfig =
|
|
58
|
-
SegmentationConfig.getToolGroupSpecificConfig(toolGroupId);
|
|
59
|
-
const mergedConfig = utilities.deepMerge(
|
|
60
|
-
currentToolGroupConfig,
|
|
61
|
-
toolGroupSpecificConfig
|
|
62
|
-
);
|
|
63
|
-
SegmentationConfig.setToolGroupSpecificConfig(toolGroupId, {
|
|
64
|
-
renderInactiveSegmentations:
|
|
65
|
-
mergedConfig.renderInactiveSegmentations || true,
|
|
66
|
-
representations: {
|
|
67
|
-
...mergedConfig.representations,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
SegmentationState.addSegmentationRepresentation(
|
|
72
|
-
toolGroupId,
|
|
73
|
-
toolGroupSpecificRepresentation
|
|
74
|
-
);
|
|
75
|
-
return segmentationRepresentationUID;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
19
|
/**
|
|
79
20
|
* It removes a segmentation representation from the tool group's viewports and
|
|
80
21
|
* from the segmentation state
|
|
@@ -210,6 +151,5 @@ function _removeSurfaceFromToolGroupViewports(
|
|
|
210
151
|
|
|
211
152
|
export default {
|
|
212
153
|
render,
|
|
213
|
-
addSegmentationRepresentation,
|
|
214
154
|
removeSegmentationRepresentation,
|
|
215
155
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
1
2
|
import * as Enums from '../enums';
|
|
2
3
|
import {
|
|
3
4
|
ContourConfig,
|
|
@@ -14,17 +15,6 @@ import {
|
|
|
14
15
|
SurfaceRenderingConfig,
|
|
15
16
|
} from './SurfaceTypes';
|
|
16
17
|
|
|
17
|
-
/**
|
|
18
|
-
* Four elements RGBA as 0-255
|
|
19
|
-
*/
|
|
20
|
-
export type Color = [number, number, number, number];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Color LUT Array - Array of colors
|
|
24
|
-
* [[0,0,0,0], [200,200,200,200], ....]
|
|
25
|
-
*/
|
|
26
|
-
export type ColorLUT = Array<Color>;
|
|
27
|
-
|
|
28
18
|
export type SegmentSpecificRepresentationConfig = {
|
|
29
19
|
[key: number | string]: RepresentationConfig;
|
|
30
20
|
};
|
|
@@ -245,7 +235,7 @@ export type ToolGroupSpecificRepresentations =
|
|
|
245
235
|
*/
|
|
246
236
|
export type SegmentationState = {
|
|
247
237
|
/** Array of colorLUT for segmentation to render */
|
|
248
|
-
colorLUT: ColorLUT[];
|
|
238
|
+
colorLUT: Types.ColorLUT[];
|
|
249
239
|
/** segmentations */
|
|
250
240
|
segmentations: Segmentation[];
|
|
251
241
|
/** global segmentation state with config */
|
|
@@ -276,4 +266,9 @@ export type SegmentationPublicInput = {
|
|
|
276
266
|
export type RepresentationPublicInput = {
|
|
277
267
|
segmentationId: string;
|
|
278
268
|
type: Enums.SegmentationRepresentations;
|
|
269
|
+
options?: {
|
|
270
|
+
// color lut to use for this representation (optional), it can
|
|
271
|
+
// be either a colorLUT array or the index of the colorLUT in the state
|
|
272
|
+
colorLUTOrIndex?: Types.ColorLUT | number;
|
|
273
|
+
};
|
|
279
274
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -34,8 +34,6 @@ import type BoundsIJK from './BoundsIJK';
|
|
|
34
34
|
import type SVGDrawingHelper from './SVGDrawingHelper';
|
|
35
35
|
import type * as CINETypes from './CINETypes';
|
|
36
36
|
import type {
|
|
37
|
-
Color,
|
|
38
|
-
ColorLUT,
|
|
39
37
|
RepresentationConfig,
|
|
40
38
|
SegmentationRepresentationConfig,
|
|
41
39
|
SegmentationRepresentationData,
|
|
@@ -120,8 +118,6 @@ export type {
|
|
|
120
118
|
ToolGroupSpecificLabelmapRepresentation,
|
|
121
119
|
ToolGroupSpecificRepresentation,
|
|
122
120
|
RepresentationPublicInput,
|
|
123
|
-
Color,
|
|
124
|
-
ColorLUT,
|
|
125
121
|
LabelmapTypes,
|
|
126
122
|
// Cursors
|
|
127
123
|
SVGCursorDescriptor,
|