@vitessce/layer-controller 3.5.11 → 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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-9f5d422b.js";
2
+ import { B as BaseDecoder } from "./index-d816962c.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -17061,7 +17061,8 @@ const COMPONENT_COORDINATION_TYPES = {
17061
17061
  CoordinationType.OBS_COLOR_ENCODING,
17062
17062
  CoordinationType.ADDITIONAL_OBS_SETS,
17063
17063
  CoordinationType.MOLECULE_HIGHLIGHT,
17064
- CoordinationType.TOOLTIPS_VISIBLE
17064
+ CoordinationType.TOOLTIPS_VISIBLE,
17065
+ CoordinationType.PHOTOMETRIC_INTERPRETATION
17065
17066
  ],
17066
17067
  [ViewType.SPATIAL_BETA]: [
17067
17068
  CoordinationType.META_COORDINATION_SCOPES,
@@ -17134,7 +17135,8 @@ const COMPONENT_COORDINATION_TYPES = {
17134
17135
  CoordinationType.LEGEND_VISIBLE,
17135
17136
  CoordinationType.SPATIAL_CHANNEL_LABELS_VISIBLE,
17136
17137
  CoordinationType.SPATIAL_CHANNEL_LABELS_ORIENTATION,
17137
- CoordinationType.SPATIAL_CHANNEL_LABEL_SIZE
17138
+ CoordinationType.SPATIAL_CHANNEL_LABEL_SIZE,
17139
+ CoordinationType.PHOTOMETRIC_INTERPRETATION
17138
17140
  ],
17139
17141
  [ViewType.HEATMAP]: [
17140
17142
  CoordinationType.DATASET,
@@ -17249,7 +17251,8 @@ const COMPONENT_COORDINATION_TYPES = {
17249
17251
  CoordinationType.SPATIAL_ROTATION_Y,
17250
17252
  CoordinationType.SPATIAL_ROTATION_Z,
17251
17253
  CoordinationType.SPATIAL_ROTATION_ORBIT,
17252
- CoordinationType.SPATIAL_ORBIT_AXIS
17254
+ CoordinationType.SPATIAL_ORBIT_AXIS,
17255
+ CoordinationType.PHOTOMETRIC_INTERPRETATION
17253
17256
  ],
17254
17257
  [ViewType.LAYER_CONTROLLER_BETA]: [
17255
17258
  CoordinationType.META_COORDINATION_SCOPES,
@@ -128177,16 +128180,16 @@ function addDecoder(cases, importFn) {
128177
128180
  }
128178
128181
  cases.forEach((c) => registry$1.set(c, importFn));
128179
128182
  }
128180
- addDecoder([void 0, 1], () => import("./raw-043cf610.js").then((m) => m.default));
128181
- addDecoder(5, () => import("./lzw-fcb90a13.js").then((m) => m.default));
128183
+ addDecoder([void 0, 1], () => import("./raw-0be8a541.js").then((m) => m.default));
128184
+ addDecoder(5, () => import("./lzw-af978121.js").then((m) => m.default));
128182
128185
  addDecoder(6, () => {
128183
128186
  throw new Error("old style JPEG compression is not supported.");
128184
128187
  });
128185
- addDecoder(7, () => import("./jpeg-de2a446b.js").then((m) => m.default));
128186
- addDecoder([8, 32946], () => import("./deflate-8a6ed1b8.js").then((m) => m.default));
128187
- addDecoder(32773, () => import("./packbits-37339fac.js").then((m) => m.default));
128188
- addDecoder(34887, () => import("./lerc-e50baa38.js").then((m) => m.default));
128189
- addDecoder(50001, () => import("./webimage-22a3672d.js").then((m) => m.default));
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));
128190
128193
  function decodeRowAcc(row, stride) {
128191
128194
  let length2 = row.length - stride;
128192
128195
  let offset4 = 0;
@@ -144034,7 +144037,7 @@ function LayerController(props) {
144034
144037
  disabled,
144035
144038
  spatialHeight,
144036
144039
  spatialWidth,
144037
- disableChannelsIfRgbDetected,
144040
+ photometricInterpretation,
144038
144041
  shouldShowRemoveLayerButton
144039
144042
  } = props;
144040
144043
  const {
@@ -144309,7 +144312,7 @@ function LayerController(props) {
144309
144312
  handleColormapChange: setColormap,
144310
144313
  handleGlobalChannelsSelectionChange,
144311
144314
  handleTransparentColorChange: setTransparentColor,
144312
- disableChannelsIfRgbDetected: isRgb(loader, channels2) && disableChannelsIfRgbDetected,
144315
+ disableChannelsIfRgbDetected: photometricInterpretation === "RGB",
144313
144316
  handleDomainChange,
144314
144317
  shouldShowTransparentColor,
144315
144318
  shouldShowDomain,
@@ -144327,8 +144330,8 @@ function LayerController(props) {
144327
144330
  modelMatrix: modelMatrix2
144328
144331
  }
144329
144332
  ),
144330
- isRgb(loader, channels2) && disableChannelsIfRgbDetected ? null : channelControllers,
144331
- isRgb(loader, channels2) && disableChannelsIfRgbDetected ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
144333
+ photometricInterpretation === "RGB" ? null : channelControllers,
144334
+ photometricInterpretation === "RGB" ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
144332
144335
  Button$1,
144333
144336
  {
144334
144337
  disabled: channels2.length === MAX_CHANNELS$1,
@@ -144570,6 +144573,7 @@ const LayerControllerMemoized = React__default.memo(
144570
144573
  setAreLoadingImageChannels,
144571
144574
  handleRasterLayerChange,
144572
144575
  handleRasterLayerRemove,
144576
+ photometricInterpretation,
144573
144577
  obsSegmentationsType,
144574
144578
  segmentationLayerLoaders,
144575
144579
  segmentationLayerMeta,
@@ -144739,6 +144743,7 @@ const LayerControllerMemoized = React__default.memo(
144739
144743
  disable3d: globalDisable3d || (disable3d || []).indexOf(layerMeta.name) >= 0 || typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
144740
144744
  disabled: typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
144741
144745
  disableChannelsIfRgbDetected,
144746
+ photometricInterpretation,
144742
144747
  imageLayerCallbacks,
144743
144748
  setImageLayerCallback,
144744
144749
  setViewState: ({
@@ -144798,7 +144803,8 @@ function LayerControllerSubscriber(props) {
144798
144803
  obsType,
144799
144804
  spatialImageLayer: rasterLayers,
144800
144805
  spatialSegmentationLayer: cellsLayer,
144801
- spatialPointLayer: moleculesLayer
144806
+ spatialPointLayer: moleculesLayer,
144807
+ photometricInterpretation: photometricInterpretationFromCoordination
144802
144808
  },
144803
144809
  {
144804
144810
  setSpatialImageLayer: setRasterLayers,
@@ -144866,12 +144872,13 @@ function LayerControllerSubscriber(props) {
144866
144872
  {}
144867
144873
  // TODO: which values to match on
144868
144874
  );
144869
- const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image || {};
144875
+ const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance } = image || {};
144870
144876
  const isReady = useReady([
144871
144877
  obsLocationsStatus,
144872
144878
  obsSegmentationsStatus,
144873
144879
  imageStatus
144874
144880
  ]);
144881
+ const photometricInterpretation = photometricInterpretationFromCoordination ?? (instance == null ? void 0 : instance.getPhotometricInterpretation());
144875
144882
  const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.loaders : null;
144876
144883
  const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.meta : null;
144877
144884
  const handleImageAdd = useCallback(async (index2) => {
@@ -144938,6 +144945,7 @@ function LayerControllerSubscriber(props) {
144938
144945
  setAreLoadingImageChannels,
144939
144946
  handleRasterLayerChange,
144940
144947
  handleRasterLayerRemove,
144948
+ photometricInterpretation,
144941
144949
  obsSegmentationsType,
144942
144950
  segmentationLayerLoaders,
144943
144951
  segmentationLayerMeta,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L, V, d, c, e, f, b, h, u } from "./index-9f5d422b.js";
1
+ import { a, L, V, d, c, e, f, b, h, u } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-9f5d422b.js";
1
+ import { B as BaseDecoder } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -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-9f5d422b.js";
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,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-9f5d422b.js";
1
+ import { B as BaseDecoder } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-9f5d422b.js";
1
+ import { B as BaseDecoder } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-9f5d422b.js";
1
+ import { B as BaseDecoder } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-9f5d422b.js";
1
+ import { B as BaseDecoder } from "./index-d816962c.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1 +1 @@
1
- {"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA6EA;;;;;;;GAOG;AACH,iEAuhBC"}
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, isRgb, getMultiSelectionStats, DOMAINS, canLoadResolution, } from '@vitessce/spatial-utils';
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, disableChannelsIfRgbDetected, shouldShowRemoveLayerButton, } = props;
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: isRgb(loader, channels) && disableChannelsIfRgbDetected, 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 }), isRgb(loader, channels) && 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, isRgb(loader, channels) && disableChannelsIfRgbDetected ? 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" }))] }));
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":"AAuSA;;;;;;;;;;;;;;;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,eA0MA"}
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.11",
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.11",
25
- "@vitessce/gl": "3.5.11",
26
- "@vitessce/spatial-utils": "3.5.11",
27
- "@vitessce/utils": "3.5.11",
28
- "@vitessce/vit-s": "3.5.11"
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",
@@ -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
- disableChannelsIfRgbDetected,
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
- {isRgb(loader, channels) && disableChannelsIfRgbDetected
451
+ {photometricInterpretation === 'RGB'
455
452
  ? null
456
453
  : channelControllers}
457
- {isRgb(loader, channels) && disableChannelsIfRgbDetected ? null : (
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}