@vitessce/layer-controller 3.5.10 → 3.5.12
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/dist/{deflate-da4e210a.js → deflate-2c798302.js} +1 -1
- package/dist/{index-70b67fad.js → index-d816962c.js} +44 -18
- package/dist/index.js +1 -1
- package/dist/{jpeg-2b29cef5.js → jpeg-f0fc1e44.js} +1 -1
- package/dist/{lerc-b9053be7.js → lerc-59798e8d.js} +1 -1
- package/dist/{lzw-dbb1bf81.js → lzw-af978121.js} +1 -1
- package/dist/{packbits-15bec513.js → packbits-48365e34.js} +1 -1
- package/dist/{raw-947f75bf.js → raw-0be8a541.js} +1 -1
- package/dist/{webimage-d8e32cb3.js → webimage-0d7dbd51.js} +1 -1
- package/dist-tsc/LayerController.d.ts.map +1 -1
- package/dist-tsc/LayerController.js +4 -4
- package/dist-tsc/LayerControllerSubscriber.d.ts.map +1 -1
- package/dist-tsc/LayerControllerSubscriber.js +7 -5
- package/package.json +6 -6
- package/src/LayerController.js +4 -7
- package/src/LayerControllerSubscriber.js +9 -1
|
@@ -16790,6 +16790,7 @@ const CoordinationType = {
|
|
|
16790
16790
|
FEATURE_VALUE_COLORMAP: "featureValueColormap",
|
|
16791
16791
|
FEATURE_VALUE_TRANSFORM: "featureValueTransform",
|
|
16792
16792
|
FEATURE_VALUE_COLORMAP_RANGE: "featureValueColormapRange",
|
|
16793
|
+
FEATURE_AGGREGATION_STRATEGY: "featureAggregationStrategy",
|
|
16793
16794
|
OBS_COLOR_ENCODING: "obsColorEncoding",
|
|
16794
16795
|
SPATIAL_IMAGE_LAYER: "spatialImageLayer",
|
|
16795
16796
|
SPATIAL_SEGMENTATION_LAYER: "spatialSegmentationLayer",
|
|
@@ -16932,6 +16933,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
16932
16933
|
CoordinationType.FEATURE_SELECTION,
|
|
16933
16934
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
16934
16935
|
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
16936
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
16935
16937
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
16936
16938
|
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
16937
16939
|
CoordinationType.TOOLTIPS_VISIBLE,
|
|
@@ -16975,6 +16977,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
16975
16977
|
CoordinationType.FEATURE_SELECTION,
|
|
16976
16978
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
16977
16979
|
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
16980
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
16978
16981
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
16979
16982
|
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
16980
16983
|
CoordinationType.TOOLTIPS_VISIBLE,
|
|
@@ -17054,10 +17057,12 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17054
17057
|
CoordinationType.FEATURE_SELECTION,
|
|
17055
17058
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
17056
17059
|
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
17060
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17057
17061
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
17058
17062
|
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
17059
17063
|
CoordinationType.MOLECULE_HIGHLIGHT,
|
|
17060
|
-
CoordinationType.TOOLTIPS_VISIBLE
|
|
17064
|
+
CoordinationType.TOOLTIPS_VISIBLE,
|
|
17065
|
+
CoordinationType.PHOTOMETRIC_INTERPRETATION
|
|
17061
17066
|
],
|
|
17062
17067
|
[ViewType.SPATIAL_BETA]: [
|
|
17063
17068
|
CoordinationType.META_COORDINATION_SCOPES,
|
|
@@ -17091,6 +17096,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17091
17096
|
CoordinationType.FEATURE_SELECTION,
|
|
17092
17097
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
17093
17098
|
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
17099
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17094
17100
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
17095
17101
|
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
17096
17102
|
CoordinationType.MOLECULE_HIGHLIGHT,
|
|
@@ -17129,7 +17135,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17129
17135
|
CoordinationType.LEGEND_VISIBLE,
|
|
17130
17136
|
CoordinationType.SPATIAL_CHANNEL_LABELS_VISIBLE,
|
|
17131
17137
|
CoordinationType.SPATIAL_CHANNEL_LABELS_ORIENTATION,
|
|
17132
|
-
CoordinationType.SPATIAL_CHANNEL_LABEL_SIZE
|
|
17138
|
+
CoordinationType.SPATIAL_CHANNEL_LABEL_SIZE,
|
|
17139
|
+
CoordinationType.PHOTOMETRIC_INTERPRETATION
|
|
17133
17140
|
],
|
|
17134
17141
|
[ViewType.HEATMAP]: [
|
|
17135
17142
|
CoordinationType.DATASET,
|
|
@@ -17204,6 +17211,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17204
17211
|
CoordinationType.FEATURE_SELECTION,
|
|
17205
17212
|
CoordinationType.FEATURE_VALUE_TRANSFORM,
|
|
17206
17213
|
CoordinationType.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
17214
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17207
17215
|
CoordinationType.OBS_SET_SELECTION,
|
|
17208
17216
|
CoordinationType.OBS_SET_FILTER,
|
|
17209
17217
|
CoordinationType.OBS_SET_HIGHLIGHT,
|
|
@@ -17219,6 +17227,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17219
17227
|
CoordinationType.FEATURE_TYPE,
|
|
17220
17228
|
CoordinationType.FEATURE_VALUE_TYPE,
|
|
17221
17229
|
CoordinationType.FEATURE_SELECTION,
|
|
17230
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17222
17231
|
CoordinationType.ADDITIONAL_OBS_SETS,
|
|
17223
17232
|
CoordinationType.OBS_SET_COLOR,
|
|
17224
17233
|
CoordinationType.OBS_COLOR_ENCODING,
|
|
@@ -17242,7 +17251,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17242
17251
|
CoordinationType.SPATIAL_ROTATION_Y,
|
|
17243
17252
|
CoordinationType.SPATIAL_ROTATION_Z,
|
|
17244
17253
|
CoordinationType.SPATIAL_ROTATION_ORBIT,
|
|
17245
|
-
CoordinationType.SPATIAL_ORBIT_AXIS
|
|
17254
|
+
CoordinationType.SPATIAL_ORBIT_AXIS,
|
|
17255
|
+
CoordinationType.PHOTOMETRIC_INTERPRETATION
|
|
17246
17256
|
],
|
|
17247
17257
|
[ViewType.LAYER_CONTROLLER_BETA]: [
|
|
17248
17258
|
CoordinationType.META_COORDINATION_SCOPES,
|
|
@@ -17297,6 +17307,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17297
17307
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
17298
17308
|
CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
|
|
17299
17309
|
CoordinationType.FEATURE_SELECTION,
|
|
17310
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17300
17311
|
CoordinationType.TOOLTIPS_VISIBLE,
|
|
17301
17312
|
CoordinationType.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
17302
17313
|
CoordinationType.LEGEND_VISIBLE,
|
|
@@ -17337,6 +17348,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17337
17348
|
CoordinationType.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
17338
17349
|
CoordinationType.FEATURE_VALUE_POSITIVITY_THRESHOLD,
|
|
17339
17350
|
CoordinationType.FEATURE_VALUE_COLORMAP,
|
|
17351
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17340
17352
|
CoordinationType.OBS_SET_SELECTION,
|
|
17341
17353
|
CoordinationType.OBS_SET_FILTER,
|
|
17342
17354
|
CoordinationType.OBS_SET_HIGHLIGHT,
|
|
@@ -17365,6 +17377,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17365
17377
|
CoordinationType.FEATURE_SELECTION,
|
|
17366
17378
|
CoordinationType.FEATURE_VALUE_TRANSFORM,
|
|
17367
17379
|
CoordinationType.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
17380
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17368
17381
|
CoordinationType.OBS_SET_SELECTION,
|
|
17369
17382
|
CoordinationType.OBS_SET_HIGHLIGHT,
|
|
17370
17383
|
CoordinationType.OBS_HIGHLIGHT,
|
|
@@ -17469,6 +17482,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
17469
17482
|
CoordinationType.OBS_TYPE,
|
|
17470
17483
|
CoordinationType.SAMPLE_TYPE,
|
|
17471
17484
|
CoordinationType.FEATURE_SELECTION,
|
|
17485
|
+
CoordinationType.FEATURE_AGGREGATION_STRATEGY,
|
|
17472
17486
|
CoordinationType.SAMPLE_SET_SELECTION,
|
|
17473
17487
|
CoordinationType.SAMPLE_SET_FILTER,
|
|
17474
17488
|
CoordinationType.OBS_SET_SELECTION,
|
|
@@ -126980,8 +126994,15 @@ class SelectionLayer extends CompositeLayer {
|
|
|
126980
126994
|
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
126981
126995
|
return true;
|
|
126982
126996
|
}
|
|
126983
|
-
if (node2.data
|
|
126984
|
-
|
|
126997
|
+
if (node2.data) {
|
|
126998
|
+
let current = node2;
|
|
126999
|
+
while (current) {
|
|
127000
|
+
const pointCoords = [].slice.call(getObsCoords(current.data));
|
|
127001
|
+
if (booleanPointInPolygon$1(point$1(pointCoords), selectedPolygon)) {
|
|
127002
|
+
pickingInfos.push(current.data);
|
|
127003
|
+
}
|
|
127004
|
+
current = current.next;
|
|
127005
|
+
}
|
|
126985
127006
|
}
|
|
126986
127007
|
return false;
|
|
126987
127008
|
});
|
|
@@ -128159,16 +128180,16 @@ function addDecoder(cases, importFn) {
|
|
|
128159
128180
|
}
|
|
128160
128181
|
cases.forEach((c) => registry$1.set(c, importFn));
|
|
128161
128182
|
}
|
|
128162
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
128163
|
-
addDecoder(5, () => import("./lzw-
|
|
128183
|
+
addDecoder([void 0, 1], () => import("./raw-0be8a541.js").then((m) => m.default));
|
|
128184
|
+
addDecoder(5, () => import("./lzw-af978121.js").then((m) => m.default));
|
|
128164
128185
|
addDecoder(6, () => {
|
|
128165
128186
|
throw new Error("old style JPEG compression is not supported.");
|
|
128166
128187
|
});
|
|
128167
|
-
addDecoder(7, () => import("./jpeg-
|
|
128168
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
128169
|
-
addDecoder(32773, () => import("./packbits-
|
|
128170
|
-
addDecoder(34887, () => import("./lerc-
|
|
128171
|
-
addDecoder(50001, () => import("./webimage-
|
|
128188
|
+
addDecoder(7, () => import("./jpeg-f0fc1e44.js").then((m) => m.default));
|
|
128189
|
+
addDecoder([8, 32946], () => import("./deflate-2c798302.js").then((m) => m.default));
|
|
128190
|
+
addDecoder(32773, () => import("./packbits-48365e34.js").then((m) => m.default));
|
|
128191
|
+
addDecoder(34887, () => import("./lerc-59798e8d.js").then((m) => m.default));
|
|
128192
|
+
addDecoder(50001, () => import("./webimage-0d7dbd51.js").then((m) => m.default));
|
|
128172
128193
|
function decodeRowAcc(row, stride) {
|
|
128173
128194
|
let length2 = row.length - stride;
|
|
128174
128195
|
let offset4 = 0;
|
|
@@ -144016,7 +144037,7 @@ function LayerController(props) {
|
|
|
144016
144037
|
disabled,
|
|
144017
144038
|
spatialHeight,
|
|
144018
144039
|
spatialWidth,
|
|
144019
|
-
|
|
144040
|
+
photometricInterpretation,
|
|
144020
144041
|
shouldShowRemoveLayerButton
|
|
144021
144042
|
} = props;
|
|
144022
144043
|
const {
|
|
@@ -144291,7 +144312,7 @@ function LayerController(props) {
|
|
|
144291
144312
|
handleColormapChange: setColormap,
|
|
144292
144313
|
handleGlobalChannelsSelectionChange,
|
|
144293
144314
|
handleTransparentColorChange: setTransparentColor,
|
|
144294
|
-
disableChannelsIfRgbDetected:
|
|
144315
|
+
disableChannelsIfRgbDetected: photometricInterpretation === "RGB",
|
|
144295
144316
|
handleDomainChange,
|
|
144296
144317
|
shouldShowTransparentColor,
|
|
144297
144318
|
shouldShowDomain,
|
|
@@ -144309,8 +144330,8 @@ function LayerController(props) {
|
|
|
144309
144330
|
modelMatrix: modelMatrix2
|
|
144310
144331
|
}
|
|
144311
144332
|
),
|
|
144312
|
-
|
|
144313
|
-
|
|
144333
|
+
photometricInterpretation === "RGB" ? null : channelControllers,
|
|
144334
|
+
photometricInterpretation === "RGB" ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
144314
144335
|
Button$1,
|
|
144315
144336
|
{
|
|
144316
144337
|
disabled: channels2.length === MAX_CHANNELS$1,
|
|
@@ -144552,6 +144573,7 @@ const LayerControllerMemoized = React__default.memo(
|
|
|
144552
144573
|
setAreLoadingImageChannels,
|
|
144553
144574
|
handleRasterLayerChange,
|
|
144554
144575
|
handleRasterLayerRemove,
|
|
144576
|
+
photometricInterpretation,
|
|
144555
144577
|
obsSegmentationsType,
|
|
144556
144578
|
segmentationLayerLoaders,
|
|
144557
144579
|
segmentationLayerMeta,
|
|
@@ -144721,6 +144743,7 @@ const LayerControllerMemoized = React__default.memo(
|
|
|
144721
144743
|
disable3d: globalDisable3d || (disable3d || []).indexOf(layerMeta.name) >= 0 || typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
|
|
144722
144744
|
disabled: typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
|
|
144723
144745
|
disableChannelsIfRgbDetected,
|
|
144746
|
+
photometricInterpretation,
|
|
144724
144747
|
imageLayerCallbacks,
|
|
144725
144748
|
setImageLayerCallback,
|
|
144726
144749
|
setViewState: ({
|
|
@@ -144780,7 +144803,8 @@ function LayerControllerSubscriber(props) {
|
|
|
144780
144803
|
obsType,
|
|
144781
144804
|
spatialImageLayer: rasterLayers,
|
|
144782
144805
|
spatialSegmentationLayer: cellsLayer,
|
|
144783
|
-
spatialPointLayer: moleculesLayer
|
|
144806
|
+
spatialPointLayer: moleculesLayer,
|
|
144807
|
+
photometricInterpretation: photometricInterpretationFromCoordination
|
|
144784
144808
|
},
|
|
144785
144809
|
{
|
|
144786
144810
|
setSpatialImageLayer: setRasterLayers,
|
|
@@ -144848,12 +144872,13 @@ function LayerControllerSubscriber(props) {
|
|
|
144848
144872
|
{}
|
|
144849
144873
|
// TODO: which values to match on
|
|
144850
144874
|
);
|
|
144851
|
-
const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image || {};
|
|
144875
|
+
const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance } = image || {};
|
|
144852
144876
|
const isReady = useReady([
|
|
144853
144877
|
obsLocationsStatus,
|
|
144854
144878
|
obsSegmentationsStatus,
|
|
144855
144879
|
imageStatus
|
|
144856
144880
|
]);
|
|
144881
|
+
const photometricInterpretation = photometricInterpretationFromCoordination ?? (instance == null ? void 0 : instance.getPhotometricInterpretation());
|
|
144857
144882
|
const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.loaders : null;
|
|
144858
144883
|
const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.meta : null;
|
|
144859
144884
|
const handleImageAdd = useCallback(async (index2) => {
|
|
@@ -144920,6 +144945,7 @@ function LayerControllerSubscriber(props) {
|
|
|
144920
144945
|
setAreLoadingImageChannels,
|
|
144921
144946
|
handleRasterLayerChange,
|
|
144922
144947
|
handleRasterLayerRemove,
|
|
144948
|
+
photometricInterpretation,
|
|
144923
144949
|
obsSegmentationsType,
|
|
144924
144950
|
segmentationLayerLoaders,
|
|
144925
144951
|
segmentationLayerMeta,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-d816962c.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@vitessce/vit-s";
|
|
5
5
|
import "react-dom";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA4EA;;;;;;;GAOG;AACH,iEAqhBC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { useId } from 'react-aria';
|
|
4
4
|
import { viv } from '@vitessce/gl';
|
|
5
|
-
import { GLOBAL_LABELS, getSourceFromLoader,
|
|
5
|
+
import { GLOBAL_LABELS, getSourceFromLoader, getMultiSelectionStats, DOMAINS, canLoadResolution, } from '@vitessce/spatial-utils';
|
|
6
6
|
import { Grid, Button, Slider, Tabs, Tab, InputLabel, Accordion, AccordionDetails, AccordionSummary, } from '@material-ui/core';
|
|
7
7
|
import { Add as AddIcon, ExpandMore as ExpandMoreIcon, Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, } from '@material-ui/icons';
|
|
8
8
|
import LayerOptions from './LayerOptions.js';
|
|
@@ -45,7 +45,7 @@ const buttonStyles = {
|
|
|
45
45
|
* @prop {function} handleLayerChange Callback for handling the changing of layer properties.
|
|
46
46
|
*/
|
|
47
47
|
export default function LayerController(props) {
|
|
48
|
-
const { layer, name, loader, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth,
|
|
48
|
+
const { layer, name, loader, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth, photometricInterpretation, shouldShowRemoveLayerButton, } = props;
|
|
49
49
|
const { colormap, opacity, channels, transparentColor, renderingMode, xSlice, ySlice, zSlice, resolution, use3d, modelMatrix, } = layer;
|
|
50
50
|
// Channels are used in a lot of callbacks and change handlers
|
|
51
51
|
// so ensuring they have an up to date copy of the data ensures consistency.
|
|
@@ -275,9 +275,9 @@ export default function LayerController(props) {
|
|
|
275
275
|
const FullController = (_jsxs(_Fragment, { children: [_jsx(LayerOptions, { channels: channels, opacity: opacity, colormap: colormap, transparentColor: transparentColor, domainType: domainType,
|
|
276
276
|
// Only allow for global dimension controllers that
|
|
277
277
|
// exist in the `dimensions` part of the loader.
|
|
278
|
-
globalControlLabels: labels.filter(label => GLOBAL_LABELS.includes(label)), globalLabelValues: globalLabelValues, handleOpacityChange: setOpacity, handleColormapChange: setColormap, handleGlobalChannelsSelectionChange: handleGlobalChannelsSelectionChange, handleTransparentColorChange: setTransparentColor, disableChannelsIfRgbDetected:
|
|
278
|
+
globalControlLabels: labels.filter(label => GLOBAL_LABELS.includes(label)), globalLabelValues: globalLabelValues, handleOpacityChange: setOpacity, handleColormapChange: setColormap, handleGlobalChannelsSelectionChange: handleGlobalChannelsSelectionChange, handleTransparentColorChange: setTransparentColor, disableChannelsIfRgbDetected: photometricInterpretation === 'RGB', handleDomainChange: handleDomainChange, shouldShowTransparentColor: shouldShowTransparentColor, shouldShowDomain: shouldShowDomain, shouldShowColormap: shouldShowColormap, use3d: use3d, loader: loader, handleMultiPropertyChange: handleMultiPropertyChange, resolution: resolution, disable3d: disable3d, setRasterLayerCallback: setImageLayerCallback, setAreAllChannelsLoading: setAreAllChannelsLoading, setViewState: setViewState, spatialHeight: spatialHeight, spatialWidth: spatialWidth, modelMatrix: modelMatrix }), photometricInterpretation === 'RGB'
|
|
279
279
|
? null
|
|
280
|
-
: channelControllers,
|
|
280
|
+
: channelControllers, photometricInterpretation === 'RGB' ? null : (_jsx(Button, { disabled: channels.length === viv.MAX_CHANNELS, onClick: handleChannelAdd, fullWidth: true, variant: "outlined", style: buttonStyles, startIcon: _jsx(AddIcon, {}), size: "small", children: "Add Channel" }))] }));
|
|
281
281
|
return (_jsxs(Accordion, { className: controllerSectionClasses.layerControllerRoot, onChange: (e, expanded) => !disabled
|
|
282
282
|
&& setIsExpanded(expanded && e?.target?.attributes?.role?.value === 'presentation'), TransitionProps: { enter: false }, expanded: !disabled && isExpanded, id: `layer-controls-accordion-${layerControlsId}`, children: [_jsx(AccordionSummary, { classes: {
|
|
283
283
|
root: accordionClasses.accordionSummaryRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"AAySA;;;;;;;;;;;;;;;GAeG;AACH,iDAbG;IAAsB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,eAAe,EAA9B,OAAO;IACQ,4BAA4B,EAA3C,OAAO;IAEQ,8BAA8B,EAA7C,OAAO;CAEjB,eAgNA"}
|
|
@@ -18,7 +18,7 @@ import ImageAddButton from './ImageAddButton.js';
|
|
|
18
18
|
// expensive so we have to be careful with props in this file in general.
|
|
19
19
|
const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
20
20
|
const { title, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, dataset, obsType, moleculesLayer, setMoleculesLayer, cellsLayer, // May be one polygon layer object or an array of bitmask layers.
|
|
21
|
-
setCellsLayer, rasterLayers, imageLayerLoaders, imageLayerMeta, imageLayerCallbacks, setImageLayerCallbacks, areLoadingImageChannels, setAreLoadingImageChannels, handleRasterLayerChange, handleRasterLayerRemove, obsSegmentationsType, segmentationLayerLoaders, segmentationLayerMeta, segmentationLayerCallbacks, setSegmentationLayerCallbacks, areLoadingSegmentationChannels, setAreLoadingSegmentationChannels, handleSegmentationLayerChange, handleSegmentationLayerRemove, disable3d, globalDisable3d, disableChannelsIfRgbDetected, layerIs3DIndex, setZoom, setTargetX, setTargetY, setTargetZ, setRotationX, setRotationOrbit, componentHeight, componentWidth, spatialLayout, handleImageAdd, enableLayerButtonsWithOneLayer, helpText, } = props;
|
|
21
|
+
setCellsLayer, rasterLayers, imageLayerLoaders, imageLayerMeta, imageLayerCallbacks, setImageLayerCallbacks, areLoadingImageChannels, setAreLoadingImageChannels, handleRasterLayerChange, handleRasterLayerRemove, photometricInterpretation, obsSegmentationsType, segmentationLayerLoaders, segmentationLayerMeta, segmentationLayerCallbacks, setSegmentationLayerCallbacks, areLoadingSegmentationChannels, setAreLoadingSegmentationChannels, handleSegmentationLayerChange, handleSegmentationLayerRemove, disable3d, globalDisable3d, disableChannelsIfRgbDetected, layerIs3DIndex, setZoom, setTargetX, setTargetY, setTargetZ, setRotationX, setRotationOrbit, componentHeight, componentWidth, spatialLayout, handleImageAdd, enableLayerButtonsWithOneLayer, helpText, } = props;
|
|
22
22
|
const shouldShowImageLayerButton = Boolean(enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1);
|
|
23
23
|
return (_jsx(TitleInfo, { title: title, isScroll: true, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, helpText: helpText, children: _jsxs("div", { className: "layer-controller-container", ref: ref, children: [moleculesLayer && (_jsx(VectorLayerController, { label: "Molecules", layerType: "molecules", layer: moleculesLayer, handleLayerChange: setMoleculesLayer }, `${dataset}-molecules`)), cellsLayer && obsSegmentationsType === 'polygon' && (_jsx(VectorLayerController, { label: `${capitalize(obsType)} Segmentations`, layerType: "cells", layer: cellsLayer, handleLayerChange: setCellsLayer }, `${dataset}-cells`)), cellsLayer && obsSegmentationsType === 'bitmask'
|
|
24
24
|
&& cellsLayer.map((layer, i) => {
|
|
@@ -97,7 +97,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
|
97
97
|
&& layerIs3DIndex !== -1
|
|
98
98
|
&& layerIs3DIndex !== i), disabled: typeof layerIs3DIndex === 'number'
|
|
99
99
|
&& layerIs3DIndex !== -1
|
|
100
|
-
&& layerIs3DIndex !== i, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallback: setImageLayerCallback, setViewState: ({ zoom: newZoom, target, rotationX: newRotationX, rotationOrbit: newRotationOrbit, }) => {
|
|
100
|
+
&& layerIs3DIndex !== i, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, photometricInterpretation: photometricInterpretation, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallback: setImageLayerCallback, setViewState: ({ zoom: newZoom, target, rotationX: newRotationX, rotationOrbit: newRotationOrbit, }) => {
|
|
101
101
|
setZoom(newZoom);
|
|
102
102
|
setTargetX(target[0]);
|
|
103
103
|
setTargetY(target[1]);
|
|
@@ -128,7 +128,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
128
128
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title = 'Spatial Layers', disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, helpText = ViewHelpMapping.LAYER_CONTROLLER, } = props;
|
|
129
129
|
const loaders = useLoaders();
|
|
130
130
|
// Get "props" from the coordination space.
|
|
131
|
-
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, },] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER], coordinationScopes);
|
|
131
|
+
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, photometricInterpretation: photometricInterpretationFromCoordination, }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, },] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER], coordinationScopes);
|
|
132
132
|
const [{ imageLayerCallbacks, areLoadingImageChannels, segmentationLayerCallbacks, areLoadingSegmentationChannels, }, { setImageLayerCallbacks, setAreLoadingImageChannels, setSegmentationLayerCallbacks, setAreLoadingSegmentationChannels, },] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
133
133
|
// Spatial layout + window size is needed for the "re-center" button to work properly.
|
|
134
134
|
// Dimensions of the Spatial component can be inferred and used for resetting view state to
|
|
@@ -142,12 +142,14 @@ export function LayerControllerSubscriber(props) {
|
|
|
142
142
|
const [obsLocationsData, obsLocationsStatus] = useObsLocationsData(loaders, dataset, false, { setSpatialPointLayer: setMoleculesLayer }, { spatialPointLayer: moleculesLayer }, {});
|
|
143
143
|
const [{ obsSegmentations, obsSegmentationsType }, obsSegmentationsStatus,] = useObsSegmentationsData(loaders, dataset, false, { setSpatialSegmentationLayer: setCellsLayer }, { spatialSegmentationLayer: cellsLayer }, {});
|
|
144
144
|
const [{ image }, imageStatus] = useImageData(loaders, dataset, false, { setSpatialImageLayer: setRasterLayers }, { spatialImageLayer: rasterLayers }, {});
|
|
145
|
-
const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image || {};
|
|
145
|
+
const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance } = image || {};
|
|
146
146
|
const isReady = useReady([
|
|
147
147
|
obsLocationsStatus,
|
|
148
148
|
obsSegmentationsStatus,
|
|
149
149
|
imageStatus,
|
|
150
150
|
]);
|
|
151
|
+
const photometricInterpretation = (photometricInterpretationFromCoordination
|
|
152
|
+
?? instance?.getPhotometricInterpretation());
|
|
151
153
|
const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.loaders : null;
|
|
152
154
|
const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.meta : null;
|
|
153
155
|
// useCallback prevents new functions from propogating
|
|
@@ -188,7 +190,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
188
190
|
setCellsLayer(newLayers);
|
|
189
191
|
}, [cellsLayer, setCellsLayer]);
|
|
190
192
|
const layerIs3DIndex = rasterLayers?.findIndex && rasterLayers.findIndex(layer => layer.use3d);
|
|
191
|
-
return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, helpText: helpText, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
|
|
193
|
+
return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, helpText: helpText, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, photometricInterpretation: photometricInterpretation, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
|
|
192
194
|
// Fall back to window for height and width.
|
|
193
195
|
componentHeight: componentHeight || windowHeight, componentWidth: componentWidth || windowWidth, spatialLayout: spatialLayout, handleImageAdd: handleImageAdd }));
|
|
194
196
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/layer-controller",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.12",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"lodash-es": "^4.17.21",
|
|
22
22
|
"math.gl": "^3.5.6",
|
|
23
23
|
"react-aria": "^3.28.0",
|
|
24
|
-
"@vitessce/constants-internal": "3.5.
|
|
25
|
-
"@vitessce/gl": "3.5.
|
|
26
|
-
"@vitessce/spatial-utils": "3.5.
|
|
27
|
-
"@vitessce/utils": "3.5.
|
|
28
|
-
"@vitessce/vit-s": "3.5.
|
|
24
|
+
"@vitessce/constants-internal": "3.5.12",
|
|
25
|
+
"@vitessce/gl": "3.5.12",
|
|
26
|
+
"@vitessce/spatial-utils": "3.5.12",
|
|
27
|
+
"@vitessce/utils": "3.5.12",
|
|
28
|
+
"@vitessce/vit-s": "3.5.12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "^18.0.0",
|
package/src/LayerController.js
CHANGED
|
@@ -4,7 +4,6 @@ import { viv } from '@vitessce/gl';
|
|
|
4
4
|
import {
|
|
5
5
|
GLOBAL_LABELS,
|
|
6
6
|
getSourceFromLoader,
|
|
7
|
-
isRgb,
|
|
8
7
|
getMultiSelectionStats,
|
|
9
8
|
DOMAINS,
|
|
10
9
|
canLoadResolution,
|
|
@@ -103,7 +102,7 @@ export default function LayerController(props) {
|
|
|
103
102
|
disabled,
|
|
104
103
|
spatialHeight,
|
|
105
104
|
spatialWidth,
|
|
106
|
-
|
|
105
|
+
photometricInterpretation,
|
|
107
106
|
shouldShowRemoveLayerButton,
|
|
108
107
|
} = props;
|
|
109
108
|
|
|
@@ -432,9 +431,7 @@ export default function LayerController(props) {
|
|
|
432
431
|
handleGlobalChannelsSelectionChange
|
|
433
432
|
}
|
|
434
433
|
handleTransparentColorChange={setTransparentColor}
|
|
435
|
-
disableChannelsIfRgbDetected={
|
|
436
|
-
isRgb(loader, channels) && disableChannelsIfRgbDetected
|
|
437
|
-
}
|
|
434
|
+
disableChannelsIfRgbDetected={photometricInterpretation === 'RGB'}
|
|
438
435
|
handleDomainChange={handleDomainChange}
|
|
439
436
|
shouldShowTransparentColor={shouldShowTransparentColor}
|
|
440
437
|
shouldShowDomain={shouldShowDomain}
|
|
@@ -451,10 +448,10 @@ export default function LayerController(props) {
|
|
|
451
448
|
spatialWidth={spatialWidth}
|
|
452
449
|
modelMatrix={modelMatrix}
|
|
453
450
|
/>
|
|
454
|
-
{
|
|
451
|
+
{photometricInterpretation === 'RGB'
|
|
455
452
|
? null
|
|
456
453
|
: channelControllers}
|
|
457
|
-
{
|
|
454
|
+
{photometricInterpretation === 'RGB' ? null : (
|
|
458
455
|
<Button
|
|
459
456
|
disabled={channels.length === viv.MAX_CHANNELS}
|
|
460
457
|
onClick={handleChannelAdd}
|
|
@@ -54,6 +54,7 @@ const LayerControllerMemoized = React.memo(
|
|
|
54
54
|
setAreLoadingImageChannels,
|
|
55
55
|
handleRasterLayerChange,
|
|
56
56
|
handleRasterLayerRemove,
|
|
57
|
+
photometricInterpretation,
|
|
57
58
|
|
|
58
59
|
obsSegmentationsType,
|
|
59
60
|
segmentationLayerLoaders,
|
|
@@ -254,6 +255,7 @@ const LayerControllerMemoized = React.memo(
|
|
|
254
255
|
&& layerIs3DIndex !== i
|
|
255
256
|
}
|
|
256
257
|
disableChannelsIfRgbDetected={disableChannelsIfRgbDetected}
|
|
258
|
+
photometricInterpretation={photometricInterpretation}
|
|
257
259
|
imageLayerCallbacks={imageLayerCallbacks}
|
|
258
260
|
setImageLayerCallback={setImageLayerCallback}
|
|
259
261
|
setViewState={({
|
|
@@ -334,6 +336,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
334
336
|
spatialImageLayer: rasterLayers,
|
|
335
337
|
spatialSegmentationLayer: cellsLayer,
|
|
336
338
|
spatialPointLayer: moleculesLayer,
|
|
339
|
+
photometricInterpretation: photometricInterpretationFromCoordination,
|
|
337
340
|
},
|
|
338
341
|
{
|
|
339
342
|
setSpatialImageLayer: setRasterLayers,
|
|
@@ -399,13 +402,17 @@ export function LayerControllerSubscriber(props) {
|
|
|
399
402
|
{ spatialImageLayer: rasterLayers },
|
|
400
403
|
{}, // TODO: which values to match on
|
|
401
404
|
);
|
|
402
|
-
const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image || {};
|
|
405
|
+
const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance } = image || {};
|
|
403
406
|
const isReady = useReady([
|
|
404
407
|
obsLocationsStatus,
|
|
405
408
|
obsSegmentationsStatus,
|
|
406
409
|
imageStatus,
|
|
407
410
|
]);
|
|
408
411
|
|
|
412
|
+
const photometricInterpretation = (
|
|
413
|
+
photometricInterpretationFromCoordination
|
|
414
|
+
?? instance?.getPhotometricInterpretation()
|
|
415
|
+
);
|
|
409
416
|
const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.loaders : null;
|
|
410
417
|
const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.meta : null;
|
|
411
418
|
|
|
@@ -481,6 +488,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
481
488
|
setAreLoadingImageChannels={setAreLoadingImageChannels}
|
|
482
489
|
handleRasterLayerChange={handleRasterLayerChange}
|
|
483
490
|
handleRasterLayerRemove={handleRasterLayerRemove}
|
|
491
|
+
photometricInterpretation={photometricInterpretation}
|
|
484
492
|
|
|
485
493
|
obsSegmentationsType={obsSegmentationsType}
|
|
486
494
|
segmentationLayerLoaders={segmentationLayerLoaders}
|