@cornerstonejs/ai 5.8.1 → 5.10.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.
- package/dist/esm/LabelmapSlicePropagationTool.js +3 -1
- package/dist/esm/MarkerLabelmapTool.js +5 -3
- package/dist/esm/ONNXSegmentationController.d.ts +4 -2
- package/dist/esm/ONNXSegmentationController.js +12 -5
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/getOrtWasmPaths.d.ts +2 -0
- package/dist/esm/utils/getOrtWasmPaths.js +5 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +6 -7
- package/LICENSE +0 -21
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getEnabledElementByViewportId } from '@cornerstonejs/core';
|
|
2
2
|
import { LabelmapBaseTool } from '@cornerstonejs/tools';
|
|
3
3
|
import ONNXSegmentationController from './ONNXSegmentationController.js';
|
|
4
|
+
import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
|
|
5
|
+
const cs3dLogger = cornerstoneUtilities.logger.aiLog.getLogger('LabelmapSlicePropagationTool');
|
|
4
6
|
class LabelmapSlicePropagationTool extends LabelmapBaseTool {
|
|
5
7
|
constructor(toolProps = {}, defaultToolProps = {
|
|
6
8
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
@@ -54,7 +56,7 @@ class LabelmapSlicePropagationTool extends LabelmapBaseTool {
|
|
|
54
56
|
const { sourceViewportId } = this.configuration;
|
|
55
57
|
const enabledElement = getEnabledElementByViewportId(sourceViewportId);
|
|
56
58
|
if (!enabledElement) {
|
|
57
|
-
|
|
59
|
+
cs3dLogger.debug('No enabled element found for viewportId:', sourceViewportId);
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
const { viewport } = enabledElement;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getEnabledElementByViewportId } from '@cornerstonejs/core';
|
|
2
2
|
import { LabelmapBaseTool, ToolGroupManager, annotation, ProbeTool, addTool, } from '@cornerstonejs/tools';
|
|
3
3
|
import ONNXSegmentationController from './ONNXSegmentationController.js';
|
|
4
|
+
import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
|
|
5
|
+
const cs3dLogger = cornerstoneUtilities.logger.aiLog.getLogger('MarkerLabelmapTool');
|
|
4
6
|
class MarkerLabelmapTool extends LabelmapBaseTool {
|
|
5
7
|
constructor(toolProps = {}, defaultToolProps = {
|
|
6
8
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
@@ -54,7 +56,7 @@ class MarkerLabelmapTool extends LabelmapBaseTool {
|
|
|
54
56
|
const { sourceViewportId } = this.configuration;
|
|
55
57
|
const enabledElement = getEnabledElementByViewportId(sourceViewportId);
|
|
56
58
|
if (!enabledElement) {
|
|
57
|
-
|
|
59
|
+
cs3dLogger.debug('No enabled element found for viewportId:', sourceViewportId);
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
const { viewport } = enabledElement;
|
|
@@ -67,7 +69,7 @@ class MarkerLabelmapTool extends LabelmapBaseTool {
|
|
|
67
69
|
this._addToolInstances = () => {
|
|
68
70
|
const toolGroup = this._getToolGroupId();
|
|
69
71
|
if (!toolGroup) {
|
|
70
|
-
|
|
72
|
+
cs3dLogger.debug(`Tool group not found`);
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
addTool(ProbeTool);
|
|
@@ -180,7 +182,7 @@ class MarkerLabelmapTool extends LabelmapBaseTool {
|
|
|
180
182
|
];
|
|
181
183
|
const toolGroup = this._getToolGroupId();
|
|
182
184
|
if (!toolGroup) {
|
|
183
|
-
|
|
185
|
+
cs3dLogger.debug(`Tool group not found for tool: ${MarkerLabelmapTool.toolName}`);
|
|
184
186
|
return false;
|
|
185
187
|
}
|
|
186
188
|
return (this.hasPreviewData() &&
|
|
@@ -12,6 +12,7 @@ export declare enum Loggers {
|
|
|
12
12
|
Encoder = "encoder",
|
|
13
13
|
Decoder = "decoder"
|
|
14
14
|
}
|
|
15
|
+
type LogListener = (message: string, ...args: unknown[]) => void;
|
|
15
16
|
export default class ONNXSegmentationController {
|
|
16
17
|
static MarkerInclude: string;
|
|
17
18
|
static MarkerExclude: string;
|
|
@@ -93,7 +94,7 @@ export default class ONNXSegmentationController {
|
|
|
93
94
|
};
|
|
94
95
|
protected pCutoff: number;
|
|
95
96
|
constructor(options?: {
|
|
96
|
-
listeners?:
|
|
97
|
+
listeners?: LogListener[];
|
|
97
98
|
getPromptAnnotations?: (viewport?: Types.IViewport) => cornerstoneTools.Types.Annotation[];
|
|
98
99
|
promptAnnotationTypes?: string[];
|
|
99
100
|
models?: Record<string, ModelType[]>;
|
|
@@ -119,7 +120,7 @@ export default class ONNXSegmentationController {
|
|
|
119
120
|
restoreCachedPromptAnnotations(viewport: Types.IViewport): any[];
|
|
120
121
|
removePromptAnnotationsWithCache(viewport: Types.IViewport): void;
|
|
121
122
|
interpolateScroll(viewport?: any, dir?: number): Promise<void>;
|
|
122
|
-
protected log(logger: Loggers, ...args:
|
|
123
|
+
protected log(logger: Loggers, ...args: unknown[]): void;
|
|
123
124
|
protected getPromptAnnotations: (viewport?: any) => cornerstoneTools.Types.Annotations;
|
|
124
125
|
protected viewportRenderedListener: (_event: any) => void;
|
|
125
126
|
protected annotationModifiedListener: Function;
|
|
@@ -148,3 +149,4 @@ export default class ONNXSegmentationController {
|
|
|
148
149
|
getFileNameForImageId(imageId: any, extension: any): any;
|
|
149
150
|
getConfig(modelName?: string): any;
|
|
150
151
|
}
|
|
152
|
+
export {};
|
|
@@ -2,10 +2,13 @@ import { utilities, eventTarget, Enums, triggerEvent, cache, } from '@cornerston
|
|
|
2
2
|
import * as cornerstoneTools from '@cornerstonejs/tools';
|
|
3
3
|
import { segmentation as cstSegmentation, LabelmapBaseTool, } from '@cornerstonejs/tools';
|
|
4
4
|
import { Events as aiEvents } from './enums/index.js';
|
|
5
|
+
import getOrtWasmPaths from './utils/getOrtWasmPaths.js';
|
|
5
6
|
const { strategies } = cstSegmentation;
|
|
6
7
|
const { fillInsideCircle } = strategies;
|
|
7
8
|
import ort from 'onnxruntime-web/webgpu';
|
|
8
9
|
import { vec3 } from 'gl-matrix';
|
|
10
|
+
import { utilities as cornerstoneUtilities } from '@cornerstonejs/core';
|
|
11
|
+
const cs3dLogger = cornerstoneUtilities.logger.aiLog.getLogger('ONNXSegmentationController');
|
|
9
12
|
const { annotation } = cornerstoneTools;
|
|
10
13
|
const { state: annotationState } = annotation;
|
|
11
14
|
const { Events } = Enums;
|
|
@@ -84,7 +87,9 @@ class ONNXSegmentationController {
|
|
|
84
87
|
this.worldPoints = new Array();
|
|
85
88
|
this._searchBreadth = 3;
|
|
86
89
|
this.excludeTool = ONNXSegmentationController.MarkerExclude;
|
|
87
|
-
this.listeners = [
|
|
90
|
+
this.listeners = [
|
|
91
|
+
(message, ...args) => cs3dLogger.info(message, ...args),
|
|
92
|
+
];
|
|
88
93
|
this.desiredImage = {
|
|
89
94
|
imageId: null,
|
|
90
95
|
sampleImageId: null,
|
|
@@ -139,7 +144,7 @@ class ONNXSegmentationController {
|
|
|
139
144
|
if (this._enabled && this._autoSegmentMode) {
|
|
140
145
|
if ('isInAcquisitionPlane' in viewport &&
|
|
141
146
|
!viewport.isInAcquisitionPlane()) {
|
|
142
|
-
|
|
147
|
+
cs3dLogger.warn('Non acquisition plane viewports and auto segment mode is not yet supported');
|
|
143
148
|
return;
|
|
144
149
|
}
|
|
145
150
|
const segmentation = cornerstoneTools.segmentation.activeSegmentation.getActiveSegmentation(viewport.id);
|
|
@@ -365,7 +370,7 @@ class ONNXSegmentationController {
|
|
|
365
370
|
sliceIndex: currentSliceIndex + dir,
|
|
366
371
|
});
|
|
367
372
|
if (!viewRef || viewRef.sliceIndex === currentSliceIndex) {
|
|
368
|
-
|
|
373
|
+
cs3dLogger.warn('No next image in direction', dir, currentSliceIndex);
|
|
369
374
|
return;
|
|
370
375
|
}
|
|
371
376
|
viewport.scroll(dir);
|
|
@@ -679,7 +684,7 @@ class ONNXSegmentationController {
|
|
|
679
684
|
}
|
|
680
685
|
const storeData = (data.image_embeddings || data.embeddings)?.cpuData;
|
|
681
686
|
if (!storeData) {
|
|
682
|
-
|
|
687
|
+
cs3dLogger.info('Unable to store data', data);
|
|
683
688
|
return;
|
|
684
689
|
}
|
|
685
690
|
const writeData = new Float32Array(storeData);
|
|
@@ -958,7 +963,9 @@ class ONNXSegmentationController {
|
|
|
958
963
|
}
|
|
959
964
|
config.threads = parseInt(String(config.threads));
|
|
960
965
|
config.local = parseInt(config.local);
|
|
961
|
-
ort.env.wasm.wasmPaths
|
|
966
|
+
if (!ort.env.wasm.wasmPaths) {
|
|
967
|
+
ort.env.wasm.wasmPaths = getOrtWasmPaths();
|
|
968
|
+
}
|
|
962
969
|
ort.env.wasm.numThreads = config.threads;
|
|
963
970
|
ort.env.wasm.proxy = config.provider == 'wasm';
|
|
964
971
|
this.config = config;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import ONNXSegmentationController from './ONNXSegmentationController.js';
|
|
|
2
2
|
import LabelmapSlicePropagationTool from './LabelmapSlicePropagationTool.js';
|
|
3
3
|
import MarkerLabelmapTool from './MarkerLabelmapTool.js';
|
|
4
4
|
import { Events } from './enums/index.js';
|
|
5
|
-
|
|
5
|
+
import getOrtWasmPaths, { DEFAULT_ORT_WASM_DIRECTORY } from './utils/getOrtWasmPaths.js';
|
|
6
|
+
export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, Events, getOrtWasmPaths, DEFAULT_ORT_WASM_DIRECTORY, };
|
package/dist/esm/index.js
CHANGED
|
@@ -2,4 +2,5 @@ import ONNXSegmentationController from './ONNXSegmentationController.js';
|
|
|
2
2
|
import LabelmapSlicePropagationTool from './LabelmapSlicePropagationTool.js';
|
|
3
3
|
import MarkerLabelmapTool from './MarkerLabelmapTool.js';
|
|
4
4
|
import { Events } from './enums/index.js';
|
|
5
|
-
|
|
5
|
+
import getOrtWasmPaths, { DEFAULT_ORT_WASM_DIRECTORY, } from './utils/getOrtWasmPaths.js';
|
|
6
|
+
export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, Events, getOrtWasmPaths, DEFAULT_ORT_WASM_DIRECTORY, };
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.10.2";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.10.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/ai",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.2",
|
|
4
4
|
"description": "AI and ML Interfaces for Cornerstone3D",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -63,12 +63,11 @@
|
|
|
63
63
|
"onnxruntime-web": "1.17.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@cornerstonejs/core": "5.
|
|
67
|
-
"@cornerstonejs/tools": "5.
|
|
66
|
+
"@cornerstonejs/core": "5.10.2",
|
|
67
|
+
"@cornerstonejs/tools": "5.10.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@cornerstonejs/core": "5.
|
|
71
|
-
"@cornerstonejs/tools": "5.
|
|
72
|
-
}
|
|
73
|
-
"gitHead": "b0e07ac229d4118fa46350210a0ed6ce2cd24a25"
|
|
70
|
+
"@cornerstonejs/core": "5.10.2",
|
|
71
|
+
"@cornerstonejs/tools": "5.10.2"
|
|
72
|
+
}
|
|
74
73
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Open Health Imaging Foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|