@vitessce/all 3.3.2 → 3.3.3

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.
@@ -29,7 +29,7 @@ var __privateMethod = (obj, member, method2) => {
29
29
  var _bytes, _encoder, _encode_buffer, _strides, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _shape2, _strides2, _metadata, _a2, _metadata2, _b, _c, _overrides, _use_suffix_request, _merge_init, merge_init_fn;
30
30
  import * as React from "react";
31
31
  import React__default, { Children, isValidElement, cloneElement, useMemo, forwardRef, useRef, useImperativeHandle, useEffect, useLayoutEffect as useLayoutEffect$1, useState, PureComponent, Component as Component$1, useCallback, createElement, useContext, useReducer, Suspense } from "react";
32
- import { useLoaders, useCoordination, useDescription, useImageData, useReady, TitleInfo, useVitessceContainer, useSetWarning, useObsSetsData, useUrls, usePlotOptionsStyles, OptionsContainer, CellColorEncodingOption, OptionSelect, useComponentHover, useComponentViewInfo, useSetComponentHover, useSetComponentViewInfo, useInitialCoordination, useDeckCanvasSize, useMultiObsLabels, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useFeatureLabelsData, useGetObsInfo, useUint8FeatureSelection, useExpressionValueGetter, useAuxiliaryCoordination, useHasLoader, useObsLocationsData, useObsLabelsData, useObsSegmentationsData, useNeighborhoodsData, useCoordinationScopes, useCoordinationScopesBy, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationScopesNonNull, useComplexCoordination, useComplexCoordinationSecondary, useMultiObsPoints, usePointMultiObsLabels, useMultiObsSpots, useSpotMultiObsSets, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useMultiObsSegmentations, useSegmentationMultiObsSets, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useMultiImages, useObsFeatureMatrixData, useUint8ObsFeatureMatrix, useGetObsMembership, PopperMenu, useComponentLayout, useClosestVitessceContainerSize, useWindowDimensions, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes, useWarning, useGridItemSize, useGenomicProfilesData, DataSourceFetchError, AbstractLoaderError, AbstractTwoStepLoader, LoaderResult, LoaderValidationError, logConfig, VitS } from "@vitessce/vit-s";
32
+ import { useLoaders, useCoordination, useDescription, useImageData, useReady, TitleInfo, useVitessceContainer, useSetWarning, useObsSetsData, useUrls, usePlotOptionsStyles, OptionsContainer, CellColorEncodingOption, OptionSelect, useComponentHover, useComponentViewInfo, useSetComponentHover, useSetComponentViewInfo, useInitialCoordination, useDeckCanvasSize, useMultiObsLabels, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useFeatureLabelsData, useGetObsInfo, useUint8FeatureSelection, useExpressionValueGetter, useAuxiliaryCoordination, useHasLoader, useObsLocationsData, useObsLabelsData, useObsSegmentationsData, useNeighborhoodsData, useMergeCoordination, useCoordinationScopes, useCoordinationScopesBy, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationScopesNonNull, useComplexCoordination, useComplexCoordinationSecondary, useMultiObsPoints, usePointMultiObsLabels, useMultiObsSpots, useSpotMultiObsSets, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useMultiObsSegmentations, useSegmentationMultiObsSets, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useMultiImages, useObsFeatureMatrixData, useUint8ObsFeatureMatrix, useGetObsMembership, PopperMenu, useComponentLayout, useClosestVitessceContainerSize, useWindowDimensions, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes, useWarning, useGridItemSize, useGenomicProfilesData, DataSourceFetchError, AbstractLoaderError, AbstractTwoStepLoader, LoaderResult, LoaderValidationError, logConfig, VitS } from "@vitessce/vit-s";
33
33
  import * as ReactDOM from "react-dom";
34
34
  import ReactDOM__default from "react-dom";
35
35
  function _mergeNamespaces(n3, m2) {
@@ -19015,7 +19015,9 @@ const FileType$1 = {
19015
19015
  OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
19016
19016
  OBS_SETS_CSV: "obsSets.csv",
19017
19017
  OBS_SETS_JSON: "obsSets.json",
19018
+ // OME-Zarr
19018
19019
  IMAGE_OME_ZARR: "image.ome-zarr",
19020
+ OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
19019
19021
  // AnnData
19020
19022
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
19021
19023
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
@@ -19504,7 +19506,9 @@ const COMPONENT_COORDINATION_TYPES = {
19504
19506
  CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
19505
19507
  CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
19506
19508
  CoordinationType$1.IMAGE_CHANNEL,
19509
+ CoordinationType$1.IMAGE_LAYER,
19507
19510
  CoordinationType$1.SEGMENTATION_CHANNEL,
19511
+ CoordinationType$1.SEGMENTATION_LAYER,
19508
19512
  CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
19509
19513
  CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
19510
19514
  CoordinationType$1.SPATIAL_CHANNEL_WINDOW,
@@ -19522,6 +19526,9 @@ const COMPONENT_COORDINATION_TYPES = {
19522
19526
  CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
19523
19527
  CoordinationType$1.SPATIAL_LAYER_COLOR,
19524
19528
  CoordinationType$1.OBS_COLOR_ENCODING,
19529
+ CoordinationType$1.FEATURE_VALUE_COLORMAP,
19530
+ CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
19531
+ CoordinationType$1.FEATURE_SELECTION,
19525
19532
  CoordinationType$1.TOOLTIPS_VISIBLE,
19526
19533
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
19527
19534
  CoordinationType$1.LEGEND_VISIBLE,
@@ -19884,13 +19891,22 @@ const imageOmeTiffSchema = z.object({
19884
19891
  offsetsUrl: z.string().optional(),
19885
19892
  coordinateTransformations: omeCoordinateTransformations.optional()
19886
19893
  });
19894
+ const obsSegmentationsOmeTiffSchema = imageOmeTiffSchema.extend({
19895
+ obsTypesFromChannelNames: z.boolean().optional()
19896
+ });
19887
19897
  const imageOmeZarrSchema = z.object({
19888
19898
  coordinateTransformations: omeCoordinateTransformations.optional()
19889
19899
  });
19900
+ const obsSegmentationsOmeZarrSchema = imageOmeZarrSchema.extend({
19901
+ obsTypesFromChannelNames: z.boolean().optional()
19902
+ });
19890
19903
  const imageSpatialdataSchema = imageOmeZarrSchema.extend({
19891
19904
  path: z.string()
19892
19905
  });
19893
19906
  const obsSegmentationsSpatialdataSchema = z.object({
19907
+ // TODO: should this also extend the imageOmeZarrSchema?
19908
+ // TODO: should this be renamed labelsSpatialdataSchema?
19909
+ // TODO: support obsTypesFromChannelNames?
19894
19910
  path: z.string()
19895
19911
  });
19896
19912
  z.object({
@@ -19975,6 +19991,19 @@ const anndataZarrSchema = z.object({
19975
19991
  z.array(annDataConvenienceObsEmbeddingItem)
19976
19992
  ])
19977
19993
  }).partial();
19994
+ const spatialdataZarrSchema = z.object({
19995
+ // TODO: should `image` be a special schema
19996
+ // to allow specifying fileUid (like for embeddingType)?
19997
+ image: imageSpatialdataSchema,
19998
+ // TODO: should this be a special schema
19999
+ // to allow specifying fileUid (like for embeddingType)?
20000
+ labels: obsSegmentationsSpatialdataSchema,
20001
+ obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
20002
+ obsSpots: obsSpotsSpatialdataSchema,
20003
+ // TODO: obsPoints
20004
+ // TODO: obsLocations
20005
+ obsSets: obsSetsSpatialdataSchema
20006
+ }).partial();
19978
20007
  const cellsJsonSchema = z.object({
19979
20008
  obsLabelsTypes: z.array(z.string()).optional(),
19980
20009
  embeddingTypes: z.array(z.string()).optional()
@@ -39100,11 +39129,11 @@ var _toLength = function(it) {
39100
39129
  return it > 0 ? min$5(toInteger$2(it), 9007199254740991) : 0;
39101
39130
  };
39102
39131
  var toInteger$1 = _toInteger;
39103
- var max$4 = Math.max;
39132
+ var max$5 = Math.max;
39104
39133
  var min$4 = Math.min;
39105
39134
  var _toAbsoluteIndex = function(index2, length2) {
39106
39135
  index2 = toInteger$1(index2);
39107
- return index2 < 0 ? max$4(index2 + length2, 0) : min$4(index2, length2);
39136
+ return index2 < 0 ? max$5(index2 + length2, 0) : min$4(index2, length2);
39108
39137
  };
39109
39138
  var toIObject$5 = _toIobject;
39110
39139
  var toLength = _toLength;
@@ -52783,6 +52812,24 @@ function tickStep$1(start, stop3, count2) {
52783
52812
  step1 *= 2;
52784
52813
  return stop3 < start ? -step1 : step1;
52785
52814
  }
52815
+ function max$4(values3, valueof) {
52816
+ let max2;
52817
+ if (valueof === void 0) {
52818
+ for (const value2 of values3) {
52819
+ if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
52820
+ max2 = value2;
52821
+ }
52822
+ }
52823
+ } else {
52824
+ let index2 = -1;
52825
+ for (let value2 of values3) {
52826
+ if ((value2 = valueof(value2, ++index2, values3)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
52827
+ max2 = value2;
52828
+ }
52829
+ }
52830
+ }
52831
+ return max2;
52832
+ }
52786
52833
  function quantileSorted$1(values3, p, valueof = number$a) {
52787
52834
  if (!(n3 = values3.length))
52788
52835
  return;
@@ -156081,16 +156128,16 @@ async function getDecoder(fileDirectory) {
156081
156128
  const Decoder = await importFn();
156082
156129
  return new Decoder(fileDirectory);
156083
156130
  }
156084
- addDecoder([void 0, 1], () => import("./raw-bd484be0.js").then((m2) => m2.default));
156085
- addDecoder(5, () => import("./lzw-3f41da4f.js").then((m2) => m2.default));
156131
+ addDecoder([void 0, 1], () => import("./raw-81ed6601.js").then((m2) => m2.default));
156132
+ addDecoder(5, () => import("./lzw-846a70ec.js").then((m2) => m2.default));
156086
156133
  addDecoder(6, () => {
156087
156134
  throw new Error("old style JPEG compression is not supported.");
156088
156135
  });
156089
- addDecoder(7, () => import("./jpeg-b2781c48.js").then((m2) => m2.default));
156090
- addDecoder([8, 32946], () => import("./deflate-71cf29f7.js").then((m2) => m2.default));
156091
- addDecoder(32773, () => import("./packbits-19b767c9.js").then((m2) => m2.default));
156092
- addDecoder(34887, () => import("./lerc-69270d36.js").then((m2) => m2.default));
156093
- addDecoder(50001, () => import("./webimage-c810ada2.js").then((m2) => m2.default));
156136
+ addDecoder(7, () => import("./jpeg-dc640134.js").then((m2) => m2.default));
156137
+ addDecoder([8, 32946], () => import("./deflate-ff8e0389.js").then((m2) => m2.default));
156138
+ addDecoder(32773, () => import("./packbits-8a313c48.js").then((m2) => m2.default));
156139
+ addDecoder(34887, () => import("./lerc-42f701c0.js").then((m2) => m2.default));
156140
+ addDecoder(50001, () => import("./webimage-72021080.js").then((m2) => m2.default));
156094
156141
  function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
156095
156142
  return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
156096
156143
  }
@@ -170384,16 +170431,16 @@ function normalize$4(arr) {
170384
170431
  const data2 = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
170385
170432
  return data2;
170386
170433
  }
170387
- function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
170434
+ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, texSize) {
170388
170435
  let totalValuesLength = 0;
170389
170436
  let totalColorsLength = 0;
170390
170437
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
170391
- var _a3, _b2, _c2, _d, _e;
170438
+ var _a3, _b2, _c2, _d;
170392
170439
  if (isSetColorMode) {
170393
- totalValuesLength += ((_b2 = (_a3 = setColorValues[channelIndex]) == null ? void 0 : _a3.obsIndex) == null ? void 0 : _b2.length) || 0;
170394
- totalColorsLength += (((_d = (_c2 = setColorValues[channelIndex]) == null ? void 0 : _c2.setColors) == null ? void 0 : _d.length) || 0) * 3;
170440
+ totalColorsLength += (((_b2 = (_a3 = setColorValues[channelIndex]) == null ? void 0 : _a3.setColors) == null ? void 0 : _b2.length) || 0) * 3;
170441
+ totalValuesLength += ((_c2 = setColorValues[channelIndex]) == null ? void 0 : _c2.obsIndex) ? max$4(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
170395
170442
  } else {
170396
- totalValuesLength += ((_e = multiFeatureValues[channelIndex]) == null ? void 0 : _e.length) || 0;
170443
+ totalValuesLength += multiMatrixObsIndex[channelIndex] ? max$4(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : ((_d = multiFeatureValues[channelIndex]) == null ? void 0 : _d.length) || 0;
170397
170444
  }
170398
170445
  });
170399
170446
  const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
@@ -170411,12 +170458,20 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
170411
170458
  let indexOffset = 0;
170412
170459
  let colorOffset = 0;
170413
170460
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
170461
+ const matrixObsIndex = multiMatrixObsIndex[channelIndex];
170462
+ const bitmaskValueIsIndex = matrixObsIndex === null;
170414
170463
  if (isSetColorMode) {
170415
170464
  const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
170416
170465
  if (setColorIndices && setColors && obsIndex) {
170417
170466
  for (let i2 = 0; i2 < obsIndex.length; i2++) {
170418
- const colorIndex = setColorIndices.get(String(i2 + 1));
170419
- totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
170467
+ let obsId = String(i2 + 1);
170468
+ let obsI = i2;
170469
+ if (!bitmaskValueIsIndex) {
170470
+ obsId = obsIndex[i2];
170471
+ obsI = parseInt(obsId) - 1;
170472
+ }
170473
+ const colorIndex = setColorIndices.get(obsId);
170474
+ totalData[indexOffset + obsI] = colorIndex === void 0 ? 0 : colorIndex + 1;
170420
170475
  }
170421
170476
  for (let i2 = 0; i2 < setColors.length; i2++) {
170422
170477
  const { color: [r3, g2, b2] } = setColors[i2];
@@ -170431,7 +170486,16 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
170431
170486
  colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
170432
170487
  } else {
170433
170488
  const featureArr = multiFeatureValues[channelIndex];
170434
- totalData.set(normalize$4(featureArr), indexOffset);
170489
+ const normalizedFeatureArr = normalize$4(featureArr);
170490
+ if (!bitmaskValueIsIndex && matrixObsIndex) {
170491
+ for (let i2 = 0; i2 < matrixObsIndex.length; i2++) {
170492
+ const obsId = matrixObsIndex[i2];
170493
+ const obsI = parseInt(obsId) - 1;
170494
+ totalData[indexOffset + obsI] = normalizedFeatureArr[i2];
170495
+ }
170496
+ } else {
170497
+ totalData.set(normalizedFeatureArr, indexOffset);
170498
+ }
170435
170499
  indicesOffsets.push(indexOffset);
170436
170500
  indexOffset += featureArr.length;
170437
170501
  colorsOffsets.push(colorOffset);
@@ -170458,6 +170522,17 @@ function padWithDefault(arr, defaultValue2, padWidth) {
170458
170522
  function getColor(arr) {
170459
170523
  return arr ? arr.map((v) => v / 255) : [0, 0, 0];
170460
170524
  }
170525
+ function isEqualShallow(prevArr, nextArr) {
170526
+ if (prevArr === nextArr) {
170527
+ return true;
170528
+ }
170529
+ if (Array.isArray(prevArr) && Array.isArray(nextArr)) {
170530
+ if (prevArr.length === nextArr.length) {
170531
+ return !prevArr.some((v, i2) => v !== nextArr[i2] && (!Array.isArray(v) && !Array.isArray(nextArr[i2]) || (v.length > 0 || nextArr[i2].length > 0)));
170532
+ }
170533
+ }
170534
+ return prevArr === nextArr;
170535
+ }
170461
170536
  const defaultProps = {
170462
170537
  channelStrokeWidths: { type: "array", value: null, compare: true },
170463
170538
  channelsFilled: { type: "array", value: null, compare: true },
@@ -170467,6 +170542,7 @@ const defaultProps = {
170467
170542
  colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
170468
170543
  expressionData: { type: "object", value: null, compare: true },
170469
170544
  multiFeatureValues: { type: "array", value: null, compare: true },
170545
+ multiMatrixObsIndex: { type: "array", value: null, compare: true },
170470
170546
  setColorValues: { type: "array", value: null, compare: true },
170471
170547
  channelFeatureValueColormaps: { type: "array", value: null, compare: true },
170472
170548
  channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
@@ -170513,9 +170589,9 @@ class BitmaskLayer2 extends XRLayer {
170513
170589
  }
170514
170590
  updateState({ props: props2, oldProps, changeFlags }) {
170515
170591
  super.updateState({ props: props2, oldProps, changeFlags });
170516
- if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
170517
- const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
170518
- const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
170592
+ if (!isEqualShallow(props2.multiFeatureValues, oldProps.multiFeatureValues) || !isEqualShallow(props2.multiMatrixObsIndex, oldProps.multiMatrixObsIndex) || !isEqualShallow(props2.setColorValues, oldProps.setColorValues) || !isEqualShallow(props2.channelIsSetColorMode, oldProps.channelIsSetColorMode)) {
170593
+ const { multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode } = this.props;
170594
+ const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode);
170519
170595
  this.setState({
170520
170596
  valueTex,
170521
170597
  colorTex,
@@ -170667,9 +170743,9 @@ class BitmaskLayer2 extends XRLayer {
170667
170743
  type: GL$1.FLOAT
170668
170744
  });
170669
170745
  }
170670
- multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
170746
+ multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode) {
170671
170747
  const isWebGL2On = isWebGL2$1(this.context.gl);
170672
- const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
170748
+ const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
170673
170749
  return [
170674
170750
  // Color indices texture
170675
170751
  new Texture2D(this.context.gl, {
@@ -191335,8 +191411,7 @@ class ZarritaPixelSource extends ZarrPixelSource {
191335
191411
  this._readChunks = false;
191336
191412
  }
191337
191413
  }
191338
- async function loadOmeZarr(url, requestInit2) {
191339
- const root2 = await zarrOpenRoot(url, requestInit2);
191414
+ async function loadOmeZarr(root2) {
191340
191415
  const { data: data2, rootAttrs, labels: labels2 } = await loadMultiscales(root2);
191341
191416
  const tileSize = guessTileSize(data2[0]);
191342
191417
  const pyramid = data2.map((arr) => new ZarritaPixelSource(createZarrArrayAdapter(arr), labels2, tileSize));
@@ -192684,6 +192759,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
192684
192759
  this.prevSpotSetColor = {};
192685
192760
  this.prevSpotSetSelection = {};
192686
192761
  this.segmentationToMatrixIndexMap = {};
192762
+ this.segmentationToMatrixIndexArr = {};
192687
192763
  this.segmentationColors = {};
192688
192764
  this.segmentationExpressionGetters = {};
192689
192765
  this.prevSegmentationSetColor = {};
@@ -192966,7 +193042,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
192966
193042
  return spatialRenderingMode === "3D";
192967
193043
  }
192968
193044
  // New createImageLayer function.
192969
- createBitmaskSegmentationLayer(layerScope, layerCoordination, channelScopes, channelCoordination, image2, layerFeatureValues) {
193045
+ createBitmaskSegmentationLayer(layerScope, layerCoordination, channelScopes, channelCoordination, image2, layerFeatureValues, layerMatrixObsIndices, bitmaskValueIsIndex) {
192970
193046
  var _a3, _b2, _c2, _d;
192971
193047
  const { delegateHover, targetT, targetZ } = this.props;
192972
193048
  const data2 = (_b2 = (_a3 = image2 == null ? void 0 : image2.obsSegmentations) == null ? void 0 : _a3.instance) == null ? void 0 : _b2.getData();
@@ -193011,6 +193087,11 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
193011
193087
  var _a4;
193012
193088
  return ((_a4 = layerFeatureValues == null ? void 0 : layerFeatureValues[cScope]) == null ? void 0 : _a4[0]) || [];
193013
193089
  }),
193090
+ // Pass in the matrixObsIndex to account for the fact that
193091
+ // the obsIndex of the obsFeatureMatrix
193092
+ // may not be ["1", "2", "3", "4", ... "N"] and
193093
+ // instead may be ["3", "20", "4", "6"].
193094
+ multiMatrixObsIndex: channelScopes.map((cScope) => bitmaskValueIsIndex ? null : (layerMatrixObsIndices == null ? void 0 : layerMatrixObsIndices[cScope]) || null),
193014
193095
  setColorValues: channelScopes.map((cScope) => {
193015
193096
  var _a4, _b3;
193016
193097
  return ((_b3 = (_a4 = this.segmentationColors) == null ? void 0 : _a4[layerScope]) == null ? void 0 : _b3[cScope]) || [];
@@ -193157,12 +193238,23 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
193157
193238
  });
193158
193239
  }
193159
193240
  createSegmentationLayers() {
193160
- const { obsSegmentations = {}, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, segmentationLayerCallbacks = [], segmentationMultiExpressionData } = this.props;
193241
+ const { obsSegmentations = {}, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, segmentationLayerCallbacks = [], segmentationMultiExpressionData, bitmaskValueIsIndex } = this.props;
193161
193242
  return segmentationLayerScopes.map((layerScope) => {
193243
+ var _a3;
193162
193244
  if (obsSegmentations[layerScope]) {
193163
193245
  const { obsSegmentationsType } = obsSegmentations[layerScope];
193164
193246
  if (obsSegmentationsType === "bitmask") {
193165
- return this.createBitmaskSegmentationLayer(layerScope, segmentationLayerCoordination[0][layerScope], segmentationChannelScopesByLayer[layerScope], segmentationChannelCoordination[0][layerScope], obsSegmentations[layerScope], segmentationMultiExpressionData == null ? void 0 : segmentationMultiExpressionData[layerScope]);
193247
+ return this.createBitmaskSegmentationLayer(
193248
+ layerScope,
193249
+ segmentationLayerCoordination[0][layerScope],
193250
+ segmentationChannelScopesByLayer[layerScope],
193251
+ segmentationChannelCoordination[0][layerScope],
193252
+ obsSegmentations[layerScope],
193253
+ segmentationMultiExpressionData == null ? void 0 : segmentationMultiExpressionData[layerScope],
193254
+ (_a3 = this.segmentationToMatrixIndexArr) == null ? void 0 : _a3[layerScope],
193255
+ // TODO: get this from the layer coordination.
193256
+ bitmaskValueIsIndex
193257
+ );
193166
193258
  }
193167
193259
  if (obsSegmentationsType === "polygon") {
193168
193260
  return this.createPolygonSegmentationLayer(layerScope, segmentationLayerCoordination[0][layerScope], segmentationChannelScopesByLayer[layerScope], segmentationChannelCoordination[0][layerScope], obsSegmentations[layerScope], segmentationMultiExpressionData == null ? void 0 : segmentationMultiExpressionData[layerScope]);
@@ -193333,6 +193425,12 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
193333
193425
  }
193334
193426
  this.segmentationToMatrixIndexMap[layerScope][channelScope] = instanceObsIndex.map((key2) => matrixIndexMap.get(key2));
193335
193427
  }
193428
+ if (matrixObsIndex) {
193429
+ if (!this.segmentationToMatrixIndexArr[layerScope]) {
193430
+ this.segmentationToMatrixIndexArr[layerScope] = {};
193431
+ }
193432
+ this.segmentationToMatrixIndexArr[layerScope][channelScope] = matrixObsIndex;
193433
+ }
193336
193434
  }
193337
193435
  onUpdateAllSegmentationsIndexData() {
193338
193436
  const { segmentationLayerScopes, segmentationChannelScopesByLayer } = this.props;
@@ -193350,7 +193448,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
193350
193448
  const expressionData = (_a3 = segmentationMultiExpressionData == null ? void 0 : segmentationMultiExpressionData[layerScope]) == null ? void 0 : _a3[channelScope];
193351
193449
  const toMatrixIndexMap = (_c2 = (_b2 = this.segmentationToMatrixIndexMap) == null ? void 0 : _b2[layerScope]) == null ? void 0 : _c2[channelScope];
193352
193450
  const getExpressionValue = (entry2, { index: instanceIndex }) => {
193353
- if (toMatrixIndexMap && expressionData && expressionData[0]) {
193451
+ if (expressionData && expressionData[0]) {
193354
193452
  const rowIndex = toMatrixIndexMap[instanceIndex];
193355
193453
  const val = expressionData[0][rowIndex];
193356
193454
  return val;
@@ -193822,10 +193920,25 @@ function getHoverData(hoverInfo, layerType) {
193822
193920
  return null;
193823
193921
  }
193824
193922
  function SpatialSubscriber(props2) {
193825
- const { uuid, coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, observationsLabelOverride, subobservationsLabelOverride: subobservationsLabel = "molecule", theme, disableTooltip = false, title: title2 = "Spatial" } = props2;
193923
+ const {
193924
+ uuid,
193925
+ coordinationScopes: coordinationScopesRaw,
193926
+ coordinationScopesBy: coordinationScopesByRaw,
193927
+ closeButtonVisible,
193928
+ downloadButtonVisible,
193929
+ removeGridComponent,
193930
+ observationsLabelOverride,
193931
+ subobservationsLabelOverride: subobservationsLabel = "molecule",
193932
+ theme,
193933
+ disableTooltip = false,
193934
+ title: title2 = "Spatial",
193935
+ bitmaskValueIsIndex = false
193936
+ // TODO: move to coordination type
193937
+ } = props2;
193826
193938
  const loaders = useLoaders();
193827
193939
  const setComponentHover = useSetComponentHover();
193828
193940
  const setComponentViewInfo = useSetComponentViewInfo(uuid);
193941
+ const mergeCoordination = useMergeCoordination();
193829
193942
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
193830
193943
  const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
193831
193944
  const [{ dataset, obsType, featureType, featureValueType, spatialZoom: zoom2, spatialTargetX: targetX2, spatialTargetY: targetY2, spatialTargetZ: targetZ, spatialTargetT: targetT, spatialRenderingMode, spatialRotationX: rotationX, spatialRotationOrbit: rotationOrbit, spatialOrbitAxis: orbitAxis, spatialAxisFixed }, { setSpatialZoom: setZoom, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL_BETA], coordinationScopes);
@@ -193922,18 +194035,18 @@ function SpatialSubscriber(props2) {
193922
194035
  ], coordinationScopes, coordinationScopesBy, CoordinationType$1.POINT_LAYER);
193923
194036
  const is3dMode = spatialRenderingMode === "3D";
193924
194037
  const [width2, height2, deckRef] = useDeckCanvasSize();
193925
- const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset);
194038
+ const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
193926
194039
  const [pointMultiObsLabelsData, pointMultiObsLabelsDataStatus] = usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loaders, dataset);
193927
- const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset);
194040
+ const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
193928
194041
  const [obsSpotsSetsData, obsSpotsSetsDataStatus] = useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
193929
194042
  const [spotMultiExpressionData, spotMultiLoadedFeatureSelection, spotMultiExpressionExtents, spotMultiExpressionNormData, spotMultiFeatureSelectionStatus] = useSpotMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
193930
194043
  const [spotMultiIndicesData, spotMultiIndicesDataStatus] = useSpotMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
193931
194044
  const [obsSegmentationsLocationsData, obsSegmentationsLocationsDataStatus] = useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset);
193932
- const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset);
194045
+ const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
193933
194046
  const [obsSegmentationsSetsData, obsSegmentationsSetsDataStatus] = useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
193934
194047
  const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
193935
194048
  const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
193936
- const [imageData, imageDataStatus, imageUrls] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset);
194049
+ const [imageData, imageDataStatus, imageUrls] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
193937
194050
  const isReadyToComputeInitialViewState = useReady([
193938
194051
  obsPointsDataStatus,
193939
194052
  obsSpotsDataStatus,
@@ -194103,7 +194216,7 @@ function SpatialSubscriber(props2) {
194103
194216
  if (layerType === "segmentation-bitmask") {
194104
194217
  const { obsIndex } = ((_a3 = segmentationMultiIndicesData == null ? void 0 : segmentationMultiIndicesData[segmentationLayerScope]) == null ? void 0 : _a3[channelScope]) || {};
194105
194218
  obsI -= 1;
194106
- if (obsIndex) {
194219
+ if (obsIndex && bitmaskValueIsIndex) {
194107
194220
  obsId = obsIndex == null ? void 0 : obsIndex[obsI];
194108
194221
  } else {
194109
194222
  obsId = String(obsI);
@@ -194217,6 +194330,7 @@ function SpatialSubscriber(props2) {
194217
194330
  obsSegmentationsSets: obsSegmentationsSetsData,
194218
194331
  segmentationMatrixIndices: segmentationMultiIndicesData,
194219
194332
  segmentationMultiExpressionData: segmentationMultiExpressionNormData,
194333
+ bitmaskValueIsIndex,
194220
194334
  // Images
194221
194335
  images: imageData,
194222
194336
  imageLayerScopes,
@@ -200094,8 +200208,8 @@ const Slicer = ({ xSlice, ySlice, zSlice, handleSlicerSetting, loader: loader2,
200094
200208
  ]
200095
200209
  ];
200096
200210
  const classes = useSlicerStyles();
200097
- const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label2, [min2, max2]]) => jsxRuntimeExports.jsxs(Grid$3, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [jsxRuntimeExports.jsx(Grid$3, { item: true, xs: 1, children: jsxRuntimeExports.jsxs(Typography$1, { className: !use3d ? classes.disabled : classes.enabled, style: { marginBottom: 0 }, variant: "h2", children: [label2, ":"] }) }), jsxRuntimeExports.jsx(Grid$3, { item: true, xs: 11, children: jsxRuntimeExports.jsx(Slider$1, { disabled: !use3d, className: !use3d ? classes.disabled : classes.enabled, value: val, onChange: (e3, v) => setVal(v), valueLabelDisplay: "auto", valueLabelFormat: (v) => abbreviateNumber(v), "aria-label": `Volume options ${label2} slider`, min: min2, max: max2, step: 5e-3, orientation: "horizontal" }) })] }, label2));
200098
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Typography$1, { className: !use3d ? classes.disabled : classes.enabled, style: { marginTop: 16, marginBottom: 0 }, variant: "h2", children: ["Clipping Planes:", " "] }), " ", Slicers] });
200211
+ const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label2, [min2, max2]]) => jsxRuntimeExports.jsxs(Grid$3, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [jsxRuntimeExports.jsx(Grid$3, { item: true, xs: 1, children: jsxRuntimeExports.jsxs(Typography$1, { className: !use3d ? classes.disabled : classes.enabled, style: { marginBottom: 0 }, children: [label2, ":"] }) }), jsxRuntimeExports.jsx(Grid$3, { item: true, xs: 11, children: jsxRuntimeExports.jsx(Slider$1, { disabled: !use3d, className: !use3d ? classes.disabled : classes.enabled, value: val, onChange: (e3, v) => setVal(v), valueLabelDisplay: "auto", valueLabelFormat: (v) => abbreviateNumber(v), "aria-label": `Volume options ${label2} slider`, min: min2, max: max2, step: 5e-3, orientation: "horizontal" }) })] }, label2));
200212
+ return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Typography$1, { className: !use3d ? classes.disabled : classes.enabled, style: { marginTop: 16, marginBottom: 0 }, children: ["Clipping Planes:", " "] }), " ", Slicers] });
200099
200213
  };
200100
200214
  const renderingOptions = Object.values(RENDERING_MODES);
200101
200215
  function RenderingModeSelect({ handleRenderingModeChange, renderingMode, use3d }) {
@@ -202291,8 +202405,9 @@ function LayerController(props2) {
202291
202405
  })] });
202292
202406
  }
202293
202407
  function LayerControllerSubscriber(props2) {
202294
- const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers" } = props2;
202408
+ const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid } = props2;
202295
202409
  const loaders = useLoaders();
202410
+ const mergeCoordination = useMergeCoordination();
202296
202411
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
202297
202412
  const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
202298
202413
  const [{ dataset, spatialTargetT: targetT, spatialTargetZ: targetZ, spatialRenderingMode }, { setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialTargetT: setTargetT, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, setSpatialRenderingMode }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.LAYER_CONTROLLER_BETA], coordinationScopes);
@@ -202382,10 +202497,10 @@ function LayerControllerSubscriber(props2) {
202382
202497
  const layerControllerRef = useRef();
202383
202498
  useClosestVitessceContainerSize(layerControllerRef);
202384
202499
  useWindowDimensions();
202385
- const [obsSegmentationsData, obsSegmentationsDataStatus] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset);
202386
- const [imageData, imageDataStatus] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset);
202387
- const [obsSpotsData, obsSpotsDataStatus] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset);
202388
- const [obsPointsData, obsPointsDataStatus] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset);
202500
+ const [obsSegmentationsData, obsSegmentationsDataStatus] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
202501
+ const [imageData, imageDataStatus] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
202502
+ const [obsSpotsData, obsSpotsDataStatus] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
202503
+ const [obsPointsData, obsPointsDataStatus] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
202389
202504
  const isReady = useReady([
202390
202505
  obsSpotsDataStatus,
202391
202506
  obsPointsDataStatus,
@@ -202687,7 +202802,7 @@ const HIGLASS_BUNDLE_VERSION = "1.11.13";
202687
202802
  const HIGLASS_CSS_URL = `https://unpkg.com/${HIGLASS_PKG_NAME}@${HIGLASS_BUNDLE_VERSION}/dist/hglib.css`;
202688
202803
  register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
202689
202804
  const LazyHiGlassComponent = React__default.lazy(async () => {
202690
- const { HiGlassComponent } = await import("./hglib-872ad77b.js").then((n3) => n3.h);
202805
+ const { HiGlassComponent } = await import("./hglib-6e6aad2d.js").then((n3) => n3.h);
202691
202806
  return { default: HiGlassComponent };
202692
202807
  });
202693
202808
  const HG_SIZE = 800;
@@ -260016,6 +260131,24 @@ class ObsLabelsCsvLoader extends CsvLoader {
260016
260131
  return this.cachedResult;
260017
260132
  }
260018
260133
  }
260134
+ class CoordinationLevel {
260135
+ constructor(value2) {
260136
+ this.value = value2;
260137
+ this.cachedValue = null;
260138
+ }
260139
+ setCached(processedLevel) {
260140
+ this.cachedValue = processedLevel;
260141
+ }
260142
+ getCached() {
260143
+ return this.cachedValue;
260144
+ }
260145
+ isCached() {
260146
+ return this.cachedValue !== null;
260147
+ }
260148
+ }
260149
+ function CL(value2) {
260150
+ return new CoordinationLevel(value2);
260151
+ }
260019
260152
  class ObsSpotsCsvLoader extends CsvLoader {
260020
260153
  loadFromCache(data2) {
260021
260154
  if (this.cachedResult) {
@@ -260032,6 +260165,32 @@ class ObsSpotsCsvLoader extends CsvLoader {
260032
260165
  this.cachedResult = { obsIndex, obsSpots };
260033
260166
  return this.cachedResult;
260034
260167
  }
260168
+ async load() {
260169
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
260170
+ if (payload instanceof AbstractLoaderError) {
260171
+ return Promise.reject(payload);
260172
+ }
260173
+ const coordinationValues = {
260174
+ spotLayer: CL({
260175
+ obsType: "spot",
260176
+ // obsColorEncoding: 'spatialLayerColor',
260177
+ // spatialLayerColor: [255, 255, 255],
260178
+ spatialLayerVisible: true,
260179
+ spatialLayerOpacity: 1,
260180
+ spatialSpotRadius: 10
260181
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
260182
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
260183
+ // featureValueColormapRange: [0, 1],
260184
+ // obsHighlight: null,
260185
+ // obsSetColor: null,
260186
+ // obsSetSelection: null,
260187
+ // additionalObsSets: null,
260188
+ })
260189
+ };
260190
+ const { data: data2, url } = payload;
260191
+ const result = this.loadFromCache(data2);
260192
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
260193
+ }
260035
260194
  }
260036
260195
  class ObsPointsCsvLoader extends CsvLoader {
260037
260196
  loadFromCache(data2) {
@@ -260049,6 +260208,31 @@ class ObsPointsCsvLoader extends CsvLoader {
260049
260208
  this.cachedResult = { obsIndex, obsPoints };
260050
260209
  return this.cachedResult;
260051
260210
  }
260211
+ async load() {
260212
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
260213
+ if (payload instanceof AbstractLoaderError) {
260214
+ return Promise.reject(payload);
260215
+ }
260216
+ const coordinationValues = {
260217
+ pointLayer: CL({
260218
+ obsType: "point",
260219
+ // obsColorEncoding: 'spatialLayerColor',
260220
+ // spatialLayerColor: [255, 255, 255],
260221
+ spatialLayerVisible: true,
260222
+ spatialLayerOpacity: 1
260223
+ // TODO: support a point radius?
260224
+ // featureValueColormapRange: [0, 1],
260225
+ // obsHighlight: null,
260226
+ // obsSetColor: null,
260227
+ // obsSetSelection: null,
260228
+ // additionalObsSets: null,
260229
+ // obsLabelsType: null,
260230
+ })
260231
+ };
260232
+ const { data: data2, url } = payload;
260233
+ const result = this.loadFromCache(data2);
260234
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
260235
+ }
260052
260236
  }
260053
260237
  class ObsLocationsCsvLoader extends CsvLoader {
260054
260238
  loadFromCache(data2) {
@@ -260205,13 +260389,39 @@ class ObsSegmentationsJsonLoader extends JsonLoader {
260205
260389
  return this.cachedResult;
260206
260390
  }
260207
260391
  async load() {
260392
+ var _a3;
260208
260393
  const payload = await super.load().catch((reason) => Promise.resolve(reason));
260209
260394
  if (payload instanceof AbstractLoaderError) {
260210
260395
  return Promise.reject(payload);
260211
260396
  }
260397
+ const channelCoordination = [{
260398
+ // obsType: null,
260399
+ spatialChannelColor: [255, 255, 255],
260400
+ spatialChannelVisible: true,
260401
+ spatialChannelOpacity: 1,
260402
+ spatialChannelWindow: null,
260403
+ // featureType: 'feature',
260404
+ // featureValueType: 'value',
260405
+ obsColorEncoding: "spatialChannelColor",
260406
+ spatialSegmentationFilled: true,
260407
+ spatialSegmentationStrokeWidth: 1,
260408
+ obsHighlight: null
260409
+ }];
260410
+ const coordinationValues = {
260411
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
260412
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
260413
+ segmentationLayer: CL([
260414
+ {
260415
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
260416
+ spatialLayerOpacity: 1,
260417
+ spatialLayerVisible: true,
260418
+ segmentationChannel: CL(channelCoordination)
260419
+ }
260420
+ ])
260421
+ };
260212
260422
  const { data: data2, url } = payload;
260213
260423
  const result = this.loadFromCache(data2);
260214
- return Promise.resolve(new LoaderResult(result, url));
260424
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
260215
260425
  }
260216
260426
  }
260217
260427
  class ObsSetsJsonLoader extends JsonLoader {
@@ -260578,7 +260788,8 @@ async function initLoader(imageData) {
260578
260788
  }
260579
260789
  case "ome-zarr": {
260580
260790
  const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata2 || {};
260581
- const loader2 = await loadOmeZarr(url, requestInit2);
260791
+ const root2 = await zarrOpenRoot(url, requestInit2);
260792
+ const loader2 = await loadOmeZarr(root2);
260582
260793
  const { metadata: loaderMetadata } = loader2;
260583
260794
  const { omero, multiscales } = loaderMetadata;
260584
260795
  if (!Array.isArray(multiscales) || multiscales.length === 0) {
@@ -260714,6 +260925,9 @@ class ZarrDataSource {
260714
260925
  this.storeRoot = zarrOpenRoot(url, requestInit2);
260715
260926
  }
260716
260927
  }
260928
+ getStoreRoot(path2) {
260929
+ return this.storeRoot.resolve(path2);
260930
+ }
260717
260931
  /**
260718
260932
  * Class method for decoding json from the store.
260719
260933
  * @param {string} key A path to the item.
@@ -260721,13 +260935,14 @@ class ZarrDataSource {
260721
260935
  * that resolves to the parsed JSON if successful.
260722
260936
  * @throws This may throw an error.
260723
260937
  */
260724
- async getJson(key2) {
260938
+ async getJson(key2, storeRootParam = null) {
260725
260939
  const { storeRoot } = this;
260940
+ const storeRootToUse = storeRootParam || storeRoot;
260726
260941
  let dirKey = key2;
260727
260942
  if (key2.endsWith(".zattrs") || key2.endsWith(".zarray") || key2.endsWith(".zgroup")) {
260728
260943
  dirKey = key2.substring(0, key2.length - 8);
260729
260944
  }
260730
- return (await open(storeRoot.resolve(dirKey))).attrs;
260945
+ return (await open(storeRootToUse.resolve(dirKey))).attrs;
260731
260946
  }
260732
260947
  }
260733
260948
  function dirname(path2) {
@@ -261538,10 +261753,28 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
261538
261753
  if (superResult instanceof AbstractLoaderError) {
261539
261754
  return Promise.reject(superResult);
261540
261755
  }
261756
+ const coordinationValues = {
261757
+ spotLayer: CL({
261758
+ obsType: "spot",
261759
+ // obsColorEncoding: 'spatialLayerColor',
261760
+ // spatialLayerColor: [255, 255, 255],
261761
+ spatialLayerVisible: true,
261762
+ spatialLayerOpacity: 1,
261763
+ spatialSpotRadius: 10
261764
+ // TODO: get this from adata.uns if possible.
261765
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
261766
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
261767
+ // featureValueColormapRange: [0, 1],
261768
+ // obsHighlight: null,
261769
+ // obsSetColor: null,
261770
+ // obsSetSelection: null,
261771
+ // additionalObsSets: null,
261772
+ })
261773
+ };
261541
261774
  return Promise.all([
261542
261775
  this.dataSource.loadObsIndex(path2),
261543
261776
  this.loadSpots()
261544
- ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null)));
261777
+ ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null, coordinationValues)));
261545
261778
  }
261546
261779
  }
261547
261780
  class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
@@ -261567,10 +261800,26 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
261567
261800
  if (superResult instanceof AbstractLoaderError) {
261568
261801
  return Promise.reject(superResult);
261569
261802
  }
261803
+ const coordinationValues = {
261804
+ pointLayer: CL({
261805
+ obsType: "point",
261806
+ // obsColorEncoding: 'spatialLayerColor',
261807
+ // spatialLayerColor: [255, 255, 255],
261808
+ spatialLayerVisible: true,
261809
+ spatialLayerOpacity: 1
261810
+ // TODO: support a point radius?
261811
+ // featureValueColormapRange: [0, 1],
261812
+ // obsHighlight: null,
261813
+ // obsSetColor: null,
261814
+ // obsSetSelection: null,
261815
+ // additionalObsSets: null,
261816
+ // obsLabelsType: null,
261817
+ })
261818
+ };
261570
261819
  return Promise.all([
261571
261820
  this.dataSource.loadObsIndex(path2),
261572
261821
  this.loadPoints()
261573
- ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult({ obsIndex, obsPoints }, null)));
261822
+ ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult({ obsIndex, obsPoints }, null, coordinationValues)));
261574
261823
  }
