@cornerstonejs/core 1.8.0 → 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.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "type": "individual",
47
47
  "url": "https://ohif.org/donate"
48
48
  },
49
- "gitHead": "adb02393675fbdb364b9b7d9a9f6d5113b15d8be"
49
+ "gitHead": "04ab5157739660d5bd012ae6c558afb01e9b3565"
50
50
  }
@@ -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
  /**