@aics/vole-app 2.11.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 (135) hide show
  1. package/LICENSE +33 -0
  2. package/LICENSE.txt +26 -0
  3. package/README.md +45 -0
  4. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.eot +0 -0
  5. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.js +2337 -0
  6. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.svg +604 -0
  7. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.ttf +0 -0
  8. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.woff +0 -0
  9. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-500.woff2 +0 -0
  10. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.eot +0 -0
  11. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.js +2336 -0
  12. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.svg +604 -0
  13. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.ttf +0 -0
  14. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.woff +0 -0
  15. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-700.woff2 +0 -0
  16. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.eot +0 -0
  17. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.js +2337 -0
  18. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.svg +604 -0
  19. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.ttf +0 -0
  20. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.woff +0 -0
  21. package/es/aics-image-viewer/assets/fonts/open-sans/open-sans-regular.woff2 +0 -0
  22. package/es/aics-image-viewer/assets/icons/axes.js +20 -0
  23. package/es/aics-image-viewer/assets/icons/boundingBox.js +18 -0
  24. package/es/aics-image-viewer/assets/icons/camera.js +15 -0
  25. package/es/aics-image-viewer/assets/icons/channels.js +15 -0
  26. package/es/aics-image-viewer/assets/icons/closePanel.js +18 -0
  27. package/es/aics-image-viewer/assets/icons/download.js +17 -0
  28. package/es/aics-image-viewer/assets/icons/dropdownArrow.js +15 -0
  29. package/es/aics-image-viewer/assets/icons/index.js +24 -0
  30. package/es/aics-image-viewer/assets/icons/metadata.js +15 -0
  31. package/es/aics-image-viewer/assets/icons/preferences.js +15 -0
  32. package/es/aics-image-viewer/assets/icons/resetView.js +16 -0
  33. package/es/aics-image-viewer/assets/icons/svg.d.js +0 -0
  34. package/es/aics-image-viewer/assets/icons/turnTable.js +18 -0
  35. package/es/aics-image-viewer/assets/styles/animatedEllipsis.css +21 -0
  36. package/es/aics-image-viewer/assets/styles/globals.css +35 -0
  37. package/es/aics-image-viewer/assets/styles/noui-slider-override.css +1 -0
  38. package/es/aics-image-viewer/assets/styles/variables.css +1 -0
  39. package/es/aics-image-viewer/components/App/ChannelUpdater.js +96 -0
  40. package/es/aics-image-viewer/components/App/index.js +849 -0
  41. package/es/aics-image-viewer/components/App/styles.css +60 -0
  42. package/es/aics-image-viewer/components/App/types.js +1 -0
  43. package/es/aics-image-viewer/components/AxisClipSliders/index.js +285 -0
  44. package/es/aics-image-viewer/components/AxisClipSliders/styles.css +257 -0
  45. package/es/aics-image-viewer/components/BottomPanel/index.js +70 -0
  46. package/es/aics-image-viewer/components/BottomPanel/styles.css +85 -0
  47. package/es/aics-image-viewer/components/CellViewerCanvasWrapper/index.js +113 -0
  48. package/es/aics-image-viewer/components/CellViewerCanvasWrapper/styles.css +12 -0
  49. package/es/aics-image-viewer/components/ChannelsWidget.js +100 -0
  50. package/es/aics-image-viewer/components/ChannelsWidgetRow/index.js +158 -0
  51. package/es/aics-image-viewer/components/ChannelsWidgetRow/styles.css +38 -0
  52. package/es/aics-image-viewer/components/ColorPicker.js +120 -0
  53. package/es/aics-image-viewer/components/ControlPanel/index.js +180 -0
  54. package/es/aics-image-viewer/components/ControlPanel/styles.css +169 -0
  55. package/es/aics-image-viewer/components/CustomizeWidget.js +46 -0
  56. package/es/aics-image-viewer/components/ErrorAlert/index.js +144 -0
  57. package/es/aics-image-viewer/components/ErrorAlert/styles.css +22 -0
  58. package/es/aics-image-viewer/components/GlobalVolumeControls.js +38 -0
  59. package/es/aics-image-viewer/components/MetadataViewer/index.js +99 -0
  60. package/es/aics-image-viewer/components/MetadataViewer/styles.css +81 -0
  61. package/es/aics-image-viewer/components/StyleProvider/index.js +210 -0
  62. package/es/aics-image-viewer/components/TfEditor/index.js +584 -0
  63. package/es/aics-image-viewer/components/TfEditor/styles.css +88 -0
  64. package/es/aics-image-viewer/components/Toolbar/DownloadButton.js +55 -0
  65. package/es/aics-image-viewer/components/Toolbar/ViewModeRadioButtons.js +22 -0
  66. package/es/aics-image-viewer/components/Toolbar/index.js +274 -0
  67. package/es/aics-image-viewer/components/Toolbar/styles.css +241 -0
  68. package/es/aics-image-viewer/components/ViewerStateProvider/ResetStateProvider.js +160 -0
  69. package/es/aics-image-viewer/components/ViewerStateProvider/index.js +261 -0
  70. package/es/aics-image-viewer/components/ViewerStateProvider/types.js +1 -0
  71. package/es/aics-image-viewer/components/shared/NumericInput/index.js +147 -0
  72. package/es/aics-image-viewer/components/shared/NumericInput/styles.css +64 -0
  73. package/es/aics-image-viewer/components/shared/SharedCheckBox.js +17 -0
  74. package/es/aics-image-viewer/components/shared/SliderRow/index.js +31 -0
  75. package/es/aics-image-viewer/components/shared/SliderRow/styles.css +19 -0
  76. package/es/aics-image-viewer/components/shared/SmarterSlider.js +40 -0
  77. package/es/aics-image-viewer/components/shared/ViewerIcon.js +22 -0
  78. package/es/aics-image-viewer/shared/colorPalette.js +19 -0
  79. package/es/aics-image-viewer/shared/constants.js +164 -0
  80. package/es/aics-image-viewer/shared/enums.js +18 -0
  81. package/es/aics-image-viewer/shared/types.js +6 -0
  82. package/es/aics-image-viewer/shared/utils/colorRepresentations.js +16 -0
  83. package/es/aics-image-viewer/shared/utils/controlPointsToLut.js +182 -0
  84. package/es/aics-image-viewer/shared/utils/hooks.js +51 -0
  85. package/es/aics-image-viewer/shared/utils/httpClient.js +57 -0
  86. package/es/aics-image-viewer/shared/utils/playControls.js +97 -0
  87. package/es/aics-image-viewer/shared/utils/sceneStore.js +140 -0
  88. package/es/aics-image-viewer/shared/utils/sliderValuesToImageValues.js +36 -0
  89. package/es/aics-image-viewer/shared/utils/test/viewerChannelSettings.test.js +132 -0
  90. package/es/aics-image-viewer/shared/utils/utilsService.js +54 -0
  91. package/es/aics-image-viewer/shared/utils/viewerChannelSettings.js +152 -0
  92. package/es/aics-image-viewer/shared/utils/viewerState.js +69 -0
  93. package/es/aics-image-viewer/shared/utils/webgl-debug.js +1103 -0
  94. package/es/index.js +4 -0
  95. package/package.json +130 -0
  96. package/type-declarations/aics-image-viewer/assets/icons/index.d.ts +14 -0
  97. package/type-declarations/aics-image-viewer/components/App/ChannelUpdater.d.ts +16 -0
  98. package/type-declarations/aics-image-viewer/components/App/index.d.ts +6 -0
  99. package/type-declarations/aics-image-viewer/components/App/types.d.ts +45 -0
  100. package/type-declarations/aics-image-viewer/components/AxisClipSliders/index.d.ts +24 -0
  101. package/type-declarations/aics-image-viewer/components/BottomPanel/index.d.ts +11 -0
  102. package/type-declarations/aics-image-viewer/components/CellViewerCanvasWrapper/index.d.ts +33 -0
  103. package/type-declarations/aics-image-viewer/components/ChannelsWidget.d.ts +19 -0
  104. package/type-declarations/aics-image-viewer/components/ChannelsWidgetRow/index.d.ts +17 -0
  105. package/type-declarations/aics-image-viewer/components/ColorPicker.d.ts +13 -0
  106. package/type-declarations/aics-image-viewer/components/ControlPanel/index.d.ts +20 -0
  107. package/type-declarations/aics-image-viewer/components/CustomizeWidget.d.ts +15 -0
  108. package/type-declarations/aics-image-viewer/components/ErrorAlert/index.d.ts +12 -0
  109. package/type-declarations/aics-image-viewer/components/GlobalVolumeControls.d.ts +21 -0
  110. package/type-declarations/aics-image-viewer/components/MetadataViewer/index.d.ts +7 -0
  111. package/type-declarations/aics-image-viewer/components/StyleProvider/index.d.ts +5 -0
  112. package/type-declarations/aics-image-viewer/components/TfEditor/index.d.ts +19 -0
  113. package/type-declarations/aics-image-viewer/components/Toolbar/DownloadButton.d.ts +8 -0
  114. package/type-declarations/aics-image-viewer/components/Toolbar/ViewModeRadioButtons.d.ts +8 -0
  115. package/type-declarations/aics-image-viewer/components/Toolbar/index.d.ts +31 -0
  116. package/type-declarations/aics-image-viewer/components/ViewerStateProvider/ResetStateProvider.d.ts +34 -0
  117. package/type-declarations/aics-image-viewer/components/ViewerStateProvider/index.d.ts +33 -0
  118. package/type-declarations/aics-image-viewer/components/ViewerStateProvider/types.d.ts +105 -0
  119. package/type-declarations/aics-image-viewer/components/shared/NumericInput/index.d.ts +19 -0
  120. package/type-declarations/aics-image-viewer/components/shared/SharedCheckBox.d.ts +9 -0
  121. package/type-declarations/aics-image-viewer/components/shared/SliderRow/index.d.ts +17 -0
  122. package/type-declarations/aics-image-viewer/components/shared/SmarterSlider.d.ts +5 -0
  123. package/type-declarations/aics-image-viewer/components/shared/ViewerIcon.d.ts +9 -0
  124. package/type-declarations/aics-image-viewer/shared/constants.d.ts +40 -0
  125. package/type-declarations/aics-image-viewer/shared/enums.d.ts +15 -0
  126. package/type-declarations/aics-image-viewer/shared/types.d.ts +15 -0
  127. package/type-declarations/aics-image-viewer/shared/utils/colorRepresentations.d.ts +10 -0
  128. package/type-declarations/aics-image-viewer/shared/utils/controlPointsToLut.d.ts +53 -0
  129. package/type-declarations/aics-image-viewer/shared/utils/hooks.d.ts +14 -0
  130. package/type-declarations/aics-image-viewer/shared/utils/playControls.d.ts +27 -0
  131. package/type-declarations/aics-image-viewer/shared/utils/sceneStore.d.ts +17 -0
  132. package/type-declarations/aics-image-viewer/shared/utils/sliderValuesToImageValues.d.ts +10 -0
  133. package/type-declarations/aics-image-viewer/shared/utils/viewerChannelSettings.d.ts +46 -0
  134. package/type-declarations/aics-image-viewer/shared/utils/viewerState.d.ts +10 -0
  135. package/type-declarations/index.d.ts +7 -0