261575
261824
  }
261576
261825
  class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
@@ -261638,13 +261887,39 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
261638
261887
  return this.segmentations;
261639
261888
  }
261640
261889
  async load() {
261890
+ var _a3;
261641
261891
  const { path: path2 } = this.options;
261642
261892
  const superResult = await super.load().catch((reason) => Promise.resolve(reason));
261643
261893
  if (superResult instanceof AbstractLoaderError) {
261644
261894
  return Promise.reject(superResult);
261645
261895
  }
261896
+ const channelCoordination = [{
261897
+ // obsType: null,
261898
+ spatialChannelColor: [255, 255, 255],
261899
+ spatialChannelVisible: true,
261900
+ spatialChannelOpacity: 1,
261901
+ spatialChannelWindow: null,
261902
+ // featureType: 'feature',
261903
+ // featureValueType: 'value',
261904
+ obsColorEncoding: "spatialChannelColor",
261905
+ spatialSegmentationFilled: true,
261906
+ spatialSegmentationStrokeWidth: 1,
261907
+ obsHighlight: null
261908
+ }];
261646
261909
  const coordinationValues = {
261647
- spatialSegmentationLayer: DEFAULT_CELLS_LAYER
261910
+ // Old
261911
+ spatialSegmentationLayer: DEFAULT_CELLS_LAYER,
261912
+ // New
261913
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
261914
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
261915
+ segmentationLayer: CL([
261916
+ {
261917
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
261918
+ spatialLayerOpacity: 1,
261919
+ spatialLayerVisible: true,
261920
+ segmentationChannel: CL(channelCoordination)
261921
+ }
261922
+ ])
261648
261923
  };
261649
261924
  return Promise.all([
261650
261925
  this.dataSource.loadObsIndex(path2),
@@ -261653,7 +261928,7 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
261653
261928
  obsIndex,
261654
261929
  obsSegmentations,
261655
261930
  obsSegmentationsType: "polygon"
261656
- }, coordinationValues)));
261931
+ }, null, coordinationValues)));
261657
261932
  }
