@cornerstonejs/ai 3.22.2 → 3.22.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.
@@ -1,6 +1,7 @@
1
1
  import { utilities, eventTarget, Enums, triggerEvent, cache, } from '@cornerstonejs/core';
2
2
  import * as cornerstoneTools from '@cornerstonejs/tools';
3
3
  import { segmentation as cstSegmentation, LabelmapBaseTool, } from '@cornerstonejs/tools';
4
+ import { Events as aiEvents } from './enums';
4
5
  const { strategies } = cstSegmentation;
5
6
  const { fillInsideCircle } = strategies;
6
7
  import ort from 'onnxruntime-web/webgpu';
@@ -13,11 +14,6 @@ const { segmentation } = cornerstoneTools;
13
14
  const { filterAnnotationsForDisplay } = cornerstoneTools.utilities.planar;
14
15
  const { IslandRemoval } = cornerstoneTools.utilities;
15
16
  const { triggerSegmentationDataModified } = segmentation.triggerSegmentationEvents;
16
- const ONNX_EVENTS = {
17
- MODEL_LOADING_STARTED: 'ONNX_MODEL_LOADING_STARTED',
18
- MODEL_LOADING_COMPLETED: 'ONNX_MODEL_LOADING_COMPLETED',
19
- MODEL_COMPONENT_LOADED: 'ONNX_MODEL_COMPONENT_LOADED',
20
- };
21
17
  function cloneTensor(t) {
22
18
  return new ort.Tensor(t.type, Float32Array.from(t.data), t.dims);
23
19
  }
@@ -861,7 +857,7 @@ export default class ONNXSegmentationController {
861
857
  const cache = await caches.open('onnx');
862
858
  let cachedResponse = await cache.match(url);
863
859
  if (cachedResponse == undefined) {
864
- triggerEvent(eventTarget, ONNX_EVENTS.MODEL_COMPONENT_LOADED, {
860
+ triggerEvent(eventTarget, aiEvents.MODEL_COMPONENT_LOADED, {
865
861
  name,
866
862
  url,
867
863
  status: 'loading',
@@ -872,7 +868,7 @@ export default class ONNXSegmentationController {
872
868
  this.log(Loggers.Log, `${name} (network)`);
873
869
  }
874
870
  else {
875
- triggerEvent(eventTarget, ONNX_EVENTS.MODEL_COMPONENT_LOADED, {
871
+ triggerEvent(eventTarget, aiEvents.MODEL_COMPONENT_LOADED, {
876
872
  name,
877
873
  url,
878
874
  status: 'loaded',
@@ -885,7 +881,7 @@ export default class ONNXSegmentationController {
885
881
  }
886
882
  catch (error) {
887
883
  this.log(Loggers.Log, `${name} (network)`);
888
- triggerEvent(eventTarget, ONNX_EVENTS.MODEL_COMPONENT_LOADED, {
884
+ triggerEvent(eventTarget, aiEvents.MODEL_COMPONENT_LOADED, {
889
885
  name,
890
886
  url,
891
887
  status: 'error',
@@ -905,7 +901,7 @@ export default class ONNXSegmentationController {
905
901
  }
906
902
  urls.push(model.url);
907
903
  }
908
- triggerEvent(eventTarget, ONNX_EVENTS.MODEL_LOADING_STARTED, {
904
+ triggerEvent(eventTarget, aiEvents.MODEL_LOADING_STARTED, {
909
905
  modelConfig: this.config.model,
910
906
  totalSize: missing,
911
907
  urls,
@@ -941,7 +937,7 @@ export default class ONNXSegmentationController {
941
937
  }
942
938
  const stop = performance.now();
943
939
  const loadTime = stop - start;
944
- triggerEvent(eventTarget, ONNX_EVENTS.MODEL_LOADING_COMPLETED, {
940
+ triggerEvent(eventTarget, aiEvents.MODEL_LOADING_COMPLETED, {
945
941
  modelConfig: this.config.model,
946
942
  loadTimeMs: loadTime,
947
943
  urls,
@@ -0,0 +1,6 @@
1
+ declare enum Events {
2
+ MODEL_LOADING_STARTED = "AI_MODEL_LOADING_STARTED",
3
+ MODEL_LOADING_COMPLETED = "AI_MODEL_LOADING_COMPLETED",
4
+ MODEL_COMPONENT_LOADED = "AI_MODEL_COMPONENT_LOADED"
5
+ }
6
+ export default Events;
@@ -0,0 +1,7 @@
1
+ var Events;
2
+ (function (Events) {
3
+ Events["MODEL_LOADING_STARTED"] = "AI_MODEL_LOADING_STARTED";
4
+ Events["MODEL_LOADING_COMPLETED"] = "AI_MODEL_LOADING_COMPLETED";
5
+ Events["MODEL_COMPONENT_LOADED"] = "AI_MODEL_COMPONENT_LOADED";
6
+ })(Events || (Events = {}));
7
+ export default Events;
@@ -0,0 +1,2 @@
1
+ import Events from './Events';
2
+ export { Events };
@@ -0,0 +1,2 @@
1
+ import Events from './Events';
2
+ export { Events };
@@ -1,4 +1,5 @@
1
1
  import ONNXSegmentationController from './ONNXSegmentationController';
2
2
  import LabelmapSlicePropagationTool from './LabelmapSlicePropagationTool';
3
3
  import MarkerLabelmapTool from './MarkerLabelmapTool';
4
- export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, };
4
+ import { Events } from './enums';
5
+ export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, Events, };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import ONNXSegmentationController from './ONNXSegmentationController';
2
2
  import LabelmapSlicePropagationTool from './LabelmapSlicePropagationTool';
3
3
  import MarkerLabelmapTool from './MarkerLabelmapTool';
4
- export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, };
4
+ import { Events } from './enums';
5
+ export { ONNXSegmentationController, LabelmapSlicePropagationTool, MarkerLabelmapTool, Events, };
@@ -1 +1 @@
1
- export declare const version = "3.22.2";
1
+ export declare const version = "3.22.3";
@@ -1 +1 @@
1
- export const version = '3.22.2';
1
+ export const version = '3.22.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/ai",
3
- "version": "3.22.2",
3
+ "version": "3.22.3",
4
4
  "description": "AI and ML Interfaces for Cornerstone3D",
5
5
  "files": [
6
6
  "dist"
@@ -62,8 +62,8 @@
62
62
  "onnxruntime-web": "1.17.1"
63
63
  },
64
64
  "peerDependencies": {
65
- "@cornerstonejs/core": "^3.22.2",
66
- "@cornerstonejs/tools": "^3.22.2"
65
+ "@cornerstonejs/core": "^3.22.3",
66
+ "@cornerstonejs/tools": "^3.22.3"
67
67
  },
68
- "gitHead": "3d92fc6b7bb0483ba2a648a3207e3d29697690f0"
68
+ "gitHead": "2c1e70319eb5a1c71a3d94fdd6c53f3f21478638"
69
69
  }