@cornerstonejs/tools 3.27.0 → 3.28.1

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.
@@ -143,7 +143,7 @@ class WindowLevelTool extends BaseTool {
143
143
  }, [Infinity, -Infinity]);
144
144
  const BitsStored = imageVolume?.metadata?.BitsStored;
145
145
  const metadataDynamicRange = BitsStored ? 2 ** BitsStored : Infinity;
146
- imageDynamicRange = Math.min(calculatedDynamicRange, metadataDynamicRange);
146
+ imageDynamicRange = Math.min(calculatedDynamicRange[1] - calculatedDynamicRange[0], metadataDynamicRange);
147
147
  }
148
148
  else {
149
149
  imageDynamicRange = this._getImageDynamicRangeFromViewport(viewport);
@@ -1,6 +1,7 @@
1
- import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, } from '@cornerstonejs/core';
1
+ import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, metaData, utilities, } from '@cornerstonejs/core';
2
2
  import { addToolState, getToolState } from './state';
3
3
  import { getStackData, requestType, priority, clearFromImageIds, getPromiseRemovedHandler, } from './stackPrefetchUtils';
4
+ const { imageRetrieveMetadataProvider } = utilities;
4
5
  let configuration = {
5
6
  maxImagesToPrefetch: Infinity,
6
7
  minBefore: 2,
@@ -103,9 +104,13 @@ function prefetch(element) {
103
104
  }
104
105
  }
105
106
  }
106
- const requestFn = (imageId, options) => imageLoader
107
- .loadAndCacheImage(imageId, options)
108
- .then(() => doneCallback(imageId));
107
+ const requestFn = (imageId, options) => {
108
+ const { retrieveOptions = {} } = metaData.get(imageRetrieveMetadataProvider.IMAGE_RETRIEVE_CONFIGURATION, imageId, 'stack');
109
+ return imageLoader.loadAndCacheImage(imageId, {
110
+ ...options,
111
+ retrieveOptions: retrieveOptions?.default || Object.values(retrieveOptions)?.[0] || {},
112
+ });
113
+ };
109
114
  stackPrefetch.indicesToRequest.forEach((imageIdIndex) => {
110
115
  const imageId = stack.imageIds[imageIdIndex];
111
116
  const options = {
@@ -1,6 +1,7 @@
1
- import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, getConfiguration as getCoreConfiguration, } from '@cornerstonejs/core';
1
+ import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, metaData, utilities, } from '@cornerstonejs/core';
2
2
  import { addToolState, getToolState } from './state';
3
3
  import { getStackData, requestType, priority, getPromiseRemovedHandler, nearestIndex, range, } from './stackPrefetchUtils';
4
+ const { imageRetrieveMetadataProvider } = utilities;
4
5
  let configuration = {
5
6
  maxImagesToPrefetch: Infinity,
6
7
  preserveExistingPool: true,
@@ -86,7 +87,13 @@ function prefetch(element) {
86
87
  imageIdsToPrefetch.push(imageId);
87
88
  }
88
89
  }
89
- const requestFn = (imageId, options) => imageLoader.loadAndCacheImage(imageId, options);
90
+ const requestFn = (imageId, options) => {
91
+ const { retrieveOptions = {} } = metaData.get(imageRetrieveMetadataProvider.IMAGE_RETRIEVE_CONFIGURATION, imageId, 'stack');
92
+ return imageLoader.loadAndCacheImage(imageId, {
93
+ ...options,
94
+ retrieveOptions: retrieveOptions?.default || Object.values(retrieveOptions)?.[0] || {},
95
+ });
96
+ };
90
97
  imageIdsToPrefetch.forEach((imageId) => {
91
98
  const options = {
92
99
  requestType,
@@ -1 +1 @@
1
- export declare const version = "3.27.0";
1
+ export declare const version = "3.28.1";
@@ -1 +1 @@
1
- export const version = '3.27.0';
1
+ export const version = '3.28.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.27.0",
3
+ "version": "3.28.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,7 +108,7 @@
108
108
  "canvas": "^3.1.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "^3.27.0",
111
+ "@cornerstonejs/core": "^3.28.1",
112
112
  "@kitware/vtk.js": "32.12.1",
113
113
  "@types/d3-array": "^3.0.4",
114
114
  "@types/d3-interpolate": "^3.0.1",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "877bed9dc602f121a7ec1da9941994d7d49da9ea"
130
+ "gitHead": "b17eba02d079a31ed370cdf975a0fedcdf6b081d"
131
131
  }