261658
261933
  }
261659
261934
  class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
@@ -261850,20 +262125,20 @@ class ImageWrapper {
261850
262125
  return result;
261851
262126
  }
261852
262127
  getNumChannels() {
261853
- if ("Pixels" in this.vivLoader.metadata) {
261854
- const { Pixels: { Channels } } = this.vivLoader.metadata;
261855
- return Channels.length;
261856
- }
261857
- if ("omero" in this.vivLoader.metadata) {
261858
- const { omero: { channels: channels2 } } = this.vivLoader.metadata;
261859
- return channels2.length;
262128
+ if ("image-label" in this.vivLoader.metadata) {
262129
+ return 1;
261860
262130
  }
261861
262131
  if ("channels_metadata" in this.vivLoader.metadata) {
261862
262132
  const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
261863
262133
  return (channelsMetadata == null ? void 0 : channelsMetadata.channels.length) || 0;
261864
262134
  }
261865
- if ("image-label" in this.vivLoader.metadata) {
261866
- return 1;
262135
+ if ("omero" in this.vivLoader.metadata) {
262136
+ const { omero: { channels: channels2 } } = this.vivLoader.metadata;
262137
+ return channels2.length;
262138
+ }
262139
+ if ("Pixels" in this.vivLoader.metadata) {
262140
+ const { Pixels: { Channels } } = this.vivLoader.metadata;
262141
+ return Channels.length;
261867
262142
  }
261868
262143
  return 0;
261869
262144
  }
@@ -261872,9 +262147,8 @@ class ImageWrapper {
261872
262147
  const { Pixels: { Channels } } = this.vivLoader.metadata;
261873
262148
  return Channels.map((channel, i2) => channel.Name || `Channel ${i2}`);
261874
262149
  }
261875
- if ("omero" in this.vivLoader.metadata) {
261876
- const { omero: { channels: channels2 } } = this.vivLoader.metadata;
261877
- return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
262150
+ if ("image-label" in this.vivLoader.metadata) {
262151
+ return ["labels"];
261878
262152
  }
261879
262153
  if ("channels_metadata" in this.vivLoader.metadata) {
261880
262154
  const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
@@ -261882,9 +262156,33 @@ class ImageWrapper {
261882
262156
  return channelsMetadata.channels.map((channel) => `Channel ${channel.label}`);
261883
262157
  }
261884
262158
  }
262159
+ if ("omero" in this.vivLoader.metadata) {
262160
+ const { omero: { channels: channels2 } } = this.vivLoader.metadata;
262161
+ return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
262162
+ }
261885
262163
  return [];
261886
262164
  }
262165
+ // TODO: support passing a custom color palette array.
261887
262166
  getChannelObjects() {
262167
+ if ("image-label" in this.vivLoader.metadata) {
262168
+ return [{
262169
+ name: "labels",
262170
+ defaultColor: [255, 255, 255],
262171
+ defaultWindow: [0, 255],
262172
+ autoDefaultColor: [0, 0, 0]
262173
+ }];
262174
+ }
262175
+ if ("channels_metadata" in this.vivLoader.metadata) {
262176
+ const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
262177
+ if (channelsMetadata && Array.isArray(channelsMetadata == null ? void 0 : channelsMetadata.channels)) {
262178
+ return channelsMetadata.channels.map((channel, i2) => ({
262179
+ name: `Channel ${channel.label}`,
262180
+ defaultColor: void 0,
262181
+ defaultWindow: void 0,
262182
+ autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
262183
+ }));
262184
+ }
262185
+ }
261888
262186
  if ("omero" in this.vivLoader.metadata) {
261889
262187
  const { omero: { channels: channels2 } } = this.vivLoader.metadata;
261890
262188
  return channels2.map((channel, i2) => ({
@@ -261903,17 +262201,6 @@ class ImageWrapper {
261903
262201
  autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
261904
262202
  }));
261905
262203
  }
261906
- if ("channels_metadata" in this.vivLoader.metadata) {
261907
- const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
261908
- if (channelsMetadata && Array.isArray(channelsMetadata == null ? void 0 : channelsMetadata.channels)) {
261909
- return channelsMetadata.channels.map((channel, i2) => ({
261910
- name: `Channel ${channel.label}`,
261911
- defaultColor: void 0,
261912
- defaultWindow: void 0,
261913
- autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
261914
- }));
261915
- }
261916
- }
261917
262204
  return [];
261918
262205
  }
261919
262206
  getDtype() {
@@ -262002,15 +262289,42 @@ class ImageWrapper {
262002
262289
  const { shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
262003
262290
  return isInterleaved$1(shape2);
262004
262291
  }
262292
+ getPhotometricInterpretation() {
262293
+ const loader2 = this.vivLoader;
262294
+ if ("Pixels" in loader2.metadata) {
262295
+ const source2 = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
262296
+ if ("meta" in source2) {
262297
+ const { meta: meta2 } = source2;
262298
+ if (meta2 && "photometricInterpretation" in meta2) {
262299
+ const numericValue = meta2.photometricInterpretation;
262300
+ if (numericValue === 2) {
262301
+ return "RGB";
262302
+ }
262303
+ }
262304
+ }
262305
+ }
262306
+ if ("omero" in loader2.metadata) {
262307
+ const { omero: { rdefs: { model } } } = loader2.metadata;
262308
+ if (model === "color") {
262309
+ return "RGB";
262310
+ }
262311
+ }
262312
+ return "BlackIsZero";
262313
+ }
262005
262314
  }
262006
262315
  class OmeZarrLoader extends AbstractTwoStepLoader {
262316
+ constructor(dataSource, params2) {
262317
+ super(dataSource, params2);
262318
+ this.storeRoot = this.dataSource.storeRoot;
262319
+ }
262007
262320
  async load() {
262008
- const payload = await this.dataSource.getJson(".zattrs").catch((reason) => Promise.resolve(reason));
262321
+ var _a3;
262322
+ const payload = await this.dataSource.getJson(".zattrs", this.storeRoot).catch((reason) => Promise.resolve(reason));
262009
262323
  if (payload instanceof AbstractLoaderError) {
262010
262324
  return Promise.reject(payload);
262011
262325
  }
262012
262326
  const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
262013
- const loader2 = await loadOmeZarr(this.url, this.requestInit);
262327
+ const loader2 = await loadOmeZarr(this.storeRoot);
262014
262328
  const imageWrapper = new ImageWrapper(loader2, this.options);
262015
262329
  const { metadata: metadata2, data: data2 } = loader2;
262016
262330
  const { omero, multiscales, channels_metadata: spatialDataChannels, "image-label": imageLabel } = metadata2;
@@ -262093,8 +262407,31 @@ class OmeZarrLoader extends AbstractTwoStepLoader {
262093
262407
  }
262094
262408
  ];
262095
262409
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = await initializeRasterLayersAndChannels(imagesWithLoaderCreators, void 0);
262410
+ const channelObjects2 = imageWrapper.getChannelObjects();
262411
+ const channelCoordination = channelObjects2.slice(0, 5).map((channelObj, i2) => ({
262412
+ spatialTargetC: i2,
262413
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
262414
+ spatialChannelVisible: true,
262415
+ spatialChannelOpacity: 1,
262416
+ spatialChannelWindow: channelObj.defaultWindow || null
262417
+ }));
262096
262418
  const coordinationValues = {
262097
- spatialImageLayer: autoImageLayers
262419
+ // Old
262420
+ spatialImageLayer: autoImageLayers,
262421
+ // New
262422
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
262423
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
262424
+ imageLayer: CL([
262425
+ {
262426
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
262427
+ spatialLayerOpacity: 1,
262428
+ spatialLayerVisible: true,
262429
+ photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
262430
+ volumetricRenderingAlgorithm: "maximumIntensityProjection",
262431
+ spatialTargetResolution: null,
262432
+ imageChannel: CL(channelCoordination)
262433
+ }
262434
+ ])
262098
262435
  };
262099
262436
  return Promise.resolve(new LoaderResult({
262100
262437
  image: {
@@ -262104,21 +262441,57 @@ class OmeZarrLoader extends AbstractTwoStepLoader {
262104
262441
  // TODO: make this the root value of LoaderResult.image.
262105
262442
  },
262106
262443
  featureIndex: imageWrapper.getChannelNames()
262107
- }, [], coordinationValues));
262444
+ }, null, coordinationValues));
262445
+ }
262446
+ }
262447
+ class OmeZarrAsObsSegmentationsLoader extends OmeZarrLoader {
262448
+ async load() {
262449
+ var _a3;
262450
+ const { obsTypesFromChannelNames } = this.options || {};
262451
+ const result = await super.load();
262452
+ const imageWrapper = result.data.image.instance;
262453
+ const channelObjects = imageWrapper.getChannelObjects();
262454
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
262455
+ spatialTargetC: i2,
262456
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
262457
+ spatialChannelVisible: true,
262458
+ spatialChannelOpacity: 1,
262459
+ spatialChannelWindow: channelObj.defaultWindow || null,
262460
+ // featureType: 'feature',
262461
+ // featureValueType: 'value',
262462
+ obsColorEncoding: "spatialChannelColor",
262463
+ spatialSegmentationFilled: true,
262464
+ spatialSegmentationStrokeWidth: 1,
262465
+ obsHighlight: null,
262466
+ ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
262467
+ }));
262468
+ const coordinationValues = {
262469
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
262470
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
262471
+ segmentationLayer: CL([
262472
+ {
262473
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
262474
+ spatialLayerOpacity: 1,
262475
+ spatialLayerVisible: true,
262476
+ segmentationChannel: CL(channelCoordination)
262477
+ }
262478
+ ])
262479
+ };
262480
+ return Promise.resolve(new LoaderResult({
262481
+ obsSegmentationsType: "bitmask",
262482
+ obsSegmentations: result.data.image
262483
+ }, result.url, coordinationValues));
262108
262484
  }
