@cornerstonejs/core 1.2.9 → 1.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.2.9",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -44,5 +44,5 @@
44
44
  "type": "individual",
45
45
  "url": "https://ohif.org/donate"
46
46
  },
47
- "gitHead": "5119d8f6cdf19bb558509d76b329dd5fba610ed2"
47
+ "gitHead": "9eb70d9467a512d4659cf70836af761de7ecc2f8"
48
48
  }
@@ -333,6 +333,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
333
333
  volumeId: volumeIdToUse,
334
334
  VOILUTFunction: this.VOILUTFunction,
335
335
  invert: this.inverted,
336
+ invertStateChanged: true,
336
337
  };
337
338
 
338
339
  triggerEvent(this.element, Events.VOI_MODIFIED, eventDetail);
package/src/init.ts CHANGED
@@ -8,8 +8,9 @@ import { deepMerge } from './utilities';
8
8
  import { Cornerstone3DConfig } from './types';
9
9
  // TODO: move sharedArrayBuffer into config.
10
10
  // TODO: change config into a class with methods to better control get/set
11
- const defaultConfig = {
12
- detectGPU: {},
11
+ const defaultConfig: Cornerstone3DConfig = {
12
+ gpuTier: undefined,
13
+ detectGPUConfig: {},
13
14
  rendering: {
14
15
  useCPURendering: false,
15
16
  // GPU rendering options
@@ -21,8 +22,9 @@ const defaultConfig = {
21
22
  // ...
22
23
  };
23
24
 
24
- let config = {
25
- detectGPU: {},
25
+ let config: Cornerstone3DConfig = {
26
+ gpuTier: undefined,
27
+ detectGPUConfig: {},
26
28
  rendering: {
27
29
  useCPURendering: false,
28
30
  // GPU rendering options
@@ -106,19 +108,19 @@ async function init(configuration = {}): Promise<boolean> {
106
108
  // merge configs
107
109
  config = deepMerge(defaultConfig, configuration);
108
110
 
109
- // detectGPU
111
+ // gpuTier
110
112
  const hasWebGLContext = _hasActiveWebGLContext();
111
113
  if (!hasWebGLContext) {
112
114
  console.log('CornerstoneRender: GPU not detected, using CPU rendering');
113
115
  config.rendering.useCPURendering = true;
114
116
  } else {
115
- const gpuTier = await getGPUTier();
116
- config.detectGPU = gpuTier;
117
+ config.gpuTier =
118
+ config.gpuTier || (await getGPUTier(config.detectGPUConfig));
117
119
  console.log(
118
120
  'CornerstoneRender: Using detect-gpu to get the GPU benchmark:',
119
- gpuTier
121
+ config.gpuTier
120
122
  );
121
- if (gpuTier.tier < 1) {
123
+ if (config.gpuTier.tier < 1) {
122
124
  console.log(
123
125
  'CornerstoneRender: GPU is not powerful enough, using CPU rendering'
124
126
  );
@@ -1,5 +1,20 @@
1
+ import type { TierResult, GetGPUTier } from 'detect-gpu';
2
+
1
3
  type Cornerstone3DConfig = {
2
- detectGPU: any;
4
+ /**
5
+ * It is used to store the device information,
6
+ * we use it if provided if not a network call is performed.
7
+ * Its type is the `TierResult` in the `detect-gpu` library.
8
+ * https://github.com/pmndrs/detect-gpu/blob/master/src/index.ts#L82
9
+ */
10
+ gpuTier?: TierResult;
11
+ /**
12
+ * When the `gpuTier` is not provided, the `detectGPUConfig` is passed as
13
+ * an argument to the `getGPUTier` method.
14
+ * Its type is the `GetGPUTier` in the `detect-gpu` library.
15
+ * https://github.com/pmndrs/detect-gpu/blob/master/src/index.ts#L20
16
+ */
17
+ detectGPUConfig: GetGPUTier;
3
18
  rendering: {
4
19
  // vtk.js supports 8bit integer textures and 32bit float textures.
5
20
  // However, if the client has norm16 textures (it can be seen by visiting
@@ -42,6 +42,8 @@ type VoiModifiedEventDetail = {
42
42
  VOILUTFunction?: VOILUTFunctionType;
43
43
  /** inverted */
44
44
  invert?: boolean;
45
+ /** Indicates if the 'invert' state has changed from the previous state */
46
+ invertStateChanged?: boolean;
45
47
  };
46
48
 
47
49
  /**