@cornerstonejs/tools 1.71.0 → 1.71.2

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.
Files changed (76) hide show
  1. package/dist/cjs/tools/displayTools/Contour/contourConfig.js +2 -2
  2. package/dist/cjs/tools/displayTools/Contour/contourConfig.js.map +1 -1
  3. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js +8 -6
  4. package/dist/cjs/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  5. package/dist/cjs/tools/displayTools/Contour/contourHandler/contourConfigCache.js.map +1 -0
  6. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +6 -0
  7. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +124 -0
  8. package/dist/cjs/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js.map +1 -0
  9. package/dist/cjs/tools/displayTools/Contour/contourHandler/utils.js.map +1 -0
  10. package/dist/cjs/tools/displayTools/Contour/removeContourFromElement.d.ts +1 -1
  11. package/dist/cjs/tools/displayTools/Contour/removeContourFromElement.js +12 -9
  12. package/dist/cjs/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
  13. package/dist/esm/tools/displayTools/Contour/contourConfig.js +2 -2
  14. package/dist/esm/tools/displayTools/Contour/contourConfig.js.map +1 -1
  15. package/dist/esm/tools/displayTools/Contour/contourDisplay.js +8 -7
  16. package/dist/esm/tools/displayTools/Contour/contourDisplay.js.map +1 -1
  17. package/dist/esm/tools/displayTools/Contour/contourHandler/contourConfigCache.js.map +1 -0
  18. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js +119 -0
  19. package/dist/esm/tools/displayTools/Contour/contourHandler/handleContourSegmentation.js.map +1 -0
  20. package/dist/esm/tools/displayTools/Contour/contourHandler/utils.js.map +1 -0
  21. package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js +12 -9
  22. package/dist/esm/tools/displayTools/Contour/removeContourFromElement.js.map +1 -1
  23. package/dist/types/tools/displayTools/Contour/contourDisplay.d.ts.map +1 -1
  24. package/dist/types/tools/displayTools/Contour/contourHandler/contourConfigCache.d.ts.map +1 -0
  25. package/dist/types/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts +7 -0
  26. package/dist/types/tools/displayTools/Contour/contourHandler/handleContourSegmentation.d.ts.map +1 -0
  27. package/dist/types/tools/displayTools/Contour/contourHandler/utils.d.ts.map +1 -0
  28. package/dist/types/tools/displayTools/Contour/removeContourFromElement.d.ts +1 -1
  29. package/dist/types/tools/displayTools/Contour/removeContourFromElement.d.ts.map +1 -1
  30. package/dist/umd/index.js +1 -1
  31. package/dist/umd/index.js.map +1 -1
  32. package/package.json +3 -3
  33. package/src/tools/displayTools/Contour/contourConfig.ts +2 -2
  34. package/src/tools/displayTools/Contour/contourDisplay.ts +14 -91
  35. package/src/tools/displayTools/Contour/contourHandler/handleContourSegmentation.ts +207 -0
  36. package/src/tools/displayTools/Contour/removeContourFromElement.ts +20 -14
  37. package/dist/cjs/tools/displayTools/Contour/vtkContour/addContourSetsToElement.d.ts +0 -3
  38. package/dist/cjs/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js +0 -73
  39. package/dist/cjs/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +0 -1
  40. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +0 -3
  41. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js +0 -14
  42. package/dist/cjs/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +0 -1
  43. package/dist/cjs/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +0 -1
  44. package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +0 -3
  45. package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js +0 -98
  46. package/dist/cjs/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +0 -1
  47. package/dist/cjs/tools/displayTools/Contour/vtkContour/utils.js.map +0 -1
  48. package/dist/esm/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js +0 -66
  49. package/dist/esm/tools/displayTools/Contour/vtkContour/addContourSetsToElement.js.map +0 -1
  50. package/dist/esm/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js +0 -10
  51. package/dist/esm/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.js.map +0 -1
  52. package/dist/esm/tools/displayTools/Contour/vtkContour/contourConfigCache.js.map +0 -1
  53. package/dist/esm/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js +0 -93
  54. package/dist/esm/tools/displayTools/Contour/vtkContour/updateVTKContourSets.js.map +0 -1
  55. package/dist/esm/tools/displayTools/Contour/vtkContour/utils.js.map +0 -1
  56. package/dist/types/tools/displayTools/Contour/vtkContour/addContourSetsToElement.d.ts +0 -4
  57. package/dist/types/tools/displayTools/Contour/vtkContour/addContourSetsToElement.d.ts.map +0 -1
  58. package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts +0 -4
  59. package/dist/types/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.d.ts.map +0 -1
  60. package/dist/types/tools/displayTools/Contour/vtkContour/contourConfigCache.d.ts.map +0 -1
  61. package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts +0 -4
  62. package/dist/types/tools/displayTools/Contour/vtkContour/updateVTKContourSets.d.ts.map +0 -1
  63. package/dist/types/tools/displayTools/Contour/vtkContour/utils.d.ts.map +0 -1
  64. package/src/tools/displayTools/Contour/vtkContour/addContourSetsToElement.ts +0 -113
  65. package/src/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.ts +0 -28
  66. package/src/tools/displayTools/Contour/vtkContour/updateVTKContourSets.ts +0 -155
  67. /package/dist/cjs/tools/displayTools/Contour/{vtkContour → contourHandler}/contourConfigCache.d.ts +0 -0
  68. /package/dist/cjs/tools/displayTools/Contour/{vtkContour → contourHandler}/contourConfigCache.js +0 -0
  69. /package/dist/cjs/tools/displayTools/Contour/{vtkContour → contourHandler}/utils.d.ts +0 -0
  70. /package/dist/cjs/tools/displayTools/Contour/{vtkContour → contourHandler}/utils.js +0 -0
  71. /package/dist/esm/tools/displayTools/Contour/{vtkContour → contourHandler}/contourConfigCache.js +0 -0
  72. /package/dist/esm/tools/displayTools/Contour/{vtkContour → contourHandler}/utils.js +0 -0
  73. /package/dist/types/tools/displayTools/Contour/{vtkContour → contourHandler}/contourConfigCache.d.ts +0 -0
  74. /package/dist/types/tools/displayTools/Contour/{vtkContour → contourHandler}/utils.d.ts +0 -0
  75. /package/src/tools/displayTools/Contour/{vtkContour → contourHandler}/contourConfigCache.ts +0 -0
  76. /package/src/tools/displayTools/Contour/{vtkContour → contourHandler}/utils.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "1.71.0",
