@aics/vole-app 2.13.5 → 2.13.6

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.
@@ -77,6 +77,11 @@ function parseLutValue(value, histogram) {
77
77
  * ```
78
78
  */
79
79
  export function parseLutFromSettings(histogram, initSettings) {
80
+ // TODO: Consider minimizing the types/classes this function is interacting
81
+ // with, since it is only using `initSettings.lut` and the returned Lut is a
82
+ // wrapper around the control point array, e.g.
83
+ // `parseControlPointsFromLutParam(histogram: Histogram, lutParam: [string,
84
+ // string] | undefined): ControlPoint[] | undefined`
80
85
  if (initSettings.lut === undefined || initSettings.lut.length !== 2) {
81
86
  return undefined;
82
87
  }
@@ -86,7 +91,22 @@ export function parseLutFromSettings(histogram, initSettings) {
86
91
  } else {
87
92
  lutValues = [parseLutValue(initSettings.lut[0], histogram), parseLutValue(initSettings.lut[1], histogram)];
88
93
  }
89
- return new Lut().createFromMinMax(Math.min(lutValues[0], lutValues[1]), Math.max(lutValues[0], lutValues[1]));
94
+ if (!Number.isFinite(lutValues[0]) || !Number.isFinite(lutValues[1])) {
95
+ return undefined;
96
+ }
97
+ var sortedLutValues = [Math.min(lutValues[0], lutValues[1]), Math.max(lutValues[0], lutValues[1])];
98
+ var controlPoints = [{
99
+ x: sortedLutValues[0],
100
+ opacity: 0,
101
+ color: TFEDITOR_DEFAULT_COLOR
102
+ }, {
103
+ x: sortedLutValues[1],
104
+ opacity: 1,
105
+ color: TFEDITOR_DEFAULT_COLOR
106
+ }];
107
+ // Create directly from control points instead of using
108
+ // `Lut.createFromMinMax()` because it applies clamping to the [0, 255] range.
109
+ return new Lut().createFromControlPoints(controlPoints);
90
110
  }
91
111
 
92
112
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aics/vole-app",
3
- "version": "2.13.5",
3
+ "version": "2.13.6",
4
4
  "description": "web view of cell volume images",
5
5
  "repository": "github:allen-cell-animated/vole-app",
6
6
  "main": "es/index.js",