@aics/vole-app 3.4.4 → 3.5.0
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 +5 -5
- package/es/aics-image-viewer/components/ColorPicker/index.js +9 -1
- package/es/aics-image-viewer/components/ControlPanel/CopySettingsButton.js +415 -0
- package/es/aics-image-viewer/components/ControlPanel/index.js +12 -4
- package/es/aics-image-viewer/components/ControlPanel/styles.css +29 -2
- package/es/aics-image-viewer/components/StyleProvider/index.js +17 -2
- package/es/aics-image-viewer/components/Toolbar/ViewModeRadioButtons.js +1 -1
- package/es/aics-image-viewer/components/Toolbar/index.js +1 -1
- package/es/aics-image-viewer/components/{CellViewerCanvasWrapper → ViewerCanvasWrapper}/index.js +1 -1
- package/es/aics-image-viewer/components/dimension_sliders/RotationSliders.js +1 -1
- package/es/aics-image-viewer/components/shared/ContextualAlert.js +101 -0
- package/es/aics-image-viewer/components/useVolume.js +1 -1
- package/es/aics-image-viewer/shared/constants.js +1 -1
- package/es/aics-image-viewer/shared/types.js +1 -1
- package/es/aics-image-viewer/shared/utils/controlPointsToLut.js +4 -0
- package/es/aics-image-viewer/shared/utils/parseSnapshot.js +179 -0
- package/es/aics-image-viewer/shared/utils/{urlParsing.js → parseUrl.js} +14 -52
- package/es/aics-image-viewer/shared/utils/permissions.js +46 -0
- package/es/aics-image-viewer/shared/utils/test/camera.test.js +0 -1
- package/es/aics-image-viewer/shared/utils/test/{urlParsing.test.js → parseUrl.test.js} +8 -5
- package/es/aics-image-viewer/state/deserialize.js +443 -331
- package/es/aics-image-viewer/state/reset.js +1 -1
- package/es/aics-image-viewer/state/serialize.js +168 -78
- package/es/aics-image-viewer/state/subscribers.js +1 -1
- package/es/aics-image-viewer/state/test/deserialize.test.js +62 -76
- package/es/aics-image-viewer/state/test/reset.test.js +1 -1
- package/es/aics-image-viewer/state/test/serialize.test.js +41 -43
- package/es/aics-image-viewer/state/test/test_data.js +119 -1
- package/es/aics-image-viewer/state/types.js +157 -245
- package/es/aics-image-viewer/state/util.js +39 -1
- package/es/index.js +4 -2
- package/package.json +1 -1
- package/type-declarations/aics-image-viewer/components/App/types.d.ts +3 -3
- package/type-declarations/aics-image-viewer/components/ControlPanel/CopySettingsButton.d.ts +9 -0
- package/type-declarations/aics-image-viewer/components/Toolbar/ViewModeRadioButtons.d.ts +1 -1
- package/type-declarations/aics-image-viewer/components/{CellViewerCanvasWrapper → ViewerCanvasWrapper}/index.d.ts +3 -3
- package/type-declarations/aics-image-viewer/components/dimension_sliders/AxisClipSliders.d.ts +6 -6
- package/type-declarations/aics-image-viewer/components/shared/ContextualAlert.d.ts +29 -0
- package/type-declarations/aics-image-viewer/shared/constants.d.ts +1 -2
- package/type-declarations/aics-image-viewer/shared/types.d.ts +2 -2
- package/type-declarations/aics-image-viewer/shared/utils/controlPointsToLut.d.ts +1 -1
- package/type-declarations/aics-image-viewer/shared/utils/parseSnapshot.d.ts +47 -0
- package/type-declarations/aics-image-viewer/shared/utils/{urlParsing.d.ts → parseUrl.d.ts} +2 -16
- package/type-declarations/aics-image-viewer/shared/utils/permissions.d.ts +7 -0
- package/type-declarations/aics-image-viewer/shared/utils/viewerChannelSettings.d.ts +1 -1
- package/type-declarations/aics-image-viewer/state/deserialize.d.ts +70 -35
- package/type-declarations/aics-image-viewer/state/reset.d.ts +1 -1
- package/type-declarations/aics-image-viewer/state/serialize.d.ts +44 -10
- package/type-declarations/aics-image-viewer/state/types.d.ts +265 -159
- package/type-declarations/aics-image-viewer/state/util.d.ts +3 -1
- package/type-declarations/index.d.ts +5 -3
- package/es/aics-image-viewer/shared/enums.js +0 -18
- package/type-declarations/aics-image-viewer/shared/enums.d.ts +0 -15
- package/type-declarations/aics-image-viewer/shared/utils/math.d.ts +0 -1
- /package/es/aics-image-viewer/components/{CellViewerCanvasWrapper → ViewerCanvasWrapper}/styles.css +0 -0
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { CameraState, ControlPoint } from "@aics/vole-core";
|
|
2
|
-
import type {
|
|
3
|
-
import type { PerAxis } from "../shared/types";
|
|
2
|
+
import type { XYZ } from "../shared/types";
|
|
4
3
|
import type { ColorArray } from "../shared/utils/colorRepresentations";
|
|
4
|
+
export declare enum ViewMode {
|
|
5
|
+
threeD = "3D",
|
|
6
|
+
xy = "XY",
|
|
7
|
+
xz = "XZ",
|
|
8
|
+
yz = "YZ"
|
|
9
|
+
}
|
|
10
|
+
export declare enum RenderMode {
|
|
11
|
+
volumetric = "volumetric",
|
|
12
|
+
maxProject = "maxproject",
|
|
13
|
+
pathTrace = "pathtrace"
|
|
14
|
+
}
|
|
15
|
+
export declare enum ImageType {
|
|
16
|
+
segmentedCell = "cell",
|
|
17
|
+
fullField = "fov"
|
|
18
|
+
}
|
|
5
19
|
/** Global (not per-channel) viewer state which may be changed in the UI */
|
|
6
20
|
export type ViewerState = {
|
|
7
21
|
viewMode: ViewMode;
|
|
@@ -17,8 +31,8 @@ export type ViewerState = {
|
|
|
17
31
|
density: number;
|
|
18
32
|
levels: [number, number, number];
|
|
19
33
|
interpolationEnabled: boolean;
|
|
20
|
-
region:
|
|
21
|
-
slice:
|
|
34
|
+
region: XYZ<[number, number]>;
|
|
35
|
+
slice: XYZ<number>;
|
|
22
36
|
time: number;
|
|
23
37
|
scene: number;
|
|
24
38
|
cameraState: Partial<CameraState> | undefined;
|
|
@@ -27,6 +41,7 @@ export type ViewerState = {
|
|
|
27
41
|
useExactScaleLevel: boolean;
|
|
28
42
|
scaleLevelIndex: number;
|
|
29
43
|
};
|
|
44
|
+
/** Settings for a single channel which may be changed in the UI */
|
|
30
45
|
export type ChannelState = {
|
|
31
46
|
name: string;
|
|
32
47
|
displayName: string;
|
|
@@ -49,32 +64,43 @@ export type ChannelState = {
|
|
|
49
64
|
keepIntensityRange: boolean;
|
|
50
65
|
};
|
|
51
66
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
67
|
+
* The variants of `ViewMode` that appear in serialized representations of state
|
|
68
|
+
* (`ViewerStateSnapshot`, `ViewerStateStringified`).
|
|
69
|
+
*
|
|
70
|
+
* **IMPORTANT:** Changing the values of this enum will BREAK existing image sharing links and exported app state.
|
|
71
|
+
* It should not be done without introducing code to handle the previous values. This enum must not have values that
|
|
72
|
+
* collide when `toLowerCase` is applied to them.
|
|
54
73
|
*/
|
|
55
|
-
export declare enum
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
export declare enum ViewModeSnapshot {
|
|
75
|
+
threeD = "3D",
|
|
76
|
+
xy = "Z",
|
|
77
|
+
xz = "Y",
|
|
78
|
+
yz = "X"
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The variants of `RenderMode` that appear in serialized representations of state
|
|
82
|
+
* (`ViewerStateSnapshot`, `ViewerStateStringified`).
|
|
83
|
+
*
|
|
84
|
+
* **IMPORTANT:** Changing the values of this enum will BREAK existing image sharing links and exported app state.
|
|
85
|
+
* It should not be done without introducing code to handle the previous values. This enum must not have values that
|
|
86
|
+
* collide when `toLowerCase` is applied to them.
|
|
87
|
+
*/
|
|
88
|
+
export declare enum RenderModeSnapshot {
|
|
89
|
+
volumetric = "volumetric",
|
|
90
|
+
maxProject = "maxproject",
|
|
91
|
+
pathTrace = "pathtrace"
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The variants of `ImageType` that appear in serialized representations of state
|
|
95
|
+
* (`ViewerStateSnapshot`, `ViewerStateStringified`).
|
|
96
|
+
*
|
|
97
|
+
* **IMPORTANT:** Changing the values of this enum will BREAK existing image sharing links and exported app state.
|
|
98
|
+
* It should not be done without introducing code to handle the previous values. This enum must not have values that
|
|
99
|
+
* collide when `toLowerCase` is applied to them.
|
|
100
|
+
*/
|
|
101
|
+
export declare enum ImageTypeSnapshot {
|
|
102
|
+
segmentedCell = "cell",
|
|
103
|
+
fullField = "fov"
|
|
78
104
|
}
|
|
79
105
|
export declare enum CameraTransformKeys {
|
|
80
106
|
/** Camera position in 3D coordinates. */
|
|
@@ -88,123 +114,114 @@ export declare enum CameraTransformKeys {
|
|
|
88
114
|
/** Vertical FOV of the camera view frustum, from top to bottom, in degrees. */
|
|
89
115
|
Fov = "fov"
|
|
90
116
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
[
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
export type CameraStateSnapshot = {
|
|
118
|
+
[CameraTransformKeys.Position]?: [number, number, number];
|
|
119
|
+
[CameraTransformKeys.Target]?: [number, number, number];
|
|
120
|
+
[CameraTransformKeys.Up]?: [number, number, number];
|
|
121
|
+
[CameraTransformKeys.OrthoScale]?: number;
|
|
122
|
+
[CameraTransformKeys.Fov]?: number;
|
|
123
|
+
};
|
|
124
|
+
export type CameraStateStringified = {
|
|
125
|
+
[K in CameraTransformKeys]?: string;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Property keys for the "snapshot" variants of `ViewerState`. These keys are shorter, for contexts that need brevity
|
|
129
|
+
* (like URLs), and have a stronger guarantee of stability than the keys of `ViewerState`.
|
|
130
|
+
*
|
|
131
|
+
* **IMPORTANT:** Changing the values of this enum will BREAK existing image sharing links and exported app state.
|
|
132
|
+
* Ideally, you should never do it. If you must, you must also add code to version-check and handle previous values.
|
|
133
|
+
*/
|
|
134
|
+
export declare enum ViewerStateSnapshotKeys {
|
|
135
|
+
/** Axis to view. Snapshot values are `3D`, `Z`, `Y`, `X` (from `ViewModeSnapshot`). */
|
|
136
|
+
View = "view",
|
|
137
|
+
/** Render mode. Possible values are `volumetric`, `maxproject`, or `pathtrace` (from `RenderModeSnapshot`). */
|
|
138
|
+
Mode = "mode",
|
|
139
|
+
/** The opacity of the mask channel, an integer in the range `[0, 100]`. Defaults to `50`. */
|
|
140
|
+
MaskOpacity = "mask",
|
|
141
|
+
/** The type of image to display. Valid values are `cell` and `fov` (from `ImageTypeSnapshot`). Default `cell`. */
|
|
142
|
+
ImageType = "image",
|
|
143
|
+
/** Whether to show the axes helper. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
144
|
+
ShowAxes = "axes",
|
|
145
|
+
/** Whether to show the bounding box. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
146
|
+
ShowBoundingBox = "bb",
|
|
112
147
|
/** The color of the bounding box, as a 6-digit hex color. */
|
|
113
|
-
|
|
148
|
+
BoundingBoxColor = "bbcol",
|
|
114
149
|
/** The background color, as a 6-digit hex color. */
|
|
115
|
-
|
|
116
|
-
/** Whether to autorotate the view.
|
|
117
|
-
|
|
118
|
-
/** The brightness of the image,
|
|
119
|
-
|
|
120
|
-
/** Density, a float in the range [0, 100]
|
|
121
|
-
|
|
150
|
+
BackgroundColor = "bgcol",
|
|
151
|
+
/** Whether to autorotate the view. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
152
|
+
Autorotate = "rot",
|
|
153
|
+
/** The brightness of the image, a float in the range `[0, 100]`. Default `70`. */
|
|
154
|
+
Brightness = "bright",
|
|
155
|
+
/** Density, a float in the range `[0, 100]`. Default `50`. */
|
|
156
|
+
Density = "dens",
|
|
122
157
|
/**
|
|
123
|
-
* Levels for image intensity adjustment. Should be three
|
|
124
|
-
*
|
|
125
|
-
*
|
|
158
|
+
* Levels for image intensity adjustment. Should be a three-element array of numbers (comma-separated when
|
|
159
|
+
* stringified), representing the low, middle, and high values in the range `[0, 255]`. Values will be sorted in
|
|
160
|
+
* ascending order. Empty values in stringified form will be parsed as `0`.
|
|
126
161
|
*/
|
|
127
|
-
|
|
128
|
-
/** Whether to enable interpolation.
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
162
|
+
Levels = "lvl",
|
|
163
|
+
/** Whether to enable interpolation. Boolean, or `0`/`1` when stringified. Default `true`. */
|
|
164
|
+
Interpolation = "interp",
|
|
165
|
+
/**
|
|
166
|
+
* Size of the clipped subregion, in the form `[[xmin, xmax], [ymin, ymax], [zmin, zmax]]`.
|
|
167
|
+
* Stringifies to the form `xmin:xmax,ymin:ymax,zmin:zmax`. Default full range (`[0, 1]`) for each axis.
|
|
132
168
|
*/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
169
|
+
Region = "reg",
|
|
170
|
+
/**
|
|
171
|
+
* Slice position per X, Y, and Z axes, as a three-element array of floats (comma-separated when stringified).
|
|
172
|
+
* Default `0.5` for all axes (e.g. `[0.5, 0.5, 0.5]`).
|
|
136
173
|
*/
|
|
137
|
-
|
|
138
|
-
/** Frame number, for time-series volumes. 0 by default. */
|
|
139
|
-
|
|
140
|
-
/** Scene number, for multiscene images. 0 by default. */
|
|
141
|
-
|
|
142
|
-
/** Whether to use an exact scale level index. 0 by default. */
|
|
143
|
-
[ViewerStateKeys.UseExactScaleLevel]?: string;
|
|
144
|
-
/** The exact scale level index to use, if `UseExactScaleLevel` is 1. 0 by default. */
|
|
145
|
-
[ViewerStateKeys.ScaleLevelIndex]?: string;
|
|
174
|
+
Slice = "slice",
|
|
175
|
+
/** Frame number, for time-series volumes. `0` by default. */
|
|
176
|
+
Time = "t",
|
|
177
|
+
/** Scene number, for multiscene images. `0` by default. */
|
|
178
|
+
Scene = "scene",
|
|
146
179
|
/**
|
|
147
|
-
* Camera transform settings
|
|
148
|
-
* Valid keys are defined in `CameraTransformKeys`:
|
|
149
|
-
* - `pos`: position
|
|
150
|
-
* - `tar`: target
|
|
151
|
-
* - `up`: up
|
|
152
|
-
* - `ort`: orthographic scale
|
|
153
|
-
* - `fov`: field of view
|
|
180
|
+
* Camera transform settings. An object with type `CameraTransformSnapshot`; see `CameraTransformKeys` for more.
|
|
154
181
|
*
|
|
155
|
-
*
|
|
156
|
-
* encoded using `encodeURIComponent`.
|
|
182
|
+
* Stringifies to a list of `key:value` pairs separated by commas. Vector values are encoded as three floats
|
|
183
|
+
* separated by colons (e.g. `1:2:3`) and encoded using `encodeURIComponent`.
|
|
157
184
|
*/
|
|
158
|
-
|
|
185
|
+
CameraState = "cam",
|
|
186
|
+
/** Whether single-channel mode is active. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
187
|
+
SingleChannelMode = "scm",
|
|
188
|
+
/** If single-channel mode is active, which channel index is shown. Default `0`. */
|
|
189
|
+
SingleChannelIndex = "sci",
|
|
190
|
+
/** Whether to use an exact scale level index. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
191
|
+
UseExactScaleLevel = "esl",
|
|
192
|
+
/** The exact scale level index to use, if `UseExactScaleLevel` is `true`. Default `0`. */
|
|
193
|
+
ScaleLevelIndex = "scl"
|
|
159
194
|
}
|
|
160
195
|
/**
|
|
161
|
-
*
|
|
196
|
+
* Property keys for the "snapshot" variants of `ChannelState`/`ViewerChannelSettings`. These keys are shorter, for
|
|
197
|
+
* contexts that need brevity (like URLs), and have a stronger guarantee of stability than the keys of `ChannelState`.
|
|
198
|
+
*
|
|
199
|
+
* **IMPORTANT:** Changing the values of this enum will BREAK existing image sharing links and exported app state.
|
|
200
|
+
* Ideally, you should never do it. If you must, you must also add code to version-check and handle previous values.
|
|
162
201
|
*/
|
|
163
|
-
export declare enum
|
|
202
|
+
export declare enum ChannelStateSnapshotKeys {
|
|
203
|
+
/** Color, as a 6-digit hex color. */
|
|
164
204
|
Color = "col",
|
|
205
|
+
/** Whether colorize is enabled. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
165
206
|
Colorize = "clz",
|
|
207
|
+
/** Colorize alpha, in the range `[0, 1]`. Default `1.0`. */
|
|
166
208
|
ColorizeAlpha = "cza",
|
|
209
|
+
/** Isosurface alpha, in the range `[0, 1]`. Set to `1.0` by default.*/
|
|
167
210
|
IsosurfaceAlpha = "isa",
|
|
168
|
-
Lut = "lut",
|
|
169
|
-
ControlPoints = "cpt",
|
|
170
|
-
ControlPointsLegacy = "cps",
|
|
171
|
-
Ramp = "ram",
|
|
172
|
-
RampLegacy = "rmp",
|
|
173
|
-
ControlPointsEnabled = "cpe",
|
|
174
|
-
VolumeEnabled = "ven",
|
|
175
|
-
SurfaceEnabled = "sen",
|
|
176
|
-
IsosurfaceValue = "isv",
|
|
177
|
-
KeepRange = "pin"
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The serialized form of a ViewerChannelSetting, as a dictionary object.
|
|
181
|
-
*/
|
|
182
|
-
export declare class ViewerChannelStateParams {
|
|
183
|
-
/** Color, as a 6-digit hex color. */
|
|
184
|
-
[ViewerChannelSettingKeys.Color]?: string;
|
|
185
|
-
/** Colorize. "1" is enabled. Disabled by default. */
|
|
186
|
-
[ViewerChannelSettingKeys.Colorize]?: "1" | "0";
|
|
187
|
-
/** Colorize alpha, in the [0, 1] range. Set to `1.0` by default. */
|
|
188
|
-
[ViewerChannelSettingKeys.ColorizeAlpha]?: string;
|
|
189
|
-
/** Isosurface alpha, in the [0, 1 range]. Set to `1.0` by default.*/
|
|
190
|
-
[ViewerChannelSettingKeys.IsosurfaceAlpha]?: string;
|
|
191
211
|
/**
|
|
192
|
-
* Lookup table (LUT) to map from volume intensity to opacity.
|
|
193
|
-
*
|
|
194
|
-
*
|
|
212
|
+
* Lookup table (LUT) to map from volume intensity to opacity. A two-element array of alphanumeric values
|
|
213
|
+
* (colon-separated when stringified), where the first value is the minimum and the second is the maximum.
|
|
214
|
+
* Default `[0, 255]`.
|
|
195
215
|
*
|
|
196
216
|
* Min and max values are determined as following:
|
|
197
|
-
* - Plain numbers are indices of histogram bins, typically in the range [0,
|
|
198
|
-
* 255].
|
|
217
|
+
* - Plain numbers are indices of histogram bins, typically in the range `[0, 255]`.
|
|
199
218
|
* - `v{n}` represents a raw intensity value, where `n` is a number.
|
|
200
|
-
* - `p{n}` represents a percentile, where `n` is a percentile in the [0, 100]
|
|
201
|
-
* range.
|
|
219
|
+
* - `p{n}` represents a percentile, where `n` is a percentile in the range `[0, 100]`.
|
|
202
220
|
* - `m{n}` represents the median multiplied by `n / 100`.
|
|
203
|
-
* - `autoij` in either the min or max fields will use the "auto" algorithm
|
|
204
|
-
* from ImageJ to select the min AND max.
|
|
221
|
+
* - `autoij` in either the min or max fields will use the "auto" algorithm from ImageJ to select the min AND max.
|
|
205
222
|
*
|
|
206
|
-
*
|
|
207
|
-
* those fields are not provided.
|
|
223
|
+
* This field has no counterpart in `ChannelState`. It will be used to determine the initial values of
|
|
224
|
+
* `ControlPoints` and `Ramp` if those fields are not provided.
|
|
208
225
|
*
|
|
209
226
|
* @example
|
|
210
227
|
* ```
|
|
@@ -214,53 +231,142 @@ export declare class ViewerChannelStateParams {
|
|
|
214
231
|
* "autoij:0" // use Auto-IJ to calculate min and max.
|
|
215
232
|
* ```
|
|
216
233
|
*/
|
|
217
|
-
|
|
234
|
+
Lut = "lut",
|
|
218
235
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* - `
|
|
223
|
-
* - `
|
|
224
|
-
*
|
|
236
|
+
* Control points for the transfer function, formatted as a list of objects of type `ControlPointSnapshot` with the
|
|
237
|
+
* following keys:
|
|
238
|
+
* - `x` is a numeric intensity value.
|
|
239
|
+
* - `opacity` is a float in the range `[0, 1]`.
|
|
240
|
+
* - `color` is a 6-digit hex color, e.g. `"ff0000"`. For the extremely common default case where the control point is
|
|
241
|
+
* white (`"ffffff"`), `color` is shortened to just `"1"`.
|
|
225
242
|
*
|
|
226
|
-
*
|
|
243
|
+
* Stringifies to a colon-separated list: `x1:opacity1:color1:x2:opacity2:color2:...`
|
|
244
|
+
*
|
|
245
|
+
* If provided, overrides the `lut` field when calculating control points.
|
|
227
246
|
*/
|
|
228
|
-
|
|
247
|
+
ControlPoints = "cpt",
|
|
229
248
|
/**
|
|
230
|
-
*
|
|
231
|
-
* `x
|
|
232
|
-
* - `x` is a numeric intensity value.
|
|
233
|
-
* - `opacity` is a float in the [0, 1] range.
|
|
234
|
-
* - `color` is a 6-digit hex color, e.g. `ff0000`.
|
|
249
|
+
* Legacy specifier for control points for the transfer function. Formatted exactly like `ControlPoints`,
|
|
250
|
+
* except `x` represents histogram bin indices (in the range `[0, 255]`), not raw intensities.
|
|
235
251
|
*
|
|
236
|
-
*
|
|
252
|
+
* Will be overridden by the `ControlPoints` field (`cpt`) if provided.
|
|
237
253
|
*/
|
|
238
|
-
|
|
254
|
+
ControlPointsLegacy = "cps",
|
|
239
255
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
256
|
+
* Ramp min and max intensity values. Two-element array, colon-separated when stringified (`min:max`).
|
|
257
|
+
*
|
|
258
|
+
* If provided, overrides the `lut` field when calculating the ramp.
|
|
242
259
|
*/
|
|
243
|
-
|
|
260
|
+
Ramp = "ram",
|
|
244
261
|
/**
|
|
245
|
-
* Legacy specifier for the transfer function ramp
|
|
246
|
-
* indices
|
|
247
|
-
*
|
|
262
|
+
* Legacy specifier for the transfer function ramp. Formatted exactly like `Ramp`, except values represent histogram
|
|
263
|
+
* bin indices (in the range `[0, 255]`), not raw intensities.
|
|
264
|
+
*
|
|
265
|
+
* Will be overridden by the Ramp field (`ram`) if provided.
|
|
248
266
|
*/
|
|
249
|
-
|
|
267
|
+
RampLegacy = "rmp",
|
|
250
268
|
/**
|
|
251
|
-
*
|
|
252
|
-
* `
|
|
269
|
+
* Whether this channel's settings are in "advanced mode" and using control points rather than min/max ramp to derive
|
|
270
|
+
* the transfer function. Boolean, or `0`/`1` when stringified. Default `false`.
|
|
253
271
|
*/
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
/** Isosurface value, in the [0, 255]
|
|
260
|
-
|
|
272
|
+
ControlPointsEnabled = "cpe",
|
|
273
|
+
/** Whether volume is enabled. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
274
|
+
VolumeEnabled = "ven",
|
|
275
|
+
/** Whether isosurface is enabled. Boolean, or `0`/`1` when stringified. Default `false`. */
|
|
276
|
+
SurfaceEnabled = "sen",
|
|
277
|
+
/** Isosurface value, in the range `[0, 255]`. Default `128`. */
|
|
278
|
+
IsosurfaceValue = "isv",
|
|
261
279
|
/**
|
|
262
|
-
* Whether to keep the current contrast settings when loading a new volume.
|
|
263
|
-
*
|
|
280
|
+
* Whether to keep the current contrast settings when loading a new volume. Boolean, or `0`/`1` when stringified.
|
|
281
|
+
* Default `false`.
|
|
264
282
|
*/
|
|
265
|
-
|
|
283
|
+
KeepRange = "pin"
|
|
266
284
|
}
|
|
285
|
+
type ViewerStateSnapshotTypes = {
|
|
286
|
+
[ViewerStateSnapshotKeys.View]: ViewModeSnapshot;
|
|
287
|
+
[ViewerStateSnapshotKeys.Mode]: RenderModeSnapshot;
|
|
288
|
+
[ViewerStateSnapshotKeys.MaskOpacity]: number;
|
|
289
|
+
[ViewerStateSnapshotKeys.ImageType]: ImageTypeSnapshot;
|
|
290
|
+
[ViewerStateSnapshotKeys.ShowAxes]: boolean;
|
|
291
|
+
[ViewerStateSnapshotKeys.ShowBoundingBox]: boolean;
|
|
292
|
+
[ViewerStateSnapshotKeys.BoundingBoxColor]: string;
|
|
293
|
+
[ViewerStateSnapshotKeys.BackgroundColor]: string;
|
|
294
|
+
[ViewerStateSnapshotKeys.Autorotate]: boolean;
|
|
295
|
+
[ViewerStateSnapshotKeys.Brightness]: number;
|
|
296
|
+
[ViewerStateSnapshotKeys.Density]: number;
|
|
297
|
+
[ViewerStateSnapshotKeys.Levels]: [number, number, number];
|
|
298
|
+
[ViewerStateSnapshotKeys.Interpolation]: boolean;
|
|
299
|
+
[ViewerStateSnapshotKeys.Region]: [[number, number], [number, number], [number, number]];
|
|
300
|
+
[ViewerStateSnapshotKeys.Slice]: [number, number, number];
|
|
301
|
+
[ViewerStateSnapshotKeys.Time]: number;
|
|
302
|
+
[ViewerStateSnapshotKeys.Scene]: number;
|
|
303
|
+
[ViewerStateSnapshotKeys.CameraState]: CameraStateSnapshot;
|
|
304
|
+
[ViewerStateSnapshotKeys.SingleChannelMode]: boolean;
|
|
305
|
+
[ViewerStateSnapshotKeys.SingleChannelIndex]: number;
|
|
306
|
+
[ViewerStateSnapshotKeys.UseExactScaleLevel]: boolean;
|
|
307
|
+
[ViewerStateSnapshotKeys.ScaleLevelIndex]: number;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* A "snapshot" of a `ViewerState`.
|
|
311
|
+
*
|
|
312
|
+
* This type is a variant representation of `ViewerState`, specialized for saving/restoring state to/from some
|
|
313
|
+
* serialized representation. It has the following desirable properties for this purpose:
|
|
314
|
+
* - Its keys are *shorter*, for formats where that's desirable (mostly URL parameters)
|
|
315
|
+
* - Its keys are reasonably *stable*, so that settings exported from older app versions can be imported by newer ones
|
|
316
|
+
* - Some values, notably colors, are converted to alternate representations for compactness and/or clarity
|
|
317
|
+
*/
|
|
318
|
+
export type ViewerStateSnapshot = {
|
|
319
|
+
[K in ViewerStateSnapshotKeys]?: ViewerStateSnapshotTypes[K];
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* A `ViewerStateSnapshot` with all its keys converted to compact string representations. Useful for (de)serializing
|
|
323
|
+
* viewer state to/from URL parameters.
|
|
324
|
+
*/
|
|
325
|
+
export type ViewerStateStringified = {
|
|
326
|
+
[K in ViewerStateSnapshotKeys]?: string;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* A `ControlPoint` where `color` is a six-digit hex string, or gets shortened to `"1"` in the overwhelming majority of
|
|
330
|
+
* cases where the control point is white to save space in sharing URLs. Used by `ChannelStateSnapshot`.
|
|
331
|
+
*/
|
|
332
|
+
export type ControlPointSnapshot = {
|
|
333
|
+
x: number;
|
|
334
|
+
opacity: number;
|
|
335
|
+
color: string;
|
|
336
|
+
};
|
|
337
|
+
type ChannelStateSnapshotTypes = {
|
|
338
|
+
[ChannelStateSnapshotKeys.Color]: string;
|
|
339
|
+
[ChannelStateSnapshotKeys.Colorize]: boolean;
|
|
340
|
+
[ChannelStateSnapshotKeys.ColorizeAlpha]: number;
|
|
341
|
+
[ChannelStateSnapshotKeys.IsosurfaceAlpha]: number;
|
|
342
|
+
[ChannelStateSnapshotKeys.Lut]: [string | number, string | number];
|
|
343
|
+
[ChannelStateSnapshotKeys.ControlPointsLegacy]: ControlPointSnapshot[];
|
|
344
|
+
[ChannelStateSnapshotKeys.ControlPoints]: ControlPointSnapshot[];
|
|
345
|
+
[ChannelStateSnapshotKeys.ControlPointsEnabled]: boolean;
|
|
346
|
+
[ChannelStateSnapshotKeys.RampLegacy]: [number, number];
|
|
347
|
+
[ChannelStateSnapshotKeys.Ramp]: [number, number];
|
|
348
|
+
[ChannelStateSnapshotKeys.VolumeEnabled]: boolean;
|
|
349
|
+
[ChannelStateSnapshotKeys.SurfaceEnabled]: boolean;
|
|
350
|
+
[ChannelStateSnapshotKeys.IsosurfaceValue]: number;
|
|
351
|
+
[ChannelStateSnapshotKeys.KeepRange]: boolean;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* A "snapshot" of a `ChannelState` or `ViewerChannelSetting`.
|
|
355
|
+
*
|
|
356
|
+
* This type is a variant representation of `ChannelState`/`ViewerChannelSetting`, specialized for saving/restoring
|
|
357
|
+
* channel state to/from some serialized representation. It has the following desirable properties for this purpose:
|
|
358
|
+
* - Its keys are *shorter*, for formats where that's desirable (mostly URL parameters)
|
|
359
|
+
* - Its keys are reasonably *stable*, so that settings exported from older app versions can be imported by newer ones
|
|
360
|
+
* - Some values, notably colors, are converted to alternate representations for compactness and/or clarity
|
|
361
|
+
*/
|
|
362
|
+
export type ChannelStateSnapshot = {
|
|
363
|
+
[K in ChannelStateSnapshotKeys]?: ChannelStateSnapshotTypes[K];
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* A `ChannelStateSnapshot` with all its keys converted to compact string representations. Useful for (de)serializing
|
|
367
|
+
* channel state to/from URL parameters.
|
|
368
|
+
*/
|
|
369
|
+
export type ChannelStateStringified = {
|
|
370
|
+
[K in ChannelStateSnapshotKeys]?: string;
|
|
371
|
+
};
|
|
372
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ViewerState } from "../state/types";
|
|
1
|
+
import type { ChannelState, ViewerState } from "../state/types";
|
|
2
2
|
/**
|
|
3
3
|
* Accepts a `key` and a new (potentially partial) `value` for a single field of `ViewerState`, & returns a fragment of
|
|
4
4
|
* `ViewerState` that can safely be merged into `currentState` to apply that value without creating an illegal state.
|
|
@@ -6,3 +6,5 @@ import type { ViewerState } from "../state/types";
|
|
|
6
6
|
export declare const validateStateValue: <K extends keyof ViewerState>(currentState: ViewerState, key: K, value: Partial<ViewerState[K]>) => Partial<ViewerState>;
|
|
7
7
|
/** Ensures a fragment of `ViewerState` can be safely merged into `currentState` without creating an illegal state. */
|
|
8
8
|
export declare const validateState: (currentState: ViewerState, newState: Partial<{ [K in keyof ViewerState]: Partial<ViewerState[K]>; }>) => Partial<ViewerState>;
|
|
9
|
+
/** Creates a deep copy of a `ChannelState` */
|
|
10
|
+
export declare const cloneChannelState: (setting: ChannelState) => ChannelState;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import ImageViewerApp from "./aics-image-viewer/components/App";
|
|
2
|
-
export {
|
|
2
|
+
export { parseViewerUrlParams } from "./aics-image-viewer/shared/utils/parseUrl";
|
|
3
3
|
export { writeMetadata, writeScenes } from "./aics-image-viewer/shared/utils/storage";
|
|
4
|
+
export { type ViewerMessage, type StoreSnapshot, viewerMessageToParams, isStoreSnapshot, snapshotToViewerChannelSettings, } from "./aics-image-viewer/shared/utils/parseSnapshot";
|
|
5
|
+
export { snapshotToViewerState } from "./aics-image-viewer/state/deserialize";
|
|
4
6
|
export type { ViewerChannelSettings, ViewerChannelGroup, ViewerChannelSetting, } from "./aics-image-viewer/shared/utils/viewerChannelSettings";
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
+
export { ViewMode, RenderMode, ImageType } from "./aics-image-viewer/state/types";
|
|
8
|
+
export type { ViewerState, ViewerStateSnapshot, ChannelStateSnapshot } from "./aics-image-viewer/state/types";
|
|
7
9
|
export type { AppProps } from "./aics-image-viewer/components/App/types";
|
|
8
10
|
export type { RawArrayData, RawArrayInfo } from "@aics/vole-core";
|
|
9
11
|
export { ImageViewerApp };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export var ViewMode = /*#__PURE__*/function (ViewMode) {
|
|
2
|
-
ViewMode["threeD"] = "3D";
|
|
3
|
-
ViewMode["xy"] = "XY";
|
|
4
|
-
ViewMode["xz"] = "XZ";
|
|
5
|
-
ViewMode["yz"] = "YZ";
|
|
6
|
-
return ViewMode;
|
|
7
|
-
}({});
|
|
8
|
-
export var RenderMode = /*#__PURE__*/function (RenderMode) {
|
|
9
|
-
RenderMode["volumetric"] = "volumetric";
|
|
10
|
-
RenderMode["maxProject"] = "maxproject";
|
|
11
|
-
RenderMode["pathTrace"] = "pathtrace";
|
|
12
|
-
return RenderMode;
|
|
13
|
-
}({});
|
|
14
|
-
export var ImageType = /*#__PURE__*/function (ImageType) {
|
|
15
|
-
ImageType["segmentedCell"] = "cell";
|
|
16
|
-
ImageType["fullField"] = "fov";
|
|
17
|
-
return ImageType;
|
|
18
|
-
}({});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare enum ViewMode {
|
|
2
|
-
threeD = "3D",
|
|
3
|
-
xy = "XY",
|
|
4
|
-
xz = "XZ",
|
|
5
|
-
yz = "YZ"
|
|
6
|
-
}
|
|
7
|
-
export declare enum RenderMode {
|
|
8
|
-
volumetric = "volumetric",
|
|
9
|
-
maxProject = "maxproject",
|
|
10
|
-
pathTrace = "pathtrace"
|
|
11
|
-
}
|
|
12
|
-
export declare enum ImageType {
|
|
13
|
-
segmentedCell = "cell",
|
|
14
|
-
fullField = "fov"
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
/package/es/aics-image-viewer/components/{CellViewerCanvasWrapper → ViewerCanvasWrapper}/styles.css
RENAMED
|
File without changes
|