@vitessce/dev 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.
@@ -96,7 +96,9 @@ const FileType$2 = {
96
96
  OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
97
97
  OBS_SETS_CSV: "obsSets.csv",
98
98
  OBS_SETS_JSON: "obsSets.json",
99
+ // OME-Zarr
99
100
  IMAGE_OME_ZARR: "image.ome-zarr",
101
+ OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
100
102
  // AnnData
101
103
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
102
104
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
@@ -279,6 +281,7 @@ const STATUS$1 = {
279
281
  };
280
282
  const DATA_TYPE_COORDINATION_VALUE_USAGE = {
281
283
  [DataType$3.OBS_SEGMENTATIONS]: [
284
+ CoordinationType$2.FILE_UID,
282
285
  CoordinationType$2.OBS_TYPE
283
286
  ],
284
287
  [DataType$3.OBS_EMBEDDING]: [
@@ -310,7 +313,9 @@ const DATA_TYPE_COORDINATION_VALUE_USAGE = {
310
313
  CoordinationType$2.FEATURE_VALUE_TYPE
311
314
  ],
312
315
  [DataType$3.GENOMIC_PROFILES]: [],
313
- [DataType$3.IMAGE]: [],
316
+ [DataType$3.IMAGE]: [
317
+ CoordinationType$2.FILE_UID
318
+ ],
314
319
  [DataType$3.NEIGHBORHOODS]: []
315
320
  };
316
321
  const AUTO_INDEPENDENT_COORDINATION_TYPES = [
@@ -636,7 +641,9 @@ const COMPONENT_COORDINATION_TYPES = {
636
641
  CoordinationType$2.SPATIAL_SEGMENTATION_FILLED,
637
642
  CoordinationType$2.SPATIAL_SEGMENTATION_STROKE_WIDTH,
638
643
  CoordinationType$2.IMAGE_CHANNEL,
644
+ CoordinationType$2.IMAGE_LAYER,
639
645
  CoordinationType$2.SEGMENTATION_CHANNEL,
646
+ CoordinationType$2.SEGMENTATION_LAYER,
640
647
  CoordinationType$2.SPATIAL_CHANNEL_VISIBLE,
641
648
  CoordinationType$2.SPATIAL_CHANNEL_OPACITY,
642
649
  CoordinationType$2.SPATIAL_CHANNEL_WINDOW,
@@ -654,6 +661,9 @@ const COMPONENT_COORDINATION_TYPES = {
654
661
  CoordinationType$2.SPATIAL_SPOT_STROKE_WIDTH,
655
662
  CoordinationType$2.SPATIAL_LAYER_COLOR,
656
663
  CoordinationType$2.OBS_COLOR_ENCODING,
664
+ CoordinationType$2.FEATURE_VALUE_COLORMAP,
665
+ CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
666
+ CoordinationType$2.FEATURE_SELECTION,
657
667
  CoordinationType$2.TOOLTIPS_VISIBLE,
658
668
  CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
659
669
  CoordinationType$2.LEGEND_VISIBLE,
@@ -694,10 +704,10 @@ const COMPONENT_COORDINATION_TYPES = {
694
704
  ]
695
705
  };
696
706
  const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
697
- const version$6 = "3.3.2";
698
- const date$3 = "2023-11-30";
707
+ const version$6 = "3.3.3";
708
+ const date$3 = "2024-01-25";
699
709
  const branch = "changeset-release/main";
700
- const hash$1 = "a562d787";
710
+ const hash$1 = "c2264756";
701
711
  const META_VERSION = {
702
712
  note,
703
713
  version: version$6,
@@ -1319,6 +1329,24 @@ function getNextScope(prevScopes) {
1319
1329
  } while (prevScopes.includes(nextScope));
1320
1330
  return nextScope;
1321
1331
  }
1332
+ function createPrefixedGetNextScopeNumeric(prefix2) {
1333
+ return (prevScopes) => {
1334
+ let nextScopeInt = 0;
1335
+ let nextScopeStr;
1336
+ do {
1337
+ nextScopeStr = `${prefix2}${nextScopeInt}`;
1338
+ nextScopeInt += 1;
1339
+ } while (prevScopes.includes(nextScopeStr));
1340
+ return nextScopeStr;
1341
+ };
1342
+ }
1343
+ function getInitialCoordinationScopePrefix(datasetUid, dataType) {
1344
+ return `init_${datasetUid}_${dataType}_`;
1345
+ }
1346
+ function getInitialCoordinationScopeName(datasetUid, dataType, i2 = null) {
1347
+ const prefix2 = getInitialCoordinationScopePrefix(datasetUid, dataType);
1348
+ return `${prefix2}${i2 === null ? 0 : i2}`;
1349
+ }
1322
1350
  const DEFAULT_DARK_COLOR = [50, 50, 50];
1323
1351
  const DEFAULT_LIGHT_COLOR$3 = [200, 200, 200];
1324
1352
  function getDefaultColor(theme) {
@@ -1460,12 +1488,12 @@ var root$l = freeGlobal$6 || freeSelf$3 || Function("return this")();
1460
1488
  const root$m = root$l;
1461
1489
  var Symbol$c = root$m.Symbol;
1462
1490
  const Symbol$d = Symbol$c;
1463
- var objectProto$I = Object.prototype;
1464
- var hasOwnProperty$B = objectProto$I.hasOwnProperty;
1465
- var nativeObjectToString$5 = objectProto$I.toString;
1491
+ var objectProto$H = Object.prototype;
1492
+ var hasOwnProperty$A = objectProto$H.hasOwnProperty;
1493
+ var nativeObjectToString$5 = objectProto$H.toString;
1466
1494
  var symToStringTag$5 = Symbol$d ? Symbol$d.toStringTag : void 0;
1467
1495
  function getRawTag$4(value2) {
1468
- var isOwn = hasOwnProperty$B.call(value2, symToStringTag$5), tag2 = value2[symToStringTag$5];
1496
+ var isOwn = hasOwnProperty$A.call(value2, symToStringTag$5), tag2 = value2[symToStringTag$5];
1469
1497
  try {
1470
1498
  value2[symToStringTag$5] = void 0;
1471
1499
  var unmasked = true;
@@ -1481,8 +1509,8 @@ function getRawTag$4(value2) {
1481
1509
  }
1482
1510
  return result;
1483
1511
  }
1484
- var objectProto$H = Object.prototype;
1485
- var nativeObjectToString$4 = objectProto$H.toString;
1512
+ var objectProto$G = Object.prototype;
1513
+ var nativeObjectToString$4 = objectProto$G.toString;
1486
1514
  function objectToString$5(value2) {
1487
1515
  return nativeObjectToString$4.call(value2);
1488
1516
  }
@@ -1595,12 +1623,12 @@ var maskSrcKey$2 = function() {
1595
1623
  function isMasked$4(func) {
1596
1624
  return !!maskSrcKey$2 && maskSrcKey$2 in func;
1597
1625
  }
1598
- var funcProto$7 = Function.prototype;
1599
- var funcToString$7 = funcProto$7.toString;
1626
+ var funcProto$6 = Function.prototype;
1627
+ var funcToString$6 = funcProto$6.toString;
1600
1628
  function toSource$6(func) {
1601
1629
  if (func != null) {
1602
1630
  try {
1603
- return funcToString$7.call(func);
1631
+ return funcToString$6.call(func);
1604
1632
  } catch (e3) {
1605
1633
  }
1606
1634
  try {
@@ -1612,11 +1640,11 @@ function toSource$6(func) {
1612
1640
  }
1613
1641
  var reRegExpChar$2 = /[\\^$.*+?()[\]{}|]/g;
1614
1642
  var reIsHostCtor$2 = /^\[object .+?Constructor\]$/;
1615
- var funcProto$6 = Function.prototype, objectProto$G = Object.prototype;
1616
- var funcToString$6 = funcProto$6.toString;
1617
- var hasOwnProperty$A = objectProto$G.hasOwnProperty;
1643
+ var funcProto$5 = Function.prototype, objectProto$F = Object.prototype;
1644
+ var funcToString$5 = funcProto$5.toString;
1645
+ var hasOwnProperty$z = objectProto$F.hasOwnProperty;
1618
1646
  var reIsNative$2 = RegExp(
1619
- "^" + funcToString$6.call(hasOwnProperty$A).replace(reRegExpChar$2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1647
+ "^" + funcToString$5.call(hasOwnProperty$z).replace(reRegExpChar$2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1620
1648
  );
1621
1649
  function baseIsNative$4(value2) {
1622
1650
  if (!isObject$l(value2) || isMasked$4(value2)) {
@@ -1776,11 +1804,11 @@ function baseAssignValue$4(object2, key2, value2) {
1776
1804
  function eq$e(value2, other) {
1777
1805
  return value2 === other || value2 !== value2 && other !== other;
1778
1806
  }
1779
- var objectProto$F = Object.prototype;
1780
- var hasOwnProperty$z = objectProto$F.hasOwnProperty;
1807
+ var objectProto$E = Object.prototype;
1808
+ var hasOwnProperty$y = objectProto$E.hasOwnProperty;
1781
1809
  function assignValue$3(object2, key2, value2) {
1782
1810
  var objValue = object2[key2];
1783
- if (!(hasOwnProperty$z.call(object2, key2) && eq$e(objValue, value2)) || value2 === void 0 && !(key2 in object2)) {
1811
+ if (!(hasOwnProperty$y.call(object2, key2) && eq$e(objValue, value2)) || value2 === void 0 && !(key2 in object2)) {
1784
1812
  baseAssignValue$4(object2, key2, value2);
1785
1813
  }
1786
1814
  }
@@ -1839,27 +1867,9 @@ function isIterateeCall$2(value2, index2, object2) {
1839
1867
  }
1840
1868
  return false;
1841
1869
  }
1842
- function createAssigner$2(assigner) {
1843
- return baseRest$2(function(object2, sources) {
1844
- var index2 = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
1845
- customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
1846
- if (guard && isIterateeCall$2(sources[0], sources[1], guard)) {
1847
- customizer = length2 < 3 ? void 0 : customizer;
1848
- length2 = 1;
1849
- }
1850
- object2 = Object(object2);
1851
- while (++index2 < length2) {
1852
- var source2 = sources[index2];
1853
- if (source2) {
1854
- assigner(object2, source2, index2, customizer);
1855
- }
1856
- }
1857
- return object2;
1858
- });
1859
- }
1860
- var objectProto$E = Object.prototype;
1870
+ var objectProto$D = Object.prototype;
1861
1871
  function isPrototype$6(value2) {
1862
- var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$E;
1872
+ var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$D;
1863
1873
  return value2 === proto;
1864
1874
  }
1865
1875
  function baseTimes$4(n3, iteratee) {
@@ -1873,13 +1883,13 @@ var argsTag$a = "[object Arguments]";
1873
1883
  function baseIsArguments$4(value2) {
1874
1884
  return isObjectLike$h(value2) && baseGetTag$d(value2) == argsTag$a;
1875
1885
  }
1876
- var objectProto$D = Object.prototype;
1877
- var hasOwnProperty$y = objectProto$D.hasOwnProperty;
1878
- var propertyIsEnumerable$5 = objectProto$D.propertyIsEnumerable;
1886
+ var objectProto$C = Object.prototype;
1887
+ var hasOwnProperty$x = objectProto$C.hasOwnProperty;
1888
+ var propertyIsEnumerable$5 = objectProto$C.propertyIsEnumerable;
1879
1889
  var isArguments$7 = baseIsArguments$4(function() {
1880
1890
  return arguments;
1881
1891
  }()) ? baseIsArguments$4 : function(value2) {
1882
- return isObjectLike$h(value2) && hasOwnProperty$y.call(value2, "callee") && !propertyIsEnumerable$5.call(value2, "callee");
1892
+ return isObjectLike$h(value2) && hasOwnProperty$x.call(value2, "callee") && !propertyIsEnumerable$5.call(value2, "callee");
1883
1893
  };
1884
1894
  const isArguments$8 = isArguments$7;
1885
1895
  function stubFalse$2() {
@@ -1892,11 +1902,11 @@ var Buffer$3 = moduleExports$2 ? root$m.Buffer : void 0;
1892
1902
  var nativeIsBuffer = Buffer$3 ? Buffer$3.isBuffer : void 0;
1893
1903
  var isBuffer$9 = nativeIsBuffer || stubFalse$2;
1894
1904
  const isBuffer$a = isBuffer$9;
1895
- var argsTag$9 = "[object Arguments]", arrayTag$7 = "[object Array]", boolTag$9 = "[object Boolean]", dateTag$9 = "[object Date]", errorTag$7 = "[object Error]", funcTag$6 = "[object Function]", mapTag$e = "[object Map]", numberTag$9 = "[object Number]", objectTag$c = "[object Object]", regexpTag$9 = "[object RegExp]", setTag$e = "[object Set]", stringTag$a = "[object String]", weakMapTag$7 = "[object WeakMap]";
1905
+ var argsTag$9 = "[object Arguments]", arrayTag$7 = "[object Array]", boolTag$9 = "[object Boolean]", dateTag$9 = "[object Date]", errorTag$7 = "[object Error]", funcTag$6 = "[object Function]", mapTag$e = "[object Map]", numberTag$9 = "[object Number]", objectTag$b = "[object Object]", regexpTag$9 = "[object RegExp]", setTag$e = "[object Set]", stringTag$a = "[object String]", weakMapTag$7 = "[object WeakMap]";
1896
1906
  var arrayBufferTag$9 = "[object ArrayBuffer]", dataViewTag$c = "[object DataView]", float32Tag$6 = "[object Float32Array]", float64Tag$6 = "[object Float64Array]", int8Tag$6 = "[object Int8Array]", int16Tag$6 = "[object Int16Array]", int32Tag$6 = "[object Int32Array]", uint8Tag$6 = "[object Uint8Array]", uint8ClampedTag$6 = "[object Uint8ClampedArray]", uint16Tag$6 = "[object Uint16Array]", uint32Tag$6 = "[object Uint32Array]";
1897
1907
  var typedArrayTags$2 = {};
1898
1908
  typedArrayTags$2[float32Tag$6] = typedArrayTags$2[float64Tag$6] = typedArrayTags$2[int8Tag$6] = typedArrayTags$2[int16Tag$6] = typedArrayTags$2[int32Tag$6] = typedArrayTags$2[uint8Tag$6] = typedArrayTags$2[uint8ClampedTag$6] = typedArrayTags$2[uint16Tag$6] = typedArrayTags$2[uint32Tag$6] = true;
1899
- typedArrayTags$2[argsTag$9] = typedArrayTags$2[arrayTag$7] = typedArrayTags$2[arrayBufferTag$9] = typedArrayTags$2[boolTag$9] = typedArrayTags$2[dataViewTag$c] = typedArrayTags$2[dateTag$9] = typedArrayTags$2[errorTag$7] = typedArrayTags$2[funcTag$6] = typedArrayTags$2[mapTag$e] = typedArrayTags$2[numberTag$9] = typedArrayTags$2[objectTag$c] = typedArrayTags$2[regexpTag$9] = typedArrayTags$2[setTag$e] = typedArrayTags$2[stringTag$a] = typedArrayTags$2[weakMapTag$7] = false;
1909
+ typedArrayTags$2[argsTag$9] = typedArrayTags$2[arrayTag$7] = typedArrayTags$2[arrayBufferTag$9] = typedArrayTags$2[boolTag$9] = typedArrayTags$2[dataViewTag$c] = typedArrayTags$2[dateTag$9] = typedArrayTags$2[errorTag$7] = typedArrayTags$2[funcTag$6] = typedArrayTags$2[mapTag$e] = typedArrayTags$2[numberTag$9] = typedArrayTags$2[objectTag$b] = typedArrayTags$2[regexpTag$9] = typedArrayTags$2[setTag$e] = typedArrayTags$2[stringTag$a] = typedArrayTags$2[weakMapTag$7] = false;
1900
1910
  function baseIsTypedArray$4(value2) {
1901
1911
  return isObjectLike$h(value2) && isLength$7(value2.length) && !!typedArrayTags$2[baseGetTag$d(value2)];
1902
1912
  }
@@ -1923,12 +1933,12 @@ const nodeUtil$5 = nodeUtil$4;
1923
1933
  var nodeIsTypedArray$2 = nodeUtil$5 && nodeUtil$5.isTypedArray;
1924
1934
  var isTypedArray$7 = nodeIsTypedArray$2 ? baseUnary$6(nodeIsTypedArray$2) : baseIsTypedArray$4;
1925
1935
  const isTypedArray$8 = isTypedArray$7;
1926
- var objectProto$C = Object.prototype;
1927
- var hasOwnProperty$x = objectProto$C.hasOwnProperty;
1936
+ var objectProto$B = Object.prototype;
1937
+ var hasOwnProperty$w = objectProto$B.hasOwnProperty;
1928
1938
  function arrayLikeKeys$5(value2, inherited) {
1929
1939
  var isArr = isArray$l(value2), isArg = !isArr && isArguments$8(value2), isBuff = !isArr && !isArg && isBuffer$a(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$8(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes$4(value2.length, String) : [], length2 = result.length;
1930
1940
  for (var key2 in value2) {
1931
- if ((inherited || hasOwnProperty$x.call(value2, key2)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1941
+ if ((inherited || hasOwnProperty$w.call(value2, key2)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1932
1942
  (key2 == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1933
1943
  isBuff && (key2 == "offset" || key2 == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1934
1944
  isType && (key2 == "buffer" || key2 == "byteLength" || key2 == "byteOffset") || // Skip index properties.
@@ -1945,15 +1955,15 @@ function overArg$5(func, transform4) {
1945
1955
  }
1946
1956
  var nativeKeys$4 = overArg$5(Object.keys, Object);
1947
1957
  const nativeKeys$5 = nativeKeys$4;
1948
- var objectProto$B = Object.prototype;
1949
- var hasOwnProperty$w = objectProto$B.hasOwnProperty;
1958
+ var objectProto$A = Object.prototype;
1959
+ var hasOwnProperty$v = objectProto$A.hasOwnProperty;
1950
1960
  function baseKeys$4(object2) {
1951
1961
  if (!isPrototype$6(object2)) {
1952
1962
  return nativeKeys$5(object2);
1953
1963
  }
1954
1964
  var result = [];
1955
1965
  for (var key2 in Object(object2)) {
1956
- if (hasOwnProperty$w.call(object2, key2) && key2 != "constructor") {
1966
+ if (hasOwnProperty$v.call(object2, key2) && key2 != "constructor") {
1957
1967
  result.push(key2);
1958
1968
  }
1959
1969
  }
@@ -1971,15 +1981,15 @@ function nativeKeysIn$2(object2) {
1971
1981
  }
1972
1982
  return result;
1973
1983
  }
1974
- var objectProto$A = Object.prototype;
1975
- var hasOwnProperty$v = objectProto$A.hasOwnProperty;
1984
+ var objectProto$z = Object.prototype;
1985
+ var hasOwnProperty$u = objectProto$z.hasOwnProperty;
1976
1986
  function baseKeysIn$2(object2) {
1977
1987
  if (!isObject$l(object2)) {
1978
1988
  return nativeKeysIn$2(object2);
1979
1989
  }
1980
1990
  var isProto = isPrototype$6(object2), result = [];
1981
1991
  for (var key2 in object2) {
1982
- if (!(key2 == "constructor" && (isProto || !hasOwnProperty$v.call(object2, key2)))) {
1992
+ if (!(key2 == "constructor" && (isProto || !hasOwnProperty$u.call(object2, key2)))) {
1983
1993
  result.push(key2);
1984
1994
  }
1985
1995
  }
@@ -2011,21 +2021,21 @@ function hashDelete$4(key2) {
2011
2021
  return result;
2012
2022
  }
2013
2023
  var HASH_UNDEFINED$8 = "__lodash_hash_undefined__";
2014
- var objectProto$z = Object.prototype;
2015
- var hasOwnProperty$u = objectProto$z.hasOwnProperty;
2024
+ var objectProto$y = Object.prototype;
2025
+ var hasOwnProperty$t = objectProto$y.hasOwnProperty;
2016
2026
  function hashGet$4(key2) {
2017
2027
  var data2 = this.__data__;
2018
2028
  if (nativeCreate$b) {
2019
2029
  var result = data2[key2];
2020
2030
  return result === HASH_UNDEFINED$8 ? void 0 : result;
2021
2031
  }
2022
- return hasOwnProperty$u.call(data2, key2) ? data2[key2] : void 0;
2032
+ return hasOwnProperty$t.call(data2, key2) ? data2[key2] : void 0;
2023
2033
  }
2024
- var objectProto$y = Object.prototype;
2025
- var hasOwnProperty$t = objectProto$y.hasOwnProperty;
2034
+ var objectProto$x = Object.prototype;
2035
+ var hasOwnProperty$s = objectProto$x.hasOwnProperty;
2026
2036
  function hashHas$4(key2) {
2027
2037
  var data2 = this.__data__;
2028
- return nativeCreate$b ? data2[key2] !== void 0 : hasOwnProperty$t.call(data2, key2);
2038
+ return nativeCreate$b ? data2[key2] !== void 0 : hasOwnProperty$s.call(data2, key2);
2029
2039
  }
2030
2040
  var HASH_UNDEFINED$7 = "__lodash_hash_undefined__";
2031
2041
  function hashSet$4(key2, value2) {
@@ -2263,22 +2273,6 @@ function flatRest(func) {
2263
2273
  }
2264
2274
  var getPrototype$4 = overArg$5(Object.getPrototypeOf, Object);
2265
2275
  const getPrototype$5 = getPrototype$4;
2266
- var objectTag$b = "[object Object]";
2267
- var funcProto$5 = Function.prototype, objectProto$x = Object.prototype;
2268
- var funcToString$5 = funcProto$5.toString;
2269
- var hasOwnProperty$s = objectProto$x.hasOwnProperty;
2270
- var objectCtorString$1 = funcToString$5.call(Object);
2271
- function isPlainObject$5(value2) {
2272
- if (!isObjectLike$h(value2) || baseGetTag$d(value2) != objectTag$b) {
2273
- return false;
2274
- }
2275
- var proto = getPrototype$5(value2);
2276
- if (proto === null) {
2277
- return true;
2278
- }
2279
- var Ctor = hasOwnProperty$s.call(proto, "constructor") && proto.constructor;
2280
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$5.call(Ctor) == objectCtorString$1;
2281
- }
2282
2276
  function baseClamp(number2, lower2, upper) {
2283
2277
  if (number2 === number2) {
2284
2278
  if (upper !== void 0) {
@@ -3069,86 +3063,9 @@ function debounce$5(func, wait2, options) {
3069
3063
  debounced.flush = flush2;
3070
3064
  return debounced;
3071
3065
  }
3072
- function assignMergeValue$3(object2, key2, value2) {
3073
- if (value2 !== void 0 && !eq$e(object2[key2], value2) || value2 === void 0 && !(key2 in object2)) {
3074
- baseAssignValue$4(object2, key2, value2);
3075
- }
3076
- }
3077
3066
  function isArrayLikeObject$2(value2) {
3078
3067
  return isObjectLike$h(value2) && isArrayLike$9(value2);
3079
3068
  }
3080
- function safeGet$3(object2, key2) {
3081
- if (key2 === "constructor" && typeof object2[key2] === "function") {
3082
- return;
3083
- }
3084
- if (key2 == "__proto__") {
3085
- return;
3086
- }
3087
- return object2[key2];
3088
- }
3089
- function toPlainObject$2(value2) {
3090
- return copyObject$6(value2, keysIn$6(value2));
3091
- }
3092
- function baseMergeDeep$2(object2, source2, key2, srcIndex, mergeFunc, customizer, stack2) {
3093
- var objValue = safeGet$3(object2, key2), srcValue = safeGet$3(source2, key2), stacked = stack2.get(srcValue);
3094
- if (stacked) {
3095
- assignMergeValue$3(object2, key2, stacked);
3096
- return;
3097
- }
3098
- var newValue = customizer ? customizer(objValue, srcValue, key2 + "", object2, source2, stack2) : void 0;
3099
- var isCommon = newValue === void 0;
3100
- if (isCommon) {
3101
- var isArr = isArray$l(srcValue), isBuff = !isArr && isBuffer$a(srcValue), isTyped = !isArr && !isBuff && isTypedArray$8(srcValue);
3102
- newValue = srcValue;
3103
- if (isArr || isBuff || isTyped) {
3104
- if (isArray$l(objValue)) {
3105
- newValue = objValue;
3106
- } else if (isArrayLikeObject$2(objValue)) {
3107
- newValue = copyArray$3(objValue);
3108
- } else if (isBuff) {
3109
- isCommon = false;
3110
- newValue = cloneBuffer$2(srcValue, true);
3111
- } else if (isTyped) {
3112
- isCommon = false;
3113
- newValue = cloneTypedArray$3(srcValue, true);
3114
- } else {
3115
- newValue = [];
3116
- }
3117
- } else if (isPlainObject$5(srcValue) || isArguments$8(srcValue)) {
3118
- newValue = objValue;
3119
- if (isArguments$8(objValue)) {
3120
- newValue = toPlainObject$2(objValue);
3121
- } else if (!isObject$l(objValue) || isFunction$b(objValue)) {
3122
- newValue = initCloneObject$3(srcValue);
3123
- }
3124
- } else {
3125
- isCommon = false;
3126
- }
3127
- }
3128
- if (isCommon) {
3129
- stack2.set(srcValue, newValue);
3130
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack2);
3131
- stack2["delete"](srcValue);
3132
- }
3133
- assignMergeValue$3(object2, key2, newValue);
3134
- }
3135
- function baseMerge$2(object2, source2, srcIndex, customizer, stack2) {
3136
- if (object2 === source2) {
3137
- return;
3138
- }
3139
- baseFor$4(source2, function(srcValue, key2) {
3140
- stack2 || (stack2 = new Stack$8());
3141
- if (isObject$l(srcValue)) {
3142
- baseMergeDeep$2(object2, source2, key2, srcIndex, baseMerge$2, customizer, stack2);
3143
- } else {
3144
- var newValue = customizer ? customizer(safeGet$3(object2, key2), srcValue, key2 + "", object2, source2, stack2) : void 0;
3145
- if (newValue === void 0) {
3146
- newValue = srcValue;
3147
- }
3148
- assignMergeValue$3(object2, key2, newValue);
3149
- }
3150
- }, keysIn$6);
3151
- }
3152
3069
  function arrayIncludesWith(array2, value2, comparator2) {
3153
3070
  var index2 = -1, length2 = array2 == null ? 0 : array2.length;
3154
3071
  while (++index2 < length2) {
@@ -3240,10 +3157,6 @@ function baseSum(array2, iteratee) {
3240
3157
  }
3241
3158
  return result;
3242
3159
  }
3243
- var merge$7 = createAssigner$2(function(object2, source2, srcIndex) {
3244
- baseMerge$2(object2, source2, srcIndex);
3245
- });
3246
- const merge$8 = merge$7;
3247
3160
  function baseSet(object2, path2, value2, customizer) {
3248
3161
  if (!isObject$l(object2)) {
3249
3162
  return object2;
@@ -11791,13 +11704,22 @@ const imageOmeTiffSchema = z.object({
11791
11704
  offsetsUrl: z.string().optional(),
11792
11705
  coordinateTransformations: omeCoordinateTransformations.optional()
11793
11706
  });
11707
+ const obsSegmentationsOmeTiffSchema = imageOmeTiffSchema.extend({
11708
+ obsTypesFromChannelNames: z.boolean().optional()
11709
+ });
11794
11710
  const imageOmeZarrSchema = z.object({
11795
11711
  coordinateTransformations: omeCoordinateTransformations.optional()
11796
11712
  });
11713
+ const obsSegmentationsOmeZarrSchema = imageOmeZarrSchema.extend({
11714
+ obsTypesFromChannelNames: z.boolean().optional()
11715
+ });
11797
11716
  const imageSpatialdataSchema = imageOmeZarrSchema.extend({
11798
11717
  path: z.string()
11799
11718
  });
11800
11719
  const obsSegmentationsSpatialdataSchema = z.object({
11720
+ // TODO: should this also extend the imageOmeZarrSchema?
11721
+ // TODO: should this be renamed labelsSpatialdataSchema?
11722
+ // TODO: support obsTypesFromChannelNames?
11801
11723
  path: z.string()
11802
11724
  });
11803
11725
  z.object({
@@ -11882,6 +11804,19 @@ const anndataZarrSchema = z.object({
11882
11804
  z.array(annDataConvenienceObsEmbeddingItem)
11883
11805
  ])
11884
11806
  }).partial();
11807
+ const spatialdataZarrSchema = z.object({
11808
+ // TODO: should `image` be a special schema
11809
+ // to allow specifying fileUid (like for embeddingType)?
11810
+ image: imageSpatialdataSchema,
11811
+ // TODO: should this be a special schema
11812
+ // to allow specifying fileUid (like for embeddingType)?
11813
+ labels: obsSegmentationsSpatialdataSchema,
11814
+ obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
11815
+ obsSpots: obsSpotsSpatialdataSchema,
11816
+ // TODO: obsPoints
11817
+ // TODO: obsLocations
11818
+ obsSets: obsSetsSpatialdataSchema
11819
+ }).partial();
11885
11820
  const cellsJsonSchema = z.object({
11886
11821
  obsLabelsTypes: z.array(z.string()).optional(),
11887
11822
  embeddingTypes: z.array(z.string()).optional()
@@ -19719,11 +19654,12 @@ class VitessceConfigCoordinationScope {
19719
19654
  * Construct a new coordination scope instance.
19720
19655
  * @param {string} cType The coordination type for this coordination scope.
19721
19656
  * @param {string} cScope The name of the coordination scope.
19657
+ * @param {[any]} cValue Optional. The coordination value of the coordination scope.
19722
19658
  */
19723
- constructor(cType, cScope) {
19659
+ constructor(cType, cScope, cValue = null) {
19724
19660
  this.cType = cType;
19725
19661
  this.cScope = cScope;
19726
- this.cValue = null;
19662
+ this.cValue = cValue;
19727
19663
  }
19728
19664
  /**
19729
19665
  * Set the coordination value of the coordination scope.
@@ -19820,6 +19756,7 @@ class VitessceConfig {
19820
19756
  layout: [],
19821
19757
  initStrategy: "auto"
19822
19758
  };
19759
+ this.getNextScope = getNextScope;
19823
19760
  }
19824
19761
  /**
19825
19762
  * Add a new dataset to the config.
@@ -19833,7 +19770,7 @@ class VitessceConfig {
19833
19770
  addDataset(name2 = void 0, description2 = void 0, options = void 0) {
19834
19771
  const { uid: uid2 } = options || {};
19835
19772
  const prevDatasetUids = this.config.datasets.map((d) => d.dataset.uid);
19836
- const nextUid = uid2 || getNextScope(prevDatasetUids);
19773
+ const nextUid = uid2 || this.getNextScope(prevDatasetUids);
19837
19774
  const newDataset = new VitessceConfigDataset(nextUid, name2, description2);
19838
19775
  this.config.datasets.push(newDataset);
19839
19776
  const [newScope] = this.addCoordination(CoordinationType$2.DATASET);
@@ -19886,7 +19823,7 @@ class VitessceConfig {
19886
19823
  const result = [];
19887
19824
  cTypes.forEach((cType) => {
19888
19825
  const prevScopes = this.config.coordinationSpace[cType] ? Object.keys(this.config.coordinationSpace[cType]) : [];
19889
- const scope = new VitessceConfigCoordinationScope(cType, getNextScope(prevScopes));
19826
+ const scope = new VitessceConfigCoordinationScope(cType, this.getNextScope(prevScopes));
19890
19827
  if (!this.config.coordinationSpace[scope.cType]) {
19891
19828
  this.config.coordinationSpace[scope.cType] = {};
19892
19829
  }
@@ -19903,7 +19840,7 @@ class VitessceConfig {
19903
19840
  addMetaCoordination() {
19904
19841
  const prevMetaScopes = this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES] ? Object.keys(this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES]) : [];
19905
19842
  const prevMetaByScopes = this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES_BY] ? Object.keys(this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES_BY]) : [];
19906
- const metaContainer = new VitessceConfigMetaCoordinationScope(getNextScope(prevMetaScopes), getNextScope(prevMetaByScopes));
19843
+ const metaContainer = new VitessceConfigMetaCoordinationScope(this.getNextScope(prevMetaScopes), this.getNextScope(prevMetaByScopes));
19907
19844
  if (!this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES]) {
19908
19845
  this.config.coordinationSpace[CoordinationType$2.META_COORDINATION_SCOPES] = {};
19909
19846
  }
@@ -19930,6 +19867,9 @@ class VitessceConfig {
19930
19867
  addCoordinationByObject(input) {
19931
19868
  const processLevel = (level) => {
19932
19869
  const result = {};
19870
+ if (level === null) {
19871
+ return result;
19872
+ }
19933
19873
  Object.entries(level).forEach(([cType, nextLevelOrInitialValue]) => {
19934
19874
  if (nextLevelOrInitialValue instanceof CoordinationLevel) {
19935
19875
  const nextLevel = nextLevelOrInitialValue.value;
@@ -20004,10 +19944,18 @@ class VitessceConfig {
20004
19944
  * instance, or a `CoordinationLevel` instance.
20005
19945
  * The CL function takes an array of objects as its argument, and returns a CoordinationLevel
20006
19946
  * instance, to support nesting.
20007
- * @param {boolean} meta Should meta-coordination be used? Optional. By default, true.
19947
+ * @param {object|null} options
19948
+ * @param {bool} options.meta Should meta-coordination be used? Optional.
19949
+ * By default, true.
19950
+ * @param {string|null} options.scopePrefix A prefix to add to all
19951
+ * coordination scope names. Optional.
20008
19952
  * @returns {VitessceConfig} This, to allow chaining.
20009
19953
  */
20010
- linkViewsByObject(views, input, meta2 = true) {
19954
+ linkViewsByObject(views, input, options = null) {
19955
+ const { meta: meta2 = true, scopePrefix = null } = options || {};
19956
+ if (scopePrefix) {
19957
+ this.getNextScope = createPrefixedGetNextScopeNumeric(scopePrefix);
19958
+ }
20011
19959
  const scopes = this.addCoordinationByObject(input);
20012
19960
  if (meta2) {
20013
19961
  const metaScope = this.addMetaCoordination();
@@ -20020,8 +19968,28 @@ class VitessceConfig {
20020
19968
  view.useCoordinationByObject(scopes);
20021
19969
  });
20022
19970
  }
19971
+ if (scopePrefix) {
19972
+ this.getNextScope = getNextScope;
19973
+ }
20023
19974
  return this;
20024
19975
  }
19976
+ /**
19977
+ * Set the value for a coordination scope.
19978
+ * If a coordination object for the coordination type does not yet exist
19979
+ * in the coordination space, it will be created.
19980
+ * @param {string} cType The coordination type.
19981
+ * @param {string} cScope The coordination scope.
19982
+ * @param {any} cValue The initial value for the coordination scope.
19983
+ * @returns {VitessceConfigCoordinationScope} A coordination scope instance.
19984
+ */
19985
+ setCoordinationValue(cType, cScope, cValue) {
19986
+ const scope = new VitessceConfigCoordinationScope(cType, cScope, cValue);
19987
+ if (!this.config.coordinationSpace[scope.cType]) {
19988
+ this.config.coordinationSpace[scope.cType] = {};
19989
+ }
19990
+ this.config.coordinationSpace[scope.cType][scope.cScope] = scope;
19991
+ return scope;
19992
+ }
20025
19993
  /**
20026
19994
  * Set the layout of views.
20027
19995
  * @param {VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat} viewConcat A
@@ -20108,6 +20076,22 @@ class VitessceConfig {
20108
20076
  return vc;
20109
20077
  }
20110
20078
  }
20079
+ function getCoordinationSpaceAndScopes(partialCoordinationValues, scopePrefix) {
20080
+ const vc = new VitessceConfig({ schemaVersion: "1.0.16", name: "__dummy__" });
20081
+ vc.getNextScope = createPrefixedGetNextScopeNumeric(scopePrefix);
20082
+ const dataset = vc.addDataset("__dummy__");
20083
+ const v12 = vc.addView(dataset, "__dummy__");
20084
+ vc.linkViewsByObject([v12], partialCoordinationValues, { meta: true });
20085
+ const vcJson = vc.toJSON();
20086
+ const { coordinationSpace } = vcJson;
20087
+ const { coordinationScopes } = vcJson.layout[0];
20088
+ const { coordinationScopesBy } = vcJson.layout[0];
20089
+ return {
20090
+ coordinationSpace,
20091
+ coordinationScopes,
20092
+ coordinationScopesBy
20093
+ };
20094
+ }
20111
20095
  const SINGLE_CELL_WITH_HEATMAP_VIEWS = {
20112
20096
  obsSets: { x: 4, y: 0, w: 4, h: 4 },
20113
20097
  obsSetSizes: { x: 8, y: 0, w: 4, h: 4 },
@@ -44815,7 +44799,7 @@ function getMetaScope(coordinationScopes, coordinationSpace, parameter) {
44815
44799
  if (metaScopes && metaSpace) {
44816
44800
  const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
44817
44801
  metaScopesArr.forEach((metaScope) => {
44818
- if (metaSpace[metaScope][parameter]) {
44802
+ if (metaSpace[metaScope]?.[parameter]) {
44819
44803
  latestMetaScope = metaScope;
44820
44804
  }
44821
44805
  });
@@ -45019,7 +45003,15 @@ function getScopes(coordinationScopes, metaSpace) {
45019
45003
  if (metaScopes && metaSpace) {
45020
45004
  const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
45021
45005
  metaScopesArr.forEach((metaScope) => {
45022
- result = merge$8(result, metaSpace[metaScope]);
45006
+ let o1 = result;
45007
+ const o2 = metaSpace[metaScope] || {};
45008
+ Object.entries(o2).forEach(([cType, cScope]) => {
45009
+ o1 = {
45010
+ ...o1,
45011
+ [cType]: cScope
45012
+ };
45013
+ });
45014
+ result = o1;
45023
45015
  });
45024
45016
  }
45025
45017
  }
@@ -45032,7 +45024,25 @@ function getScopesBy(coordinationScopes, coordinationScopesBy, metaSpaceBy) {
45032
45024
  if (metaSpaceBy && metaScopesBy) {
45033
45025
  const metaScopesArr = Array.isArray(metaScopesBy) ? metaScopesBy : [metaScopesBy];
45034
45026
  metaScopesArr.forEach((metaScope) => {
45035
- result = merge$8(result, metaSpaceBy[metaScope]);
45027
+ let o1 = result;
45028
+ const o2 = metaSpaceBy[metaScope] || {};
45029
+ Object.entries(o2).forEach(([primaryType, primaryObj]) => {
45030
+ Object.entries(primaryObj).forEach(([secondaryType, secondaryObj]) => {
45031
+ Object.entries(secondaryObj).forEach(([primaryScope, secondaryScopeVal]) => {
45032
+ o1 = {
45033
+ ...o1,
45034
+ [primaryType]: {
45035
+ ...o1?.[primaryType] || {},
45036
+ [secondaryType]: {
45037
+ ...o1?.[primaryType]?.[secondaryType] || {},
45038
+ [primaryScope]: secondaryScopeVal
45039
+ }
45040
+ }
45041
+ };
45042
+ });
45043
+ });
45044
+ });
45045
+ result = o1;
45036
45046
  });
45037
45047
  }
45038
45048
  }
@@ -45087,6 +45097,78 @@ const createViewConfigStore = (initialLoaders, initialConfig) => create$b((set3)
45087
45097
  }
45088
45098
  };
45089
45099
  }),
45100
+ mergeCoordination: (newCoordinationValues, scopePrefix, viewUid) => set3((state) => {
45101
+ const { coordinationSpace, layout: layout2 } = state.viewConfig;
45102
+ const { coordinationSpace: newCoordinationSpace, coordinationScopes } = getCoordinationSpaceAndScopes(newCoordinationValues, scopePrefix);
45103
+ Object.entries(newCoordinationSpace).forEach(([coordinationType, coordinationObj]) => {
45104
+ if (coordinationType === CoordinationType$2.META_COORDINATION_SCOPES) {
45105
+ Object.entries(coordinationObj).forEach(([coordinationScope, coordinationValue]) => {
45106
+ coordinationSpace[coordinationType] = {
45107
+ ...coordinationSpace[coordinationType],
45108
+ [coordinationScope]: {
45109
+ ...coordinationValue,
45110
+ ...coordinationSpace[coordinationType]?.[coordinationScope] || {}
45111
+ }
45112
+ };
45113
+ });
45114
+ } else if (coordinationType === CoordinationType$2.META_COORDINATION_SCOPES_BY) {
45115
+ Object.entries(coordinationObj).forEach(([coordinationScope, coordinationValue]) => {
45116
+ Object.entries(coordinationValue).forEach(([primaryType, primaryObj]) => {
45117
+ Object.entries(primaryObj).forEach(([secondaryType, secondaryObj]) => {
45118
+ coordinationSpace[coordinationType] = {
45119
+ ...coordinationSpace[coordinationType],
45120
+ [coordinationScope]: {
45121
+ ...coordinationSpace[coordinationType]?.[coordinationScope] || {},
45122
+ [primaryType]: {
45123
+ ...coordinationSpace[coordinationType]?.[coordinationScope]?.[primaryType] || {},
45124
+ [secondaryType]: {
45125
+ ...secondaryObj,
45126
+ ...coordinationSpace[coordinationType]?.[coordinationScope]?.[primaryType]?.[secondaryType] || {}
45127
+ }
45128
+ }
45129
+ }
45130
+ };
45131
+ });
45132
+ });
45133
+ });
45134
+ } else {
45135
+ coordinationSpace[coordinationType] = {
45136
+ ...coordinationObj,
45137
+ // Existing coordination values should be preserved,
45138
+ // so that user-defined values take precedence over auto-initialization values.
45139
+ ...coordinationSpace[coordinationType] || {}
45140
+ };
45141
+ }
45142
+ });
45143
+ const newViewConfig = {
45144
+ ...state.viewConfig,
45145
+ coordinationSpace: {
45146
+ ...coordinationSpace
45147
+ },
45148
+ layout: layout2.map((viewObj) => {
45149
+ if (viewObj.uid === viewUid) {
45150
+ return {
45151
+ ...viewObj,
45152
+ coordinationScopes: {
45153
+ ...viewObj.coordinationScopes,
45154
+ [CoordinationType$2.META_COORDINATION_SCOPES]: [
45155
+ ...coordinationScopes[CoordinationType$2.META_COORDINATION_SCOPES] || [],
45156
+ ...viewObj.coordinationScopes[CoordinationType$2.META_COORDINATION_SCOPES] || []
45157
+ ],
45158
+ [CoordinationType$2.META_COORDINATION_SCOPES_BY]: [
45159
+ ...coordinationScopes[CoordinationType$2.META_COORDINATION_SCOPES_BY] || [],
45160
+ ...viewObj.coordinationScopes[CoordinationType$2.META_COORDINATION_SCOPES_BY] || []
45161
+ ]
45162
+ }
45163
+ };
45164
+ }
45165
+ return viewObj;
45166
+ })
45167
+ };
45168
+ return {
45169
+ viewConfig: newViewConfig
45170
+ };
45171
+ }),
45090
45172
  removeImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope, channelScope) => set3((state) => {
45091
45173
  const { coordinationSpace } = state.viewConfig;
45092
45174
  return {
@@ -45509,6 +45591,9 @@ function useChangeLayout() {
45509
45591
  function useSetLoaders() {
45510
45592
  return useViewConfigStore((state) => state.setLoaders);
45511
45593
  }
45594
+ function useMergeCoordination() {
45595
+ return useViewConfigStore((state) => state.mergeCoordination);
45596
+ }
45512
45597
  function useSetViewConfig(viewConfigStoreApi) {
45513
45598
  const setViewConfigRef = useRef(viewConfigStoreApi.getState().setViewConfig);
45514
45599
  const setViewConfig = setViewConfigRef.current;
@@ -51591,7 +51676,7 @@ function useRowHeight(config3, initialRowHeight, height2, margin2, padding2) {
51591
51676
  return [rowHeight, containerRef];
51592
51677
  }
51593
51678
  function withDefaults(coordinationValues, dataType, fileType, datasetUid, defaultCoordinationValues) {
51594
- const defaultKeys = DATA_TYPE_COORDINATION_VALUE_USAGE[dataType].filter((k) => Object.keys(defaultCoordinationValues).includes(k) && defaultCoordinationValues[k] && !Object.keys(coordinationValues).includes(k));
51679
+ const defaultKeys = DATA_TYPE_COORDINATION_VALUE_USAGE[dataType].filter((k) => Object.keys(defaultCoordinationValues).includes(k) && !Object.keys(coordinationValues).includes(k));
51595
51680
  const defaultValues = pick$4(defaultCoordinationValues, defaultKeys);
51596
51681
  const coordinationValuesWithDefaults = {
51597
51682
  ...defaultValues,
@@ -51870,6 +51955,24 @@ function tickStep$1(start, stop3, count2) {
51870
51955
  step1 *= 2;
51871
51956
  return stop3 < start ? -step1 : step1;
51872
51957
  }
51958
+ function max$5(values3, valueof) {
51959
+ let max2;
51960
+ if (valueof === void 0) {
51961
+ for (const value2 of values3) {
51962
+ if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
51963
+ max2 = value2;
51964
+ }
51965
+ }
51966
+ } else {
51967
+ let index2 = -1;
51968
+ for (let value2 of values3) {
51969
+ if ((value2 = valueof(value2, ++index2, values3)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
51970
+ max2 = value2;
51971
+ }
51972
+ }
51973
+ }
51974
+ return max2;
51975
+ }
51873
51976
  function quantileSorted$1(values3, p, valueof = number$a) {
51874
51977
  if (!(n3 = values3.length))
51875
51978
  return;
@@ -52421,7 +52524,7 @@ function getAltText(config3) {
52421
52524
  const padding$2 = 10;
52422
52525
  const margin = 5;
52423
52526
  function VitessceGrid(props2) {
52424
- const { success, configKey, rowHeight: initialRowHeight, config: config3, theme, height: height2, isBounded, viewTypes, fileTypes, coordinationTypes } = props2;
52527
+ const { success, configKey, rowHeight: initialRowHeight, config: config3, theme, height: height2, isBounded, viewTypes, fileTypes, coordinationTypes, stores } = props2;
52425
52528
  const [rowHeight, containerRef] = useRowHeight(config3, initialRowHeight, height2, margin, padding$2);
52426
52529
  const onResize = useEmitGridResize();
52427
52530
  const [componentWidth] = useClosestVitessceContainerSize(containerRef);
@@ -52446,7 +52549,7 @@ function VitessceGrid(props2) {
52446
52549
  let newLoaders = null;
52447
52550
  let newConfig = null;
52448
52551
  if (success) {
52449
- newLoaders = createLoaders(config3.datasets, config3.description, fileTypes, coordinationTypes);
52552
+ newLoaders = createLoaders(config3.datasets, config3.description, fileTypes, coordinationTypes, stores);
52450
52553
  newConfig = config3;
52451
52554
  }
52452
52555
  setViewConfig(newConfig);
@@ -52784,7 +52887,7 @@ function VitS(props2) {
52784
52887
  }
52785
52888
  return createViewConfigStore(null, null);
52786
52889
  }, [success, configKey]);
52787
- return success ? jsxRuntimeExports.jsx(StylesProvider, { generateClassName: generateClassName2, children: jsxRuntimeExports.jsx(ThemeProvider, { theme: muiTheme[theme], children: jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: jsxRuntimeExports.jsx(ViewConfigProvider, { createStore: createViewConfigStoreClosure, children: jsxRuntimeExports.jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [jsxRuntimeExports.jsx(VitessceGrid, { success, configKey, viewTypes, fileTypes, coordinationTypes, config: configOrWarning, rowHeight, height: height2, theme, isBounded }), jsxRuntimeExports.jsx(CallbackPublisher, { onWarn, onConfigChange, onLoaderChange, validateOnConfigChange, pluginSpecificConfigSchema })] }) }, configKey) }) }) }) : jsxRuntimeExports.jsx(StylesProvider, { generateClassName: generateClassName2, children: jsxRuntimeExports.jsx(ThemeProvider, { theme: muiTheme[theme], children: jsxRuntimeExports.jsx(Warning, { ...configOrWarning }) }) });
52890
+ return success ? jsxRuntimeExports.jsx(StylesProvider, { generateClassName: generateClassName2, children: jsxRuntimeExports.jsx(ThemeProvider, { theme: muiTheme[theme], children: jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: jsxRuntimeExports.jsx(ViewConfigProvider, { createStore: createViewConfigStoreClosure, children: jsxRuntimeExports.jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [jsxRuntimeExports.jsx(VitessceGrid, { success, configKey, viewTypes, fileTypes, coordinationTypes, config: configOrWarning, rowHeight, height: height2, theme, isBounded, stores }), jsxRuntimeExports.jsx(CallbackPublisher, { onWarn, onConfigChange, onLoaderChange, validateOnConfigChange, pluginSpecificConfigSchema })] }) }, configKey) }) }) }) : jsxRuntimeExports.jsx(StylesProvider, { generateClassName: generateClassName2, children: jsxRuntimeExports.jsx(ThemeProvider, { theme: muiTheme[theme], children: jsxRuntimeExports.jsx(Warning, { ...configOrWarning }) }) });
52788
52891
  }
52789
52892
  const AddIcon = createSvgIcon(/* @__PURE__ */ React$6.createElement("path", {
52790
52893
  d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
@@ -53037,7 +53140,7 @@ async function dataQueryFn(ctx2) {
53037
53140
  if (!payload)
53038
53141
  return placeholderObject;
53039
53142
  const { data: data2, url, coordinationValues } = payload;
53040
- const urls2 = Array.isArray(url) ? url : [{ url, name: dataType }];
53143
+ const urls2 = (Array.isArray(url) ? url : [{ url, name: dataType }]).filter((d) => d.url);
53041
53144
  return { data: data2, coordinationValues, urls: urls2 };
53042
53145
  }
53043
53146
  if (isRequired) {
@@ -53079,7 +53182,7 @@ function useDataType(dataType, loaders, dataset, isRequired, coordinationSetters
53079
53182
  const dataStatus = isFetching ? STATUS$1.LOADING : status;
53080
53183
  return [loadedData, dataStatus, urls2];
53081
53184
  }
53082
- function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOnObj) {
53185
+ function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOnObj, mergeCoordination, viewUid) {
53083
53186
  const placeholderObject = useMemo(() => ({}), []);
53084
53187
  const setWarning = useSetWarning();
53085
53188
  const matchOnEntries = matchOnObj ? Object.entries(matchOnObj) : [];
@@ -53105,8 +53208,18 @@ function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSe
53105
53208
  const dataStatus = anyLoading ? STATUS$1.LOADING : anyError ? STATUS$1.ERROR : STATUS$1.SUCCESS;
53106
53209
  const isSuccess = dataStatus === STATUS$1.SUCCESS;
53107
53210
  useEffect(() => {
53108
- dataQueries.map((q) => q.data?.coordinationValues).filter((v) => Boolean(v)).forEach((coordinationValues) => {
53109
- initCoordinationSpace(coordinationValues, coordinationSetters, initialCoordinationValues);
53211
+ dataQueries.filter((q) => Boolean(q.data?.coordinationValues)).forEach((q) => {
53212
+ const { coordinationValues } = q.data;
53213
+ if (mergeCoordination) {
53214
+ mergeCoordination(
53215
+ coordinationValues,
53216
+ // Auto-generate based on the dataset and data type.
53217
+ getInitialCoordinationScopePrefix(dataset, dataType),
53218
+ viewUid
53219
+ );
53220
+ } else {
53221
+ initCoordinationSpace(coordinationValues, coordinationSetters, initialCoordinationValues);
53222
+ }
53110
53223
  });
53111
53224
  }, [isSuccess]);
53112
53225
  useEffect(() => {
@@ -53251,7 +53364,7 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
53251
53364
  obsIndex: payloadData2.rows,
53252
53365
  featureIndex: payloadData2.cols
53253
53366
  },
53254
- urls: [{ url: url2, name: DataType$3.OBS_FEATURE_MATRIX }]
53367
+ urls: url2 ? [{ url: url2, name: DataType$3.OBS_FEATURE_MATRIX }] : null
53255
53368
  };
53256
53369
  }
53257
53370
  const payload = await loader2.load();
@@ -53285,7 +53398,7 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
53285
53398
  }, [error2, setWarning]);
53286
53399
  return [loadedData, dataStatus, urls2];
53287
53400
  }
53288
- function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset) {
53401
+ function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
53289
53402
  const obsTypeCoordination = useComplexCoordination([
53290
53403
  CoordinationType$2.OBS_TYPE
53291
53404
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
@@ -53296,10 +53409,10 @@ function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, da
53296
53409
  // indirect dependencies here.
53297
53410
  [coordinationScopes, coordinationScopesBy]
53298
53411
  );
53299
- const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useDataTypeMulti(DataType$3.OBS_POINTS, loaders, dataset, false, {}, {}, matchOnObj);
53412
+ const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useDataTypeMulti(DataType$3.OBS_POINTS, loaders, dataset, false, {}, {}, matchOnObj, mergeCoordination, viewUid);
53300
53413
  return [obsPointsData, obsPointsDataStatus, obsPointsUrls];
53301
53414
  }
53302
- function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset) {
53415
+ function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
53303
53416
  const obsTypeCoordination = useComplexCoordination([
53304
53417
  CoordinationType$2.OBS_TYPE
53305
53418
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.SPOT_LAYER);
@@ -53310,7 +53423,7 @@ function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dat
53310
53423
  // indirect dependencies here.
53311
53424
  [coordinationScopes, coordinationScopesBy]
53312
53425
  );
53313
- const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useDataTypeMulti(DataType$3.OBS_SPOTS, loaders, dataset, false, {}, {}, matchOnObj);
53426
+ const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useDataTypeMulti(DataType$3.OBS_SPOTS, loaders, dataset, false, {}, {}, matchOnObj, mergeCoordination, viewUid);
53314
53427
  return [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls];
53315
53428
  }
53316
53429
  function useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset) {
@@ -53336,7 +53449,7 @@ function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
53336
53449
  const [obsLabelsData, obsLabelsDataStatus, obsLabelsUrls] = useDataTypeMulti(DataType$3.OBS_LABELS, loaders, dataset, false, {}, {}, obsLabelsMatchOnObj);
53337
53450
  return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus, obsLabelsUrls];
53338
53451
  }
53339
- function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
53452
+ function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
53340
53453
  const imageCoordination = useComplexCoordination([
53341
53454
  CoordinationType$2.FILE_UID
53342
53455
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.SEGMENTATION_LAYER);
@@ -53347,10 +53460,10 @@ function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, load
53347
53460
  // indirect dependencies here.
53348
53461
  [coordinationScopes, coordinationScopesBy]
53349
53462
  );
53350
- const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useDataTypeMulti(DataType$3.OBS_SEGMENTATIONS, loaders, dataset, false, {}, {}, matchOnObj);
53463
+ const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useDataTypeMulti(DataType$3.OBS_SEGMENTATIONS, loaders, dataset, false, {}, {}, matchOnObj, mergeCoordination, viewUid);
53351
53464
  return [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls];
53352
53465
  }
53353
- function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset) {
53466
+ function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
53354
53467
  const imageCoordination = useComplexCoordination([
53355
53468
  CoordinationType$2.FILE_UID
53356
53469
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.IMAGE_LAYER);
@@ -53361,7 +53474,7 @@ function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, datas
53361
53474
  // indirect dependencies here.
53362
53475
  [coordinationScopes, coordinationScopesBy]
53363
53476
  );
53364
- const [imageData, imageDataStatus, imageUrls] = useDataTypeMulti(DataType$3.IMAGE, loaders, dataset, false, {}, {}, matchOnObj);
53477
+ const [imageData, imageDataStatus, imageUrls] = useDataTypeMulti(DataType$3.IMAGE, loaders, dataset, false, {}, {}, matchOnObj, mergeCoordination, viewUid);
53365
53478
  return [imageData, imageDataStatus, imageUrls];
53366
53479
  }
53367
53480
  function getFeatureSelectionQueryKeyScopeTuplesAux(allSelections, allMatchOnObj, depth, dataset, dataType, isRequired, prevLevelScopes, currSelection, currMatchOn) {
@@ -53532,7 +53645,7 @@ function useFeatureSelectionMultiLevel(loaders, dataset, isRequired, matchOnObj,
53532
53645
  const nestedExtents = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatExtents);
53533
53646
  const nestedNormData = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatNormData);
53534
53647
  return [nestedGeneData, nestedLoadedGeneName, nestedExtents, nestedNormData];
53535
- }, [featureQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0)]);
53648
+ }, [featureQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0), queryKeyScopeTuples]);
53536
53649
  return [geneData, loadedGeneName, extents, normData, dataStatus];
53537
53650
  }
53538
53651
  async function matrixIndicesQueryFn(ctx2) {
@@ -53594,7 +53707,7 @@ function useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, isRequired, matc
53594
53707
  const indicesData = useMemo(() => {
53595
53708
  const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
53596
53709
  return nestedIndicesData;
53597
- }, [indicesQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0)]);
53710
+ }, [indicesQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0), queryKeyScopeTuples]);
53598
53711
  return [indicesData, dataStatus];
53599
53712
  }
53600
53713
  function useDataTypeMultiLevel(loaders, dataset, isRequired, matchOnObj, depth, dataType) {
@@ -53621,7 +53734,7 @@ function useDataTypeMultiLevel(loaders, dataset, isRequired, matchOnObj, depth,
53621
53734
  const locationsData = useMemo(() => {
53622
53735
  const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
53623
53736
  return nestedIndicesData;
53624
- }, [locationsQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0)]);
53737
+ }, [locationsQueries.reduce((a2, h2) => a2 + h2.dataUpdatedAt, 0), queryKeyScopeTuples]);
53625
53738
  return [locationsData, dataStatus];
53626
53739
  }
53627
53740
  function useObsLocationsMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
@@ -53649,6 +53762,7 @@ function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationSc
53649
53762
  // indirect dependencies here.
53650
53763
  [coordinationScopes, coordinationScopesBy]
53651
53764
  );
53765
+ const useMemoDependency = Object.values(featureSelectionCoordination[0] || {}).flatMap((layerVal) => Object.values(layerVal).map((cVal) => cVal.featureSelection));
53652
53766
  const selections = useMemo(
53653
53767
  () => fromEntries(Object.entries(featureSelectionCoordination[0]).map(([layerScope, layerVal]) => [
53654
53768
  layerScope,
@@ -53658,7 +53772,9 @@ function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationSc
53658
53772
  [
53659
53773
  coordinationScopes,
53660
53774
  coordinationScopesBy,
53661
- ...Object.values(featureSelectionCoordination[0] || {}).flatMap((layerVal) => Object.values(layerVal).map((cVal) => cVal.featureSelection))
53775
+ // We need to ensure there are always the same number of
53776
+ // entries in the full dependency array.
53777
+ JSON.stringify(useMemoDependency.length > 0 ? useMemoDependency : [null])
53662
53778
  ]
53663
53779
  );
53664
53780
  const [featureData, loadedSelections, extents, normData, featureStatus] = useFeatureSelectionMultiLevel(loaders, dataset, false, matchOnObj, selections, 2);
@@ -170204,16 +170320,16 @@ async function getDecoder(fileDirectory) {
170204
170320
  const Decoder = await importFn();
170205
170321
  return new Decoder(fileDirectory);
170206
170322
  }
170207
- addDecoder([void 0, 1], () => import("./raw-09ac1cd1.js").then((m2) => m2.default));
170208
- addDecoder(5, () => import("./lzw-5c1d5530.js").then((m2) => m2.default));
170323
+ addDecoder([void 0, 1], () => import("./raw-f79f69c9.js").then((m2) => m2.default));
170324
+ addDecoder(5, () => import("./lzw-385da6fb.js").then((m2) => m2.default));
170209
170325
  addDecoder(6, () => {
170210
170326
  throw new Error("old style JPEG compression is not supported.");
170211
170327
  });
170212
- addDecoder(7, () => import("./jpeg-84db51fc.js").then((m2) => m2.default));
170213
- addDecoder([8, 32946], () => import("./deflate-3ddb759b.js").then((m2) => m2.default));
170214
- addDecoder(32773, () => import("./packbits-fcadb85f.js").then((m2) => m2.default));
170215
- addDecoder(34887, () => import("./lerc-01f78fda.js").then((m2) => m2.default));
170216
- addDecoder(50001, () => import("./webimage-4a08568e.js").then((m2) => m2.default));
170328
+ addDecoder(7, () => import("./jpeg-c8d27cff.js").then((m2) => m2.default));
170329
+ addDecoder([8, 32946], () => import("./deflate-d4e561ec.js").then((m2) => m2.default));
170330
+ addDecoder(32773, () => import("./packbits-48af1346.js").then((m2) => m2.default));
170331
+ addDecoder(34887, () => import("./lerc-a7e69cfb.js").then((m2) => m2.default));
170332
+ addDecoder(50001, () => import("./webimage-f08d90a2.js").then((m2) => m2.default));
170217
170333
  function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
170218
170334
  return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
170219
170335
  }
@@ -184492,15 +184608,15 @@ function normalize$4(arr) {
184492
184608
  const data2 = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
184493
184609
  return data2;
184494
184610
  }
184495
- function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
184611
+ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, texSize) {
184496
184612
  let totalValuesLength = 0;
184497
184613
  let totalColorsLength = 0;
184498
184614
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
184499
184615
  if (isSetColorMode) {
184500
- totalValuesLength += setColorValues[channelIndex]?.obsIndex?.length || 0;
184501
184616
  totalColorsLength += (setColorValues[channelIndex]?.setColors?.length || 0) * 3;
184617
+ totalValuesLength += setColorValues[channelIndex]?.obsIndex ? max$5(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
184502
184618
  } else {
184503
- totalValuesLength += multiFeatureValues[channelIndex]?.length || 0;
184619
+ totalValuesLength += multiMatrixObsIndex[channelIndex] ? max$5(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : multiFeatureValues[channelIndex]?.length || 0;
184504
184620
  }
184505
184621
  });
184506
184622
  const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
@@ -184518,12 +184634,20 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
184518
184634
  let indexOffset = 0;
184519
184635
  let colorOffset = 0;
184520
184636
  channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
184637
+ const matrixObsIndex = multiMatrixObsIndex[channelIndex];
184638
+ const bitmaskValueIsIndex = matrixObsIndex === null;
184521
184639
  if (isSetColorMode) {
184522
184640
  const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
184523
184641
  if (setColorIndices && setColors && obsIndex) {
184524
184642
  for (let i2 = 0; i2 < obsIndex.length; i2++) {
184525
- const colorIndex = setColorIndices.get(String(i2 + 1));
184526
- totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
184643
+ let obsId = String(i2 + 1);
184644
+ let obsI = i2;
184645
+ if (!bitmaskValueIsIndex) {
184646
+ obsId = obsIndex[i2];
184647
+ obsI = parseInt(obsId) - 1;
184648
+ }
184649
+ const colorIndex = setColorIndices.get(obsId);
184650
+ totalData[indexOffset + obsI] = colorIndex === void 0 ? 0 : colorIndex + 1;
184527
184651
  }
184528
184652
  for (let i2 = 0; i2 < setColors.length; i2++) {
184529
184653
  const { color: [r3, g2, b2] } = setColors[i2];
@@ -184538,7 +184662,16 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
184538
184662
  colorOffset += setColors?.length || 0;
184539
184663
  } else {
184540
184664
  const featureArr = multiFeatureValues[channelIndex];
184541
- totalData.set(normalize$4(featureArr), indexOffset);
184665
+ const normalizedFeatureArr = normalize$4(featureArr);
184666
+ if (!bitmaskValueIsIndex && matrixObsIndex) {
184667
+ for (let i2 = 0; i2 < matrixObsIndex.length; i2++) {
184668
+ const obsId = matrixObsIndex[i2];
184669
+ const obsI = parseInt(obsId) - 1;
184670
+ totalData[indexOffset + obsI] = normalizedFeatureArr[i2];
184671
+ }
184672
+ } else {
184673
+ totalData.set(normalizedFeatureArr, indexOffset);
184674
+ }
184542
184675
  indicesOffsets.push(indexOffset);
184543
184676
  indexOffset += featureArr.length;
184544
184677
  colorsOffsets.push(colorOffset);
@@ -184565,6 +184698,17 @@ function padWithDefault(arr, defaultValue2, padWidth) {
184565
184698
  function getColor(arr) {
184566
184699
  return arr ? arr.map((v) => v / 255) : [0, 0, 0];
184567
184700
  }
184701
+ function isEqualShallow(prevArr, nextArr) {
184702
+ if (prevArr === nextArr) {
184703
+ return true;
184704
+ }
184705
+ if (Array.isArray(prevArr) && Array.isArray(nextArr)) {
184706
+ if (prevArr.length === nextArr.length) {
184707
+ return !prevArr.some((v, i2) => v !== nextArr[i2] && (!Array.isArray(v) && !Array.isArray(nextArr[i2]) || (v.length > 0 || nextArr[i2].length > 0)));
184708
+ }
184709
+ }
184710
+ return prevArr === nextArr;
184711
+ }
184568
184712
  const defaultProps = {
184569
184713
  channelStrokeWidths: { type: "array", value: null, compare: true },
184570
184714
  channelsFilled: { type: "array", value: null, compare: true },
@@ -184574,6 +184718,7 @@ const defaultProps = {
184574
184718
  colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
184575
184719
  expressionData: { type: "object", value: null, compare: true },
184576
184720
  multiFeatureValues: { type: "array", value: null, compare: true },
184721
+ multiMatrixObsIndex: { type: "array", value: null, compare: true },
184577
184722
  setColorValues: { type: "array", value: null, compare: true },
184578
184723
  channelFeatureValueColormaps: { type: "array", value: null, compare: true },
184579
184724
  channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
@@ -184620,9 +184765,9 @@ class BitmaskLayer2 extends XRLayer {
184620
184765
  }
184621
184766
  updateState({ props: props2, oldProps, changeFlags }) {
184622
184767
  super.updateState({ props: props2, oldProps, changeFlags });
184623
- if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
184624
- const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
184625
- const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
184768
+ if (!isEqualShallow(props2.multiFeatureValues, oldProps.multiFeatureValues) || !isEqualShallow(props2.multiMatrixObsIndex, oldProps.multiMatrixObsIndex) || !isEqualShallow(props2.setColorValues, oldProps.setColorValues) || !isEqualShallow(props2.channelIsSetColorMode, oldProps.channelIsSetColorMode)) {
184769
+ const { multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode } = this.props;
184770
+ const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode);
184626
184771
  this.setState({
184627
184772
  valueTex,
184628
184773
  colorTex,
@@ -184774,9 +184919,9 @@ class BitmaskLayer2 extends XRLayer {
184774
184919
  type: GL$1.FLOAT
184775
184920
  });
184776
184921
  }
184777
- multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
184922
+ multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode) {
184778
184923
  const isWebGL2On = isWebGL2$1(this.context.gl);
184779
- const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
184924
+ const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
184780
184925
  return [
184781
184926
  // Color indices texture
184782
184927
  new Texture2D(this.context.gl, {
@@ -205254,8 +205399,7 @@ class ZarritaPixelSource extends ZarrPixelSource {
205254
205399
  this._readChunks = false;
205255
205400
  }
205256
205401
  }
205257
- async function loadOmeZarr(url, requestInit2) {
205258
- const root2 = await zarrOpenRoot(url, requestInit2);
205402
+ async function loadOmeZarr(root2) {
205259
205403
  const { data: data2, rootAttrs, labels: labels2 } = await loadMultiscales(root2);
205260
205404
  const tileSize = guessTileSize(data2[0]);
205261
205405
  const pyramid = data2.map((arr) => new ZarritaPixelSource(createZarrArrayAdapter(arr), labels2, tileSize));
@@ -206596,6 +206740,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
206596
206740
  this.prevSpotSetColor = {};
206597
206741
  this.prevSpotSetSelection = {};
206598
206742
  this.segmentationToMatrixIndexMap = {};
206743
+ this.segmentationToMatrixIndexArr = {};
206599
206744
  this.segmentationColors = {};
206600
206745
  this.segmentationExpressionGetters = {};
206601
206746
  this.prevSegmentationSetColor = {};
@@ -206853,7 +206998,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
206853
206998
  return spatialRenderingMode === "3D";
206854
206999
  }
206855
207000
  // New createImageLayer function.
206856
- createBitmaskSegmentationLayer(layerScope, layerCoordination, channelScopes, channelCoordination, image2, layerFeatureValues) {
207001
+ createBitmaskSegmentationLayer(layerScope, layerCoordination, channelScopes, channelCoordination, image2, layerFeatureValues, layerMatrixObsIndices, bitmaskValueIsIndex) {
206857
207002
  const { delegateHover, targetT, targetZ } = this.props;
206858
207003
  const data2 = image2?.obsSegmentations?.instance?.getData();
206859
207004
  if (!data2) {
@@ -206894,6 +207039,11 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
206894
207039
  modelMatrix: layerDefModelMatrix,
206895
207040
  // hoveredCell: Number(this.props.cellHighlight),
206896
207041
  multiFeatureValues: channelScopes.map((cScope) => layerFeatureValues?.[cScope]?.[0] || []),
207042
+ // Pass in the matrixObsIndex to account for the fact that
207043
+ // the obsIndex of the obsFeatureMatrix
207044
+ // may not be ["1", "2", "3", "4", ... "N"] and
207045
+ // instead may be ["3", "20", "4", "6"].
207046
+ multiMatrixObsIndex: channelScopes.map((cScope) => bitmaskValueIsIndex ? null : layerMatrixObsIndices?.[cScope] || null),
206897
207047
  setColorValues: channelScopes.map((cScope) => this.segmentationColors?.[layerScope]?.[cScope] || []),
206898
207048
  renderSubLayers: renderSubBitmaskLayers,
206899
207049
  loader: data2,
@@ -207036,12 +207186,22 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
207036
207186
  });
207037
207187
  }
207038
207188
  createSegmentationLayers() {
207039
- const { obsSegmentations = {}, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, segmentationLayerCallbacks = [], segmentationMultiExpressionData } = this.props;
207189
+ const { obsSegmentations = {}, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, segmentationLayerCallbacks = [], segmentationMultiExpressionData, bitmaskValueIsIndex } = this.props;
207040
207190
  return segmentationLayerScopes.map((layerScope) => {
207041
207191
  if (obsSegmentations[layerScope]) {
207042
207192
  const { obsSegmentationsType } = obsSegmentations[layerScope];
207043
207193
  if (obsSegmentationsType === "bitmask") {
207044
- return this.createBitmaskSegmentationLayer(layerScope, segmentationLayerCoordination[0][layerScope], segmentationChannelScopesByLayer[layerScope], segmentationChannelCoordination[0][layerScope], obsSegmentations[layerScope], segmentationMultiExpressionData?.[layerScope]);
207194
+ return this.createBitmaskSegmentationLayer(
207195
+ layerScope,
207196
+ segmentationLayerCoordination[0][layerScope],
207197
+ segmentationChannelScopesByLayer[layerScope],
207198
+ segmentationChannelCoordination[0][layerScope],
207199
+ obsSegmentations[layerScope],
207200
+ segmentationMultiExpressionData?.[layerScope],
207201
+ this.segmentationToMatrixIndexArr?.[layerScope],
207202
+ // TODO: get this from the layer coordination.
207203
+ bitmaskValueIsIndex
207204
+ );
207045
207205
  }
207046
207206
  if (obsSegmentationsType === "polygon") {
207047
207207
  return this.createPolygonSegmentationLayer(layerScope, segmentationLayerCoordination[0][layerScope], segmentationChannelScopesByLayer[layerScope], segmentationChannelCoordination[0][layerScope], obsSegmentations[layerScope], segmentationMultiExpressionData?.[layerScope]);
@@ -207209,6 +207369,12 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
207209
207369
  }
207210
207370
  this.segmentationToMatrixIndexMap[layerScope][channelScope] = instanceObsIndex.map((key2) => matrixIndexMap.get(key2));
207211
207371
  }
207372
+ if (matrixObsIndex) {
207373
+ if (!this.segmentationToMatrixIndexArr[layerScope]) {
207374
+ this.segmentationToMatrixIndexArr[layerScope] = {};
207375
+ }
207376
+ this.segmentationToMatrixIndexArr[layerScope][channelScope] = matrixObsIndex;
207377
+ }
207212
207378
  }
207213
207379
  onUpdateAllSegmentationsIndexData() {
207214
207380
  const { segmentationLayerScopes, segmentationChannelScopesByLayer } = this.props;
@@ -207224,7 +207390,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
207224
207390
  const expressionData = segmentationMultiExpressionData?.[layerScope]?.[channelScope];
207225
207391
  const toMatrixIndexMap = this.segmentationToMatrixIndexMap?.[layerScope]?.[channelScope];
207226
207392
  const getExpressionValue = (entry2, { index: instanceIndex }) => {
207227
- if (toMatrixIndexMap && expressionData && expressionData[0]) {
207393
+ if (expressionData && expressionData[0]) {
207228
207394
  const rowIndex = toMatrixIndexMap[instanceIndex];
207229
207395
  const val = expressionData[0][rowIndex];
207230
207396
  return val;
@@ -207669,10 +207835,25 @@ function getHoverData(hoverInfo, layerType) {
207669
207835
  return null;
207670
207836
  }
207671
207837
  function SpatialSubscriber(props2) {
207672
- const { uuid, coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, observationsLabelOverride, subobservationsLabelOverride: subobservationsLabel = "molecule", theme, disableTooltip = false, title: title2 = "Spatial" } = props2;
207838
+ const {
207839
+ uuid,
207840
+ coordinationScopes: coordinationScopesRaw,
207841
+ coordinationScopesBy: coordinationScopesByRaw,
207842
+ closeButtonVisible,
207843
+ downloadButtonVisible,
207844
+ removeGridComponent,
207845
+ observationsLabelOverride,
207846
+ subobservationsLabelOverride: subobservationsLabel = "molecule",
207847
+ theme,
207848
+ disableTooltip = false,
207849
+ title: title2 = "Spatial",
207850
+ bitmaskValueIsIndex = false
207851
+ // TODO: move to coordination type
207852
+ } = props2;
207673
207853
  const loaders = useLoaders();
207674
207854
  const setComponentHover = useSetComponentHover();
207675
207855
  const setComponentViewInfo = useSetComponentViewInfo(uuid);
207856
+ const mergeCoordination = useMergeCoordination();
207676
207857
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
207677
207858
  const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
207678
207859
  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$2.SPATIAL_BETA], coordinationScopes);
@@ -207769,18 +207950,18 @@ function SpatialSubscriber(props2) {
207769
207950
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
207770
207951
  const is3dMode = spatialRenderingMode === "3D";
207771
207952
  const [width2, height2, deckRef] = useDeckCanvasSize();
207772
- const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset);
207953
+ const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
207773
207954
  const [pointMultiObsLabelsData, pointMultiObsLabelsDataStatus] = usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loaders, dataset);
207774
- const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset);
207955
+ const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
207775
207956
  const [obsSpotsSetsData, obsSpotsSetsDataStatus] = useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
207776
207957
  const [spotMultiExpressionData, spotMultiLoadedFeatureSelection, spotMultiExpressionExtents, spotMultiExpressionNormData, spotMultiFeatureSelectionStatus] = useSpotMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
207777
207958
  const [spotMultiIndicesData, spotMultiIndicesDataStatus] = useSpotMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
207778
207959
  const [obsSegmentationsLocationsData, obsSegmentationsLocationsDataStatus] = useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset);
207779
- const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset);
207960
+ const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
207780
207961
  const [obsSegmentationsSetsData, obsSegmentationsSetsDataStatus] = useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
207781
207962
  const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
207782
207963
  const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
207783
- const [imageData, imageDataStatus, imageUrls] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset);
207964
+ const [imageData, imageDataStatus, imageUrls] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
207784
207965
  const isReadyToComputeInitialViewState = useReady([
207785
207966
  obsPointsDataStatus,
207786
207967
  obsSpotsDataStatus,
@@ -207941,7 +208122,7 @@ function SpatialSubscriber(props2) {
207941
208122
  if (layerType === "segmentation-bitmask") {
207942
208123
  const { obsIndex } = segmentationMultiIndicesData?.[segmentationLayerScope]?.[channelScope] || {};
207943
208124
  obsI -= 1;
207944
- if (obsIndex) {
208125
+ if (obsIndex && bitmaskValueIsIndex) {
207945
208126
  obsId = obsIndex?.[obsI];
207946
208127
  } else {
207947
208128
  obsId = String(obsI);
@@ -208050,6 +208231,7 @@ function SpatialSubscriber(props2) {
208050
208231
  obsSegmentationsSets: obsSegmentationsSetsData,
208051
208232
  segmentationMatrixIndices: segmentationMultiIndicesData,
208052
208233
  segmentationMultiExpressionData: segmentationMultiExpressionNormData,
208234
+ bitmaskValueIsIndex,
208053
208235
  // Images
208054
208236
  images: imageData,
208055
208237
  imageLayerScopes,
@@ -213923,8 +214105,8 @@ const Slicer = ({ xSlice, ySlice, zSlice, handleSlicerSetting, loader: loader2,
213923
214105
  ]
213924
214106
  ];
213925
214107
  const classes = useSlicerStyles();
213926
- 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));
213927
- 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] });
214108
+ 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));
214109
+ 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] });
213928
214110
  };
213929
214111
  const renderingOptions = Object.values(RENDERING_MODES);
213930
214112
  function RenderingModeSelect({ handleRenderingModeChange, renderingMode, use3d }) {
@@ -215081,8 +215263,9 @@ function LayerController(props2) {
215081
215263
  return jsxRuntimeExports.jsxs("div", { children: [anyLayerHasZ ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode }) : null, anyLayerHasT ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null, pointLayerScopes && reversedPointLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(PointLayerController, { theme, layerScope, layerCoordination: pointLayerCoordination[0][layerScope], setLayerCoordination: pointLayerCoordination[1][layerScope] }, layerScope)), spotLayerScopes && reversedSpotLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SpotLayerController, { theme, layerScope, layerCoordination: spotLayerCoordination[0][layerScope], setLayerCoordination: spotLayerCoordination[1][layerScope] }, layerScope)), segmentationLayerScopes && reversedSegmentationLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SegmentationLayerController, { theme, layerScope, layerCoordination: segmentationLayerCoordination[0][layerScope], setLayerCoordination: segmentationLayerCoordination[1][layerScope], channelScopes: segmentationChannelScopesByLayer[layerScope], channelCoordination: segmentationChannelCoordination[0][layerScope], setChannelCoordination: segmentationChannelCoordination[1][layerScope] }, layerScope)), imageLayerScopes && reversedImageLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(ImageLayerController, { theme, coordinationScopesRaw, layerScope, layerCoordination: imageLayerCoordination[0][layerScope], setLayerCoordination: imageLayerCoordination[1][layerScope], channelScopes: imageChannelScopesByLayer[layerScope], channelCoordination: imageChannelCoordination[0][layerScope], setChannelCoordination: imageChannelCoordination[1][layerScope], image: images[layerScope]?.image?.instance, featureIndex: images[layerScope]?.featureIndex, targetT, targetZ, spatialRenderingMode }, layerScope))] });
215082
215264
  }
215083
215265
  function LayerControllerSubscriber(props2) {
215084
- const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers" } = props2;
215266
+ const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid } = props2;
215085
215267
  const loaders = useLoaders();
215268
+ const mergeCoordination = useMergeCoordination();
215086
215269
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
215087
215270
  const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
215088
215271
  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$2.LAYER_CONTROLLER_BETA], coordinationScopes);
@@ -215172,10 +215355,10 @@ function LayerControllerSubscriber(props2) {
215172
215355
  const layerControllerRef = useRef();
215173
215356
  useClosestVitessceContainerSize(layerControllerRef);
215174
215357
  useWindowDimensions();
215175
- const [obsSegmentationsData, obsSegmentationsDataStatus] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset);
215176
- const [imageData, imageDataStatus] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset);
215177
- const [obsSpotsData, obsSpotsDataStatus] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset);
215178
- const [obsPointsData, obsPointsDataStatus] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset);
215358
+ const [obsSegmentationsData, obsSegmentationsDataStatus] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
215359
+ const [imageData, imageDataStatus] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
215360
+ const [obsSpotsData, obsSpotsDataStatus] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
215361
+ const [obsPointsData, obsPointsDataStatus] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid);
215179
215362
  const isReady = useReady([
215180
215363
  obsSpotsDataStatus,
215181
215364
  obsPointsDataStatus,
@@ -215477,7 +215660,7 @@ const HIGLASS_BUNDLE_VERSION = "1.11.13";
215477
215660
  const HIGLASS_CSS_URL = `https://unpkg.com/${HIGLASS_PKG_NAME}@${HIGLASS_BUNDLE_VERSION}/dist/hglib.css`;
215478
215661
  register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
215479
215662
  const LazyHiGlassComponent = React__default.lazy(async () => {
215480
- const { HiGlassComponent } = await import("./hglib-cdf09f0e.js").then((n3) => n3.h);
215663
+ const { HiGlassComponent } = await import("./hglib-8cc3a278.js").then((n3) => n3.h);
215481
215664
  return { default: HiGlassComponent };
215482
215665
  });
215483
215666
  const HG_SIZE = 800;
@@ -272836,6 +273019,32 @@ class ObsSpotsCsvLoader extends CsvLoader {
272836
273019
  this.cachedResult = { obsIndex, obsSpots };
272837
273020
  return this.cachedResult;
272838
273021
  }
273022
+ async load() {
273023
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
273024
+ if (payload instanceof AbstractLoaderError) {
273025
+ return Promise.reject(payload);
273026
+ }
273027
+ const coordinationValues = {
273028
+ spotLayer: CL({
273029
+ obsType: "spot",
273030
+ // obsColorEncoding: 'spatialLayerColor',
273031
+ // spatialLayerColor: [255, 255, 255],
273032
+ spatialLayerVisible: true,
273033
+ spatialLayerOpacity: 1,
273034
+ spatialSpotRadius: 10
273035
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
273036
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
273037
+ // featureValueColormapRange: [0, 1],
273038
+ // obsHighlight: null,
273039
+ // obsSetColor: null,
273040
+ // obsSetSelection: null,
273041
+ // additionalObsSets: null,
273042
+ })
273043
+ };
273044
+ const { data: data2, url } = payload;
273045
+ const result = this.loadFromCache(data2);
273046
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
273047
+ }
272839
273048
  }
272840
273049
  class ObsPointsCsvLoader extends CsvLoader {
272841
273050
  loadFromCache(data2) {
@@ -272853,6 +273062,31 @@ class ObsPointsCsvLoader extends CsvLoader {
272853
273062
  this.cachedResult = { obsIndex, obsPoints };
272854
273063
  return this.cachedResult;
272855
273064
  }
273065
+ async load() {
273066
+ const payload = await this.getSourceData().catch((reason) => Promise.resolve(reason));
273067
+ if (payload instanceof AbstractLoaderError) {
273068
+ return Promise.reject(payload);
273069
+ }
273070
+ const coordinationValues = {
273071
+ pointLayer: CL({
273072
+ obsType: "point",
273073
+ // obsColorEncoding: 'spatialLayerColor',
273074
+ // spatialLayerColor: [255, 255, 255],
273075
+ spatialLayerVisible: true,
273076
+ spatialLayerOpacity: 1
273077
+ // TODO: support a point radius?
273078
+ // featureValueColormapRange: [0, 1],
273079
+ // obsHighlight: null,
273080
+ // obsSetColor: null,
273081
+ // obsSetSelection: null,
273082
+ // additionalObsSets: null,
273083
+ // obsLabelsType: null,
273084
+ })
273085
+ };
273086
+ const { data: data2, url } = payload;
273087
+ const result = this.loadFromCache(data2);
273088
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
273089
+ }
272856
273090
  }
272857
273091
  class ObsLocationsCsvLoader extends CsvLoader {
272858
273092
  loadFromCache(data2) {
@@ -273013,9 +273247,34 @@ class ObsSegmentationsJsonLoader extends JsonLoader {
273013
273247
  if (payload instanceof AbstractLoaderError) {
273014
273248
  return Promise.reject(payload);
273015
273249
  }
273250
+ const channelCoordination = [{
273251
+ // obsType: null,
273252
+ spatialChannelColor: [255, 255, 255],
273253
+ spatialChannelVisible: true,
273254
+ spatialChannelOpacity: 1,
273255
+ spatialChannelWindow: null,
273256
+ // featureType: 'feature',
273257
+ // featureValueType: 'value',
273258
+ obsColorEncoding: "spatialChannelColor",
273259
+ spatialSegmentationFilled: true,
273260
+ spatialSegmentationStrokeWidth: 1,
273261
+ obsHighlight: null
273262
+ }];
273263
+ const coordinationValues = {
273264
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
273265
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
273266
+ segmentationLayer: CL([
273267
+ {
273268
+ fileUid: this.coordinationValues?.fileUid || null,
273269
+ spatialLayerOpacity: 1,
273270
+ spatialLayerVisible: true,
273271
+ segmentationChannel: CL(channelCoordination)
273272
+ }
273273
+ ])
273274
+ };
273016
273275
  const { data: data2, url } = payload;
273017
273276
  const result = this.loadFromCache(data2);
273018
- return Promise.resolve(new LoaderResult(result, url));
273277
+ return Promise.resolve(new LoaderResult(result, url, coordinationValues));
273019
273278
  }
273020
273279
  }
273021
273280
  class ObsSetsJsonLoader extends JsonLoader {
@@ -273381,7 +273640,8 @@ async function initLoader(imageData) {
273381
273640
  }
273382
273641
  case "ome-zarr": {
273383
273642
  const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata2 || {};
273384
- const loader2 = await loadOmeZarr(url, requestInit2);
273643
+ const root2 = await zarrOpenRoot(url, requestInit2);
273644
+ const loader2 = await loadOmeZarr(root2);
273385
273645
  const { metadata: loaderMetadata } = loader2;
273386
273646
  const { omero, multiscales } = loaderMetadata;
273387
273647
  if (!Array.isArray(multiscales) || multiscales.length === 0) {
@@ -273513,6 +273773,9 @@ class ZarrDataSource {
273513
273773
  this.storeRoot = zarrOpenRoot(url, requestInit2);
273514
273774
  }
273515
273775
  }
273776
+ getStoreRoot(path2) {
273777
+ return this.storeRoot.resolve(path2);
273778
+ }
273516
273779
  /**
273517
273780
  * Class method for decoding json from the store.
273518
273781
  * @param {string} key A path to the item.
@@ -273520,13 +273783,14 @@ class ZarrDataSource {
273520
273783
  * that resolves to the parsed JSON if successful.
273521
273784
  * @throws This may throw an error.
273522
273785
  */
273523
- async getJson(key2) {
273786
+ async getJson(key2, storeRootParam = null) {
273524
273787
  const { storeRoot } = this;
273788
+ const storeRootToUse = storeRootParam || storeRoot;
273525
273789
  let dirKey = key2;
273526
273790
  if (key2.endsWith(".zattrs") || key2.endsWith(".zarray") || key2.endsWith(".zgroup")) {
273527
273791
  dirKey = key2.substring(0, key2.length - 8);
273528
273792
  }
273529
- return (await open(storeRoot.resolve(dirKey))).attrs;
273793
+ return (await open(storeRootToUse.resolve(dirKey))).attrs;
273530
273794
  }
273531
273795
  }
273532
273796
  function dirname(path2) {
@@ -274336,10 +274600,28 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
274336
274600
  if (superResult instanceof AbstractLoaderError) {
274337
274601
  return Promise.reject(superResult);
274338
274602
  }
274603
+ const coordinationValues = {
274604
+ spotLayer: CL({
274605
+ obsType: "spot",
274606
+ // obsColorEncoding: 'spatialLayerColor',
274607
+ // spatialLayerColor: [255, 255, 255],
274608
+ spatialLayerVisible: true,
274609
+ spatialLayerOpacity: 1,
274610
+ spatialSpotRadius: 10
274611
+ // TODO: get this from adata.uns if possible.
274612
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
274613
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
274614
+ // featureValueColormapRange: [0, 1],
274615
+ // obsHighlight: null,
274616
+ // obsSetColor: null,
274617
+ // obsSetSelection: null,
274618
+ // additionalObsSets: null,
274619
+ })
274620
+ };
274339
274621
  return Promise.all([
274340
274622
  this.dataSource.loadObsIndex(path2),
274341
274623
  this.loadSpots()
274342
- ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null)));
274624
+ ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null, coordinationValues)));
274343
274625
  }
274344
274626
  }
274345
274627
  class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
@@ -274365,10 +274647,26 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
274365
274647
  if (superResult instanceof AbstractLoaderError) {
274366
274648
  return Promise.reject(superResult);
274367
274649
  }
274650
+ const coordinationValues = {
274651
+ pointLayer: CL({
274652
+ obsType: "point",
274653
+ // obsColorEncoding: 'spatialLayerColor',
274654
+ // spatialLayerColor: [255, 255, 255],
274655
+ spatialLayerVisible: true,
274656
+ spatialLayerOpacity: 1
274657
+ // TODO: support a point radius?
274658
+ // featureValueColormapRange: [0, 1],
274659
+ // obsHighlight: null,
274660
+ // obsSetColor: null,
274661
+ // obsSetSelection: null,
274662
+ // additionalObsSets: null,
274663
+ // obsLabelsType: null,
274664
+ })
274665
+ };
274368
274666
  return Promise.all([
274369
274667
  this.dataSource.loadObsIndex(path2),
274370
274668
  this.loadPoints()
274371
- ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult({ obsIndex, obsPoints }, null)));
274669
+ ]).then(([obsIndex, obsPoints]) => Promise.resolve(new LoaderResult({ obsIndex, obsPoints }, null, coordinationValues)));
274372
274670
  }
274373
274671
  }
274374
274672
  class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
@@ -274441,8 +274739,33 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
274441
274739
  if (superResult instanceof AbstractLoaderError) {
274442
274740
  return Promise.reject(superResult);
274443
274741
  }
274742
+ const channelCoordination = [{
274743
+ // obsType: null,
274744
+ spatialChannelColor: [255, 255, 255],
274745
+ spatialChannelVisible: true,
274746
+ spatialChannelOpacity: 1,
274747
+ spatialChannelWindow: null,
274748
+ // featureType: 'feature',
274749
+ // featureValueType: 'value',
274750
+ obsColorEncoding: "spatialChannelColor",
274751
+ spatialSegmentationFilled: true,
274752
+ spatialSegmentationStrokeWidth: 1,
274753
+ obsHighlight: null
274754
+ }];
274444
274755
  const coordinationValues = {
274445
- spatialSegmentationLayer: DEFAULT_CELLS_LAYER
274756
+ // Old
274757
+ spatialSegmentationLayer: DEFAULT_CELLS_LAYER,
274758
+ // New
274759
+ // spatialTargetZ: imageWrapper.getDefaultTargetZ(),
274760
+ // spatialTargetT: imageWrapper.getDefaultTargetT(),
274761
+ segmentationLayer: CL([
274762
+ {
274763
+ fileUid: this.coordinationValues?.fileUid || null,
274764
+ spatialLayerOpacity: 1,
274765
+ spatialLayerVisible: true,
274766
+ segmentationChannel: CL(channelCoordination)
274767
+ }
274768
+ ])
274446
274769
  };
274447
274770
  return Promise.all([
274448
274771
  this.dataSource.loadObsIndex(path2),
@@ -274451,7 +274774,7 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
274451
274774
  obsIndex,
274452
274775
  obsSegmentations,
274453
274776
  obsSegmentationsType: "polygon"
274454
- }, coordinationValues)));
274777
+ }, null, coordinationValues)));
274455
274778
  }
274456
274779
  }
274457
274780
  class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
@@ -274648,20 +274971,20 @@ class ImageWrapper {
274648
274971
  return result;
274649
274972
  }
274650
274973
  getNumChannels() {
274651
- if ("Pixels" in this.vivLoader.metadata) {
274652
- const { Pixels: { Channels } } = this.vivLoader.metadata;
274653
- return Channels.length;
274654
- }
274655
- if ("omero" in this.vivLoader.metadata) {
274656
- const { omero: { channels: channels2 } } = this.vivLoader.metadata;
274657
- return channels2.length;
274974
+ if ("image-label" in this.vivLoader.metadata) {
274975
+ return 1;
274658
274976
  }
274659
274977
  if ("channels_metadata" in this.vivLoader.metadata) {
274660
274978
  const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
274661
274979
  return channelsMetadata?.channels.length || 0;
274662
274980
  }
274663
- if ("image-label" in this.vivLoader.metadata) {
274664
- return 1;
274981
+ if ("omero" in this.vivLoader.metadata) {
274982
+ const { omero: { channels: channels2 } } = this.vivLoader.metadata;
274983
+ return channels2.length;
274984
+ }
274985
+ if ("Pixels" in this.vivLoader.metadata) {
274986
+ const { Pixels: { Channels } } = this.vivLoader.metadata;
274987
+ return Channels.length;
274665
274988
  }
274666
274989
  return 0;
274667
274990
  }
@@ -274670,9 +274993,8 @@ class ImageWrapper {
274670
274993
  const { Pixels: { Channels } } = this.vivLoader.metadata;
274671
274994
  return Channels.map((channel, i2) => channel.Name || `Channel ${i2}`);
274672
274995
  }
274673
- if ("omero" in this.vivLoader.metadata) {
274674
- const { omero: { channels: channels2 } } = this.vivLoader.metadata;
274675
- return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
274996
+ if ("image-label" in this.vivLoader.metadata) {
274997
+ return ["labels"];
274676
274998
  }
274677
274999
  if ("channels_metadata" in this.vivLoader.metadata) {
274678
275000
  const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
@@ -274680,9 +275002,33 @@ class ImageWrapper {
274680
275002
  return channelsMetadata.channels.map((channel) => `Channel ${channel.label}`);
274681
275003
  }
274682
275004
  }
275005
+ if ("omero" in this.vivLoader.metadata) {
275006
+ const { omero: { channels: channels2 } } = this.vivLoader.metadata;
275007
+ return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
275008
+ }
274683
275009
  return [];
274684
275010
  }
275011
+ // TODO: support passing a custom color palette array.
274685
275012
  getChannelObjects() {
275013
+ if ("image-label" in this.vivLoader.metadata) {
275014
+ return [{
275015
+ name: "labels",
275016
+ defaultColor: [255, 255, 255],
275017
+ defaultWindow: [0, 255],
275018
+ autoDefaultColor: [0, 0, 0]
275019
+ }];
275020
+ }
275021
+ if ("channels_metadata" in this.vivLoader.metadata) {
275022
+ const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
275023
+ if (channelsMetadata && Array.isArray(channelsMetadata?.channels)) {
275024
+ return channelsMetadata.channels.map((channel, i2) => ({
275025
+ name: `Channel ${channel.label}`,
275026
+ defaultColor: void 0,
275027
+ defaultWindow: void 0,
275028
+ autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
275029
+ }));
275030
+ }
275031
+ }
274686
275032
  if ("omero" in this.vivLoader.metadata) {
274687
275033
  const { omero: { channels: channels2 } } = this.vivLoader.metadata;
274688
275034
  return channels2.map((channel, i2) => ({
@@ -274701,17 +275047,6 @@ class ImageWrapper {
274701
275047
  autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
274702
275048
  }));
274703
275049
  }
274704
- if ("channels_metadata" in this.vivLoader.metadata) {
274705
- const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
274706
- if (channelsMetadata && Array.isArray(channelsMetadata?.channels)) {
274707
- return channelsMetadata.channels.map((channel, i2) => ({
274708
- name: `Channel ${channel.label}`,
274709
- defaultColor: void 0,
274710
- defaultWindow: void 0,
274711
- autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
274712
- }));
274713
- }
274714
- }
274715
275050
  return [];
274716
275051
  }
274717
275052
  getDtype() {
@@ -274800,15 +275135,41 @@ class ImageWrapper {
274800
275135
  const { shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
274801
275136
  return isInterleaved$1(shape2);
274802
275137
  }
275138
+ getPhotometricInterpretation() {
275139
+ const loader2 = this.vivLoader;
275140
+ if ("Pixels" in loader2.metadata) {
275141
+ const source2 = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
275142
+ if ("meta" in source2) {
275143
+ const { meta: meta2 } = source2;
275144
+ if (meta2 && "photometricInterpretation" in meta2) {
275145
+ const numericValue = meta2.photometricInterpretation;
275146
+ if (numericValue === 2) {
275147
+ return "RGB";
275148
+ }
275149
+ }
275150
+ }
275151
+ }
275152
+ if ("omero" in loader2.metadata) {
275153
+ const { omero: { rdefs: { model } } } = loader2.metadata;
275154
+ if (model === "color") {
275155
+ return "RGB";
275156
+ }
275157
+ }
275158
+ return "BlackIsZero";
275159
+ }
274803
275160
  }
274804
275161
  class OmeZarrLoader extends AbstractTwoStepLoader {
275162
+ constructor(dataSource, params2) {
275163
+ super(dataSource, params2);
275164
+ this.storeRoot = this.dataSource.storeRoot;
275165
+ }
274805
275166
  async load() {
274806
- const payload = await this.dataSource.getJson(".zattrs").catch((reason) => Promise.resolve(reason));
275167
+ const payload = await this.dataSource.getJson(".zattrs", this.storeRoot).catch((reason) => Promise.resolve(reason));
274807
275168
  if (payload instanceof AbstractLoaderError) {
274808
275169
  return Promise.reject(payload);
274809
275170
  }
274810
275171
  const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
274811
- const loader2 = await loadOmeZarr(this.url, this.requestInit);
275172
+ const loader2 = await loadOmeZarr(this.storeRoot);
274812
275173
  const imageWrapper = new ImageWrapper(loader2, this.options);
274813
275174
  const { metadata: metadata2, data: data2 } = loader2;
274814
275175
  const { omero, multiscales, channels_metadata: spatialDataChannels, "image-label": imageLabel } = metadata2;
@@ -274891,8 +275252,31 @@ class OmeZarrLoader extends AbstractTwoStepLoader {
274891
275252
  }
274892
275253
  ];
274893
275254
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = await initializeRasterLayersAndChannels(imagesWithLoaderCreators, void 0);
275255
+ const channelObjects2 = imageWrapper.getChannelObjects();
275256
+ const channelCoordination = channelObjects2.slice(0, 5).map((channelObj, i2) => ({
275257
+ spatialTargetC: i2,
275258
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
275259
+ spatialChannelVisible: true,
275260
+ spatialChannelOpacity: 1,
275261
+ spatialChannelWindow: channelObj.defaultWindow || null
275262
+ }));
274894
275263
  const coordinationValues = {
274895
- spatialImageLayer: autoImageLayers
275264
+ // Old
275265
+ spatialImageLayer: autoImageLayers,
275266
+ // New
275267
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
275268
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
275269
+ imageLayer: CL([
275270
+ {
275271
+ fileUid: this.coordinationValues?.fileUid || null,
275272
+ spatialLayerOpacity: 1,
275273
+ spatialLayerVisible: true,
275274
+ photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
275275
+ volumetricRenderingAlgorithm: "maximumIntensityProjection",
275276
+ spatialTargetResolution: null,
275277
+ imageChannel: CL(channelCoordination)
275278
+ }
275279
+ ])
274896
275280
  };
274897
275281
  return Promise.resolve(new LoaderResult({
274898
275282
  image: {
@@ -274902,17 +275286,51 @@ class OmeZarrLoader extends AbstractTwoStepLoader {
274902
275286
  // TODO: make this the root value of LoaderResult.image.
274903
275287
  },
274904
275288
  featureIndex: imageWrapper.getChannelNames()
274905
- }, [], coordinationValues));
275289
+ }, null, coordinationValues));
275290
+ }
275291
+ }
275292
+ class OmeZarrAsObsSegmentationsLoader extends OmeZarrLoader {
275293
+ async load() {
275294
+ const { obsTypesFromChannelNames } = this.options || {};
275295
+ const result = await super.load();
275296
+ const imageWrapper = result.data.image.instance;
275297
+ const channelObjects = imageWrapper.getChannelObjects();
275298
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
275299
+ spatialTargetC: i2,
275300
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
275301
+ spatialChannelVisible: true,
275302
+ spatialChannelOpacity: 1,
275303
+ spatialChannelWindow: channelObj.defaultWindow || null,
275304
+ // featureType: 'feature',
275305
+ // featureValueType: 'value',
275306
+ obsColorEncoding: "spatialChannelColor",
275307
+ spatialSegmentationFilled: true,
275308
+ spatialSegmentationStrokeWidth: 1,
275309
+ obsHighlight: null,
275310
+ ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
275311
+ }));
275312
+ const coordinationValues = {
275313
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
275314
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
275315
+ segmentationLayer: CL([
275316
+ {
275317
+ fileUid: this.coordinationValues?.fileUid || null,
275318
+ spatialLayerOpacity: 1,
275319
+ spatialLayerVisible: true,
275320
+ segmentationChannel: CL(channelCoordination)
275321
+ }
275322
+ ])
275323
+ };
275324
+ return Promise.resolve(new LoaderResult({
275325
+ obsSegmentationsType: "bitmask",
275326
+ obsSegmentations: result.data.image
275327
+ }, result.url, coordinationValues));
274906
275328
  }
274907
275329
  }
274908
275330
  class SpatialDataImageLoader extends OmeZarrLoader {
274909
275331
  constructor(dataSource, params2) {
274910
- const newParams = {
274911
- ...params2,
274912
- url: `${params2.url}/${params2.options.path}`
274913
- };
274914
- super(dataSource, newParams);
274915
- this.dataSource = dataSource;
275332
+ super(dataSource, params2);
275333
+ this.storeRoot = this.dataSource.getStoreRoot(params2.options.path);
274916
275334
  }
274917
275335
  }
274918
275336
  class SpatialDataLabelsLoader extends SpatialDataImageLoader {
@@ -274925,12 +275343,44 @@ class SpatialDataLabelsLoader extends SpatialDataImageLoader {
274925
275343
  obsSegmentations: result.data.image,
274926
275344
  obsSegmentationsType: "bitmask"
274927
275345
  };
275346
+ const imageWrapper = result.data.obsSegmentations.instance;
275347
+ const channelObjects = imageWrapper.getChannelObjects();
275348
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
275349
+ spatialTargetC: i2,
275350
+ // obsType: channelObj.name,
275351
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
275352
+ spatialChannelVisible: true,
275353
+ spatialChannelOpacity: 1,
275354
+ spatialChannelWindow: channelObj.defaultWindow || null,
275355
+ // featureType: 'feature',
275356
+ // featureValueType: 'value',
275357
+ obsColorEncoding: "spatialChannelColor",
275358
+ spatialSegmentationFilled: true,
275359
+ spatialSegmentationStrokeWidth: 1,
275360
+ obsHighlight: null
275361
+ }));
275362
+ const coordinationValues = {
275363
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
275364
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
275365
+ segmentationLayer: CL([
275366
+ {
275367
+ fileUid: this.coordinationValues?.fileUid || null,
275368
+ spatialLayerOpacity: 1,
275369
+ spatialLayerVisible: true,
275370
+ segmentationChannel: CL(channelCoordination)
275371
+ }
275372
+ ])
275373
+ };
275374
+ result.coordinationValues = coordinationValues;
274928
275375
  return Promise.resolve(result);
274929
275376
  }