262109
262485
  }
262110
262486
  class SpatialDataImageLoader extends OmeZarrLoader {
262111
262487
  constructor(dataSource, params2) {
262112
- const newParams = {
262113
- ...params2,
262114
- url: `${params2.url}/${params2.options.path}`
262115
- };
262116
- super(dataSource, newParams);
262117
- this.dataSource = dataSource;
262488
+ super(dataSource, params2);
262489
+ this.storeRoot = this.dataSource.getStoreRoot(params2.options.path);
262118
262490
  }
262119
262491
  }
262120
262492
  class SpatialDataLabelsLoader extends SpatialDataImageLoader {
262121
262493
  async load() {
262494
+ var _a3;
262122
262495
  const result = await super.load();
262123
262496
  if (result instanceof AbstractLoaderError) {
262124
262497
  return Promise.reject(result);
@@ -262127,12 +262500,44 @@ class SpatialDataLabelsLoader extends SpatialDataImageLoader {
262127
262500
  obsSegmentations: result.data.image,
262128
262501
  obsSegmentationsType: "bitmask"
262129
262502
  };
262503
+ const imageWrapper = result.data.obsSegmentations.instance;
262504
+ const channelObjects = imageWrapper.getChannelObjects();
262505
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
262506
+ spatialTargetC: i2,
262507
+ // obsType: channelObj.name,
262508
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
262509
+ spatialChannelVisible: true,
262510
+ spatialChannelOpacity: 1,
262511
+ spatialChannelWindow: channelObj.defaultWindow || null,
262512
+ // featureType: 'feature',
262513
+ // featureValueType: 'value',
262514
+ obsColorEncoding: "spatialChannelColor",
262515
+ spatialSegmentationFilled: true,
262516
+ spatialSegmentationStrokeWidth: 1,
262517
+ obsHighlight: null
262518
+ }));
262519
+ const coordinationValues = {
262520
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
262521
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
262522
+ segmentationLayer: CL([
262523
+ {
262524
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
262525
+ spatialLayerOpacity: 1,
262526
+ spatialLayerVisible: true,
262527
+ segmentationChannel: CL(channelCoordination)
262528
+ }
262529
+ ])
262530
+ };
262531
+ result.coordinationValues = coordinationValues;
262130
262532
  return Promise.resolve(result);
