@cornerstonejs/tools 4.15.28 → 4.15.29
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/stateManagement/segmentation/helpers/clearSegmentValue.d.ts +3 -1
- package/dist/esm/stateManagement/segmentation/helpers/clearSegmentValue.js +12 -3
- package/dist/esm/stateManagement/segmentation/helpers/removeSegmentAnnotations.d.ts +3 -1
- package/dist/esm/stateManagement/segmentation/helpers/removeSegmentAnnotations.js +23 -6
- package/dist/esm/stateManagement/segmentation/removeSegment.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/removeSegment.js +7 -3
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationTool.js +3 -1
- package/dist/esm/utilities/segmentation/createLabelmapMemo.js +1 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { cache } from '@cornerstonejs/core';
|
|
1
|
+
import { cache, utilities } from '@cornerstonejs/core';
|
|
2
2
|
import { getSegmentation } from '../getSegmentation';
|
|
3
3
|
import { triggerSegmentationDataModified } from '../triggerSegmentationEvents';
|
|
4
|
-
|
|
4
|
+
import { createLabelmapMemo } from '../../../utilities/segmentation/createLabelmapMemo';
|
|
5
|
+
const { DefaultHistoryMemo } = utilities.HistoryMemo;
|
|
6
|
+
export function clearSegmentValue(segmentationId, segmentIndex, options) {
|
|
5
7
|
const segmentation = getSegmentation(segmentationId);
|
|
6
8
|
if (segmentation.representationData.Labelmap) {
|
|
7
9
|
const { representationData } = segmentation;
|
|
@@ -15,11 +17,18 @@ export function clearSegmentValue(segmentationId, segmentIndex) {
|
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
const { voxelManager } = item;
|
|
20
|
+
const memo = options?.recordHistory
|
|
21
|
+
? createLabelmapMemo(segmentationId, voxelManager)
|
|
22
|
+
: null;
|
|
23
|
+
const useVoxelManager = memo?.voxelManager ?? voxelManager;
|
|
18
24
|
voxelManager.forEach(({ value, index }) => {
|
|
19
25
|
if (value === segmentIndex) {
|
|
20
|
-
|
|
26
|
+
useVoxelManager.setAtIndex(index, 0);
|
|
21
27
|
}
|
|
22
28
|
});
|
|
29
|
+
if (memo?.commitMemo()) {
|
|
30
|
+
DefaultHistoryMemo.push(memo);
|
|
31
|
+
}
|
|
23
32
|
});
|
|
24
33
|
}
|
|
25
34
|
triggerSegmentationDataModified(segmentationId);
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import { getAnnotation } from '../../annotation/annotationState';
|
|
2
|
+
import AnnotationTool from '../../../tools/base/AnnotationTool';
|
|
2
3
|
import { getAnnotationsUIDMapFromSegmentation, removeCompleteContourAnnotation, } from '../utilities';
|
|
3
4
|
import { isContourSegmentationAnnotation } from '../../../utilities/contourSegmentation';
|
|
4
|
-
export function removeContourSegmentAnnotations(segmentationId, segmentIndex) {
|
|
5
|
+
export function removeContourSegmentAnnotations(segmentationId, segmentIndex, options) {
|
|
5
6
|
const annotationUIDsMap = getAnnotationsUIDMapFromSegmentation(segmentationId);
|
|
6
7
|
if (!annotationUIDsMap) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
10
|
+
const annotationUIDsSet = annotationUIDsMap.get(segmentIndex);
|
|
11
|
+
if (!annotationUIDsSet) {
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
|
-
annotationUIDs.
|
|
14
|
+
const annotationUIDs = Array.from(annotationUIDsSet);
|
|
15
|
+
const annotations = [];
|
|
16
|
+
for (const annotationUID of annotationUIDs) {
|
|
14
17
|
const annotation = getAnnotation(annotationUID);
|
|
15
18
|
if (isContourSegmentationAnnotation(annotation)) {
|
|
16
|
-
|
|
19
|
+
annotations.push(annotation);
|
|
17
20
|
}
|
|
18
|
-
}
|
|
21
|
+
}
|
|
22
|
+
if (annotations.length === 0) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (const annotation of annotations) {
|
|
26
|
+
if (annotation.parentAnnotationUID) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (options?.recordHistory) {
|
|
30
|
+
AnnotationTool.createAnnotationMemo(null, annotation, {
|
|
31
|
+
deleting: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
removeCompleteContourAnnotation(annotation);
|
|
35
|
+
}
|
|
19
36
|
}
|
|
@@ -11,10 +11,14 @@ export function removeSegment(segmentationId, segmentIndex, options = {
|
|
|
11
11
|
}) {
|
|
12
12
|
const segmentation = getSegmentation(segmentationId);
|
|
13
13
|
if (segmentation?.representationData.Contour) {
|
|
14
|
-
removeContourSegmentAnnotations(segmentationId, segmentIndex
|
|
14
|
+
removeContourSegmentAnnotations(segmentationId, segmentIndex, {
|
|
15
|
+
recordHistory: options.recordHistory,
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
else if (segmentation?.representationData.Labelmap) {
|
|
17
|
-
clearSegmentValue(segmentationId, segmentIndex
|
|
19
|
+
clearSegmentValue(segmentationId, segmentIndex, {
|
|
20
|
+
recordHistory: options.recordHistory,
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
else {
|
|
20
24
|
throw new Error('Invalid segmentation type');
|
|
@@ -33,7 +37,7 @@ export function removeSegment(segmentationId, segmentIndex, options = {
|
|
|
33
37
|
},
|
|
34
38
|
},
|
|
35
39
|
]);
|
|
36
|
-
if (isThisSegmentActive && options.setNextSegmentAsActive) {
|
|
40
|
+
if (isThisSegmentActive && options.setNextSegmentAsActive !== false) {
|
|
37
41
|
const segmentIndices = Object.keys(segments)
|
|
38
42
|
.map(Number)
|
|
39
43
|
.sort((a, b) => a - b);
|
|
@@ -42,7 +42,7 @@ declare abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
42
42
|
data: import("../../types").AnnotationData;
|
|
43
43
|
deleting: boolean;
|
|
44
44
|
};
|
|
45
|
-
static createAnnotationMemo(element:
|
|
45
|
+
static createAnnotationMemo(element: HTMLDivElement | null | undefined, annotation: Annotation, options?: {
|
|
46
46
|
newAnnotation?: boolean;
|
|
47
47
|
deleting?: boolean;
|
|
48
48
|
}): {
|
|
@@ -216,7 +216,9 @@ class AnnotationTool extends AnnotationDisplayTool {
|
|
|
216
216
|
}
|
|
217
217
|
state.data = newState.data;
|
|
218
218
|
currentAnnotation.invalidated = true;
|
|
219
|
-
|
|
219
|
+
if (element) {
|
|
220
|
+
triggerAnnotationModified(currentAnnotation, element, ChangeTypes.History);
|
|
221
|
+
}
|
|
220
222
|
},
|
|
221
223
|
id: annotationUID,
|
|
222
224
|
operationType: 'annotation',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { utilities
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
2
|
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
3
|
-
import Events from '../../enums/Events';
|
|
4
3
|
const { VoxelManager, RLEVoxelMap } = utilities;
|
|
5
4
|
export function createLabelmapMemo(segmentationId, segmentationVoxelManager) {
|
|
6
5
|
return createRleMemo(segmentationId, segmentationVoxelManager);
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.15.
|
|
1
|
+
export declare const version = "4.15.29";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.15.
|
|
1
|
+
export const version = '4.15.29';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.29",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "3.2.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "4.15.
|
|
111
|
+
"@cornerstonejs/core": "4.15.29",
|
|
112
112
|
"@kitware/vtk.js": "34.15.1",
|
|
113
113
|
"@types/d3-array": "3.2.1",
|
|
114
114
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "ff9cdf1e59a849b7ba2be95578dee05b311800d0"
|
|
131
131
|
}
|