@cornerstonejs/tools 4.22.4 → 4.22.6
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/SegmentationStateManager.d.ts +1 -0
- package/dist/esm/stateManagement/segmentation/SegmentationStateManager.js +21 -4
- package/dist/esm/store/SynchronizerManager/Synchronizer.d.ts +3 -1
- package/dist/esm/synchronizers/synchronizers/createPresentationViewSynchronizer.d.ts +1 -1
- package/dist/esm/tools/displayTools/Labelmap/removeLabelmapFromElement.js +5 -2
- package/dist/esm/types/ISynchronizerEventHandler.d.ts +2 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +4 -4
|
@@ -6,6 +6,7 @@ export default class SegmentationStateManager {
|
|
|
6
6
|
readonly uid: string;
|
|
7
7
|
private _stackLabelmapImageIdReferenceMap;
|
|
8
8
|
private _labelmapImageIdReferenceMap;
|
|
9
|
+
private _labelmapKeysBySegmentationId;
|
|
9
10
|
constructor(uid?: string);
|
|
10
11
|
getState(): Readonly<SegmentationState>;
|
|
11
12
|
private updateState;
|
|
@@ -14,6 +14,7 @@ export default class SegmentationStateManager {
|
|
|
14
14
|
constructor(uid) {
|
|
15
15
|
this._stackLabelmapImageIdReferenceMap = new Map();
|
|
16
16
|
this._labelmapImageIdReferenceMap = new Map();
|
|
17
|
+
this._labelmapKeysBySegmentationId = new Map();
|
|
17
18
|
uid ||= csUtils.uuidv4();
|
|
18
19
|
this.state = Object.freeze(csUtils.deepClone(initialDefaultState));
|
|
19
20
|
this.uid = uid;
|
|
@@ -35,6 +36,7 @@ export default class SegmentationStateManager {
|
|
|
35
36
|
resetState() {
|
|
36
37
|
this._stackLabelmapImageIdReferenceMap.clear();
|
|
37
38
|
this._labelmapImageIdReferenceMap.clear();
|
|
39
|
+
this._labelmapKeysBySegmentationId.clear();
|
|
38
40
|
this.state = Object.freeze(csUtils.deepClone(initialDefaultState));
|
|
39
41
|
}
|
|
40
42
|
getSegmentation(segmentationId) {
|
|
@@ -69,6 +71,14 @@ export default class SegmentationStateManager {
|
|
|
69
71
|
triggerSegmentationAdded(segmentation.segmentationId);
|
|
70
72
|
}
|
|
71
73
|
removeSegmentation(segmentationId) {
|
|
74
|
+
this._stackLabelmapImageIdReferenceMap.delete(segmentationId);
|
|
75
|
+
const keys = this._labelmapKeysBySegmentationId.get(segmentationId);
|
|
76
|
+
if (keys) {
|
|
77
|
+
for (const key of keys) {
|
|
78
|
+
this._labelmapImageIdReferenceMap.delete(key);
|
|
79
|
+
}
|
|
80
|
+
this._labelmapKeysBySegmentationId.delete(segmentationId);
|
|
81
|
+
}
|
|
72
82
|
this.updateState((state) => {
|
|
73
83
|
const filteredSegmentations = state.segmentations.filter((segmentation) => segmentation.segmentationId !== segmentationId);
|
|
74
84
|
state.segmentations.splice(0, state.segmentations.length, ...filteredSegmentations);
|
|
@@ -363,11 +373,18 @@ export default class SegmentationStateManager {
|
|
|
363
373
|
const key = this._generateMapKey({ segmentationId, referenceImageId });
|
|
364
374
|
if (!this._labelmapImageIdReferenceMap.has(key)) {
|
|
365
375
|
this._labelmapImageIdReferenceMap.set(key, [labelmapImageId]);
|
|
366
|
-
return;
|
|
367
376
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
377
|
+
else {
|
|
378
|
+
const currentValues = this._labelmapImageIdReferenceMap.get(key);
|
|
379
|
+
const newValues = Array.from(new Set([...currentValues, labelmapImageId]));
|
|
380
|
+
this._labelmapImageIdReferenceMap.set(key, newValues);
|
|
381
|
+
}
|
|
382
|
+
let keys = this._labelmapKeysBySegmentationId.get(segmentationId);
|
|
383
|
+
if (!keys) {
|
|
384
|
+
keys = new Set();
|
|
385
|
+
this._labelmapKeysBySegmentationId.set(segmentationId, keys);
|
|
386
|
+
}
|
|
387
|
+
keys.add(key);
|
|
371
388
|
}
|
|
372
389
|
_setActiveSegmentation(state, viewportId, segmentationId) {
|
|
373
390
|
const viewport = state.viewportSegRepresentations[viewportId];
|
|
@@ -8,7 +8,9 @@ type auxiliaryEvent = {
|
|
|
8
8
|
export type SynchronizerOptions = {
|
|
9
9
|
auxiliaryEvents?: auxiliaryEvent[];
|
|
10
10
|
eventSource?: eventSource;
|
|
11
|
-
viewPresentation?: Types.
|
|
11
|
+
viewPresentation?: Types.ViewPresentationSelector;
|
|
12
|
+
syncInvertState?: boolean;
|
|
13
|
+
syncColormap?: boolean;
|
|
12
14
|
};
|
|
13
15
|
declare class Synchronizer {
|
|
14
16
|
private _enabled;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Types } from '@cornerstonejs/core';
|
|
2
2
|
import type Synchronizer from '../../store/SynchronizerManager/Synchronizer';
|
|
3
|
-
export default function createPresentationViewSynchronizer(synchronizerName: string, options?: Types.
|
|
3
|
+
export default function createPresentationViewSynchronizer(synchronizerName: string, options?: Types.ViewPresentationSelector): Synchronizer;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { getLabelmapActorEntries } from '../../../stateManagement/segmentation/helpers/getSegmentationActor';
|
|
3
3
|
function removeLabelmapFromElement(element, segmentationId) {
|
|
4
4
|
const enabledElement = getEnabledElement(element);
|
|
5
5
|
const { viewport } = enabledElement;
|
|
6
|
-
|
|
6
|
+
const actorEntries = getLabelmapActorEntries(viewport.id, segmentationId);
|
|
7
|
+
if (actorEntries?.length) {
|
|
8
|
+
viewport.removeActors(actorEntries.map((entry) => entry.uid));
|
|
9
|
+
}
|
|
7
10
|
}
|
|
8
11
|
export default removeLabelmapFromElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Types } from '@cornerstonejs/core';
|
|
2
2
|
import type { Synchronizer } from '../store';
|
|
3
|
+
import type { SynchronizerOptions } from '../store/SynchronizerManager/Synchronizer';
|
|
3
4
|
export default interface ISynchronizerEventHandler {
|
|
4
|
-
(synchronizer: Synchronizer, sourceViewport: Types.IViewportId, targetViewport: Types.IViewportId, sourceEvent:
|
|
5
|
+
(synchronizer: Synchronizer, sourceViewport: Types.IViewportId, targetViewport: Types.IViewportId, sourceEvent: Event, options?: SynchronizerOptions): Promise<void> | void;
|
|
5
6
|
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.22.
|
|
1
|
+
export declare const version = "4.22.6";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.22.
|
|
1
|
+
export const version = '4.22.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "4.22.
|
|
3
|
+
"version": "4.22.6",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"lodash.get": "4.4.2"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@cornerstonejs/core": "4.22.
|
|
108
|
+
"@cornerstonejs/core": "4.22.6",
|
|
109
109
|
"canvas": "3.2.0"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
|
-
"@cornerstonejs/core": "4.22.
|
|
112
|
+
"@cornerstonejs/core": "4.22.6",
|
|
113
113
|
"@kitware/vtk.js": "34.15.1",
|
|
114
114
|
"@types/d3-array": "3.2.1",
|
|
115
115
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"type": "individual",
|
|
129
129
|
"url": "https://ohif.org/donate"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "7f73487d7ef2023ee875a7da3c4ee31ccbc12175"
|
|
132
132
|
}
|