3
+ "version": "1.71.2",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
30
30
  },
31
31
  "dependencies": {
32
- "@cornerstonejs/core": "^1.71.0",
32
+ "@cornerstonejs/core": "^1.71.2",
33
33
  "@icr/polyseg-wasm": "0.4.0",
34
34
  "@types/offscreencanvas": "2019.7.3",
35
35
  "comlink": "^4.4.1",
@@ -59,5 +59,5 @@
59
59
  "type": "individual",
60
60
  "url": "https://ohif.org/donate"
61
61
  },
62
- "gitHead": "03c01970a50a7383de86bb15c8d4f344a8ff7d25"
62
+ "gitHead": "7adfc02d0c2268d971df17450c825c54a082bd3f"
63
63
  }
@@ -3,7 +3,7 @@ import { ContourConfig } from '../../../types/ContourTypes';
3
3
  const defaultContourConfig: ContourConfig = {
4
4
  renderOutline: true,
5
5
  outlineWidthAutoGenerated: 3,
6
- outlineWidthActive: 2,
6
+ outlineWidthActive: 1,
7
7
  outlineWidthInactive: 1,
8
8
  outlineOpacity: 1,
9
9
  outlineOpacityInactive: 0.85,
@@ -11,7 +11,7 @@ const defaultContourConfig: ContourConfig = {
11
11
  outlineDashInactive: undefined,
12
12
  outlineDashAutoGenerated: '5,3',
13
13
  activeSegmentOutlineWidthDelta: 0,
14
- renderFill: true,
14
+ renderFill: false,
15
15
  fillAlpha: 0.5,
16
16
  fillAlphaInactive: 0.3,
17
17
  fillAlphaAutoGenerated: 0.3,
@@ -1,8 +1,4 @@
1
- import {
2
- getEnabledElementByIds,
3
- Types,
4
- BaseVolumeViewport,
5
- } from '@cornerstonejs/core';
1
+ import { getEnabledElementByIds, Types } from '@cornerstonejs/core';
6
2
 
7
3
  import Representations from '../../../enums/SegmentationRepresentations';
8
4
  import * as SegmentationState from '../../../stateManagement/segmentation/segmentationState';
@@ -11,10 +7,10 @@ import {
11
7
  SegmentationRepresentationConfig,
12
8
  ToolGroupSpecificRepresentation,
13
9
  } from '../../../types/SegmentationStateTypes';
14
- import { addOrUpdateVTKContourSets } from './vtkContour/addOrUpdateVTKContourSets';
15
10
  import removeContourFromElement from './removeContourFromElement';
16
- import { deleteConfigCache } from './vtkContour/contourConfigCache';
11
+ import { deleteConfigCache } from './contourHandler/contourConfigCache';
17
12
  import { polySeg } from '../../../stateManagement/segmentation';
13
+ import { handleContourSegmentation } from './contourHandler/handleContourSegmentation';
18
14
 
19
15
  let polySegConversionInProgress = false;
20
16
 
@@ -95,89 +91,19 @@ async function render(
95
91
  );
96
92
  }
97
93
 
98
- // From here to below it is basically the legacy geometryId based
99
- // contour rendering via vtkActors that has some bugs for display,
100
- // as it sometimes appear and sometimes not, and it is not clear.
101
- // We have moved to the new SVG based contours via our annotation tools
102
- // check out annotationUIDsMap in the ContourSegmentationData type
103
- const { geometryIds } = contourData;
104
-
105
- if (!geometryIds?.length || !(viewport instanceof BaseVolumeViewport)) {
94
+ if (!contourData) {
106
95
  return;
107
96
  }
108
97
 
109
- // add the contour sets to the viewport
110
- addOrUpdateVTKContourSets(
111
- viewport,
112
- geometryIds,
113
- representationConfig,
114
- toolGroupConfig
115
- );
116
-
117
- /**
118
- * The following logic could be added if we want to support the use case
119
- * where the contour representation data is initiated using annotations
120
- * in the state from the get-go , and not when the user draws a contour.
121
- */
122
- // if (contourData?.points?.length) {
123
- // // contourData = createAnnotationsFromPoints(contourData.points);
124
- // const contourSegmentationAnnotation = {
125
- // annotationUID: csUtils.uuidv4(),
126
- // data: {
127
- // contour: {
128
- // closed: true,
129
- // polyline: contourData.points,
130
- // },
131
- // segmentation: {
132
- // segmentationId,
133
- // segmentIndex: 1, // Todo
134
- // segmentationRepresentationUID:
135
- // representationConfig.segmentationRepresentationUID,
136
- // },
137
- // },
138
- // highlighted: false,
139
- // invalidated: false,
140
- // isLocked: false,
141
- // isVisible: true,
142
- // metadata: {
143
- // toolName: 'PlanarFreehandContourSegmentationTool',
144
- // FrameOfReferenceUID: viewport.getFrameOfReferenceUID(),
145
- // viewPlaneNormal: viewport.getCamera().viewPlaneNormal,
146
- // },
147
- // };
148
-
149
- // addAnnotation(contourSegmentationAnnotation, viewport.element);
150
- // } else if (
151
- // !contourData &&
152
- // polySeg.canComputeRequestedRepresentation(
153
- // representationConfig.segmentationRepresentationUID
154
- // )
155
- // ) {
156
- // contourData = await polySeg.computeAndAddContourRepresentation(
157
- // segmentationId,
158
- // {
159
- // segmentationRepresentationUID:
160
- // representationConfig.segmentationRepresentationUID,
161
- // viewport,
162
- // }
163
- // );
164
- // }
165
-
166
- // if (contourData?.geometryIds?.length) {
167
- // handleVTKContour({
168
- // viewport,
169
- // representationConfig,
170
- // toolGroupConfig,
171
- // geometryIds: contourData.geometryIds,
172
- // });
173
- // } else if (contourData.annotationUIDsMap?.size) {
174
- // handleContourAnnotationSegmentation({
175
- // viewport,
176
- // representationConfig,
177
- // toolGroupConfig,
178
- // annotationUIDsMap: contourData.annotationUIDsMap,
179
- // });
180
- // }
98
+ if (contourData?.geometryIds?.length) {
99
+ handleContourSegmentation(
100
+ viewport,
101
+ contourData.geometryIds,
102
+ contourData.annotationUIDsMap,
103
+ representationConfig,
104
+ toolGroupConfig
105
+ );
106
+ }
181
107
  }
182
108
 
183
109
  function _removeContourFromToolGroupViewports(
@@ -198,10 +124,7 @@ function _removeContourFromToolGroupViewports(
198
124
  viewportId,
199
125
  renderingEngineId
200
126
  );
201
- removeContourFromElement(
202
- enabledElement.viewport.element,
203
- segmentationRepresentationUID
204
- );
127
+ removeContourFromElement(segmentationRepresentationUID, toolGroupId);
205
128
  }
206
129
  }
