@aics/vole-app 2.11.0 → 2.13.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.
Files changed (27) hide show
  1. package/es/aics-image-viewer/components/App/ChannelUpdater.js +11 -12
  2. package/es/aics-image-viewer/components/App/index.js +62 -30
  3. package/es/aics-image-viewer/components/AxisClipSliders/index.js +34 -25
  4. package/es/aics-image-viewer/components/BottomPanel/index.js +12 -28
  5. package/es/aics-image-viewer/components/CellViewerCanvasWrapper/index.js +3 -12
  6. package/es/aics-image-viewer/components/ChannelsWidgetRow/index.js +6 -2
  7. package/es/aics-image-viewer/components/ChannelsWidgetRow/styles.css +5 -1
  8. package/es/aics-image-viewer/components/ErrorAlert/index.js +1 -1
  9. package/es/aics-image-viewer/components/ErrorAlert/styles.css +3 -0
  10. package/es/aics-image-viewer/components/StyleProvider/index.js +1 -1
  11. package/es/aics-image-viewer/components/TfEditor/index.js +229 -41
  12. package/es/aics-image-viewer/components/TfEditor/styles.css +19 -7
  13. package/es/aics-image-viewer/components/Toolbar/ViewModeRadioButtons.js +1 -1
  14. package/es/aics-image-viewer/components/Toolbar/index.js +34 -30
  15. package/es/aics-image-viewer/components/ViewerStateProvider/index.js +11 -13
  16. package/es/aics-image-viewer/shared/constants.js +41 -1
  17. package/es/aics-image-viewer/shared/utils/hooks.js +3 -3
  18. package/es/aics-image-viewer/shared/utils/viewerState.js +3 -1
  19. package/package.json +4 -3
  20. package/type-declarations/aics-image-viewer/components/App/types.d.ts +1 -1
  21. package/type-declarations/aics-image-viewer/components/BottomPanel/index.d.ts +2 -2
  22. package/type-declarations/aics-image-viewer/components/CellViewerCanvasWrapper/index.d.ts +2 -2
  23. package/type-declarations/aics-image-viewer/components/TfEditor/index.d.ts +2 -0
  24. package/type-declarations/aics-image-viewer/components/Toolbar/index.d.ts +1 -1
  25. package/type-declarations/aics-image-viewer/components/ViewerStateProvider/types.d.ts +2 -0
  26. package/type-declarations/aics-image-viewer/shared/constants.d.ts +8 -1
  27. package/type-declarations/aics-image-viewer/shared/types.d.ts +2 -2
@@ -31,6 +31,44 @@ export var TFEDITOR_MAX_BIN = 255;
31
31
  export var CACHE_MAX_SIZE = 1000000000;
32
32
  export var QUEUE_MAX_SIZE = 10;
33
33
  export var QUEUE_MAX_LOW_PRIORITY_SIZE = 4;
34
+
35
+ /** Maps channel data types to their minimum and maximum values */
36
+ export var DTYPE_RANGE = {
37
+ int8: {
38
+ min: -Math.pow(2, 7),
39
+ max: Math.pow(2, 7) - 1
40
+ },
41
+ int16: {
42
+ min: -Math.pow(2, 15),
43
+ max: Math.pow(2, 15) - 1
44
+ },
45
+ int32: {
46
+ min: -Math.pow(2, 31),
47
+ max: Math.pow(2, 31) - 1
48
+ },
49
+ uint8: {
50
+ min: 0,
51
+ max: Math.pow(2, 8) - 1
52
+ },
53
+ uint16: {
54
+ min: 0,
55
+ max: Math.pow(2, 16) - 1
56
+ },
57
+ uint32: {
58
+ min: 0,
59
+ max: Math.pow(2, 32) - 1
60
+ },
61
+ // These are obviously not the actual min and max representable values for floats, but the actual ones (`-Infinity`
62
+ // and `Infinity`) would give us nonsense. These may also produce nonsense, but these types should be rare anyways.
63
+ float32: {
64
+ min: 0,
65
+ max: Math.pow(2, 8) - 1
66
+ },
67
+ float64: {
68
+ min: 0,
69
+ max: Math.pow(2, 8) - 1
70
+ }
71
+ };
34
72
  export var PRESET_COLORS_1 = [[190, 68, 171], [189, 211, 75], [61, 155, 169], [128, 128, 128], [255, 255, 255], [239, 27, 45], [238, 77, 245], [96, 255, 255]];
