@cornerstonejs/tools 2.0.0-beta.17 → 2.0.0-beta.18
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/esm/eventListeners/segmentation/imageChangeEventListener.js +11 -14
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +26 -27
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +1 -4
- package/dist/esm/eventListeners/segmentation/segmentationModifiedEventListener.js +2 -11
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationModifiedEventListener.js +10 -2
- package/dist/esm/eventListeners/segmentation/segmentationRepresentationRemovedEventListener.js +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/stateManagement/index.d.ts +3 -3
- package/dist/esm/stateManagement/index.js +2 -2
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.d.ts +19 -18
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +87 -130
- package/dist/esm/stateManagement/segmentation/activeSegmentation.d.ts +4 -5
- package/dist/esm/stateManagement/segmentation/activeSegmentation.js +6 -23
- package/dist/esm/stateManagement/segmentation/addRepresentation.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/addRepresentation.js +51 -0
- package/dist/esm/stateManagement/segmentation/addRepresentations.d.ts +3 -0
- package/dist/esm/stateManagement/segmentation/addRepresentations.js +9 -0
- package/dist/esm/stateManagement/segmentation/config/index.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/config/index.js +2 -2
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.d.ts +4 -4
- package/dist/esm/stateManagement/segmentation/config/segmentationColor.js +10 -10
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.d.ts +8 -8
- package/dist/esm/stateManagement/segmentation/config/segmentationConfig.js +19 -13
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.d.ts +7 -6
- package/dist/esm/stateManagement/segmentation/config/segmentationVisibility.js +29 -54
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.d.ts +1 -1
- package/dist/esm/stateManagement/segmentation/convertStackToVolumeSegmentation.js +5 -5
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/convertVolumeToStackSegmentation.js +5 -5
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationRenderingConfig.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/helpers/{getRepresentationSpecificConfig.js → getRepresentationRenderingConfig.js} +1 -1
- package/dist/esm/stateManagement/segmentation/index.d.ts +3 -3
- package/dist/esm/stateManagement/segmentation/index.js +3 -3
- package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js +2 -4
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js +5 -6
- package/dist/esm/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.js +4 -4
- package/dist/esm/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.js +2 -6
- package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.d.ts +2 -0
- package/dist/esm/stateManagement/segmentation/removeRepresentationsFromViewport.js +23 -0
- package/dist/esm/stateManagement/segmentation/segmentIndex.js +6 -4
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +23 -20
- package/dist/esm/stateManagement/segmentation/segmentationState.js +68 -95
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/triggerSegmentationEvents.js +4 -18
- package/dist/esm/store/ToolGroupManager/destroyToolGroup.js +0 -4
- package/dist/esm/tools/AdvancedMagnifyViewport.js +3 -3
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +0 -2
- package/dist/esm/tools/base/ContourSegmentationBaseTool.d.ts +0 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +42 -33
- package/dist/esm/tools/displayTools/Contour/contourDisplay.d.ts +4 -4
- package/dist/esm/tools/displayTools/Contour/contourDisplay.js +17 -30
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +4 -4
- package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +20 -11
- package/dist/esm/tools/displayTools/Contour/contourHandler/utils.d.ts +0 -2
- package/dist/esm/tools/displayTools/Contour/contourHandler/utils.js +0 -11
- package/dist/esm/tools/displayTools/Contour/removeContourFromElement.d.ts +1 -1
- package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js +3 -3
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.d.ts +5 -5
- package/dist/esm/tools/displayTools/Labelmap/labelmapDisplay.js +51 -54
- package/dist/esm/tools/displayTools/SegmentationRenderingEngine.d.ts +19 -0
- package/dist/esm/tools/displayTools/SegmentationRenderingEngine.js +136 -0
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.d.ts +5 -5
- package/dist/esm/tools/displayTools/Surface/surfaceDisplay.js +14 -25
- package/dist/esm/tools/index.d.ts +1 -2
- package/dist/esm/tools/index.js +1 -2
- package/dist/esm/tools/segmentation/BrushTool.d.ts +15 -2
- package/dist/esm/tools/segmentation/BrushTool.js +13 -14
- package/dist/esm/tools/segmentation/CircleScissorsTool.js +3 -4
- package/dist/esm/tools/segmentation/PaintFillTool.js +1 -2
- package/dist/esm/tools/segmentation/RectangleScissorsTool.js +3 -4
- package/dist/esm/tools/segmentation/SegmentSelectTool.d.ts +3 -2
- package/dist/esm/tools/segmentation/SegmentSelectTool.js +5 -5
- package/dist/esm/tools/segmentation/SphereScissorsTool.js +4 -5
- package/dist/esm/tools/segmentation/strategies/compositions/preview.js +2 -2
- package/dist/esm/types/EventTypes.d.ts +0 -3
- package/dist/esm/types/SegmentationStateTypes.d.ts +24 -23
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/utilities/segmentation/getSegmentIndexAtLabelmapBorder.d.ts +7 -0
- package/dist/esm/utilities/segmentation/{getSegmentAtLabelmapBorder.js → getSegmentIndexAtLabelmapBorder.js} +3 -3
- package/dist/esm/utilities/segmentation/getSegmentIndexAtWorldPoint.d.ts +11 -0
- package/dist/esm/utilities/segmentation/{getSegmentAtWorldPoint.js → getSegmentIndexAtWorldPoint.js} +7 -7
- package/dist/esm/utilities/segmentation/index.d.ts +3 -3
- package/dist/esm/utilities/segmentation/index.js +3 -3
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.d.ts +2 -17
- package/dist/esm/utilities/segmentation/triggerSegmentationRender.js +4 -106
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.d.ts +3 -0
- package/dist/esm/utilities/segmentation/triggerSegmentationRenderForViewports.js +6 -0
- package/dist/esm/utilities/triggerAnnotationRenderForViewportIds.js +7 -2
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -4
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentation.js +0 -63
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.d.ts +0 -3
- package/dist/esm/stateManagement/segmentation/addSegmentationRepresentations.js +0 -14
- package/dist/esm/stateManagement/segmentation/helpers/getRepresentationSpecificConfig.d.ts +0 -2
- package/dist/esm/stateManagement/segmentation/removeSegmentationsFromToolGroup.d.ts +0 -2
- package/dist/esm/stateManagement/segmentation/removeSegmentationsFromToolGroup.js +0 -39
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.d.ts +0 -13
- package/dist/esm/tools/displayTools/SegmentationDisplayTool.js +0 -101
- package/dist/esm/utilities/segmentation/getSegmentAtLabelmapBorder.d.ts +0 -7
- package/dist/esm/utilities/segmentation/getSegmentAtWorldPoint.d.ts +0 -11
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
5
|
-
const toolGroupSegmentationRepresentations = segmentationStateManager.getSegmentationRepresentations(toolGroupId);
|
|
6
|
-
if (!toolGroupSegmentationRepresentations) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const activeRepresentation = toolGroupSegmentationRepresentations.find((representation) => representation.active);
|
|
10
|
-
return activeRepresentation;
|
|
1
|
+
import * as SegmentationState from './segmentationState';
|
|
2
|
+
function getActiveRepresentation(viewportId) {
|
|
3
|
+
return SegmentationState.getActiveRepresentation(viewportId);
|
|
11
4
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
if (!activeRepresentation) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const activeSegmentation = getSegmentation(activeRepresentation.segmentationId);
|
|
18
|
-
return activeSegmentation;
|
|
5
|
+
function setActiveRepresentation(viewportId, segmentationRepresentationUID, suppressEvent = false) {
|
|
6
|
+
SegmentationState.setActiveRepresentation(viewportId, segmentationRepresentationUID, suppressEvent);
|
|
19
7
|
}
|
|
20
|
-
|
|
21
|
-
const segmentationStateManager = getDefaultSegmentationStateManager();
|
|
22
|
-
segmentationStateManager.setActiveSegmentationRepresentation(toolGroupId, segmentationRepresentationUID);
|
|
23
|
-
triggerSegmentationRepresentationModified(toolGroupId, segmentationRepresentationUID);
|
|
24
|
-
}
|
|
25
|
-
export { getActiveSegmentationRepresentation, getActiveSegmentation, setActiveSegmentationRepresentation, };
|
|
8
|
+
export { getActiveRepresentation, setActiveRepresentation, };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SegmentationRepresentationConfig, RepresentationPublicInput } from '../../types/SegmentationStateTypes';
|
|
2
|
+
declare function addRepresentation(viewportId: string, representationInput: RepresentationPublicInput, initialConfig?: SegmentationRepresentationConfig): Promise<string>;
|
|
3
|
+
export { addRepresentation };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
import * as SegmentationState from './segmentationState';
|
|
3
|
+
import { getRepresentationRenderingConfig } from './helpers/getRepresentationRenderingConfig';
|
|
4
|
+
import CORNERSTONE_COLOR_LUT from '../../constants/COLOR_LUT';
|
|
5
|
+
import { triggerAnnotationRenderForViewportIds } from '../../utilities';
|
|
6
|
+
import { SegmentationRepresentations } from '../../enums';
|
|
7
|
+
import { triggerSegmentationModified } from './triggerSegmentationEvents';
|
|
8
|
+
async function addRepresentation(viewportId, representationInput, initialConfig) {
|
|
9
|
+
const { segmentationId, options = {} } = representationInput;
|
|
10
|
+
const segmentationRepresentationUID = representationInput.options?.segmentationRepresentationUID ||
|
|
11
|
+
utilities.uuidv4();
|
|
12
|
+
const colorLUTIndexToUse = getColorLUTIndex(options);
|
|
13
|
+
const representation = {
|
|
14
|
+
segmentationId,
|
|
15
|
+
segmentationRepresentationUID,
|
|
16
|
+
type: representationInput.type,
|
|
17
|
+
colorLUTIndex: colorLUTIndexToUse,
|
|
18
|
+
rendering: getRepresentationRenderingConfig(representationInput),
|
|
19
|
+
polySeg: options.polySeg,
|
|
20
|
+
config: {
|
|
21
|
+
allSegments: {},
|
|
22
|
+
perSegment: {},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
SegmentationState.addRepresentationToViewport(viewportId, representation);
|
|
26
|
+
if (initialConfig) {
|
|
27
|
+
SegmentationState.setAllSegmentsConfig(segmentationRepresentationUID, initialConfig.representations);
|
|
28
|
+
}
|
|
29
|
+
if (representationInput.type === SegmentationRepresentations.Contour) {
|
|
30
|
+
triggerAnnotationRenderForViewportIds([viewportId]);
|
|
31
|
+
}
|
|
32
|
+
triggerSegmentationModified(segmentationId);
|
|
33
|
+
return segmentationRepresentationUID;
|
|
34
|
+
}
|
|
35
|
+
function getColorLUTIndex(options = {}) {
|
|
36
|
+
const colorLUTOrIndexInput = options.colorLUTOrIndex;
|
|
37
|
+
let colorLUTIndexToUse;
|
|
38
|
+
if (typeof colorLUTOrIndexInput === 'number') {
|
|
39
|
+
colorLUTIndexToUse = colorLUTOrIndexInput;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const nextIndex = SegmentationState.getNextColorLUTIndex();
|
|
43
|
+
const colorLUTToAdd = Array.isArray(colorLUTOrIndexInput)
|
|
44
|
+
? colorLUTOrIndexInput
|
|
45
|
+
: CORNERSTONE_COLOR_LUT;
|
|
46
|
+
SegmentationState.addColorLUT(colorLUTToAdd, nextIndex);
|
|
47
|
+
colorLUTIndexToUse = nextIndex;
|
|
48
|
+
}
|
|
49
|
+
return colorLUTIndexToUse;
|
|
50
|
+
}
|
|
51
|
+
export { addRepresentation };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SegmentationRepresentationConfig, RepresentationPublicInput } from '../../types/SegmentationStateTypes';
|
|
2
|
+
declare function addRepresentations(viewportId: string, representationInputArray: RepresentationPublicInput[], segmentationRepresentationConfig?: SegmentationRepresentationConfig): Promise<string[]>;
|
|
3
|
+
export default addRepresentations;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { addRepresentation } from './addRepresentation';
|
|
2
|
+
async function addRepresentations(viewportId, representationInputArray, segmentationRepresentationConfig) {
|
|
3
|
+
const promises = representationInputArray.map((representationInput) => {
|
|
4
|
+
return addRepresentation(viewportId, representationInput, segmentationRepresentationConfig);
|
|
5
|
+
});
|
|
6
|
+
const segmentationRepresentationUIDs = await Promise.all(promises);
|
|
7
|
+
return segmentationRepresentationUIDs;
|
|
8
|
+
}
|
|
9
|
+
export default addRepresentations;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as color from './segmentationColor';
|
|
2
2
|
import * as visibility from './segmentationVisibility';
|
|
3
|
-
import { getGlobalConfig, getGlobalRepresentationConfig,
|
|
4
|
-
export { color, visibility, getGlobalConfig, getGlobalRepresentationConfig,
|
|
3
|
+
import { getGlobalConfig, getGlobalRepresentationConfig, setGlobalConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, getPerSegmentConfig, getSegmentIndexConfig, setAllSegmentsConfig, setPerSegmentConfig, setSegmentIndexConfig } from './segmentationConfig';
|
|
4
|
+
export { color, visibility, getGlobalConfig, getGlobalRepresentationConfig, setGlobalConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, getPerSegmentConfig, getSegmentIndexConfig, setAllSegmentsConfig, setPerSegmentConfig, setSegmentIndexConfig, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as color from './segmentationColor';
|
|
2
2
|
import * as visibility from './segmentationVisibility';
|
|
3
|
-
import { getGlobalConfig, getGlobalRepresentationConfig,
|
|
4
|
-
export { color, visibility, getGlobalConfig, getGlobalRepresentationConfig,
|
|
3
|
+
import { getGlobalConfig, getGlobalRepresentationConfig, setGlobalConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, getPerSegmentConfig, getSegmentIndexConfig, setAllSegmentsConfig, setPerSegmentConfig, setSegmentIndexConfig, } from './segmentationConfig';
|
|
4
|
+
export { color, visibility, getGlobalConfig, getGlobalRepresentationConfig, setGlobalConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, getPerSegmentConfig, getSegmentIndexConfig, setAllSegmentsConfig, setPerSegmentConfig, setSegmentIndexConfig, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
declare function addColorLUT(colorLUT: Types.ColorLUT, colorLUTIndex: number): void;
|
|
3
|
-
declare function setColorLUT(
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
export {
|
|
3
|
+
declare function setColorLUT(segmentationRepresentationUID: string, colorLUTIndex: number): void;
|
|
4
|
+
declare function getSegmentIndexColor(segmentationRepresentationUID: string, segmentIndex: number): Types.Color;
|
|
5
|
+
declare function setSegmentIndexColor(segmentationRepresentationUID: string, segmentIndex: number, color: Types.Color): void;
|
|
6
|
+
export { getSegmentIndexColor, addColorLUT, setColorLUT, setSegmentIndexColor };
|
|
@@ -11,8 +11,8 @@ function addColorLUT(colorLUT, colorLUTIndex) {
|
|
|
11
11
|
}
|
|
12
12
|
SegmentationState.addColorLUT(colorLUT, colorLUTIndex);
|
|
13
13
|
}
|
|
14
|
-
function setColorLUT(
|
|
15
|
-
const segRepresentation = SegmentationState.
|
|
14
|
+
function setColorLUT(segmentationRepresentationUID, colorLUTIndex) {
|
|
15
|
+
const segRepresentation = SegmentationState.getRepresentation(segmentationRepresentationUID);
|
|
16
16
|
if (!segRepresentation) {
|
|
17
17
|
throw new Error(`setColorLUT: could not find segmentation representation with UID ${segmentationRepresentationUID}`);
|
|
18
18
|
}
|
|
@@ -20,12 +20,12 @@ function setColorLUT(toolGroupId, segmentationRepresentationUID, colorLUTIndex)
|
|
|
20
20
|
throw new Error(`setColorLUT: could not find colorLUT with index ${colorLUTIndex}`);
|
|
21
21
|
}
|
|
22
22
|
segRepresentation.colorLUTIndex = colorLUTIndex;
|
|
23
|
-
triggerSegmentationRepresentationModified(
|
|
23
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const segmentationRepresentation = SegmentationState.
|
|
25
|
+
function getSegmentIndexColor(segmentationRepresentationUID, segmentIndex) {
|
|
26
|
+
const segmentationRepresentation = SegmentationState.getRepresentation(segmentationRepresentationUID);
|
|
27
27
|
if (!segmentationRepresentation) {
|
|
28
|
-
throw new Error(`segmentation representation with UID ${segmentationRepresentationUID} does not exist
|
|
28
|
+
throw new Error(`segmentation representation with UID ${segmentationRepresentationUID} does not exist`);
|
|
29
29
|
}
|
|
30
30
|
const { colorLUTIndex } = segmentationRepresentation;
|
|
31
31
|
const colorLUT = SegmentationState.getColorLUT(colorLUTIndex);
|
|
@@ -38,11 +38,11 @@ function getColorForSegmentIndex(toolGroupId, segmentationRepresentationUID, seg
|
|
|
38
38
|
}
|
|
39
39
|
return colorValue;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const colorReference =
|
|
41
|
+
function setSegmentIndexColor(segmentationRepresentationUID, segmentIndex, color) {
|
|
42
|
+
const colorReference = getSegmentIndexColor(segmentationRepresentationUID, segmentIndex);
|
|
43
43
|
for (let i = 0; i < color.length; i++) {
|
|
44
44
|
colorReference[i] = color[i];
|
|
45
45
|
}
|
|
46
|
-
triggerSegmentationRepresentationModified(
|
|
46
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
47
47
|
}
|
|
48
|
-
export {
|
|
48
|
+
export { getSegmentIndexColor, addColorLUT, setColorLUT, setSegmentIndexColor };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import SegmentationRepresentations from '../../../enums/SegmentationRepresentations';
|
|
2
|
-
import { RepresentationConfig, SegmentationRepresentationConfig,
|
|
2
|
+
import { RepresentationConfig, SegmentationRepresentationConfig, SegmentRepresentationConfig } from '../../../types/SegmentationStateTypes';
|
|
3
3
|
declare function getGlobalConfig(): SegmentationRepresentationConfig;
|
|
4
4
|
declare function setGlobalConfig(segmentationConfig: SegmentationRepresentationConfig): void;
|
|
5
5
|
declare function getGlobalRepresentationConfig(representationType: SegmentationRepresentations): RepresentationConfig['LABELMAP'];
|
|
6
6
|
declare function setGlobalRepresentationConfig(representationType: SegmentationRepresentations, config: RepresentationConfig['LABELMAP']): void;
|
|
7
|
-
declare function
|
|
8
|
-
declare function
|
|
9
|
-
declare function
|
|
10
|
-
declare function
|
|
11
|
-
declare function
|
|
12
|
-
declare function
|
|
13
|
-
export { getGlobalConfig, setGlobalConfig, getGlobalRepresentationConfig, setGlobalRepresentationConfig,
|
|
7
|
+
declare function getAllSegmentsConfig(segmentationRepresentationUID: string): RepresentationConfig;
|
|
8
|
+
declare function setAllSegmentsConfig(segmentationRepresentationUID: string, config: RepresentationConfig): void;
|
|
9
|
+
declare function setPerSegmentConfig(segmentationRepresentationUID: string, config: SegmentRepresentationConfig): void;
|
|
10
|
+
declare function getPerSegmentConfig(segmentationRepresentationUID: string): SegmentRepresentationConfig;
|
|
11
|
+
declare function setSegmentIndexConfig(segmentationRepresentationUID: string, segmentIndex: number, config: RepresentationConfig, suppressEvent?: boolean): void;
|
|
12
|
+
declare function getSegmentIndexConfig(segmentationRepresentationUID: string, segmentIndex: number): RepresentationConfig;
|
|
13
|
+
export { getGlobalConfig, setGlobalConfig, getGlobalRepresentationConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, setAllSegmentsConfig, setPerSegmentConfig, getPerSegmentConfig, setSegmentIndexConfig, getSegmentIndexConfig, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
2
|
+
import { triggerSegmentationRepresentationModified } from '../triggerSegmentationEvents';
|
|
2
3
|
function getGlobalConfig() {
|
|
3
4
|
return SegmentationState.getGlobalConfig();
|
|
4
5
|
}
|
|
@@ -22,22 +23,27 @@ function setGlobalRepresentationConfig(representationType, config) {
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
return SegmentationState.
|
|
26
|
+
function getAllSegmentsConfig(segmentationRepresentationUID) {
|
|
27
|
+
return SegmentationState.getAllSegmentsConfig(segmentationRepresentationUID);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
SegmentationState.
|
|
29
|
+
function setAllSegmentsConfig(segmentationRepresentationUID, config) {
|
|
30
|
+
SegmentationState.setAllSegmentsConfig(segmentationRepresentationUID, config);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
32
|
+
function setPerSegmentConfig(segmentationRepresentationUID, config) {
|
|
33
|
+
SegmentationState.setPerSegmentConfig(segmentationRepresentationUID, config);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
SegmentationState.
|
|
35
|
+
function getPerSegmentConfig(segmentationRepresentationUID) {
|
|
36
|
+
return SegmentationState.getPerSegmentConfig(segmentationRepresentationUID);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
38
|
+
function setSegmentIndexConfig(segmentationRepresentationUID, segmentIndex, config, suppressEvent = false) {
|
|
39
|
+
const perSegment = SegmentationState.getPerSegmentConfig(segmentationRepresentationUID);
|
|
40
|
+
perSegment[segmentIndex] = config;
|
|
41
|
+
if (!suppressEvent) {
|
|
42
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
|
-
function
|
|
41
|
-
SegmentationState.
|
|
45
|
+
function getSegmentIndexConfig(segmentationRepresentationUID, segmentIndex) {
|
|
46
|
+
const perSegment = SegmentationState.getPerSegmentConfig(segmentationRepresentationUID);
|
|
47
|
+
return perSegment?.[segmentIndex];
|
|
42
48
|
}
|
|
43
|
-
export { getGlobalConfig, setGlobalConfig, getGlobalRepresentationConfig, setGlobalRepresentationConfig,
|
|
49
|
+
export { getGlobalConfig, setGlobalConfig, getGlobalRepresentationConfig, setGlobalRepresentationConfig, getAllSegmentsConfig, setAllSegmentsConfig, setPerSegmentConfig, getPerSegmentConfig, setSegmentIndexConfig, getSegmentIndexConfig, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare function
|
|
3
|
-
declare function setSegmentsVisibility(
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
|
|
1
|
+
declare function setRepresentationVisibility(viewportId: string, segmentationRepresentationUID: string, visibility: boolean): void;
|
|
2
|
+
declare function getRepresentationVisibility(viewportId: string, segmentationRepresentationUID: string): boolean | undefined;
|
|
3
|
+
declare function setSegmentsVisibility(viewport: string, segmentationRepresentationUID: string, segmentIndices: number[], visibility: boolean): void;
|
|
4
|
+
declare function setSegmentIndexVisibility(viewportId: string, segmentationRepresentationUID: string, segmentIndex: number, visibility: boolean): void;
|
|
5
|
+
declare function getSegmentIndexVisibility(viewportId: string, segmentationRepresentationUID: string, segmentIndex: number): boolean;
|
|
6
|
+
declare function getSegmentsHidden(viewportId: string, segmentationRepresentationUID: string): Set<number>;
|
|
7
|
+
export { setRepresentationVisibility, getRepresentationVisibility, setSegmentsVisibility, setSegmentIndexVisibility, getSegmentIndexVisibility, getSegmentsHidden, };
|
|
@@ -1,69 +1,44 @@
|
|
|
1
1
|
import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
|
|
2
|
-
import { getSegmentationRepresentations } from '../../../stateManagement/segmentation/segmentationState';
|
|
3
|
-
import { getUniqueSegmentIndices } from '../../../utilities/segmentation';
|
|
4
2
|
import { triggerSegmentationRepresentationModified } from '../triggerSegmentationEvents';
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const representation = toolGroupSegmentationRepresentations.find((representation) => representation.segmentationRepresentationUID ===
|
|
11
|
-
segmentationRepresentationUID);
|
|
3
|
+
function setRepresentationVisibility(viewportId, segmentationRepresentationUID, visibility) {
|
|
4
|
+
const representation = SegmentationState.getRepresentation(segmentationRepresentationUID);
|
|
5
|
+
debugger;
|
|
12
6
|
if (!representation) {
|
|
13
7
|
return;
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (visibility) {
|
|
18
|
-
segmentsHidden.clear();
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
indices.forEach((index) => {
|
|
22
|
-
segmentsHidden.add(index);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
triggerSegmentationRepresentationModified(toolGroupId, representation.segmentationRepresentationUID);
|
|
9
|
+
SegmentationState.setRepresentationVisibility(viewportId, segmentationRepresentationUID, visibility);
|
|
10
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
26
11
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
const representation = toolGroupSegmentationRepresentations.find((representation) => representation.segmentationRepresentationUID ===
|
|
30
|
-
segmentationRepresentationUID);
|
|
31
|
-
if (!representation) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const { segmentsHidden, segmentationId } = representation;
|
|
35
|
-
const indices = getUniqueSegmentIndices(segmentationId);
|
|
36
|
-
const indicesSet = new Set(indices);
|
|
37
|
-
segmentsHidden.forEach((segmentIndex) => indicesSet.delete(segmentIndex));
|
|
38
|
-
return !!indicesSet.size;
|
|
12
|
+
function getRepresentationVisibility(viewportId, segmentationRepresentationUID) {
|
|
13
|
+
return SegmentationState.getRepresentationVisibility(viewportId, segmentationRepresentationUID);
|
|
39
14
|
}
|
|
40
|
-
function setSegmentsVisibility(
|
|
41
|
-
const
|
|
42
|
-
if (!segRepresentation) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
15
|
+
function setSegmentsVisibility(viewport, segmentationRepresentationUID, segmentIndices, visibility) {
|
|
16
|
+
const hiddenSegments = getSegmentsHidden(viewport, segmentationRepresentationUID);
|
|
45
17
|
segmentIndices.forEach((segmentIndex) => {
|
|
46
18
|
visibility
|
|
47
|
-
?
|
|
48
|
-
:
|
|
19
|
+
? hiddenSegments.delete(segmentIndex)
|
|
20
|
+
: hiddenSegments.add(segmentIndex);
|
|
49
21
|
});
|
|
50
|
-
triggerSegmentationRepresentationModified(
|
|
22
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
51
23
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
24
|
+
function setSegmentIndexVisibility(viewportId, segmentationRepresentationUID, segmentIndex, visibility) {
|
|
25
|
+
const hiddenSegments = getSegmentsHidden(viewportId, segmentationRepresentationUID);
|
|
26
|
+
debugger;
|
|
57
27
|
visibility
|
|
58
|
-
?
|
|
59
|
-
:
|
|
60
|
-
triggerSegmentationRepresentationModified(
|
|
28
|
+
? hiddenSegments.delete(segmentIndex)
|
|
29
|
+
: hiddenSegments.add(segmentIndex);
|
|
30
|
+
triggerSegmentationRepresentationModified(segmentationRepresentationUID);
|
|
31
|
+
}
|
|
32
|
+
function getSegmentIndexVisibility(viewportId, segmentationRepresentationUID, segmentIndex) {
|
|
33
|
+
const hiddenSegments = getSegmentsHidden(viewportId, segmentationRepresentationUID);
|
|
34
|
+
return !hiddenSegments.has(segmentIndex);
|
|
61
35
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
return
|
|
36
|
+
function getSegmentsHidden(viewportId, segmentationRepresentationUID) {
|
|
37
|
+
const viewportRenderingState = SegmentationState.getRepresentationsRenderingStateForViewport(viewportId);
|
|
38
|
+
if (!viewportRenderingState) {
|
|
39
|
+
return new Set();
|
|
66
40
|
}
|
|
67
|
-
return
|
|
41
|
+
return (viewportRenderingState[segmentationRepresentationUID]?.segmentsHidden ??
|
|
42
|
+
new Set());
|
|
68
43
|
}
|
|
69
|
-
export {
|
|
44
|
+
export { setRepresentationVisibility, getRepresentationVisibility, setSegmentsVisibility, setSegmentIndexVisibility, getSegmentIndexVisibility, getSegmentsHidden, };
|
|
@@ -9,7 +9,7 @@ declare function computeVolumeSegmentationFromStack({ imageIdReferenceMap, optio
|
|
|
9
9
|
declare function convertStackToVolumeSegmentation({ segmentationId, options, }: {
|
|
10
10
|
segmentationId: string;
|
|
11
11
|
options?: {
|
|
12
|
-
|
|
12
|
+
viewportId: string;
|
|
13
13
|
volumeId?: string;
|
|
14
14
|
removeOriginal?: boolean;
|
|
15
15
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { volumeLoader, utilities as csUtils, eventTarget, cache, } from '@cornerstonejs/core';
|
|
2
2
|
import { Events, SegmentationRepresentations } from '../../enums';
|
|
3
|
-
import
|
|
3
|
+
import addRepresentations from './addRepresentations';
|
|
4
4
|
import { triggerSegmentationRender } from '../../utilities/segmentation';
|
|
5
5
|
import { getSegmentation } from './segmentationState';
|
|
6
6
|
import { triggerSegmentationDataModified } from './triggerSegmentationEvents';
|
|
@@ -25,12 +25,12 @@ async function convertStackToVolumeSegmentation({ segmentationId, options, }) {
|
|
|
25
25
|
});
|
|
26
26
|
await updateSegmentationState({
|
|
27
27
|
segmentationId,
|
|
28
|
-
|
|
28
|
+
viewportId: options.viewportId,
|
|
29
29
|
options,
|
|
30
30
|
volumeId,
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
async function updateSegmentationState({ segmentationId,
|
|
33
|
+
async function updateSegmentationState({ segmentationId, viewportId, volumeId, options, }) {
|
|
34
34
|
const segmentation = getSegmentation(segmentationId);
|
|
35
35
|
if (options?.removeOriginal) {
|
|
36
36
|
const data = segmentation.representationData
|
|
@@ -49,13 +49,13 @@ async function updateSegmentationState({ segmentationId, toolGroupId, volumeId,
|
|
|
49
49
|
volumeId,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
await
|
|
52
|
+
await addRepresentations(viewportId, [
|
|
53
53
|
{
|
|
54
54
|
segmentationId,
|
|
55
55
|
type: SegmentationRepresentations.Labelmap,
|
|
56
56
|
},
|
|
57
57
|
]);
|
|
58
|
-
triggerSegmentationRender(
|
|
58
|
+
triggerSegmentationRender(viewportId);
|
|
59
59
|
eventTarget.addEventListenerOnce(Events.SEGMENTATION_RENDERED, () => triggerSegmentationDataModified(segmentationId));
|
|
60
60
|
}
|
|
61
61
|
export { convertStackToVolumeSegmentation, computeVolumeSegmentationFromStack };
|
|
@@ -6,14 +6,14 @@ export declare function computeStackSegmentationFromVolume({ volumeId, }: {
|
|
|
6
6
|
export declare function convertVolumeToStackSegmentation({ segmentationId, options, }: {
|
|
7
7
|
segmentationId: string;
|
|
8
8
|
options?: {
|
|
9
|
-
|
|
9
|
+
viewportId: string;
|
|
10
10
|
newSegmentationId?: string;
|
|
11
11
|
removeOriginal?: boolean;
|
|
12
12
|
};
|
|
13
13
|
}): Promise<void>;
|
|
14
|
-
export declare function updateStackSegmentationState({ segmentationId,
|
|
14
|
+
export declare function updateStackSegmentationState({ segmentationId, viewportId, imageIdReferenceMap, options, }: {
|
|
15
15
|
segmentationId: string;
|
|
16
|
-
|
|
16
|
+
viewportId: string;
|
|
17
17
|
imageIdReferenceMap: Map<any, any>;
|
|
18
18
|
options?: {
|
|
19
19
|
removeOriginal?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cache, eventTarget, getRenderingEngines, } from '@cornerstonejs/core';
|
|
2
2
|
import { Events, SegmentationRepresentations } from '../../enums';
|
|
3
|
-
import
|
|
3
|
+
import addRepresentations from './addRepresentations';
|
|
4
4
|
import { triggerSegmentationRender, createImageIdReferenceMap, } from '../../utilities/segmentation';
|
|
5
5
|
import { getSegmentation } from './segmentationState';
|
|
6
6
|
import { triggerSegmentationDataModified } from './triggerSegmentationEvents';
|
|
@@ -28,12 +28,12 @@ export async function convertVolumeToStackSegmentation({ segmentationId, options
|
|
|
28
28
|
});
|
|
29
29
|
await updateStackSegmentationState({
|
|
30
30
|
segmentationId,
|
|
31
|
-
|
|
31
|
+
viewportId: options.viewportId,
|
|
32
32
|
imageIdReferenceMap,
|
|
33
33
|
options,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
export async function updateStackSegmentationState({ segmentationId,
|
|
36
|
+
export async function updateStackSegmentationState({ segmentationId, viewportId, imageIdReferenceMap, options, }) {
|
|
37
37
|
const segmentation = getSegmentation(segmentationId);
|
|
38
38
|
if (options?.removeOriginal) {
|
|
39
39
|
const data = segmentation.representationData
|
|
@@ -51,13 +51,13 @@ export async function updateStackSegmentationState({ segmentationId, toolGroupId
|
|
|
51
51
|
imageIdReferenceMap,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
await
|
|
54
|
+
await addRepresentations(viewportId, [
|
|
55
55
|
{
|
|
56
56
|
segmentationId,
|
|
57
57
|
type: SegmentationRepresentations.Labelmap,
|
|
58
58
|
},
|
|
59
59
|
]);
|
|
60
|
-
triggerSegmentationRender(
|
|
60
|
+
triggerSegmentationRender();
|
|
61
61
|
eventTarget.addEventListenerOnce(Events.SEGMENTATION_RENDERED, () => triggerSegmentationDataModified(segmentationId));
|
|
62
62
|
}
|
|
63
63
|
function _getImageIdReferenceMapForStackSegmentation(segmentationVolume) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SegmentationRepresentations from '../../../enums/SegmentationRepresentations';
|
|
2
2
|
import { getRepresentationRenderingConfig as getLabelmapRenderingConfig } from '../../../tools/displayTools/Labelmap/labelmapDisplay';
|
|
3
|
-
export function
|
|
3
|
+
export function getRepresentationRenderingConfig(representationInput) {
|
|
4
4
|
const { type } = representationInput;
|
|
5
5
|
if (type === SegmentationRepresentations.Labelmap) {
|
|
6
6
|
return getLabelmapRenderingConfig();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import removeRepresentationsFromViewport from './removeRepresentationsFromViewport';
|
|
2
2
|
import addSegmentations from './addSegmentations';
|
|
3
|
-
import
|
|
3
|
+
import addRepresentations from './addRepresentations';
|
|
4
4
|
import addRepresentationData from './addRepresentationData';
|
|
5
5
|
import { convertStackToVolumeSegmentation } from './convertStackToVolumeSegmentation';
|
|
6
6
|
import { convertVolumeToStackSegmentation } from './convertVolumeToStackSegmentation';
|
|
@@ -11,4 +11,4 @@ import * as config from './config';
|
|
|
11
11
|
import * as segmentIndex from './segmentIndex';
|
|
12
12
|
import * as triggerSegmentationEvents from './triggerSegmentationEvents';
|
|
13
13
|
import * as polySegManager from './polySeg';
|
|
14
|
-
export { addSegmentations,
|
|
14
|
+
export { addSegmentations, addRepresentations, removeRepresentationsFromViewport, addRepresentationData, state, activeSegmentation, segmentLocking, config, segmentIndex, triggerSegmentationEvents, convertStackToVolumeSegmentation, convertVolumeToStackSegmentation, polySegManager as polySeg, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import removeRepresentationsFromViewport from './removeRepresentationsFromViewport';
|
|
2
2
|
import addSegmentations from './addSegmentations';
|
|
3
|
-
import
|
|
3
|
+
import addRepresentations from './addRepresentations';
|
|
4
4
|
import addRepresentationData from './addRepresentationData';
|
|
5
5
|
import { convertStackToVolumeSegmentation } from './convertStackToVolumeSegmentation';
|
|
6
6
|
import { convertVolumeToStackSegmentation } from './convertVolumeToStackSegmentation';
|
|
@@ -11,4 +11,4 @@ import * as config from './config';
|
|
|
11
11
|
import * as segmentIndex from './segmentIndex';
|
|
12
12
|
import * as triggerSegmentationEvents from './triggerSegmentationEvents';
|
|
13
13
|
import * as polySegManager from './polySeg';
|
|
14
|
-
export { addSegmentations,
|
|
14
|
+
export { addSegmentations, addRepresentations, removeRepresentationsFromViewport, addRepresentationData, state, activeSegmentation, segmentLocking, config, segmentIndex, triggerSegmentationEvents, convertStackToVolumeSegmentation, convertVolumeToStackSegmentation, polySegManager as polySeg, };
|
package/dist/esm/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { cache } from '@cornerstonejs/core';
|
|
2
2
|
import { getUniqueSegmentIndices } from '../../../../utilities/segmentation';
|
|
3
|
-
import { getSegmentation,
|
|
3
|
+
import { getSegmentation, setAllSegmentsConfig } from '../../segmentationState';
|
|
4
4
|
import { computeSurfaceFromLabelmapSegmentation } from '../Surface/surfaceComputationStrategies';
|
|
5
5
|
import { clipAndCacheSurfacesForViewport, } from '../../helpers/clipAndCacheSurfacesForViewport';
|
|
6
6
|
import { extractContourData } from './utils/extractContourData';
|
|
7
7
|
import { createAndAddContourSegmentationsFromClippedSurfaces } from './utils/createAndAddContourSegmentationsFromClippedSurfaces';
|
|
8
|
-
import { getToolGroupForViewport } from '../../../../store/ToolGroupManager';
|
|
9
8
|
export async function computeContourData(segmentationId, options = {}) {
|
|
10
9
|
const segmentIndices = options.segmentIndices?.length
|
|
11
10
|
? options.segmentIndices
|
|
@@ -36,8 +35,7 @@ export async function computeContourData(segmentationId, options = {}) {
|
|
|
36
35
|
}
|
|
37
36
|
const { viewport, segmentationRepresentationUID } = options;
|
|
38
37
|
const annotationUIDsMap = createAndAddContourSegmentationsFromClippedSurfaces(rawContourData, viewport, segmentationId);
|
|
39
|
-
|
|
40
|
-
setSegmentationRepresentationSpecificConfig(toolGroupId, segmentationRepresentationUID, {
|
|
38
|
+
setAllSegmentsConfig(segmentationRepresentationUID, {
|
|
41
39
|
CONTOUR: {
|
|
42
40
|
fillAlpha: 0,
|
|
43
41
|
},
|
package/dist/esm/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Enums, geometryLoader } from '@cornerstonejs/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getSegmentIndexColor } from '../../config/segmentationColor';
|
|
3
|
+
import { getRepresentation, getSegmentation } from '../../segmentationState';
|
|
4
4
|
export async function createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesData, options = {}) {
|
|
5
|
-
let segmentationRepresentation
|
|
5
|
+
let segmentationRepresentation;
|
|
6
6
|
if (options.segmentationRepresentationUID) {
|
|
7
|
-
|
|
8
|
-
findSegmentationRepresentationByUID(options.segmentationRepresentationUID));
|
|
7
|
+
segmentationRepresentation = getRepresentation(options.segmentationRepresentationUID);
|
|
9
8
|
}
|
|
10
9
|
const segmentation = getSegmentation(segmentationId);
|
|
11
10
|
const geometryIds = new Map();
|
|
@@ -13,7 +12,7 @@ export async function createAndCacheSurfacesFromRaw(segmentationId, rawSurfacesD
|
|
|
13
12
|
const rawSurfaceData = rawSurfacesData[index];
|
|
14
13
|
const segmentIndex = rawSurfaceData.segmentIndex;
|
|
15
14
|
const color = segmentationRepresentation;
|
|
16
|
-
|
|
15
|
+
getSegmentIndexColor(segmentationRepresentation.segmentationRepresentationUID, segmentIndex).slice(0, 3);
|
|
17
16
|
if (!color) {
|
|
18
17
|
throw new Error('No color found for segment index, unable to create surface');
|
|
19
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cache } from '@cornerstonejs/core';
|
|
2
2
|
import { getUniqueSegmentIndices } from '../../../../utilities/segmentation';
|
|
3
|
-
import { getSegmentation,
|
|
3
|
+
import { getSegmentation, getRepresentationsForViewport, getViewportIdsWithSegmentationId, } from '../../segmentationState';
|
|
4
4
|
import { triggerSegmentationModified } from '../../triggerSegmentationEvents';
|
|
5
5
|
import { SegmentationRepresentations } from '../../../../enums';
|
|
6
6
|
import { computeSurfaceFromLabelmapSegmentation } from './surfaceComputationStrategies';
|
|
@@ -27,9 +27,9 @@ export async function updateSurfaceData(segmentationId) {
|
|
|
27
27
|
const geometryId = `segmentation_${segmentationId}_surface_${segmentIndex}`;
|
|
28
28
|
const geometry = cache.getGeometry(geometryId);
|
|
29
29
|
if (!geometry) {
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
const segmentationRepresentations =
|
|
30
|
+
const viewportIds = getViewportIdsWithSegmentationId(segmentationId);
|
|
31
|
+
return viewportIds.map((viewportId) => {
|
|
32
|
+
const segmentationRepresentations = getRepresentationsForViewport(viewportId);
|
|
33
33
|
return segmentationRepresentations.map((segmentationRepresentation) => {
|
|
34
34
|
if (segmentationRepresentation.type !==
|
|
35
35
|
SegmentationRepresentations.Surface) {
|