@cornerstonejs/tools 1.61.6 → 1.62.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/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +1 -1
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +2 -2
- package/dist/cjs/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js +1 -0
- package/dist/cjs/utilities/contours/interpolation/createPolylineToolData.js.map +1 -1
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js +13 -10
- package/dist/cjs/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js +0 -1
- package/dist/cjs/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +1 -1
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -1
- package/dist/esm/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.js.map +1 -1
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js +2 -2
- package/dist/esm/utilities/contourSegmentation/removeContourSegmentationAnnotation.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js +1 -0
- package/dist/esm/utilities/contours/interpolation/createPolylineToolData.js.map +1 -1
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js +13 -10
- package/dist/esm/utilities/contours/interpolation/getInterpolationData.js.map +1 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js +0 -1
- package/dist/esm/utilities/segmentation/InterpolationManager/InterpolationManager.js.map +1 -1
- package/dist/types/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/removeContourSegmentationAnnotation.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/createPolylineToolData.d.ts.map +1 -1
- package/dist/types/utilities/contours/interpolation/getInterpolationData.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/InterpolationManager/InterpolationManager.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/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +1 -1
- package/src/stateManagement/annotation/FrameOfReferenceSpecificAnnotationManager.ts +1 -0
- package/src/utilities/contourSegmentation/removeContourSegmentationAnnotation.ts +5 -4
- package/src/utilities/contours/interpolation/createPolylineToolData.ts +1 -0
- package/src/utilities/contours/interpolation/getInterpolationData.ts +30 -14
- package/src/utilities/segmentation/InterpolationManager/InterpolationManager.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.62.0",
|
|
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": "
|
|
62
|
+
"gitHead": "f42feae4b86eba94ce9ca3b493fb080905241007"
|
|
63
63
|
}
|
|
@@ -359,7 +359,7 @@ function combinePolylines(
|
|
|
359
359
|
metadata: {
|
|
360
360
|
...metadata,
|
|
361
361
|
toolName: DEFAULT_CONTOUR_SEG_TOOLNAME,
|
|
362
|
-
originalToolName:
|
|
362
|
+
originalToolName: metadata.originalToolName || metadata.toolName,
|
|
363
363
|
},
|
|
364
364
|
data: {
|
|
365
365
|
cachedStats: {},
|
|
@@ -127,6 +127,7 @@ class FrameOfReferenceSpecificAnnotationManager implements IAnnotationManager {
|
|
|
127
127
|
* @param toolName - Optional. The name of the tool to retrieve annotations for.
|
|
128
128
|
* @returns The annotations associated with the specified group (default FrameOfReferenceUID) and tool,
|
|
129
129
|
* or all annotations for the group (FrameOfReferenceUID) if the tool name is not provided.
|
|
130
|
+
* WARNING: The list returned here is internal tool data, not a copy, so do NOT modify it.
|
|
130
131
|
*/
|
|
131
132
|
getAnnotations = (
|
|
132
133
|
groupKey: string,
|
|
@@ -3,9 +3,10 @@ import { ContourSegmentationAnnotation } from '../../types';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Removes a contour segmentation annotation from the given annotation.
|
|
6
|
-
* If the annotation does not have a segmentation data,
|
|
6
|
+
* If the annotation does not have a segmentation data, this method returns
|
|
7
|
+
* quietly. This can occur for interpolated segmentations that have not yet
|
|
8
|
+
* been converted to real segmentations or other in-process segmentations.
|
|
7
9
|
* @param annotation - The contour segmentation annotation to remove.
|
|
8
|
-
* @throws Error if the annotation does not have a segmentation data.
|
|
9
10
|
*/
|
|
10
11
|
export function removeContourSegmentationAnnotation(
|
|
11
12
|
annotation: ContourSegmentationAnnotation
|
|
@@ -18,8 +19,8 @@ export function removeContourSegmentationAnnotation(
|
|
|
18
19
|
|
|
19
20
|
const { segmentationId, segmentIndex } = annotation.data.segmentation;
|
|
20
21
|
const segmentation = state.getSegmentation(segmentationId);
|
|
21
|
-
const { annotationUIDsMap } = segmentation
|
|
22
|
-
const annotationsUIDsSet = annotationUIDsMap
|
|
22
|
+
const { annotationUIDsMap } = segmentation?.representationData.CONTOUR || {};
|
|
23
|
+
const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
|
|
23
24
|
|
|
24
25
|
if (!annotationsUIDsSet) {
|
|
25
26
|
return;
|
|
@@ -45,21 +45,37 @@ export default function getInterpolationData(
|
|
|
45
45
|
const interpolationDatas = new Map<number, Annotation[]>();
|
|
46
46
|
const { toolName, originalToolName } = annotation.metadata;
|
|
47
47
|
const testToolName = originalToolName || toolName;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
// Get a copy of the annotations list by filtering it for only
|
|
49
|
+
// items which are originally the right tool name
|
|
50
|
+
const annotations = (
|
|
51
|
+
(getAnnotations(
|
|
52
|
+
testToolName,
|
|
53
|
+
viewport.element
|
|
54
|
+
) as ContourSegmentationAnnotation[]) || []
|
|
55
|
+
).filter(
|
|
56
|
+
(annotation) =>
|
|
57
|
+
!annotation.metadata.originalToolName ||
|
|
58
|
+
annotation.metadata.originalToolName === testToolName
|
|
52
59
|
);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
|
|
61
|
+
// Then add the default contour seg tool name which has the testTool name
|
|
62
|
+
// to the segmentations list.
|
|
63
|
+
if (testToolName !== DEFAULT_CONTOUR_SEG_TOOLNAME) {
|
|
64
|
+
const modifiedAnnotations = getAnnotations(
|
|
65
|
+
DEFAULT_CONTOUR_SEG_TOOLNAME,
|
|
66
|
+
viewport.element
|
|
67
|
+
) as ContourSegmentationAnnotation[];
|
|
68
|
+
if (modifiedAnnotations?.length) {
|
|
69
|
+
modifiedAnnotations.forEach((annotation) => {
|
|
70
|
+
const { metadata } = annotation;
|
|
71
|
+
if (
|
|
72
|
+
metadata.originalToolName === testToolName &&
|
|
73
|
+
metadata.originalToolName !== metadata.toolName
|
|
74
|
+
) {
|
|
75
|
+
annotations.push(annotation);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
if (!annotations?.length) {
|