@@ -0,0 +1,105 @@
1
+ import { CameraState, ControlPoint } from "@aics/vole-core";
2
+ import type { ImageType, RenderMode, ViewMode } from "../../shared/enums";
3
+ import type { PerAxis } from "../../shared/types";
4
+ import type { ColorArray } from "../../shared/utils/colorRepresentations";
5
+ import { ViewerChannelSettings } from "../../shared/utils/viewerChannelSettings";
6
+ /** Global (not per-channel) viewer state which may be changed in the UI */
7
+ export interface ViewerState {
8
+ viewMode: ViewMode;
9
+ renderMode: RenderMode;
10
+ imageType: ImageType;
11
+ showAxes: boolean;
12
+ showBoundingBox: boolean;
13
+ boundingBoxColor: ColorArray;
14
+ backgroundColor: ColorArray;
15
+ autorotate: boolean;
16
+ maskAlpha: number;
17
+ brightness: number;
18
+ density: number;
19
+ levels: [number, number, number];
20
+ interpolationEnabled: boolean;
21
+ region: PerAxis<[number, number]>;
22
+ slice: PerAxis<number>;
23
+ time: number;
24
+ scene: number;
25
+ cameraState: Partial<CameraState> | undefined;
26
+ }
27
+ export type ViewerStateKey = keyof ViewerState;
28
+ /**
29
+ * If a value in `ViewerState` is an object, we want to allow updates with a partial object. Otherwise, components that
30
+ * update some but not all of the object's properties have to know the object's current value in order to clone it with
31
+ * only the key they care about updated, which exposes us to stale closure issues.
32
+ */
33
+ export type PartialIfObject<T> = T extends Record<string, unknown> ? Partial<T> : T;
34
+ /**
35
+ * A type which lets us provide a map of optional check functions for certain settings updates, to avoid entering
36
+ * illegal states. E.g., whenever `renderMode` is changed to pathtrace, make sure `autorotate` is set to false.
37
+ */
38
+ export type ViewerSettingChangeHandlers = {
39
+ [K in ViewerStateKey]?: (settings: ViewerState, value: PartialIfObject<ViewerState[K]>) => ViewerState;
40
+ };
41
+ /**
42
+ * The type of the global settings updater provided by `ViewerStateProvider` and passed down to most UI components.
43
+ * Looks kind of like redux's `dispatch` if you squint. `key` names the setting to update; `value` is the new
44
+ * (potentially partial) value.
45
+ */
46
+ export type ViewerSettingUpdater = <K extends ViewerStateKey>(key: K, value: PartialIfObject<ViewerState[K]>) => void;
47
+ /** Settings for a single channel, as stored internally by the app */
48
+ export interface ChannelState {
49
+ name: string;
50
+ displayName: string;
51
+ volumeEnabled: boolean;
52
+ isosurfaceEnabled: boolean;
53
+ isovalue: number;
54
+ colorizeEnabled: boolean;
55
+ colorizeAlpha: number;
56
+ opacity: number;
57
+ color: ColorArray;
58
+ ramp: [number, number];
59
+ useControlPoints: boolean;
60
+ controlPoints: ControlPoint[];
61
+ }
62
+ export type ChannelStateKey = keyof ChannelState;
63
+ export type ChannelSettingUpdater = <K extends ChannelStateKey>(index: number | number[], value: Partial<Record<K, ChannelState[K]>>) => void;
64
+ export type SingleChannelSettingUpdater = <K extends ChannelStateKey>(value: Partial<Record<K, ChannelState[K]>>) => void;
65
+ export type ResetState = {
66
+ /**
67
+ * Sets the initial viewer channel settings that will be applied when calling
68
+ * `resetToSavedViewerState()`. Initial settings should be set from the viewer props (when embedded)
69
+ * or the URL parameters.
70
+ */
71
+ setSavedViewerChannelSettings: (settings: ViewerChannelSettings | undefined) => void;
72
+ /**
73
+ * Returns the current viewer channel settings that should be used when resetting
74
+ * the channel transfer functions (control points and ramp).
75
+ */
76
+ getCurrentViewerChannelSettings: () => ViewerChannelSettings | undefined;
77
+ /** Channels that should be immediately reset on next render. */
78
+ getChannelsAwaitingReset: () => Set<number>;
79
+ /** Channels that should be reset once new data is loaded. */
80
+ getChannelsAwaitingResetOnLoad: () => Set<number>;
81
+ /**
82
+ * Removes the channel from the list of channels to be reset (as given by
83
+ * `getChannelsAwaitingReset()` or `getChannelsAwaitingResetOnLoad()`).
84
+ */
85
+ onResetChannel: (channelIndex: number) => void;
86
+ /**
87
+ * Resets the viewer and all channels to a saved initial state, determined
88
+ * by viewer props.
89
+ * The initial settings for channels can be set with `setSavedViewerChannelSettings()`.
90
+ */
91
+ resetToSavedViewerState: () => void;
92
+ /**
93
+ * Resets the viewer and all channels to the default state, as though
94
+ * loaded from scratch with no initial parameters set.
95
+ * Uses the default channel settings as given by `getDefaultViewerChannelSettings()`.
96
+ */
97
+ resetToDefaultViewerState: () => void;
98
+ };
99
+ export type ViewerStateContextType = ViewerState & ResetState & {
100
+ channelSettings: ChannelState[];
101
+ changeViewerSetting: ViewerSettingUpdater;
102
+ changeChannelSetting: ChannelSettingUpdater;
103
+ setChannelSettings: (settings: ChannelState[]) => void;
104
+ applyColorPresets: (presets: ColorArray[]) => void;
105
+ };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import "./styles.css";
3
+ interface NumericInputProps {
4
+ value: number;
5
+ step?: number;
6
+ precision?: number;
7
+ min?: number;
8
+ max?: number;
9
+ disabled?: boolean;
10
+ className?: string;
11
+ onChange: (value: number) => void;
12
+ }
13
+ /**
14
+ * Fully-controlled numeric input (value must be supplied from state in parent).
15
+ * Changeable with arrow keys, typing values, or clickable arrows. Inspired by
16
+ * ant's `InputNumber`, but conforms to our style and behavior expectations.
17
+ */
18
+ declare const NumericInput: React.FC<NumericInputProps>;
19
+ export default NumericInput;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ type SharedCheckboxProps<T> = React.PropsWithChildren<{
3
+ allOptions: T[];
4
+ checkedList: T[];
5
+ onChange: (checked: boolean, checkedList: T[]) => void;
6
+ style?: React.CSSProperties;
7
+ }>;
8
+ declare const SharedCheckbox: <T>(props: SharedCheckboxProps<T>) => React.ReactElement;
9
+ export default SharedCheckbox;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { NouisliderProps } from "nouislider-react";
3
+ import "./styles.css";
4
+ type SliderRowProps = {
5
+ label: React.ReactNode;
6
+ start?: number | number[];
7
+ step?: number;
8
+ formatInteger?: boolean;
9
+ max?: number;
10
+ onUpdate?: NouisliderProps["onUpdate"];
11
+ onChange?: NouisliderProps["onChange"];
12
+ hideSlider?: boolean;
13
+ children?: React.ReactNode;
14
+ };
15
+ /** A component to ensure a single unified style across the many labeled slider rows in the control panel */
16
+ declare const SliderRow: React.FC<SliderRowProps>;
17
+ export default SliderRow;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { NouisliderProps } from "nouislider-react";
3
+ /** A wrapper around `Nouislider` that prevents updates while the slider is being dragged. */
4
+ declare const SmarterSlider: React.FC<NouisliderProps>;
5
+ export default SmarterSlider;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { IconComponentProps } from "@ant-design/icons/lib/components/Icon";
3
+ import ICONS from "../../assets/icons";
4
+ type ViewerIconProps = {
5
+ type: keyof typeof ICONS;
6
+ } & Omit<IconComponentProps, "type" | "component" | "ref">;
7
+ /** Wrapper component for easy inclusion of our own custom icons. */
8
+ declare const ViewerIcon: React.FC<ViewerIconProps>;
9
+ export default ViewerIcon;
@@ -0,0 +1,40 @@
1
+ import { CameraState } from "@aics/vole-core";
2
+ import { ChannelState, ViewerState } from "../components/ViewerStateProvider/types";
3
+ import { ViewMode } from "./enums";
4
+ import { ColorArray } from "./utils/colorRepresentations";
5
+ import { ViewerChannelSettings } from "./utils/viewerChannelSettings";
6
+ export declare const // Control panel will automatically close if viewport is less than this width
7
+ CONTROL_PANEL_CLOSE_WIDTH = 970, CLIPPING_PANEL_HEIGHT_DEFAULT = 200, CLIPPING_PANEL_HEIGHT_TALL = 235, BACKGROUND_COLOR_DEFAULT: ColorArray, BOUNDING_BOX_COLOR_DEFAULT: ColorArray, AXIS_MARGIN_DEFAULT: [number, number], SCALE_BAR_MARGIN_DEFAULT: [number, number], LUT_MIN_PERCENTILE = 0.5, LUT_MAX_PERCENTILE = 0.983, ISOSURFACE_OPACITY_SLIDER_MAX = 255, ALPHA_MASK_SLIDER_DEFAULT = 0, BRIGHTNESS_SLIDER_LEVEL_DEFAULT = 70, DENSITY_SLIDER_LEVEL_DEFAULT = 50, LEVELS_SLIDER_DEFAULT: ColorArray, INTERPOLATION_ENABLED_DEFAULT = true, OTHER_CHANNEL_KEY = "Other", SINGLE_GROUP_CHANNEL_KEY = "Channels";
8
+ export declare const TFEDITOR_DEFAULT_COLOR: ColorArray;
9
+ export declare const TFEDITOR_MAX_BIN = 255;
10
+ export declare const CACHE_MAX_SIZE = 1000000000;
11
+ export declare const QUEUE_MAX_SIZE = 10;
12
+ export declare const QUEUE_MAX_LOW_PRIORITY_SIZE = 4;
13
+ export declare const PRESET_COLORS_1: ColorArray[];
14
+ export declare const PRESET_COLORS_2: ColorArray[];
15
+ export declare const PRESET_COLORS_3: ColorArray[];
16
+ export declare const PRESET_COLORS_0: ColorArray[];
17
+ export declare const PRESET_COLOR_MAP: readonly {
18
+ colors: ColorArray[];
19
+ name: string;
20
+ }[];
21
+ /**
22
+ * Reflects the default camera settings the 3D viewer uses on volume load.
23
+ * These SHOULD NOT be changed; otherwise, existing shared links that don't specify the
24
+ * camera settings will use the new defaults and may be in unexpected orientations or positions.
25
+ */
26
+ export declare const getDefaultCameraState: (viewMode?: ViewMode) => CameraState;
27
+ export declare const getDefaultViewerChannelSettings: () => ViewerChannelSettings;
28
+ /**
29
+ * Returns the default viewer state as a new object.
30
+ */
31
+ export declare const getDefaultViewerState: () => ViewerState;
32
+ /** Returns the default color for a channel, by its index. */
33
+ export declare function getDefaultChannelColor(channelIndex: number): ColorArray;
34
+ /**
35
+ * Returns the default channel state as a new object. If an index is provided, uses the default
36
+ * color preset for that index.
37
+ * @param index Optional channel index to use for the color preset.
38
+ * @returns a default ChannelState object.
39
+ */
40
+ export declare const getDefaultChannelState: (index?: number) => ChannelState;
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,15 @@
1
+ import { CSSProperties } from "react";
2
+ import { ViewMode } from "./enums";
3
+ export type AxisName = "x" | "y" | "z";
4
+ export type PerAxis<T> = Record<AxisName, T>;
5
+ export declare const activeAxisMap: {
6
+ [A in ViewMode]: AxisName | null;
7
+ };
8
+ export type IsosurfaceFormat = "GLTF" | "STL";
9
+ export type Styles = {
10
+ [key: string]: CSSProperties;
11
+ };
12
+ export type MetadataEntry = string | number | boolean | MetadataRecord | null | undefined;
13
+ export type MetadataRecord = {
14
+ [key: string]: MetadataEntry;
15
+ } | MetadataEntry[];
@@ -0,0 +1,10 @@
1
+ export type ColorObject = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ };
6
+ export type ColorArray = [number, number, number];
7
+ export declare const colorObjectToArray: (obj: ColorObject) => ColorArray;
8
+ export declare const colorArrayToObject: (arr: ColorArray) => ColorObject;
9
+ export declare const colorArrayToFloats: (arr: ColorArray) => ColorArray;
10
+ export declare const colorArrayToString: (arr: ColorArray) => string;
@@ -0,0 +1,53 @@
1
+ import { Channel, ControlPoint, Histogram, Lut, Volume } from "@aics/vole-core";
2
+ import { ViewerChannelSetting, ViewerChannelSettings } from "./viewerChannelSettings";
3
+ export declare function controlPointsToLut(controlPoints: ControlPoint[]): Lut;
4
+ /** Returns a default lookup table based on a min/max percentile of the current volume's data. */
5
+ export declare function getDefaultLut(histogram: Histogram): Lut;
6
+ /**
7
+ * Parses a lookup table (LUT) from a `ViewerChannelSetting` object, where the `lut` field is an
8
+ * array of two alphanumeric strings.
9
+ *
10
+ * @returns a Lut object if the `lut` field is valid; otherwise, returns undefined.
11
+ *
12
+ * Min and max values are determined as following:
13
+ * - Plain numbers are direct intensity values.
14
+ * - `p{n}` represents a percentile, where `n` is a percentile in the [0, 100] range.
15
+ * - `m{n}` represents the median multiplied by `n / 100`.
16
+ * - `autoij` in either the min or max fields will use the "auto" algorithm
17
+ * from ImageJ to select the min AND max.
18
+ *
19
+ * @example
20
+ * ```
21
+ * "0:255" // min: intensity 0, max: intensity 255.
22
+ * "p50:p90" // min: 50th percentile, max: 90th percentile.
23
+ * "m1:p75" // min: median, max: 75th percentile.
24
+ * "autoij:0" // use Auto-IJ to calculate min and max.
25
+ * ```
26
+ */
27
+ export declare function parseLutFromSettings(histogram: Histogram, initSettings: ViewerChannelSetting): Lut | undefined;
28
+ /**
29
+ * Initializes the lookup table (LUT) that maps from volume intensity values to color + opacity and applies the LUT to the volume.
30
+ *
31
+ * @param aimg The loaded volume data.
32
+ * @param channelIndex The index of the channel to initialize the LUT for.
33
+ * @param channelSettings The ViewerChannelSettings object that may contain settings for this channel. If relevant
34
+ * settings are not found, a default LUT will be used.
35
+ * @returns an object containing the retrieved ramp control points and "advanced mode" control points.
36
+ *
37
+ * LUT values will be determined using the following rules:
38
+ * - If no `lut` is provided in the `channelSettings`, a default LUT is calculated using min/max percentiles of the data.
39
+ * - Otherwise, `lut` will be parsed as described in `ViewerChannelSettingParams.lut`.
40
+ * - The `controlPoints` and `ramp` fields in the `channelSettings` will be used to override the returned "advanced mode"
41
+ * control points and ramp, respectively.
42
+ *
43
+ * If `controlPointsEnabled` is set to true in the `channelSettings`, the "advanced mode" control points will be applied
44
+ * to the volume; otherwise, the ramp will be applied.
45
+ */
46
+ export declare function initializeLut(aimg: Volume, channelIndex: number, channelSettings?: ViewerChannelSettings): {
47
+ ramp: ControlPoint[];
48
+ controlPoints: ControlPoint[];
49
+ };
50
+ export declare function controlPointsToRamp(controlPoints: ControlPoint[]): [number, number];
51
+ export declare function rampToControlPoints([min, max]: [number, number]): ControlPoint[];
52
+ /** Remaps an array of control points from an old range (as a 2-tuple) to a new one (extracted from a `Channel`) */
53
+ export declare function remapControlPointsForChannel(controlPoints: ControlPoint[], oldRange: [number, number] | undefined, { rawMin, rawMax }: Channel): ControlPoint[];
@@ -0,0 +1,14 @@
1
+ import { MutableRefObject } from "react";
2
+ /** A `useState` that also creates a getter function for breaking through closures. */
3
+ export declare function useStateWithGetter<T>(initialState: T | (() => T)): [T, (value: T) => void, () => T];
4
+ /**
5
+ * Wraps a setter function and keeps a ref updated to follow the set value. Useful for making the most up-to-date value
6
+ * of some state accessible to a closure that might be called after the value is updated.
7
+ */
8
+ export declare function useRefWithSetter<T>(setter: (value: T) => void): [MutableRefObject<T | undefined>, (value: T) => void];
9
+ export declare function useRefWithSetter<T>(setter: (value: T) => void, init: T): [MutableRefObject<T>, (value: T) => void];
10
+ /**
11
+ * For objects which are persistent for the lifetime of the component, not
12
+ * a member of state, and require a constructor to create. Wraps `useRef`.
13
+ */
14
+ export declare function useConstructor<T>(constructor: () => T): T;
@@ -0,0 +1,27 @@
1
+ import { AxisName } from "../types";
2
+ type PlayAxisName = AxisName | "t";
3
+ export default class PlayControls {
4
+ playingAxis: PlayAxisName | null;
5
+ playWaitingForLoad: boolean;
6
+ playHolding: boolean;
7
+ playTimeoutId: number;
8
+ getVolumeIsLoaded?: () => boolean;
9
+ stepAxis?: (axis: PlayAxisName) => void;
10
+ onPlayingAxisChanged?: (axis: PlayAxisName | null) => void;
11
+ private setPlayingAxis;
12
+ private playStep;
13
+ /** Call whenever new data is loaded to resume playback if it was paused for data loading. */
14
+ onImageLoaded(): void;
15
+ /**
16
+ * Pause playback on the currently playing axis.
17
+ * `willResume` marks this as a temporary suspension, e.g. while the user is scrubbing along the playing axis.
18
+ */
19
+ pause(willResume?: boolean): void;
20
+ /** Begin playback on `axis`. */
21
+ play(axis: PlayAxisName): void;
22
+ /** If `axis` is currently playing, begin a temporary hold on playback while other input is pending. */
23
+ startHold(axis: PlayAxisName): void;
24
+ /** If a playback hold is active, end it. */
25
+ endHold(): void;
26
+ }
27
+ export {};
@@ -0,0 +1,17 @@
1
+ import { LoadSpec, PerChannelCallback, PrefetchDirection, RawArrayLoaderOptions, Volume, VolumeLoaderContext } from "@aics/vole-core";
2
+ import { ThreadableVolumeLoader } from "@aics/vole-core/es/types/loaders/IVolumeLoader";
3
+ export default class SceneStore {
4
+ context: VolumeLoaderContext;
5
+ loaders: (ThreadableVolumeLoader | undefined)[];
6
+ paths: (string | string[] | RawArrayLoaderOptions)[];
7
+ currentScene: number;
8
+ syncChannels: boolean;
9
+ prefetchPriority: PrefetchDirection[];
10
+ constructor(context: VolumeLoaderContext, paths: (string | string[] | RawArrayLoaderOptions)[]);
11
+ /** Get the loader associated with the given scene index, or create it if it doesn't exist */
12
+ private getLoader;
13
+ loadScene(scene: number, image: Volume, loadSpec?: LoadSpec, onChannelLoaded?: PerChannelCallback): Promise<void>;
14
+ createVolume(scene: number, loadSpec: LoadSpec, onChannelLoaded?: PerChannelCallback): Promise<Volume>;
15
+ syncMultichannelLoading(sync: boolean): void;
16
+ setPrefetchPriority(priority: PrefetchDirection[]): void;
17
+ }
@@ -0,0 +1,10 @@
1
+ type ImageValues = {
2
+ min: number;
3
+ max: number;
4
+ scale: number;
5
+ };
6
+ export declare const gammaSliderToImageValues: (sliderValues: [number, number, number]) => ImageValues;
7
+ export declare const densitySliderToImageValue: (sliderValues: number, _isPT: boolean) => number;
8
+ export declare const brightnessSliderToImageValue: (sliderValues: number, _isPT: boolean) => number;
9
+ export declare const alphaSliderToImageValue: (sliderValues: number) => number;
10
+ export {};
@@ -0,0 +1,46 @@
1
+ import { ControlPoint } from "@aics/vole-core";
2
+ /** Settings for a single channel, as passed in via props by App users */
3
+ export interface ViewerChannelSetting {
4
+ match: (string | number)[] | string | number;
5
+ name?: string;
6
+ color?: string;
7
+ enabled?: boolean;
8
+ surfaceEnabled?: boolean;
9
+ /**
10
+ * Min and max values for the intensity lookup table, which maps from raw intensity values
11
+ * in the volume to opacity and color. Defaults to [0, 255].
12
+ *
13
+ * - Plain numbers are treated as direct intensity values.
14
+ * - `p{n}` represents a percentile, where `n` is a percentile in the [0, 100] range.
15
+ * - `m{n}` represents the median multiplied by `n / 100`.
16
+ * - `autoij` in either the min or max fields will use the "auto" algorithm
17
+ * from ImageJ to select the min and max.
18
+ */
19
+ lut?: [string, string];
20
+ /**
21
+ * Whether to show control point controls instead of a simpler ramp control.
22
+ * Defaults to false.
23
+ */
24
+ controlPointsEnabled?: boolean;
25
+ controlPoints?: ControlPoint[];
26
+ ramp?: [number, number];
27
+ isovalue?: number;
28
+ surfaceOpacity?: number;
29
+ colorizeEnabled?: boolean;
30
+ colorizeAlpha?: number;
31
+ }
32
+ export interface ViewerChannelGroup {
33
+ name: string;
34
+ channels: ViewerChannelSetting[];
35
+ }
36
+ export interface ViewerChannelSettings {
37
+ maskChannelName?: string;
38
+ groups: ViewerChannelGroup[];
39
+ }
40
+ export type ChannelGrouping = {
41
+ [key: string]: number[];
42
+ };
43
+ export declare function matchChannel(channelName: string, channelIndex: number, c: ViewerChannelSetting): boolean;
44
+ export declare function findFirstChannelMatch(channel: string, channelIndex: number, settings: ViewerChannelSettings): ViewerChannelSetting | undefined;
45
+ export declare function getDisplayName(name: string, index: number, settings?: ViewerChannelSettings): string;
46
+ export declare function makeChannelIndexGrouping(channels: string[], settings?: ViewerChannelSettings): ChannelGrouping;
@@ -0,0 +1,10 @@
1
+ import { ChannelState, ViewerSettingUpdater, ViewerState } from "../../components/ViewerStateProvider/types";
2
+ import { ColorArray } from "./colorRepresentations";
3
+ import { ViewerChannelSettings } from "./viewerChannelSettings";
4
+ /** Sets all fields of the viewer state to the values of the `newState`. */
5
+ export declare function overrideViewerState(changeViewerSetting: ViewerSettingUpdater, newState: ViewerState): void;
6
+ export declare function overrideChannelStates(setChannelSettings: (settings: ChannelState[]) => void, currentStates: ChannelState[], newStates: ChannelState[]): void;
7
+ /** Returns the indices of channels that have either the volume or isosurface enabled. */
8
+ export declare function getEnabledChannelIndices(channelSettings: ChannelState[]): number[];
9
+ export declare function colorHexToArray(hex: string): ColorArray | null;
10
+ export declare function initializeOneChannelSetting(channelName: string, index: number, defaultColor: ColorArray, viewerChannelSettings?: ViewerChannelSettings, defaultChannelState?: ChannelState): ChannelState;
@@ -0,0 +1,7 @@
1
+ import ImageViewerApp from "./aics-image-viewer/components/App";
2
+ import ViewerStateProvider from "./aics-image-viewer/components/ViewerStateProvider";
3
+ export type { ViewerChannelSettings, ViewerChannelGroup, ViewerChannelSetting, } from "./aics-image-viewer/shared/utils/viewerChannelSettings";
4
+ export { ViewMode, RenderMode, ImageType } from "./aics-image-viewer/shared/enums";
5
+ export type { AppProps } from "./aics-image-viewer/components/App/types";
6
+ export type { RawArrayData, RawArrayInfo } from "@aics/vole-core";
7
+ export { ImageViewerApp, ViewerStateProvider };