207
130
 
@@ -0,0 +1,207 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable @typescript-eslint/no-empty-function */
3
+
4
+ import { addAnnotation } from '../../../../stateManagement';
5
+ import { cache, Types, utilities } from '@cornerstonejs/core';
6
+
7
+ import {
8
+ SegmentationRepresentationConfig,
9
+ ToolGroupSpecificContourRepresentation,
10
+ } from '../../../../types';
11
+ import { getConfigCache, setConfigCache } from './contourConfigCache';
12
+ import { getSegmentSpecificConfig } from './utils';
13
+ import { addContourSegmentationAnnotation } from '../../../../utilities/contourSegmentation';
14
+
15
+ import { validateGeometry } from './utils';
16
+
17
+ function handleContourSegmentation(
18
+ viewport: Types.IVolumeViewport,
19
+ geometryIds: string[],
20
+ annotationUIDsMap: Map<number, Set<string>>,
21
+ contourRepresentation: ToolGroupSpecificContourRepresentation,
22
+ contourRepresentationConfig: SegmentationRepresentationConfig
23
+ ) {
24
+ const addOrUpdateFn = annotationUIDsMap.size
25
+ ? updateContourSets
26
+ : addContourSetsToElement;
27
+ addOrUpdateFn(
28
+ viewport,
29
+ geometryIds,
30
+ contourRepresentation,
31
+ contourRepresentationConfig
32
+ );
33
+ }
34
+
35
+ function updateContourSets(
36
+ viewport: Types.IVolumeViewport,
37
+ geometryIds: string[],
38
+ contourRepresentation: ToolGroupSpecificContourRepresentation,
39
+ contourRepresentationConfig: SegmentationRepresentationConfig
40
+ ) {
41
+ const { segmentationRepresentationUID, segmentsHidden } =
42
+ contourRepresentation;
43
+ const newContourConfig = contourRepresentationConfig.representations.CONTOUR;
44
+ const cachedConfig = getConfigCache(segmentationRepresentationUID);
45
+
46
+ const newOutlineWithActive = newContourConfig.outlineWidthActive;
47
+
48
+ if (cachedConfig?.outlineWidthActive !== newOutlineWithActive) {
49
+ setConfigCache(
50
+ segmentationRepresentationUID,
51
+ Object.assign({}, cachedConfig, {
52
+ outlineWidthActive: newOutlineWithActive,
53
+ })
54
+ );
55
+ }
56
+
57
+ const segmentsToSetToInvisible = [];
58
+ const segmentsToSetToVisible = [];
59
+
60
+ for (const segmentIndex of segmentsHidden) {
61
+ if (!cachedConfig.segmentsHidden.has(segmentIndex)) {
62
+ segmentsToSetToInvisible.push(segmentIndex);
63
+ }
64
+ }
65
+
66
+ for (const segmentIndex of cachedConfig.segmentsHidden) {
67
+ if (!segmentsHidden.has(segmentIndex)) {
68
+ segmentsToSetToVisible.push(segmentIndex);
69
+ }
70
+ }
71
+
72
+ const mergedInvisibleSegments = Array.from(cachedConfig.segmentsHidden)
73
+ .filter((segmentIndex) => !segmentsToSetToVisible.includes(segmentIndex))
74
+ .concat(segmentsToSetToInvisible);
75
+
76
+ const { segmentSpecificConfigs } = geometryIds.reduce(
77
+ (acc, geometryId) => {
78
+ const geometry = cache.getGeometry(geometryId);
79
+ const { data: contourSet } = geometry;
80
+ const segmentIndex = (contourSet as Types.IContourSet).getSegmentIndex();
81
+ const segmentSpecificConfig = getSegmentSpecificConfig(
82
+ contourRepresentation,
83
+ geometryId,
84
+ segmentIndex
85
+ );
86
+ acc.segmentSpecificConfigs[segmentIndex] = segmentSpecificConfig ?? {};
87
+
88
+ return acc;
89
+ },
90
+ { contourSets: [], segmentSpecificConfigs: {} }
91
+ );
92
+
93
+ const affectedSegments = [
94
+ ...mergedInvisibleSegments,
95
+ ...segmentsToSetToVisible,
96
+ ];
97
+
98
+ const hasCustomSegmentSpecificConfig = Object.values(
99
+ segmentSpecificConfigs
100
+ ).some((config) => Object.keys(config).length > 0);
101
+
102
+ if (affectedSegments.length || hasCustomSegmentSpecificConfig) {
103
+ setConfigCache(
104
+ segmentationRepresentationUID,
105
+ Object.assign({}, cachedConfig, {
106
+ segmentsHidden: new Set(segmentsHidden),
107
+ })
108
+ );
109
+ }
110
+
111
+ viewport.render();
112
+ }
113
+
114
+ function addContourSetsToElement(
115
+ viewport: Types.IVolumeViewport,
116
+ geometryIds: string[],
117
+ contourRepresentation: ToolGroupSpecificContourRepresentation,
118
+ contourRepresentationConfig: SegmentationRepresentationConfig
119
+ ) {
120
+ const { segmentationRepresentationUID, segmentationId, segmentsHidden } =
121
+ contourRepresentation;
122
+ const segmentSpecificMap = new Map();
123
+ geometryIds.forEach((geometryId) => {
124
+ const geometry = cache.getGeometry(geometryId);
125
+
126
+ if (!geometry) {
127
+ console.warn(
128
+ `No geometry found for geometryId ${geometryId}. Skipping render.`
129
+ );
130
+ return;
131
+ }
132
+
133
+ const segmentIndex = (geometry.data as Types.IContourSet).getSegmentIndex();
134
+
135
+ validateGeometry(geometry);
136
+
137
+ const segmentSpecificConfig = getSegmentSpecificConfig(
138
+ contourRepresentation,
139
+ geometryId,
140
+ segmentIndex
141
+ );
142
+
143
+ const contourSet = geometry.data as Types.IContourSet;
144
+
145
+ contourSet.contours.forEach((contour) => {
146
+ const { points, color, id } = contour;
147
+ const contourSegmentationAnnotation = {
148
+ annotationUID: utilities.uuidv4(),
149
+ data: {
150
+ contour: {
151
+ closed: true,
152
+ polyline: points,
153
+ },
154
+ segmentation: {
155
+ segmentationId,
156
+ segmentIndex,
157
+ color,
158
+ id,
159
+ },
160
+ handles: {},
161
+ },
162
+ handles: {},
163
+ highlighted: false,
164
+ autoGenerated: false,
165
+ invalidated: false,
166
+ isLocked: false,
167
+ isVisible: true,
168
+ metadata: {
169
+ referencedImageId: viewport.getCurrentImageId(),
170
+ toolName: 'PlanarFreehandContourSegmentationTool',
171
+ FrameOfReferenceUID: viewport.getFrameOfReferenceUID(),
172
+ viewPlaneNormal: viewport.getCamera().viewPlaneNormal,
173
+ },
174
+ };
175
+ const annotationGroupSelector = viewport.element;
176
+
177
+ addAnnotation(contourSegmentationAnnotation, annotationGroupSelector);
178
+
179
+ addContourSegmentationAnnotation(contourSegmentationAnnotation);
180
+ });
181
+
182
+ if (segmentSpecificConfig) {
183
+ segmentSpecificMap.set(segmentIndex, segmentSpecificConfig);
184
+ }
185
+ });
186
+
187
+ const outlineWidthActive =
188
+ contourRepresentationConfig.representations.CONTOUR.outlineWidthActive;
189
+
190
+ setConfigCache(
191
+ segmentationRepresentationUID,
192
+ Object.assign({}, getConfigCache(segmentationRepresentationUID), {
193
+ segmentsHidden: new Set(segmentsHidden),
194
+ segmentSpecificMap,
195
+ outlineWidthActive,
196
+ })
197
+ );
198
+
199
+ viewport.resetCamera();
200
+ viewport.render();
201
+ }
202
+
203
+ export {
204
+ handleContourSegmentation,
205
+ updateContourSets,
206
+ addContourSetsToElement,
207
+ };
@@ -1,37 +1,43 @@
1
1
  import { getEnabledElement } from '@cornerstonejs/core';
