@aics/vole-app 2.13.5 → 2.13.7
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/es/aics-image-viewer/components/App/index.js +8 -3
- package/es/aics-image-viewer/components/ErrorAlert/index.js +1 -1
- package/es/aics-image-viewer/shared/utils/controlPointsToLut.js +21 -1
- package/package.json +1 -1
- package/type-declarations/aics-image-viewer/components/App/types.d.ts +1 -0
- package/type-declarations/aics-image-viewer/shared/types.d.ts +4 -0
|
@@ -72,7 +72,8 @@ var defaultProps = {
|
|
|
72
72
|
parentImageDownloadHref: "",
|
|
73
73
|
pixelSize: undefined,
|
|
74
74
|
canvasMargin: "0 0 0 0",
|
|
75
|
-
view3dRef: undefined
|
|
75
|
+
view3dRef: undefined,
|
|
76
|
+
showError: undefined
|
|
76
77
|
};
|
|
77
78
|
var CLIPPING_PANEL_ANIMATION_DURATION_MS = 300;
|
|
78
79
|
var setIndicatorPositions = function setIndicatorPositions(view3d, panelOpen, hasTime, hasScenes, isMode3d) {
|
|
@@ -104,7 +105,7 @@ var setIndicatorPositions = function setIndicatorPositions(view3d, panelOpen, ha
|
|
|
104
105
|
view3d.setScaleBarPosition(scaleBarX, scaleBarY);
|
|
105
106
|
};
|
|
106
107
|
var App = function App(props) {
|
|
107
|
-
var _getCurrentViewerChan, _scenes$length, _scenes2, _image$imageInfo$volu, _image$imageInfo$subr, _image$imageInfo$time, _props$transform2, _props$transform4;
|
|
108
|
+
var _props$showError, _getCurrentViewerChan, _scenes$length, _scenes2, _image$imageInfo$volu, _image$imageInfo$subr, _image$imageInfo$time, _props$transform2, _props$transform4;
|
|
108
109
|
props = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
109
110
|
|
|
110
111
|
// State management /////////////////////////////////////////////////////////
|
|
@@ -134,10 +135,14 @@ var App = function App(props) {
|
|
|
134
135
|
if (props.view3dRef !== undefined) {
|
|
135
136
|
props.view3dRef.current = view3d;
|
|
136
137
|
}
|
|
138
|
+
|
|
139
|
+
// Allows AppWrapper to pass in its own `useErrorAlert` callbacks, but still keeps error
|
|
140
|
+
// messaging when App is used standalone.
|
|
137
141
|
var _useErrorAlert = useErrorAlert(),
|
|
138
142
|
_useErrorAlert2 = _slicedToArray(_useErrorAlert, 2),
|
|
139
143
|
errorAlert = _useErrorAlert2[0],
|
|
140
|
-
|
|
144
|
+
_showError = _useErrorAlert2[1];
|
|
145
|
+
var showError = (_props$showError = props.showError) !== null && _props$showError !== void 0 ? _props$showError : _showError;
|
|
141
146
|
useEffect(function () {
|
|
142
147
|
// Get notifications of loading errors which occur after the initial load, e.g. on time change or new channel load
|
|
143
148
|
view3d.setLoadErrorHandler(function (_vol, e) {
|
|
@@ -37,7 +37,7 @@ var ERROR_TYPE_DESCRIPTIONS = _defineProperty(_defineProperty(_defineProperty(_d
|
|
|
37
37
|
}, "start a bug report here"), ".")), VolumeLoadErrorType.INVALID_METADATA, /*#__PURE__*/React.createElement(React.Fragment, null, "The viewer was unable to read all necessary information from this volume's metadata. Check that your dataset's metadata is complete and properly formatted. If you believe your data is valid and should be supported by our viewer, let us know by ", /*#__PURE__*/React.createElement(IssueLink, null, "opening a GitHub issue"), ".")), VolumeLoadErrorType.INVALID_MULTI_SOURCE_ZARR, /*#__PURE__*/React.createElement(React.Fragment, null, "The viewer is currently configured to consolidate multiple OME-Zarr datasets into a single volume, but the provided datasets can't all be matched up. Ensure that all dataset URLs are correct and that at least one equivalently-sized scale level exists in all datasets."));
|
|
38
38
|
var getErrorTitle = function getErrorTitle(error) {
|
|
39
39
|
var _error$toString;
|
|
40
|
-
return error instanceof Error && ((_error$toString = error.toString) === null || _error$toString === void 0 ? void 0 : _error$toString.call(error)) || "Unknown error";
|
|
40
|
+
return error instanceof Error && ((_error$toString = error.toString) === null || _error$toString === void 0 ? void 0 : _error$toString.call(error)) || typeof error === "string" && error || "Unknown error";
|
|
41
41
|
};
|
|
42
42
|
var getErrorDescription = function getErrorDescription(error) {
|
|
43
43
|
var _ERROR_TYPE_DESCRIPTI2;
|
|
@@ -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
|
-
|
|
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