@cornerstonejs/tools 5.10.2 → 5.10.3
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/tools/segmentation/BrushTool.js +9 -7
- package/dist/esm/tools/segmentation/LabelmapBaseTool.d.ts +1 -0
- package/dist/esm/tools/segmentation/LabelmapBaseTool.js +6 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.d.ts +8 -1
- package/dist/esm/tools/segmentation/strategies/utils/getStrategyData.js +6 -4
- package/dist/esm/utilities/segmentation/getStatistics.js +3 -0
- package/dist/esm/utilities/segmentation/utilsForWorker.d.ts +8 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -211,11 +211,11 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
const memo = this.createMemo(operationData.segmentationId, strategyData.segmentationVoxelManager);
|
|
214
|
-
this.
|
|
214
|
+
this._setPreview(this.applyActiveStrategyCallback(getEnabledElement(this._previewData.element), {
|
|
215
215
|
...operationData,
|
|
216
216
|
...strategyData,
|
|
217
217
|
memo,
|
|
218
|
-
}, StrategyCallbacks.Preview);
|
|
218
|
+
}, StrategyCallbacks.Preview));
|
|
219
219
|
};
|
|
220
220
|
this._dragCallback = (evt) => {
|
|
221
221
|
const eventData = evt.detail;
|
|
@@ -279,7 +279,7 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
279
279
|
vec3.clone(this._lastDragInfo.world),
|
|
280
280
|
vec3.clone(currentWorld),
|
|
281
281
|
];
|
|
282
|
-
this.
|
|
282
|
+
this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
|
|
283
283
|
}
|
|
284
284
|
const currentCanvasClone = vec2.clone(currentCanvas);
|
|
285
285
|
this._lastDragInfo = {
|
|
@@ -310,10 +310,10 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
310
310
|
operationData.strokePointsWorld = this._lazyEdit
|
|
311
311
|
.getStrokePointsWorld()
|
|
312
312
|
.map((point) => vec3.clone(point));
|
|
313
|
-
this.applyActiveStrategy(enabledElement, operationData);
|
|
313
|
+
this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
|
|
314
314
|
}
|
|
315
315
|
else if (!this._previewData.preview && !this._previewData.isDrag) {
|
|
316
|
-
this.applyActiveStrategy(enabledElement, operationData);
|
|
316
|
+
this._setPreview(this.applyActiveStrategy(enabledElement, operationData));
|
|
317
317
|
}
|
|
318
318
|
this.doneEditMemo();
|
|
319
319
|
this._deactivateDraw(element);
|
|
@@ -467,7 +467,9 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
467
467
|
if (!operationData) {
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
this.
|
|
470
|
+
if (this._previewData.preview) {
|
|
471
|
+
this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
|
|
472
|
+
}
|
|
471
473
|
this._previewData.preview = null;
|
|
472
474
|
this._previewData.isDrag = false;
|
|
473
475
|
}
|
|
@@ -486,7 +488,7 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
486
488
|
if (!enabledElement || !operationData) {
|
|
487
489
|
return;
|
|
488
490
|
}
|
|
489
|
-
this.
|
|
491
|
+
this._setPreview(this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.Interpolate, config.configuration));
|
|
490
492
|
this._previewData.isDrag = true;
|
|
491
493
|
}
|
|
492
494
|
invalidateBrushCursor() {
|
|
@@ -72,6 +72,7 @@ export default class LabelmapBaseTool extends BaseTool {
|
|
|
72
72
|
protected _cancelTouchDraw(element: HTMLDivElement): void;
|
|
73
73
|
protected _historyRedoHandler(evt: any): void;
|
|
74
74
|
protected get _previewData(): PreviewData;
|
|
75
|
+
protected _setPreview(results: any): void;
|
|
75
76
|
hasPreviewData(): boolean;
|
|
76
77
|
shouldResolvePreviewRequests(): boolean;
|
|
77
78
|
createMemo(segmentationId: string, segmentationVoxelManager: any): LabelmapMemo.LabelmapMemo;
|
|
@@ -67,6 +67,9 @@ class LabelmapBaseTool extends BaseTool {
|
|
|
67
67
|
get _previewData() {
|
|
68
68
|
return LabelmapBaseTool.previewData;
|
|
69
69
|
}
|
|
70
|
+
_setPreview(results) {
|
|
71
|
+
this._previewData.preview = results?.modified ? results : null;
|
|
72
|
+
}
|
|
70
73
|
hasPreviewData() {
|
|
71
74
|
return !!this._previewData.preview;
|
|
72
75
|
}
|
|
@@ -291,7 +294,9 @@ class LabelmapBaseTool extends BaseTool {
|
|
|
291
294
|
if (!enabledElement || !operationData) {
|
|
292
295
|
return;
|
|
293
296
|
}
|
|
294
|
-
this.
|
|
297
|
+
if (this._previewData.preview) {
|
|
298
|
+
this.applyActiveStrategyCallback(enabledElement, operationData, StrategyCallbacks.RejectPreview);
|
|
299
|
+
}
|
|
295
300
|
this._previewData.preview = null;
|
|
296
301
|
this._previewData.isDrag = false;
|
|
297
302
|
}
|
|
@@ -5,9 +5,16 @@ declare function getStrategyData({ operationData, viewport, strategy, }: {
|
|
|
5
5
|
viewport?: Types.IStackViewport | Types.IVolumeViewport;
|
|
6
6
|
strategy: unknown;
|
|
7
7
|
}): {
|
|
8
|
-
segmentationImageData:
|
|
8
|
+
segmentationImageData: import("@kitware/vtk.js/Common/DataModel/ImageData").vtkImageData;
|
|
9
|
+
segmentationVoxelManager: Types.IVoxelManager<number> | Types.IVoxelManager<Types.RGB>;
|
|
9
10
|
segmentationScalarData: any;
|
|
10
11
|
imageScalarData: any;
|
|
12
|
+
imageVoxelManager: any;
|
|
13
|
+
imageData: any;
|
|
14
|
+
} | {
|
|
15
|
+
segmentationImageData: any;
|
|
16
|
+
readonly segmentationScalarData: unknown;
|
|
17
|
+
imageScalarData: any;
|
|
11
18
|
segmentationVoxelManager: any;
|
|
12
19
|
imageVoxelManager: any;
|
|
13
20
|
imageData: any;
|
|
@@ -36,7 +36,7 @@ function getStrategyDataForStackViewport({ operationData, viewport, strategy, })
|
|
|
36
36
|
const { segmentationId } = operationData;
|
|
37
37
|
let segmentationImageData;
|
|
38
38
|
let segmentationVoxelManager;
|
|
39
|
-
let
|
|
39
|
+
let getSegmentationScalarData;
|
|
40
40
|
let imageScalarData;
|
|
41
41
|
let imageVoxelManager;
|
|
42
42
|
let imageData;
|
|
@@ -47,7 +47,7 @@ function getStrategyDataForStackViewport({ operationData, viewport, strategy, })
|
|
|
47
47
|
});
|
|
48
48
|
segmentationVoxelManager = operationData.segmentationVoxelManager;
|
|
49
49
|
segmentationImageData = operationData.segmentationImageData;
|
|
50
|
-
|
|
50
|
+
getSegmentationScalarData = () => null;
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
const labelmapImageId = getCurrentLabelmapImageIdForViewport(viewport.id, segmentationId);
|
|
@@ -66,7 +66,7 @@ function getStrategyDataForStackViewport({ operationData, viewport, strategy, })
|
|
|
66
66
|
if (!segmentationImage) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
getSegmentationScalarData = () => segmentationImage.getPixelData?.();
|
|
70
70
|
}
|
|
71
71
|
if (strategy.ensureImageVolumeFor3DManipulation) {
|
|
72
72
|
strategy.ensureImageVolumeFor3DManipulation({
|
|
@@ -89,7 +89,9 @@ function getStrategyDataForStackViewport({ operationData, viewport, strategy, })
|
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
91
91
|
segmentationImageData,
|
|
92
|
-
segmentationScalarData
|
|
92
|
+
get segmentationScalarData() {
|
|
93
|
+
return getSegmentationScalarData();
|
|
94
|
+
},
|
|
93
95
|
imageScalarData,
|
|
94
96
|
segmentationVoxelManager,
|
|
95
97
|
imageVoxelManager,
|
|
@@ -45,6 +45,9 @@ async function calculateVolumeStatistics({ operationData, indices, unit, mode, }
|
|
|
45
45
|
return VolumetricCalculator.getStatistics({ spacing });
|
|
46
46
|
}
|
|
47
47
|
const segmentationScalarData = segmentationVoxelManager.getCompleteScalarDataArray();
|
|
48
|
+
if (!segmentationScalarData?.length) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
48
51
|
const segmentationInfo = {
|
|
49
52
|
scalarData: segmentationScalarData,
|
|
50
53
|
dimensions: segmentationImageData.getDimensions(),
|
|
@@ -11,9 +11,16 @@ export declare const getSegmentationDataForWorker: (segmentationId: any, segment
|
|
|
11
11
|
indices: any;
|
|
12
12
|
};
|
|
13
13
|
export declare const prepareVolumeStrategyDataForWorker: (operationData: any) => {
|
|
14
|
-
segmentationImageData:
|
|
14
|
+
segmentationImageData: import("@kitware/vtk.js/Common/DataModel/ImageData").vtkImageData;
|
|
15
|
+
segmentationVoxelManager: import("packages/core/dist/esm/types").IVoxelManager<number> | import("packages/core/dist/esm/types").IVoxelManager<import("packages/core/dist/esm/types").RGB>;
|
|
15
16
|
segmentationScalarData: any;
|
|
16
17
|
imageScalarData: any;
|
|
18
|
+
imageVoxelManager: any;
|
|
19
|
+
imageData: any;
|
|
20
|
+
} | {
|
|
21
|
+
segmentationImageData: any;
|
|
22
|
+
readonly segmentationScalarData: unknown;
|
|
23
|
+
imageScalarData: any;
|
|
17
24
|
segmentationVoxelManager: any;
|
|
18
25
|
imageVoxelManager: any;
|
|
19
26
|
imageData: any;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.10.
|
|
1
|
+
export declare const version = "5.10.3";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.10.
|
|
1
|
+
export const version = '5.10.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.3",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -126,11 +126,11 @@
|
|
|
126
126
|
"lodash.get": "4.4.2"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@cornerstonejs/core": "5.10.
|
|
129
|
+
"@cornerstonejs/core": "5.10.3",
|
|
130
130
|
"canvas": "3.2.0"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
|
-
"@cornerstonejs/core": "5.10.
|
|
133
|
+
"@cornerstonejs/core": "5.10.3",
|
|
134
134
|
"@kitware/vtk.js": "36.4.1",
|
|
135
135
|
"@types/d3-array": "3.2.1",
|
|
136
136
|
"@types/d3-interpolate": "3.0.4",
|