@cornerstonejs/tools 2.18.5 → 2.18.7

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.
@@ -12,7 +12,7 @@ export default {
12
12
  };
13
13
  previewVoxelManager.forEach(callback);
14
14
  }
15
- const inputImage = getItkImage(segmentationImageData, 'interpolation');
15
+ const inputImage = await getItkImage(segmentationImageData, 'interpolation');
16
16
  let itkModule;
17
17
  try {
18
18
  itkModule = await peerImport('@itk-wasm/morphological-contour-interpolation');
@@ -1,2 +1 @@
1
- import { Image } from 'itk-wasm';
2
- export default function getItkImage(imageData: any, imageName?: string): Image;
1
+ export default function getItkImage(imageData: any, imageName?: string): Promise<unknown>;
@@ -1,17 +1,28 @@
1
- import { Image, ImageType, IntTypes, FloatTypes, PixelTypes } from 'itk-wasm';
2
- const dataTypesMap = {
3
- Int8: IntTypes.Int8,
4
- UInt8: IntTypes.UInt8,
5
- Int16: IntTypes.Int16,
6
- UInt16: IntTypes.UInt16,
7
- Int32: IntTypes.Int32,
8
- UInt32: IntTypes.UInt32,
9
- Int64: IntTypes.Int64,
10
- UInt64: IntTypes.UInt64,
11
- Float32: FloatTypes.Float32,
12
- Float64: FloatTypes.Float64,
13
- };
14
- export default function getItkImage(imageData, imageName) {
1
+ export default async function getItkImage(imageData, imageName) {
2
+ let Image, ImageType, IntTypes, FloatTypes, PixelTypes;
3
+ try {
4
+ const itkModule = await import('itk-wasm');
5
+ if (!itkModule) {
6
+ throw new Error('Module not found');
7
+ }
8
+ ({ Image, ImageType, IntTypes, FloatTypes, PixelTypes } = itkModule);
9
+ }
10
+ catch (error) {
11
+ console.debug("Warning: 'itk-wasm' module not found. Please install it separately.");
12
+ return null;
13
+ }
14
+ const dataTypesMap = {
15
+ Int8: IntTypes.Int8,
16
+ UInt8: IntTypes.UInt8,
17
+ Int16: IntTypes.Int16,
18
+ UInt16: IntTypes.UInt16,
19
+ Int32: IntTypes.Int32,
20
+ UInt32: IntTypes.UInt32,
21
+ Int64: IntTypes.Int64,
22
+ UInt64: IntTypes.UInt64,
23
+ Float32: FloatTypes.Float32,
24
+ Float64: FloatTypes.Float64,
25
+ };
15
26
  const { voxelManager } = imageData.get('voxelManager');
16
27
  const { numberOfComponents } = imageData.get('numberOfComponents');
17
28
  const scalarData = voxelManager.getCompleteScalarDataArray();
@@ -320,10 +320,10 @@ function _createVolumeViewportCinePlayContext(viewport, volume) {
320
320
  function _createDynamicVolumeViewportCinePlayContext(volume) {
321
321
  return {
322
322
  get numScrollSteps() {
323
- return volume.numTimePoints;
323
+ return volume.numDimensionGroups;
324
324
  },
325
325
  get currentStepIndex() {
326
- return volume.timePointIndex;
326
+ return volume.dimensionGroupNumber;
327
327
  },
328
328
  get frameTimeVectorEnabled() {
329
329
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "2.18.5",
3
+ "version": "2.18.7",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -104,7 +104,7 @@
104
104
  "canvas": "^2.11.2"
105
105
  },
106
106
  "peerDependencies": {
107
- "@cornerstonejs/core": "^2.18.5",
107
+ "@cornerstonejs/core": "^2.18.7",
108
108
  "@kitware/vtk.js": "32.9.0",
109
109
  "@types/d3-array": "^3.0.4",
110
110
  "@types/d3-interpolate": "^3.0.1",
@@ -123,5 +123,5 @@
123
123
  "type": "individual",
124
124
  "url": "https://ohif.org/donate"
125
125
  },
126
- "gitHead": "be8bb617be050ca5aa5a9d2d61013a9c674efa5d"
126
+ "gitHead": "313a569eec20e132ea5f0929e10b34bd5ea63ba2"
127
127
  }