35
73
  export var PRESET_COLORS_2 = [[128, 0, 0], [0, 128, 0], [0, 0, 128], [32, 32, 32], [255, 255, 0], [255, 0, 255], [0, 255, 0], [0, 0, 255]];
36
74
  export var PRESET_COLORS_3 = [[128, 0, 128], [128, 128, 128], [0, 128, 128], [128, 128, 0], [255, 255, 255], [255, 0, 0], [255, 0, 255], [0, 255, 255]];
@@ -159,6 +197,8 @@ export var getDefaultChannelState = function getDefaultChannelState() {
159
197
  x: 255,
160
198
  opacity: 1,
161
199
  color: [255, 255, 255]
162
- }]
200
+ }],
201
+ plotMin: 0,
202
+ plotMax: TFEDITOR_MAX_BIN
163
203
  };
164
204
  };
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
4
4
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
- import { useState, useRef, useCallback } from "react";
7
+ import { useCallback, useRef, useState } from "react";
8
8
 
9
9
  /** A `useState` that also creates a getter function for breaking through closures. */
10
10
  export function useStateWithGetter(initialState) {
@@ -30,11 +30,11 @@ export function useStateWithGetter(initialState) {
30
30
  // TODO should this replace `useStateWithGetter`?
31
31
 
32
32
  export function useRefWithSetter(setter, init) {
33
- var value = init === undefined ? useRef() : useRef(init);
33
+ var value = useRef(init);
34
34
  var wrappedSetter = useCallback(function (newValue) {
35
35
  value.current = newValue;
36
36
  setter(newValue);
37
- }, [setter]);
37
+ }, [setter, value]);
38
38
  return [value, wrappedSetter];
39
39
  }
40
40
 
@@ -64,6 +64,8 @@ export function initializeOneChannelSetting(channelName, index, defaultColor, vi
64
64
  color: (_colorHexToArray = colorHexToArray((_initSettings$color = initSettings.color) !== null && _initSettings$color !== void 0 ? _initSettings$color : "")) !== null && _colorHexToArray !== void 0 ? _colorHexToArray : defaultColor,
65
65
  useControlPoints: (_initSettings$control = initSettings.controlPointsEnabled) !== null && _initSettings$control !== void 0 ? _initSettings$control : defaultChannelState.useControlPoints,
66
66
  controlPoints: (_initSettings$control2 = initSettings.controlPoints) !== null && _initSettings$control2 !== void 0 ? _initSettings$control2 : defaultChannelState.controlPoints,
67
- ramp: (_initSettings$ramp = initSettings.ramp) !== null && _initSettings$ramp !== void 0 ? _initSettings$ramp : defaultChannelState.ramp
67
+ ramp: (_initSettings$ramp = initSettings.ramp) !== null && _initSettings$ramp !== void 0 ? _initSettings$ramp : defaultChannelState.ramp,
68
+ plotMin: defaultChannelState.plotMin,
69
+ plotMax: defaultChannelState.plotMax
68
70
  };
69
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aics/vole-app",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "web view of cell volume images",
5
5
  "repository": "github:allen-cell-animated/vole-app",
6
6
  "main": "es/index.js",
@@ -41,7 +41,7 @@
41
41
  "author": "Megan Riel-Mehan",
42
42
  "license": "ISC",