262131
262533
  }
262132
262534
  }
262133
262535
  function getCoordsPath(path2) {
262134
262536
  return `${path2}/coords`;
262135
262537
  }
262538
+ function getRadiusPath(path2) {
262539
+ return `${path2}/radius`;
262540
+ }
262136
262541
  class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
262137
262542
  /**
262138
262543
  * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
@@ -262150,6 +262555,18 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
262150
262555
  this.locations = Promise.resolve(null);
262151
262556
  return this.locations;
262152
262557
  }
262558
+ loadRadius() {
262559
+ const { path: path2 } = this.options;
262560
+ if (this.radius) {
262561
+ return this.radius;
262562
+ }
262563
+ if (!this.radius) {
262564
+ this.radius = this.dataSource.loadNumeric(getRadiusPath(path2));
262565
+ return this.radius;
262566
+ }
262567
+ this.radius = Promise.resolve(null);
262568
+ return this.radius;
262569
+ }
262153
262570
  async load() {
262154
262571
  const { path: path2, tablePath } = this.options;
262155
262572
  const superResult = await super.load().catch((reason) => Promise.resolve(reason));
@@ -262158,8 +262575,30 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
262158
262575
  }
262159
262576
  return Promise.all([
262160
262577
  this.dataSource.loadObsIndex(getCoordsPath(path2), tablePath),
262161
- this.loadSpots()
262162
- ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null)));
262578
+ this.loadSpots(),
262579
+ this.loadRadius()
262580
+ ]).then(([obsIndex, obsSpots, obsRadius]) => {
262581
+ var _a3;
262582
+ const spatialSpotRadius = (_a3 = obsRadius == null ? void 0 : obsRadius.data) == null ? void 0 : _a3[0];
262583
+ const coordinationValues = {
262584
+ spotLayer: CL({
262585
+ obsType: "spot",
262586
+ // obsColorEncoding: 'spatialLayerColor',
262587
+ // spatialLayerColor: [255, 255, 255],
262588
+ spatialLayerVisible: true,
262589
+ spatialLayerOpacity: 1,
262590
+ spatialSpotRadius
262591
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
262592
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
262593
+ // featureValueColormapRange: [0, 1],
262594
+ // obsHighlight: null,
262595
+ // obsSetColor: null,
262596
+ // obsSetSelection: null,
262597
+ // additionalObsSets: null,
262598
+ })
262599
+ };
262600
+ return Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null, coordinationValues));
262601
+ });
262163
262602
  }
262164
262603
  }
262165
262604
  class SpatialDataObsSetsLoader extends ObsSetsAnndataLoader {
@@ -262226,6 +262665,14 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
262226
262665
  const urls2 = [
262227
262666
  { url, name: image2.name }
262228
262667
  ];
262668
+ const channelObjects = imageWrapper.getChannelObjects();
262669
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
262670
+ spatialTargetC: i2,
262671
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
262672
+ spatialChannelVisible: true,
262673
+ spatialChannelOpacity: 1,
262674
+ spatialChannelWindow: channelObj.defaultWindow || null
262675
+ }));
262229
262676
  const imagesWithLoaderCreators = [
262230
262677
  {
262231
262678
  ...image2,
@@ -262237,9 +262684,25 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
262237
262684
  this.autoImageCache = initializeRasterLayersAndChannels(imagesWithLoaderCreators, renderLayers, usePhysicalSizeScaling);
262238
262685
  }
262239
262686
  return this.autoImageCache.then((autoImages) => {
262687
+ var _a3;
262240
262688
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
262241
262689
  const coordinationValues = {
262242
- spatialImageLayer: autoImageLayers
262690
+ // Old
262691
+ spatialImageLayer: autoImageLayers,
262692
+ // New
262693
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
262694
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
262695
+ imageLayer: CL([
262696
+ {
262697
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
262698
+ spatialLayerOpacity: 1,
262699
+ spatialLayerVisible: true,
262700
+ photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
262701
+ volumetricRenderingAlgorithm: "maximumIntensityProjection",
262702
+ spatialTargetResolution: null,
262703
+ imageChannel: CL(channelCoordination)
262704
+ }
262705
+ ])
262243
262706
  };
262244
262707
  return new LoaderResult({
262245
262708
  image: {
@@ -262256,7 +262719,7 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
262256
262719
  class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
262257
262720
  async load() {
262258
262721
  const { url, requestInit: requestInit2 } = this;
262259
- const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
262722
+ const { coordinateTransformations: coordinateTransformationsFromOptions, obsTypesFromChannelNames } = this.options || {};
262260
262723
  const offsets2 = await this.loadOffsets();
262261
262724
  const loader2 = await loadOmeTiff(url, { offsets: offsets2, headers: requestInit2 == null ? void 0 : requestInit2.headers });
262262
262725
  const imageWrapper = new ImageWrapper(loader2, this.options);
@@ -262278,6 +262741,21 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
262278
262741
  }
262279
262742
  };
262280
262743
  const urls2 = [{ url, name: image2.name }];
262744
+ const channelObjects = imageWrapper.getChannelObjects();
262745
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
262746
+ spatialTargetC: i2,
262747
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
262748
+ spatialChannelVisible: true,
262749
+ spatialChannelOpacity: 1,
262750
+ spatialChannelWindow: channelObj.defaultWindow || null,
262751
+ // featureType: 'feature',
262752
+ // featureValueType: 'value',
262753
+ obsColorEncoding: "spatialChannelColor",
262754
+ spatialSegmentationFilled: true,
262755
+ spatialSegmentationStrokeWidth: 1,
262756
+ obsHighlight: null,
262757
+ ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
262758
+ }));
262281
262759
  const imagesWithLoaderCreators = [
262282
262760
  {
262283
262761
  ...image2,
@@ -262292,9 +262770,22 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
262292
262770
  this.autoImageCache = initializeRasterLayersAndChannels(imagesWithLoaderCreators, renderLayers, usePhysicalSizeScaling);
262293
262771
  }
262294
262772
  return this.autoImageCache.then((autoImages) => {
262773
+ var _a3;
262295
262774
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
262296
262775
  const coordinationValues = {
262297
- spatialSegmentationLayer: autoImageLayers
262776
+ // Old
262777
+ spatialSegmentationLayer: autoImageLayers,
262778
+ // New
262779
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
262780
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
262781
+ segmentationLayer: CL([
262782
+ {
262783
+ fileUid: ((_a3 = this.coordinationValues) == null ? void 0 : _a3.fileUid) || null,
262784
+ spatialLayerOpacity: 1,
262785
+ spatialLayerVisible: true,
262786
+ segmentationChannel: CL(channelCoordination)
262787
+ }
262788
+ ])
262298
262789
  };
262299
262790
  return new LoaderResult({
262300
262791
  obsSegmentationsType: "bitmask",
@@ -262479,6 +262970,84 @@ function expandAnndataZarr(fileDef) {
262479
262970
  }] : []
262480
262971
  ];
262481
262972
  }
262973
+ function expandSpatialdataZarr(fileDef) {
262974
+ var _a3, _b2, _c2;
262975
+ const baseFileDef = {
262976
+ url: fileDef.url,
262977
+ requestInit: fileDef.requestInit,
262978
+ coordinationValues: {
262979
+ ...fileDef.coordinationValues,
262980
+ obsType: ((_a3 = fileDef.coordinationValues) == null ? void 0 : _a3.obsType) || "cell",
262981
+ featureType: ((_b2 = fileDef.coordinationValues) == null ? void 0 : _b2.featureType) || "gene",
262982
+ featureValueType: ((_c2 = fileDef.coordinationValues) == null ? void 0 : _c2.featureValueType) || "expression"
262983
+ }
262984
+ };
262985
+ const extraCoordinationValues = {};
262986
+ Object.entries(baseFileDef.coordinationValues).forEach(([key2, value2]) => {
262987
+ if (!expectedCoordinationTypes.includes(key2)) {
262988
+ extraCoordinationValues[key2] = value2;
262989
+ }
262990
+ });
262991
+ const { options = {} } = fileDef;
262992
+ return [
262993
+ // obsFeatureMatrix
262994
+ ...options.obsFeatureMatrix ? [{
262995
+ ...baseFileDef,
262996
+ fileType: FileType$1.OBS_FEATURE_MATRIX_SPATIALDATA_ZARR,
262997
+ options: options.obsFeatureMatrix,
262998
+ coordinationValues: {
262999
+ ...extraCoordinationValues,
263000
+ obsType: baseFileDef.coordinationValues.obsType,
263001
+ featureType: baseFileDef.coordinationValues.featureType,
263002
+ featureValueType: baseFileDef.coordinationValues.featureValueType
263003
+ }
263004
+ }] : [],
263005
+ // obsSets
263006
+ ...options.obsSets ? [{
263007
+ ...baseFileDef,
263008
+ fileType: FileType$1.OBS_SETS_SPATIALDATA_ZARR,
263009
+ options: options.obsSets,
263010
+ coordinationValues: {
263011
+ ...extraCoordinationValues,
263012
+ obsType: baseFileDef.coordinationValues.obsType
263013
+ }
263014
+ }] : [],
263015
+ // obsSpots
263016
+ ...options.obsSpots ? [{
263017
+ ...baseFileDef,
263018
+ fileType: FileType$1.OBS_SPOTS_SPATIALDATA_ZARR,
263019
+ options: options.obsSpots,
263020
+ coordinationValues: {
263021
+ ...extraCoordinationValues,
263022
+ obsType: baseFileDef.coordinationValues.obsType
263023
+ }
263024
+ }] : [],
263025
+ // TODO: obsPoints?
263026
+ // TODO: obsLocations?
263027
+ // image
263028
+ ...options.image ? [{
263029
+ ...baseFileDef,
263030
+ fileType: FileType$1.IMAGE_SPATIALDATA_ZARR,
263031
+ options: options.image,
263032
+ coordinationValues: {
263033
+ ...extraCoordinationValues,
263034
+ featureType: baseFileDef.coordinationValues.featureType
263035
+ // TODO: fileUid?
263036
+ }
263037
+ }] : [],
263038
+ // labels
263039
+ ...options.labels ? [{
263040
+ ...baseFileDef,
263041
+ fileType: FileType$1.LABELS_SPATIALDATA_ZARR,
263042
+ options: options.labels,
263043
+ coordinationValues: {
263044
+ ...extraCoordinationValues,
263045
+ obsType: baseFileDef.coordinationValues.obsType
263046
+ // TODO: fileUid?
263047
+ }
263048
+ }] : []
263049
+ ];
263050
+ }
262482
263051
  function expandMoleculesJson(fileDef) {
262483
263052
  var _a3;
262484
263053
  const baseFileDef = {
@@ -262811,7 +263380,8 @@ const baseFileTypes = [
262811
263380
  // All OME file types
262812
263381
  makeFileType(FileType$1.IMAGE_OME_ZARR, DataType$2.IMAGE, OmeZarrLoader, ZarrDataSource, imageOmeZarrSchema),
262813
263382
  makeFileType(FileType$1.IMAGE_OME_TIFF, DataType$2.IMAGE, OmeTiffLoader, OmeTiffSource, imageOmeTiffSchema),
262814
- makeFileType(FileType$1.OBS_SEGMENTATIONS_OME_TIFF, DataType$2.OBS_SEGMENTATIONS, OmeTiffAsObsSegmentationsLoader, OmeTiffSource, imageOmeZarrSchema),
263383
+ makeFileType(FileType$1.OBS_SEGMENTATIONS_OME_ZARR, DataType$2.OBS_SEGMENTATIONS, OmeZarrAsObsSegmentationsLoader, ZarrDataSource, obsSegmentationsOmeZarrSchema),
263384
+ makeFileType(FileType$1.OBS_SEGMENTATIONS_OME_TIFF, DataType$2.OBS_SEGMENTATIONS, OmeTiffAsObsSegmentationsLoader, OmeTiffSource, obsSegmentationsOmeTiffSchema),
262815
263385
  // SpatialData file types
262816
263386
  makeFileType(FileType$1.IMAGE_SPATIALDATA_ZARR, DataType$2.IMAGE, SpatialDataImageLoader, ZarrDataSource, imageSpatialdataSchema),
262817
263387
  // TODO: create a new loader for labels that returns obsSegmentations with obsSegmentationsType: 'bitmask'
@@ -262840,7 +263410,7 @@ const baseFileTypes = [
262840
263410
  ];
262841
263411
  const baseJointFileTypes = [
262842
263412
  new PluginJointFileType(FileType$1.ANNDATA_ZARR, expandAnndataZarr, anndataZarrSchema),
262843
- // new PluginJointFileType(FileType.SPATIALDATA_ZARR, expandSpatialdataZarr, spatialdataZarrSchema),
263413
+ new PluginJointFileType(FileType$1.SPATIALDATA_ZARR, expandSpatialdataZarr, spatialdataZarrSchema),
262844
263414
  // For legacy file types:
262845
263415
  new PluginJointFileType(FileType$1.ANNDATA_CELLS_ZARR, expandAnndataCellsZarr, anndataCellsZarrSchema),
262846
263416
  new PluginJointFileType(FileType$1.ANNDATA_CELL_SETS_ZARR, expandAnndataCellSetsZarr, anndataCellSetsZarrSchema),
@@ -263012,7 +263582,7 @@ const baseCoordinationTypes = [
263012
263582
  new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_VISIBLE, true, z.boolean()),
263013
263583
  new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_OPACITY, 1, z.number()),
263014
263584
  new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_WINDOW, null, z.array(z.number()).length(2).nullable()),
263015
- new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_COLOR, null, z.array(z.number()).length(3).nullable()),
263585
+ new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_COLOR, [255, 255, 255], z.array(z.number()).length(3).nullable()),
263016
263586
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SEGMENTATION_FILLED, true, z.boolean()),
263017
263587
  new PluginCoordinationType(CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH, 1, z.number()),
263018
263588
  // Reference: https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html