2
2
  import type { Types } from '@cornerstonejs/core';
3
+ import {
4
+ getSegmentationRepresentationByUID,
5
+ getSegmentation,
6
+ } from '../../../stateManagement/segmentation/segmentationState';
7
+
8
+ import { removeAnnotation } from '../../../stateManagement';
3
9
 
4
10
  /**
5
11
  * Remove the contour representation from the viewport's HTML Element.
6
12
  * NOTE: This function should not be called directly.
7
13
  *
8
- * @param element - The element that the segmentation is being added to.
9
14
  * @param segmentationRepresentationUID - The UID of the contour representation to remove.
15
+ * @param toolGroupId - The ID of the toolGroup that the segmentationRepresentation belongs to.
10
16
  * @param removeFromCache - boolean
11
17
  *
12
18
  * @internal
13
19
  */
14
20
  function removeContourFromElement(
15
- element: HTMLDivElement,
16
21
  segmentationRepresentationUID: string,
22
+ toolGroupId: string,
17
23
  removeFromCache = false // Todo
18
24
  ): void {
19
- const enabledElement = getEnabledElement(element);
20
- const { viewport } = enabledElement;
25
+ const segmentationRepresentation = getSegmentationRepresentationByUID(
26
+ toolGroupId,
27
+ segmentationRepresentationUID
28
+ );
21
29
 
22
- const actorEntries = (viewport as Types.IVolumeViewport).getActors();
30
+ const { segmentationId } = segmentationRepresentation;
23
31
 
24
- // remove actors whose id has the same prefix as the segmentationRepresentationUID
25
- const actorUIDsToRemove = actorEntries
26
- .map(({ uid }) =>
27
- uid.includes(segmentationRepresentationUID) ? uid : undefined
28
- )
29
- .filter(Boolean);
32
+ const segmentation = getSegmentation(segmentationId);
30
33
 
31
- // @ts-ignore
32
- viewport.removeActors(actorUIDsToRemove);
34
+ const { annotationUIDsMap } = segmentation.representationData.CONTOUR;
33
35
 
34
- // Todo: add the logic to remove the svg contour segmentation representations as well
36
+ annotationUIDsMap.forEach((annotationSet) => {
37
+ annotationSet.forEach((annotationUID) => {
38
+ removeAnnotation(annotationUID);
39
+ });
40
+ });
35
41
  }
