@cornerstonejs/core 1.7.2 → 1.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "scripts": {
18
18
  "build:cjs": "tsc --project ./tsconfig.cjs.json",
19
19
  "build:esm": "tsc --project ./tsconfig.esm.json",
20
+ "build:esm:watch": "tsc --project ./tsconfig.esm.json --watch",
20
21
  "build:umd": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
21
22
  "build:all": "yarn run build:umd && yarn run build:cjs && yarn run build:esm",
22
23
  "clean": "shx rm -rf dist",
@@ -45,5 +46,5 @@
45
46
  "type": "individual",
46
47
  "url": "https://ohif.org/donate"
47
48
  },
48
- "gitHead": "8d996239bf6e2ce265a4d0bd6a5a6d8fe5e7122f"
49
+ "gitHead": "04ab5157739660d5bd012ae6c558afb01e9b3565"
49
50
  }
@@ -1757,8 +1757,8 @@ class StackViewport extends Viewport implements IStackViewport {
1757
1757
 
1758
1758
  //If Photometric Interpretation is not the same for the next image we are trying to load, invalidate the stack to recreate the VTK imageData
1759
1759
  if (
1760
- this.csImage?.imageFrame?.photometricInterpretation !==
1761
- image.imageFrame?.photometricInterpretation
1760
+ this.csImage?.imageFrame.photometricInterpretation !==
1761
+ image?.imageFrame?.photometricInterpretation
1762
1762
  ) {
1763
1763
  this.stackInvalidated = true;
1764
1764
  }
@@ -2050,10 +2050,15 @@ class StackViewport extends Viewport implements IStackViewport {
2050
2050
  const monochrome1 =
2051
2051
  imagePixelModule.photometricInterpretation === 'MONOCHROME1';
2052
2052
 
2053
+ // invalidate the stack so that we can set the voi range
2054
+ this.stackInvalidated = true;
2055
+
2053
2056
  this.setVOI(this._getInitialVOIRange(image), {
2054
2057
  forceRecreateLUTFunction: !!monochrome1,
2055
2058
  });
2056
- this.setInvertColor(!!monochrome1);
2059
+
2060
+ // should carry over the invert color from the previous image if has been applied
2061
+ this.setInvertColor(this.invert || !!monochrome1);
2057
2062
 
2058
2063
  // Saving position of camera on render, to cache the panning
2059
2064
  this.cameraFocalPointOnRender = this.getCamera().focalPoint;
@@ -2107,9 +2112,20 @@ class StackViewport extends Viewport implements IStackViewport {
2107
2112
  windowWidth: number | number[],
2108
2113
  windowCenter: number | number[]
2109
2114
  ): { lower: number; upper: number } | undefined {
2110
- return typeof windowCenter === 'number' && typeof windowWidth === 'number'
2111
- ? windowLevelUtil.toLowHighRange(windowWidth, windowCenter)
2112
- : undefined;
2115
+ let center, width;
2116
+
2117
+ if (typeof windowCenter === 'number' && typeof windowWidth === 'number') {
2118
+ center = windowCenter;
2119
+ width = windowWidth;
2120
+ } else if (Array.isArray(windowCenter) && Array.isArray(windowWidth)) {
2121
+ center = windowCenter[0];
2122
+ width = windowWidth[0];
2123
+ }
2124
+
2125
+ // If center and width are defined, convert them to low-high range
2126
+ if (center !== undefined && width !== undefined) {
2127
+ return windowLevelUtil.toLowHighRange(width, center);
2128
+ }
2113
2129
  }
2114
2130
 
2115
2131
  /**