43
43
  "dependencies": {
44
- "@aics/vole-core": "^3.12.4",
44
+ "@aics/vole-core": "^3.15.2",
45
45
  "@ant-design/icons": "^5.2.5",
46
46
  "@fortawesome/fontawesome-svg-core": "^6.5.2",
47
47
  "@fortawesome/free-solid-svg-icons": "^6.5.2",
@@ -93,7 +93,8 @@
93
93
  "esbuild": "^0.14.50",
94
94
  "esbuild-jest": "^0.5.0",
95
95
  "eslint": "^8.20.0",
96
- "eslint-plugin-react": "^7.30.1",
96
+ "eslint-plugin-react": "^7.37.5",
97
+ "eslint-plugin-react-hooks": "^5.2.0",
97
98
  "file-loader": "^6.2.0",
98
99
  "firebase": "^7.x",
99
100
  "gh-pages": "^4.0.0",
@@ -37,7 +37,7 @@ export interface AppProps {
37
37
  translation: [number, number, number];
38
38
  rotation: [number, number, number];
39
39
  };
40
- metadata?: MetadataRecord;
40
+ metadata?: MetadataRecord | MetadataRecord[];
41
41
  view3dRef?: MutableRefObject<View3d | null>;
42
42
  metadataFormatter?: (metadata: MetadataRecord) => MetadataRecord;
43
43
  onControlPanelToggle?: (collapsed: boolean) => void;
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import "./styles.css";
3
3
  type BottomPanelProps = {
4
4
  title?: string;
5
- onVisibleChange?: (visible: boolean) => void;
6
- onVisibleChangeEnd?: (visible: boolean) => void;
5
+ open?: boolean;
6
+ onOpenChange?: (visible: boolean) => void;
7
7
  children?: React.ReactNode;
8
8
  height?: number;
9
9
  };
@@ -19,8 +19,8 @@ type ViewerWrapperProps = {
19
19
  visibleControls: {
20
20
  axisClipSliders: boolean;
21
21
  };
22
- onClippingPanelVisibleChange?: (panelOpen: boolean, hasTime: boolean, hasScenes: boolean, mode3d: boolean) => void;
23
- onClippingPanelVisibleChangeEnd?: (panelOpen: boolean) => void;
22
+ clippingPanelOpen?: boolean;
23
+ onClippingPanelOpenChange?: (visible: boolean) => void;
24
24
  autorotate: boolean;
25
25
  viewMode: ViewMode;
26
26
  region: PerAxis<[number, number]>;
@@ -14,6 +14,8 @@ type TfEditorProps = {
14
14
  useControlPoints: boolean;
15
15
  controlPoints: ControlPoint[];
16
16
  ramp: [number, number];
17
+ plotMin: number;
18
+ plotMax: number;
17
19
  };
18
20
  declare const TfEditor: React.FC<TfEditorProps>;
19
21
  export default TfEditor;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { ViewerSettingUpdater } from "../ViewerStateProvider/types";
3
2
  import { ImageType, RenderMode, ViewMode } from "../../shared/enums";
3
+ import { ViewerSettingUpdater } from "../ViewerStateProvider/types";
4
4
  import "./styles.css";
5
5
  type ToolbarProps = {
6
6
  cellDownloadHref: string;
@@ -58,6 +58,8 @@ export interface ChannelState {
58
58
  ramp: [number, number];
59
59
  useControlPoints: boolean;
60
60
  controlPoints: ControlPoint[];
61
+ plotMin: number;
62
+ plotMax: number;
61
63
  }
62
64
  export type ChannelStateKey = keyof ChannelState;
63
65
  export type ChannelSettingUpdater = <K extends ChannelStateKey>(index: number | number[], value: Partial<Record<K, ChannelState[K]>>) => void;
@@ -1,4 +1,4 @@
1
- import { CameraState } from "@aics/vole-core";
1
+ import type { CameraState, Channel } from "@aics/vole-core";
2
2
  import { ChannelState, ViewerState } from "../components/ViewerStateProvider/types";
3
3
  import { ViewMode } from "./enums";
4
4
  import { ColorArray } from "./utils/colorRepresentations";
@@ -10,6 +10,13 @@ export declare const TFEDITOR_MAX_BIN = 255;
10
10
  export declare const CACHE_MAX_SIZE = 1000000000;
11
11
  export declare const QUEUE_MAX_SIZE = 10;
12
12
  export declare const QUEUE_MAX_LOW_PRIORITY_SIZE = 4;
13
+ /** Maps channel data types to their minimum and maximum values */
14
+ export declare const DTYPE_RANGE: {
15
+ [T in Channel["dtype"]]: {
16
+ min: number;
17
+ max: number;
18
+ };
19
+ };
13
20
  export declare const PRESET_COLORS_1: ColorArray[];
14
21
  export declare const PRESET_COLORS_2: ColorArray[];
15
22
  export declare const PRESET_COLORS_3: ColorArray[];
@@ -9,7 +9,7 @@ export type IsosurfaceFormat = "GLTF" | "STL";
9
9
  export type Styles = {
10
10
  [key: string]: CSSProperties;
11
11
  };
12
- export type MetadataEntry = string | number | boolean | MetadataRecord | null | undefined;
12
+ export type MetadataEntry = string | number | boolean | MetadataRecord | MetadataEntry[] | null | undefined;
13
13
  export type MetadataRecord = {
14
14
  [key: string]: MetadataEntry;
15
- } | MetadataEntry[];
15
+ };