36
42
 
37
43
  export default removeContourFromElement;
@@ -1,3 +0,0 @@
1
- import { Types } from '@cornerstonejs/core';
2
- import { SegmentationRepresentationConfig, ToolGroupSpecificContourRepresentation } from '../../../../types';
3
- export declare function addContourSetsToElement(viewport: Types.IVolumeViewport, geometryIds: string[], contourRepresentation: ToolGroupSpecificContourRepresentation, contourRepresentationConfig: SegmentationRepresentationConfig, contourActorUID: string): void;
@@ -1,73 +0,0 @@
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.addContourSetsToElement = void 0;
7
- const core_1 = require("@cornerstonejs/core");
8
- const DataArray_1 = __importDefault(require("@kitware/vtk.js/Common/Core/DataArray"));
9
- const AppendPolyData_1 = __importDefault(require("@kitware/vtk.js/Filters/General/AppendPolyData"));
10
- const Actor_1 = __importDefault(require("@kitware/vtk.js/Rendering/Core/Actor"));
11
- const Mapper_1 = __importDefault(require("@kitware/vtk.js/Rendering/Core/Mapper"));
12
- const utils_1 = require("./utils");
13
- const contourConfigCache_1 = require("./contourConfigCache");
14
- function addContourSetsToElement(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, contourActorUID) {
15
- const { segmentationRepresentationUID, segmentsHidden } = contourRepresentation;
16
- const appendPolyData = AppendPolyData_1.default.newInstance();
17
- const scalarToColorMap = new Map();
18
- const segmentSpecificMap = new Map();
19
- geometryIds.forEach((geometryId) => {
20
- const geometry = core_1.cache.getGeometry(geometryId);
21
- if (!geometry) {
22
- console.warn(`No geometry found for geometryId ${geometryId}. Skipping render.`);
23
- return;
24
- }
25
- const segmentIndex = geometry.data.getSegmentIndex();
26
- (0, utils_1.validateGeometry)(geometry);
27
- const segmentSpecificConfig = (0, utils_1.getSegmentSpecificConfig)(contourRepresentation, geometryId, segmentIndex);
28
- const contourSet = geometry.data;
29
- const polyData = (0, utils_1.getPolyData)(contourSet);
30
- const color = contourSet.getColor();
31
- const size = polyData.getPoints().getNumberOfPoints();
32
- const scalars = DataArray_1.default.newInstance({
33
- size: size * 4,
34
- numberOfComponents: 4,
35
- dataType: 'Uint8Array',
36
- });
37
- for (let i = 0; i < size; ++i) {
38
- scalars.setTuple(i, [...color, 255]);
39
- }
40
- polyData.getPointData().setScalars(scalars);
41
- if (segmentSpecificConfig) {
42
- segmentSpecificMap.set(segmentIndex, segmentSpecificConfig);
43
- }
44
- scalarToColorMap.set(segmentIndex, [
45
- ...color,
46
- segmentsHidden.has(segmentIndex) ? 0 : 255,
47
- ]);
48
- segmentIndex === 0
49
- ? appendPolyData.setInputData(polyData)
50
- : appendPolyData.addInputData(polyData);
51
- });
52
- const polyDataOutput = appendPolyData.getOutputData();
53
- const outlineWidthActive = contourRepresentationConfig.representations.CONTOUR.outlineWidthActive;
54
- const mapper = Mapper_1.default.newInstance();
55
- mapper.setInputData(polyDataOutput);
56
- const actor = Actor_1.default.newInstance();
57
- actor.setMapper(mapper);
58
- actor.getProperty().setLineWidth(outlineWidthActive);
59
- (0, contourConfigCache_1.setConfigCache)(segmentationRepresentationUID, Object.assign({}, (0, contourConfigCache_1.getConfigCache)(segmentationRepresentationUID), {
60
- segmentsHidden: new Set(segmentsHidden),
61
- segmentSpecificMap,
62
- outlineWidthActive,
63
- }));
64
- actor.setForceOpaque(true);
65
- viewport.addActor({
66
- uid: contourActorUID,
67
- actor: actor,
68
- });
69
- viewport.resetCamera();
70
- viewport.render();
71
- }
72
- exports.addContourSetsToElement = addContourSetsToElement;
73
- //# sourceMappingURL=addContourSetsToElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addContourSetsToElement.js","sourceRoot":"","sources":["../../../../../../src/tools/displayTools/Contour/vtkContour/addContourSetsToElement.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAmD;AACnD,sFAAiE;AACjE,oGAA+E;AAC/E,iFAA4D;AAC5D,mFAA8D;AAE9D,mCAIiB;AAMjB,6DAAsE;AAEtE,SAAgB,uBAAuB,CACrC,QAA+B,EAC/B,WAAqB,EACrB,qBAA6D,EAC7D,2BAA6D,EAC7D,eAAuB;IAEvB,MAAM,EAAE,6BAA6B,EAAE,cAAc,EAAE,GACrD,qBAAqB,CAAC;IACxB,MAAM,cAAc,GAAG,wBAAiB,CAAC,WAAW,EAAE,CAAC;IAEvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;IAErC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACjC,MAAM,QAAQ,GAAG,YAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO,CAAC,IAAI,CACV,oCAAoC,UAAU,oBAAoB,CACnE,CAAC;YACF,OAAO;SACR;QAED,MAAM,YAAY,GAAI,QAAQ,CAAC,IAA0B,CAAC,eAAe,EAAE,CAAC;QAE5E,IAAA,wBAAgB,EAAC,QAAQ,CAAC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AAC;IAEtD,MAAM,kBAAkB,GACtB,2BAA2B,CAAC,eAAe,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAEzE,MAAM,MAAM,GAAG,gBAAS,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAEpC,MAAM,KAAK,GAAG,eAAQ,CAAC,WAAW,EAAE,CAAC;IACrC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAGrD,IAAA,mCAAc,EACZ,6BAA6B,EAC7B,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAA,mCAAc,EAAC,6BAA6B,CAAC,EAAE;QAC/D,cAAc,EAAE,IAAI,GAAG,CAAC,cAAc,CAAC;QACvC,kBAAkB;QAClB,kBAAkB;KACnB,CAAC,CACH,CAAC;IAEF,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAE3B,QAAQ,CAAC,QAAQ,CAAC;QAChB,GAAG,EAAE,eAAe;QACpB,KAAK,EAAE,KAA+B;KACvC,CAAC,CAAC;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,CAAC;AACpB,CAAC;AA9FD,0DA8FC"}
@@ -1,3 +0,0 @@
1
- import { Types } from '@cornerstonejs/core';
2
- import { SegmentationRepresentationConfig, ToolGroupSpecificContourRepresentation } from '../../../../types';
3
- export declare function addOrUpdateVTKContourSets(viewport: Types.IVolumeViewport, geometryIds: string[], contourRepresentation: ToolGroupSpecificContourRepresentation, contourRepresentationConfig: SegmentationRepresentationConfig): void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addOrUpdateVTKContourSets = void 0;
4
- const addContourSetsToElement_1 = require("./addContourSetsToElement");
5
- const updateVTKContourSets_1 = require("./updateVTKContourSets");
6
- function addOrUpdateVTKContourSets(viewport, geometryIds, contourRepresentation, contourRepresentationConfig) {
7
- const { segmentationRepresentationUID } = contourRepresentation;
8
- const actorUID = `CONTOUR_${segmentationRepresentationUID}`;
9
- const actor = viewport.getActor(actorUID);
10
- const addOrUpdateFn = actor ? updateVTKContourSets_1.updateVTKContourSets : addContourSetsToElement_1.addContourSetsToElement;
11
- addOrUpdateFn(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, actorUID);
12
- }
13
- exports.addOrUpdateVTKContourSets = addOrUpdateVTKContourSets;
14
- //# sourceMappingURL=addOrUpdateVTKContourSets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addOrUpdateVTKContourSets.js","sourceRoot":"","sources":["../../../../../../src/tools/displayTools/Contour/vtkContour/addOrUpdateVTKContourSets.ts"],"names":[],"mappings":";;;AAMA,uEAAoE;AACpE,iEAA8D;AAE9D,SAAgB,yBAAyB,CACvC,QAA+B,EAC/B,WAAqB,EACrB,qBAA6D,EAC7D,2BAA6D;IAE7D,MAAM,EAAE,6BAA6B,EAAE,GAAG,qBAAqB,CAAC;IAChE,MAAM,QAAQ,GAAG,WAAW,6BAA6B,EAAE,CAAC;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE1C,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,2CAAoB,CAAC,CAAC,CAAC,iDAAuB,CAAC;IAC7E,aAAa,CACX,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,QAAQ,CACT,CAAC;AACJ,CAAC;AAlBD,8DAkBC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contourConfigCache.js","sourceRoot":"","sources":["../../../../../../src/tools/displayTools/Contour/vtkContour/contourConfigCache.ts"],"names":[],"mappings":";;;AAYA,MAAM,2CAA2C,GAAG,IAAI,GAAG,EAAE,CAAC;AAE9D,SAAgB,cAAc,CAC5B,6BAAqC;IAErC,OAAO,2CAA2C,CAAC,GAAG,CACpD,6BAA6B,CAC9B,CAAC;AACJ,CAAC;AAND,wCAMC;AAED,SAAgB,cAAc,CAC5B,6BAAqC,EACrC,MAAmB;IAEnB,2CAA2C,CAAC,GAAG,CAC7C,6BAA6B,EAC7B,MAAM,CACP,CAAC;AACJ,CAAC;AARD,wCAQC;AAED,SAAgB,iBAAiB,CAAC,6BAAqC;IACrE,2CAA2C,CAAC,MAAM,CAChD,6BAA6B,CAC9B,CAAC;AACJ,CAAC;AAJD,8CAIC"}
@@ -1,3 +0,0 @@
1
- import { Types } from '@cornerstonejs/core';
2
- import { SegmentationRepresentationConfig, ToolGroupSpecificContourRepresentation } from '../../../../types';
3
- export declare function updateVTKContourSets(viewport: Types.IVolumeViewport, geometryIds: string[], contourRepresentation: ToolGroupSpecificContourRepresentation, contourRepresentationConfig: SegmentationRepresentationConfig, contourActorUID: string): void;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateVTKContourSets = void 0;
4
- const core_1 = require("@cornerstonejs/core");
5
- const contourConfigCache_1 = require("./contourConfigCache");
6
- const utils_1 = require("./utils");
7
- function updateVTKContourSets(viewport, geometryIds, contourRepresentation, contourRepresentationConfig, contourActorUID) {
8
- const { segmentationRepresentationUID, segmentsHidden } = contourRepresentation;
9
- const newContourConfig = contourRepresentationConfig.representations.CONTOUR;
10
- const cachedConfig = (0, contourConfigCache_1.getConfigCache)(segmentationRepresentationUID);
11
- const contourSetsActor = viewport.getActor(contourActorUID);
12
- if (!contourSetsActor) {
13
- console.warn(`No contour actor found for actorUID ${contourActorUID}. Skipping render.`);
14
- return;
15
- }
16
- const { actor } = contourSetsActor;
17
- const newOutlineWithActive = newContourConfig.outlineWidthActive;
18
- if ((cachedConfig === null || cachedConfig === void 0 ? void 0 : cachedConfig.outlineWidthActive) !== newOutlineWithActive) {
19
- actor
20
- .getProperty()
21
- .setLineWidth(newOutlineWithActive);
22
- (0, contourConfigCache_1.setConfigCache)(segmentationRepresentationUID, Object.assign({}, cachedConfig, {
23
- outlineWidthActive: newOutlineWithActive,
24
- }));
25
- }
26
- const mapper = actor.getMapper();
27
- const lut = mapper.getLookupTable();
28
- const segmentsToSetToInvisible = [];
29
- const segmentsToSetToVisible = [];
30
- for (const segmentIndex of segmentsHidden) {
31
- if (!cachedConfig.segmentsHidden.has(segmentIndex)) {
32
- segmentsToSetToInvisible.push(segmentIndex);
33
- }
34
- }
35
- for (const segmentIndex of cachedConfig.segmentsHidden) {
36
- if (!segmentsHidden.has(segmentIndex)) {
37
- segmentsToSetToVisible.push(segmentIndex);
38
- }
39
- }
40
- const mergedInvisibleSegments = Array.from(cachedConfig.segmentsHidden)
41
- .filter((segmentIndex) => !segmentsToSetToVisible.includes(segmentIndex))
42
- .concat(segmentsToSetToInvisible);
43
- const { contourSets, segmentSpecificConfigs } = geometryIds.reduce((acc, geometryId) => {
44
- const geometry = core_1.cache.getGeometry(geometryId);
45
- const { data: contourSet } = geometry;
46
- const segmentIndex = contourSet.getSegmentIndex();
47
- const segmentSpecificConfig = (0, utils_1.getSegmentSpecificConfig)(contourRepresentation, geometryId, segmentIndex);
48
- acc.contourSets.push(contourSet);
49
- acc.segmentSpecificConfigs[segmentIndex] = segmentSpecificConfig !== null && segmentSpecificConfig !== void 0 ? segmentSpecificConfig : {};
50
- return acc;
51
- }, { contourSets: [], segmentSpecificConfigs: {} });
52
- const affectedSegments = [
53
- ...mergedInvisibleSegments,
54
- ...segmentsToSetToVisible,
55
- ];
56
- const hasCustomSegmentSpecificConfig = Object.values(segmentSpecificConfigs).some((config) => Object.keys(config).length > 0);
57
- let polyDataModified = false;
58
- if (affectedSegments.length || hasCustomSegmentSpecificConfig) {
59
- const appendPolyData = mapper.getInputData();
60
- const appendScalars = appendPolyData.getPointData().getScalars();
61
- const appendScalarsData = appendScalars.getData();
62
- let offset = 0;
63
- contourSets.forEach((contourSet) => {
64
- var _a;
65
- const segmentIndex = contourSet.getSegmentIndex();
66
- const size = contourSet.getTotalNumberOfPoints();
67
- if (affectedSegments.includes(segmentIndex) ||
68
- ((_a = segmentSpecificConfigs[segmentIndex]) === null || _a === void 0 ? void 0 : _a.fillAlpha)) {
69
- const color = contourSet.getColor();
70
- let visibility = mergedInvisibleSegments.includes(segmentIndex)
71
- ? 0
72
- : 255;
73
- const segmentConfig = segmentSpecificConfigs[segmentIndex];
74
- if (segmentConfig.fillAlpha !== undefined) {
75
- visibility = segmentConfig.fillAlpha * 255;
76
- }
77
- for (let i = 0; i < size; ++i) {
78
- appendScalarsData[offset + i * 4] = color[0];
79
- appendScalarsData[offset + i * 4 + 1] = color[1];
80
- appendScalarsData[offset + i * 4 + 2] = color[2];
81
- appendScalarsData[offset + i * 4 + 3] = visibility;
82
- }
83
- polyDataModified = true;
84
- }
85
- offset = offset + size * 4;
86
- });
87
- if (polyDataModified) {
88
- appendPolyData.modified();
89
- }
90
- (0, contourConfigCache_1.setConfigCache)(segmentationRepresentationUID, Object.assign({}, cachedConfig, {
91
- segmentsHidden: new Set(segmentsHidden),
92
- }));
93
- mapper.setLookupTable(lut);
94
- }
95
- viewport.render();
96
- }
97
- exports.updateVTKContourSets = updateVTKContourSets;
98
- //# sourceMappingURL=updateVTKContourSets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateVTKContourSets.js","sourceRoot":"","sources":["../../../../../../src/tools/displayTools/Contour/vtkContour/updateVTKContourSets.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AAOnD,6DAAsE;AACtE,mCAAmD;AAEnD,SAAgB,oBAAoB,CAClC,QAA+B,EAC/B,WAAqB,EACrB,qBAA6D,EAC7D,2BAA6D,EAC7D,eAAuB;IAEvB,MAAM,EAAE,6BAA6B,EAAE,cAAc,EAAE,GACrD,qBAAqB,CAAC;IACxB,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,eAAe,CAAC,OAAO,CAAC;IAC7E,MAAM,YAAY,GAAG,IAAA,mCAAc,EAAC,6BAA6B,CAAC,CAAC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