@cornerstonejs/tools 0.67.0 → 0.67.2

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/tools",
3
- "version": "0.67.0",
3
+ "version": "0.67.2",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
27
27
  },
28
28
  "dependencies": {
29
- "@cornerstonejs/core": "^0.46.0",
29
+ "@cornerstonejs/core": "^0.46.2",
30
30
  "lodash.clonedeep": "4.5.0",
31
31
  "lodash.get": "^4.4.2"
32
32
  },
@@ -49,5 +49,5 @@
49
49
  "type": "individual",
50
50
  "url": "https://ohif.org/donate"
51
51
  },
52
- "gitHead": "5856c935d5879c1efa3a50930044d6526ed5c2c2"
52
+ "gitHead": "1e5e0ec2e760c409d532f14b145f52853a9f50ec"
53
53
  }
@@ -65,7 +65,8 @@ class WindowLevelTool extends BaseTool {
65
65
  modality = viewport.modality;
66
66
  ({ lower, upper } = properties.voiRange);
67
67
  const { preScale } = viewport.getImageData();
68
- isPreScaled = preScale.scaled;
68
+ isPreScaled =
69
+ preScale.scaled && preScale.scalingParameters?.suvbw !== undefined;
69
70
  } else {
70
71
  throw new Error('Viewport is not a valid type');
71
72
  }
@@ -74,12 +75,15 @@ class WindowLevelTool extends BaseTool {
74
75
  // the x direction. For other modalities, use the canvas delta in both
75
76
  // directions, and if the viewport is a volumeViewport, the multiplier
76
77
  // is calculate using the volume min and max.
77
- if (modality === PT && isPreScaled) {
78
- newRange = this.getPTNewRange({
78
+ if (modality === PT) {
79
+ newRange = this.getPTScaledNewRange({
79
80
  deltaPointsCanvas: deltaPoints.canvas,
80
81
  lower,
81
82
  upper,
82
83
  clientHeight: element.clientHeight,
84
+ isPreScaled,
85
+ viewport,
86
+ volumeId,
83
87
  });
84
88
  } else {
85
89
  newRange = this.getNewRange({
@@ -112,13 +116,30 @@ class WindowLevelTool extends BaseTool {
112
116
  }
113
117
  }
114
118
 
115
- getPTNewRange({ deltaPointsCanvas, lower, upper, clientHeight }) {
119
+ getPTScaledNewRange({
120
+ deltaPointsCanvas,
121
+ lower,
122
+ upper,
123
+ clientHeight,
124
+ viewport,
125
+ volumeId,
126
+ isPreScaled,
127
+ }) {
128
+ let multiplier = DEFAULT_MULTIPLIER;
129
+
130
+ if (isPreScaled) {
131
+ multiplier = 5 / clientHeight;
132
+ } else {
133
+ multiplier =
134
+ this._getMultiplierFromDynamicRange(viewport, volumeId) ||
135
+ DEFAULT_MULTIPLIER;
136
+ }
137
+
116
138
  const deltaY = deltaPointsCanvas[1];
117
- const multiplier = 5 / clientHeight;
118
139
  const wcDelta = deltaY * multiplier;
119
140
 
120
141
  upper -= wcDelta;
121
- upper = Math.max(upper, 0.1);
142
+ upper = isPreScaled ? Math.max(upper, 0.1) : upper;
122
143
 
123
144
  return { lower, upper };
124
145
  }