274930
275377
  }
274931
275378
  function getCoordsPath(path2) {
274932
275379
  return `${path2}/coords`;
274933
275380
  }
275381
+ function getRadiusPath(path2) {
275382
+ return `${path2}/radius`;
275383
+ }
274934
275384
  class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
274935
275385
  /**
274936
275386
  * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
@@ -274948,6 +275398,18 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
274948
275398
  this.locations = Promise.resolve(null);
274949
275399
  return this.locations;
274950
275400
  }
275401
+ loadRadius() {
275402
+ const { path: path2 } = this.options;
275403
+ if (this.radius) {
275404
+ return this.radius;
275405
+ }
275406
+ if (!this.radius) {
275407
+ this.radius = this.dataSource.loadNumeric(getRadiusPath(path2));
275408
+ return this.radius;
275409
+ }
275410
+ this.radius = Promise.resolve(null);
275411
+ return this.radius;
275412
+ }
274951
275413
  async load() {
274952
275414
  const { path: path2, tablePath } = this.options;
274953
275415
  const superResult = await super.load().catch((reason) => Promise.resolve(reason));
@@ -274956,8 +275418,29 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
274956
275418
  }
274957
275419
  return Promise.all([
274958
275420
  this.dataSource.loadObsIndex(getCoordsPath(path2), tablePath),
274959
- this.loadSpots()
274960
- ]).then(([obsIndex, obsSpots]) => Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null)));
275421
+ this.loadSpots(),
275422
+ this.loadRadius()
275423
+ ]).then(([obsIndex, obsSpots, obsRadius]) => {
275424
+ const spatialSpotRadius = obsRadius?.data?.[0];
275425
+ const coordinationValues = {
275426
+ spotLayer: CL({
275427
+ obsType: "spot",
275428
+ // obsColorEncoding: 'spatialLayerColor',
275429
+ // spatialLayerColor: [255, 255, 255],
275430
+ spatialLayerVisible: true,
275431
+ spatialLayerOpacity: 1,
275432
+ spatialSpotRadius
275433
+ // TODO: spatialSpotRadiusUnit: 'µm' or 'um'
275434
+ // after resolving https://github.com/vitessce/vitessce/issues/1760
275435
+ // featureValueColormapRange: [0, 1],
275436
+ // obsHighlight: null,
275437
+ // obsSetColor: null,
275438
+ // obsSetSelection: null,
275439
+ // additionalObsSets: null,
275440
+ })
275441
+ };
275442
+ return Promise.resolve(new LoaderResult({ obsIndex, obsSpots }, null, coordinationValues));
275443
+ });
274961
275444
  }
274962
275445
  }
274963
275446
  class SpatialDataObsSetsLoader extends ObsSetsAnndataLoader {
@@ -275024,6 +275507,14 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
275024
275507
  const urls2 = [
275025
275508
  { url, name: image2.name }
275026
275509
  ];
275510
+ const channelObjects = imageWrapper.getChannelObjects();
275511
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
275512
+ spatialTargetC: i2,
275513
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
275514
+ spatialChannelVisible: true,
275515
+ spatialChannelOpacity: 1,
275516
+ spatialChannelWindow: channelObj.defaultWindow || null
275517
+ }));
275027
275518
  const imagesWithLoaderCreators = [
275028
275519
  {
275029
275520
  ...image2,
@@ -275037,7 +275528,22 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
275037
275528
  return this.autoImageCache.then((autoImages) => {
275038
275529
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
275039
275530
  const coordinationValues = {
275040
- spatialImageLayer: autoImageLayers
275531
+ // Old
275532
+ spatialImageLayer: autoImageLayers,
275533
+ // New
275534
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
275535
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
275536
+ imageLayer: CL([
275537
+ {
275538
+ fileUid: this.coordinationValues?.fileUid || null,
275539
+ spatialLayerOpacity: 1,
275540
+ spatialLayerVisible: true,
275541
+ photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
275542
+ volumetricRenderingAlgorithm: "maximumIntensityProjection",
275543
+ spatialTargetResolution: null,
275544
+ imageChannel: CL(channelCoordination)
275545
+ }
275546
+ ])
275041
275547
  };
275042
275548
  return new LoaderResult({
275043
275549
  image: {
@@ -275054,7 +275560,7 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
275054
275560
  class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
275055
275561
  async load() {
275056
275562
  const { url, requestInit: requestInit2 } = this;
275057
- const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
275563
+ const { coordinateTransformations: coordinateTransformationsFromOptions, obsTypesFromChannelNames } = this.options || {};
275058
275564
  const offsets2 = await this.loadOffsets();
275059
275565
  const loader2 = await loadOmeTiff(url, { offsets: offsets2, headers: requestInit2?.headers });
275060
275566
  const imageWrapper = new ImageWrapper(loader2, this.options);
@@ -275076,6 +275582,21 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
275076
275582
  }
275077
275583
  };
275078
275584
  const urls2 = [{ url, name: image2.name }];
275585
+ const channelObjects = imageWrapper.getChannelObjects();
275586
+ const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
275587
+ spatialTargetC: i2,
275588
+ spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
275589
+ spatialChannelVisible: true,
275590
+ spatialChannelOpacity: 1,
275591
+ spatialChannelWindow: channelObj.defaultWindow || null,
275592
+ // featureType: 'feature',
275593
+ // featureValueType: 'value',
275594
+ obsColorEncoding: "spatialChannelColor",
275595
+ spatialSegmentationFilled: true,
275596
+ spatialSegmentationStrokeWidth: 1,
275597
+ obsHighlight: null,
275598
+ ...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
275599
+ }));
275079
275600
  const imagesWithLoaderCreators = [
275080
275601
  {
275081
275602
  ...image2,
@@ -275092,7 +275613,19 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
275092
275613
  return this.autoImageCache.then((autoImages) => {
275093
275614
  const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
275094
275615
  const coordinationValues = {
275095
- spatialSegmentationLayer: autoImageLayers
275616
+ // Old
275617
+ spatialSegmentationLayer: autoImageLayers,
275618
+ // New
275619
+ spatialTargetZ: imageWrapper.getDefaultTargetZ(),
275620
+ spatialTargetT: imageWrapper.getDefaultTargetT(),
275621
+ segmentationLayer: CL([
275622
+ {
275623
+ fileUid: this.coordinationValues?.fileUid || null,
275624
+ spatialLayerOpacity: 1,
275625
+ spatialLayerVisible: true,
275626
+ segmentationChannel: CL(channelCoordination)
275627
+ }
275628
+ ])
275096
275629
  };
275097
275630
  return new LoaderResult({
275098
275631
  obsSegmentationsType: "bitmask",
@@ -275276,6 +275809,83 @@ function expandAnndataZarr(fileDef) {
275276
275809
  }] : []
275277
275810
  ];
275278
275811
  }
275812
+ function expandSpatialdataZarr(fileDef) {
275813
+ const baseFileDef = {
275814
+ url: fileDef.url,
275815
+ requestInit: fileDef.requestInit,
275816
+ coordinationValues: {
275817
+ ...fileDef.coordinationValues,
275818
+ obsType: fileDef.coordinationValues?.obsType || "cell",
275819
+ featureType: fileDef.coordinationValues?.featureType || "gene",
275820
+ featureValueType: fileDef.coordinationValues?.featureValueType || "expression"
275821
+ }
275822
+ };
275823
+ const extraCoordinationValues = {};
275824
+ Object.entries(baseFileDef.coordinationValues).forEach(([key2, value2]) => {
275825
+ if (!expectedCoordinationTypes.includes(key2)) {
275826
+ extraCoordinationValues[key2] = value2;
275827
+ }
275828
+ });
275829
+ const { options = {} } = fileDef;
275830
+ return [
275831
+ // obsFeatureMatrix
275832
+ ...options.obsFeatureMatrix ? [{
275833
+ ...baseFileDef,
275834
+ fileType: FileType$2.OBS_FEATURE_MATRIX_SPATIALDATA_ZARR,
275835
+ options: options.obsFeatureMatrix,
275836
+ coordinationValues: {
275837
+ ...extraCoordinationValues,
275838
+ obsType: baseFileDef.coordinationValues.obsType,
275839
+ featureType: baseFileDef.coordinationValues.featureType,
275840
+ featureValueType: baseFileDef.coordinationValues.featureValueType
275841
+ }
275842
+ }] : [],
275843
+ // obsSets
275844
+ ...options.obsSets ? [{
275845
+ ...baseFileDef,
275846
+ fileType: FileType$2.OBS_SETS_SPATIALDATA_ZARR,
275847
+ options: options.obsSets,
275848
+ coordinationValues: {
275849
+ ...extraCoordinationValues,
275850
+ obsType: baseFileDef.coordinationValues.obsType
275851
+ }
275852
+ }] : [],
275853
+ // obsSpots
275854
+ ...options.obsSpots ? [{
275855
+ ...baseFileDef,
275856
+ fileType: FileType$2.OBS_SPOTS_SPATIALDATA_ZARR,
275857
+ options: options.obsSpots,
275858
+ coordinationValues: {
275859
+ ...extraCoordinationValues,
275860
+ obsType: baseFileDef.coordinationValues.obsType
275861
+ }
275862
+ }] : [],
275863
+ // TODO: obsPoints?
275864
+ // TODO: obsLocations?
275865
+ // image
275866
+ ...options.image ? [{
275867
+ ...baseFileDef,
275868
+ fileType: FileType$2.IMAGE_SPATIALDATA_ZARR,
275869
+ options: options.image,
275870
+ coordinationValues: {
275871
+ ...extraCoordinationValues,
275872
+ featureType: baseFileDef.coordinationValues.featureType
275873
+ // TODO: fileUid?
275874
+ }
275875
+ }] : [],
275876
+ // labels
275877
+ ...options.labels ? [{
275878
+ ...baseFileDef,
275879
+ fileType: FileType$2.LABELS_SPATIALDATA_ZARR,
275880
+ options: options.labels,
275881
+ coordinationValues: {
275882
+ ...extraCoordinationValues,
275883
+ obsType: baseFileDef.coordinationValues.obsType
275884
+ // TODO: fileUid?
275885
+ }
275886
+ }] : []
275887
+ ];
275888
+ }
275279
275889
  function expandMoleculesJson(fileDef) {
275280
275890
  const baseFileDef = {
275281
275891
  ...fileDef,
@@ -275600,7 +276210,8 @@ const baseFileTypes = [
275600
276210
  // All OME file types
275601
276211
  makeFileType(FileType$2.IMAGE_OME_ZARR, DataType$3.IMAGE, OmeZarrLoader, ZarrDataSource, imageOmeZarrSchema),
275602
276212
  makeFileType(FileType$2.IMAGE_OME_TIFF, DataType$3.IMAGE, OmeTiffLoader, OmeTiffSource, imageOmeTiffSchema),
275603
- makeFileType(FileType$2.OBS_SEGMENTATIONS_OME_TIFF, DataType$3.OBS_SEGMENTATIONS, OmeTiffAsObsSegmentationsLoader, OmeTiffSource, imageOmeZarrSchema),
276213
+ makeFileType(FileType$2.OBS_SEGMENTATIONS_OME_ZARR, DataType$3.OBS_SEGMENTATIONS, OmeZarrAsObsSegmentationsLoader, ZarrDataSource, obsSegmentationsOmeZarrSchema),
276214
+ makeFileType(FileType$2.OBS_SEGMENTATIONS_OME_TIFF, DataType$3.OBS_SEGMENTATIONS, OmeTiffAsObsSegmentationsLoader, OmeTiffSource, obsSegmentationsOmeTiffSchema),
275604
276215
  // SpatialData file types
275605
276216
  makeFileType(FileType$2.IMAGE_SPATIALDATA_ZARR, DataType$3.IMAGE, SpatialDataImageLoader, ZarrDataSource, imageSpatialdataSchema),
275606
276217
  // TODO: create a new loader for labels that returns obsSegmentations with obsSegmentationsType: 'bitmask'
@@ -275629,7 +276240,7 @@ const baseFileTypes = [
275629
276240
  ];
275630
276241
  const baseJointFileTypes = [
275631
276242
  new PluginJointFileType(FileType$2.ANNDATA_ZARR, expandAnndataZarr, anndataZarrSchema),
275632
- // new PluginJointFileType(FileType.SPATIALDATA_ZARR, expandSpatialdataZarr, spatialdataZarrSchema),
276243
+ new PluginJointFileType(FileType$2.SPATIALDATA_ZARR, expandSpatialdataZarr, spatialdataZarrSchema),
275633
276244
  // For legacy file types:
275634
276245
  new PluginJointFileType(FileType$2.ANNDATA_CELLS_ZARR, expandAnndataCellsZarr, anndataCellsZarrSchema),
275635
276246
  new PluginJointFileType(FileType$2.ANNDATA_CELL_SETS_ZARR, expandAnndataCellSetsZarr, anndataCellSetsZarrSchema),
@@ -275728,7 +276339,7 @@ const baseCoordinationTypes = [
275728
276339
  new PluginCoordinationType(CoordinationType$2.SPATIAL_CHANNEL_VISIBLE, true, z.boolean()),
275729
276340
  new PluginCoordinationType(CoordinationType$2.SPATIAL_CHANNEL_OPACITY, 1, z.number()),
275730
276341
  new PluginCoordinationType(CoordinationType$2.SPATIAL_CHANNEL_WINDOW, null, z.array(z.number()).length(2).nullable()),
275731
- new PluginCoordinationType(CoordinationType$2.SPATIAL_CHANNEL_COLOR, null, z.array(z.number()).length(3).nullable()),
276342
+ new PluginCoordinationType(CoordinationType$2.SPATIAL_CHANNEL_COLOR, [255, 255, 255], z.array(z.number()).length(3).nullable()),
275732
276343
  new PluginCoordinationType(CoordinationType$2.SPATIAL_SEGMENTATION_FILLED, true, z.boolean()),
275733
276344
  new PluginCoordinationType(CoordinationType$2.SPATIAL_SEGMENTATION_STROKE_WIDTH, 1, z.number()),
275734
276345
  // Reference: https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
@@ -278260,14 +278871,17 @@ export {
278260
278871
  VitessceConfig as i,
278261
278872
  hconcat as j,
278262
278873
  CL as k,
278263
- generateConfig as l,
278264
- getHintOptions as m,
278265
- HINT_TYPE_TO_FILE_TYPE_MAP as n,
278874
+ getCoordinationSpaceAndScopes as l,
278875
+ generateConfig as m,
278876
+ getHintOptions as n,
278266
278877
  objectAssign$2 as o,
278267
- Vitessce as p,
278268
- PluginViewType as q,
278269
- PluginCoordinationType as r,
278270
- PluginJointFileType as s,
278878
+ HINT_TYPE_TO_FILE_TYPE_MAP as p,
278879
+ getInitialCoordinationScopePrefix as q,
278880
+ getInitialCoordinationScopeName as r,
278881
+ Vitessce as s,
278882
+ PluginViewType as t,
278883
+ PluginCoordinationType as u,
278271
278884
  vconcat as v,
278885
+ PluginJointFileType as w,
278272
278886
  z
278273
278887
  };