@vitessce/layer-controller 3.1.3 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{deflate-460ebda8.js → deflate-22ea8fc3.js} +1 -1
  2. package/dist/{index-7295e6e7.js → index-f8a9f462.js} +1187 -323
  3. package/dist/index.js +9 -2
  4. package/dist/{jpeg-5e6a02ae.js → jpeg-932c57f1.js} +1 -1
  5. package/dist/{lerc-f147b9b3.js → lerc-0db1b156.js} +1 -1
  6. package/dist/{lzw-328dcf22.js → lzw-3b2cc6cd.js} +1 -1
  7. package/dist/{packbits-d1842d12.js → packbits-c8220e7f.js} +1 -1
  8. package/dist/{raw-e59a20ba.js → raw-dd52cf7d.js} +1 -1
  9. package/dist/{webimage-30f949aa.js → webimage-d7166a5a.js} +1 -1
  10. package/dist-tsc/ChannelOptions.d.ts.map +1 -1
  11. package/dist-tsc/ChannelOptions.js +6 -1
  12. package/dist-tsc/LayerController.d.ts.map +1 -1
  13. package/dist-tsc/LayerController.js +3 -5
  14. package/dist-tsc/LayerOptions.d.ts.map +1 -1
  15. package/dist-tsc/LayerOptions.js +5 -5
  16. package/dist-tsc/RasterChannelController.d.ts.map +1 -1
  17. package/dist-tsc/RasterChannelController.js +1 -25
  18. package/dist-tsc/VolumeOptions.js +1 -1
  19. package/dist-tsc/index.d.ts +1 -0
  20. package/dist-tsc/index.js +1 -0
  21. package/dist-tsc/styles.d.ts +3 -3
  22. package/dist-tsc/styles.d.ts.map +1 -1
  23. package/dist-tsc/styles.js +10 -13
  24. package/package.json +7 -6
  25. package/src/ChannelOptions.js +7 -1
  26. package/src/LayerController.js +8 -6
  27. package/src/LayerOptions.js +13 -8
  28. package/src/RasterChannelController.js +7 -29
  29. package/src/VolumeOptions.js +1 -1
  30. package/src/index.js +9 -0
  31. package/src/styles.js +10 -14
  32. package/dist-tsc/RasterChannelController.test.d.ts +0 -2
  33. package/dist-tsc/RasterChannelController.test.d.ts.map +0 -1
  34. package/dist-tsc/RasterChannelController.test.js +0 -22
  35. package/dist-tsc/constants.d.ts +0 -2
  36. package/dist-tsc/constants.d.ts.map +0 -1
  37. package/dist-tsc/constants.js +0 -12
  38. package/dist-tsc/utils.d.ts +0 -24
  39. package/dist-tsc/utils.d.ts.map +0 -1
  40. package/dist-tsc/utils.js +0 -117
  41. package/src/RasterChannelController.test.js +0 -24
  42. package/src/constants.js +0 -14
  43. package/src/utils.js +0 -138
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { Children, isValidElement, cloneElement, useState, useEffect, useCallback, useId, useRef, forwardRef } from "react";
2
+ import React__default, { Children, isValidElement, cloneElement, useState, useEffect, useCallback, useContext, useRef, forwardRef } from "react";
3
3
  import { PopperMenu, TitleInfo, useLoaders, useCoordination, useAuxiliaryCoordination, useComponentLayout, useClosestVitessceContainerSize, useWindowDimensions, useObsLocationsData, useObsSegmentationsData, useImageData, useReady } from "@vitessce/vit-s";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default from "react-dom";
@@ -16808,8 +16808,10 @@ const ViewType$1 = {
16808
16808
  STATUS: "status",
16809
16809
  SCATTERPLOT: "scatterplot",
16810
16810
  SPATIAL: "spatial",
16811
+ SPATIAL_BETA: "spatialBeta",
16811
16812
  HEATMAP: "heatmap",
16812
16813
  LAYER_CONTROLLER: "layerController",
16814
+ LAYER_CONTROLLER_BETA: "layerControllerBeta",
16813
16815
  GENOMIC_PROFILES: "genomicProfiles",
16814
16816
  GATING: "gating",
16815
16817
  FEATURE_LIST: "featureList",
@@ -16821,20 +16823,24 @@ const ViewType$1 = {
16821
16823
  const DataType$2 = {
16822
16824
  OBS_LABELS: "obsLabels",
16823
16825
  OBS_EMBEDDING: "obsEmbedding",
16824
- OBS_LOCATIONS: "obsLocations",
16825
16826
  OBS_FEATURE_MATRIX: "obsFeatureMatrix",
16826
16827
  OBS_SETS: "obsSets",
16827
16828
  FEATURE_LABELS: "featureLabels",
16828
16829
  IMAGE: "image",
16829
16830
  OBS_SEGMENTATIONS: "obsSegmentations",
16830
16831
  NEIGHBORHOODS: "neighborhoods",
16831
- GENOMIC_PROFILES: "genomic-profiles"
16832
+ GENOMIC_PROFILES: "genomic-profiles",
16833
+ OBS_SPOTS: "obsSpots",
16834
+ OBS_POINTS: "obsPoints",
16835
+ OBS_LOCATIONS: "obsLocations"
16832
16836
  };
16833
16837
  const FileType$1 = {
16834
16838
  // Joint file types
16835
16839
  ANNDATA_ZARR: "anndata.zarr",
16836
16840
  // Atomic file types
16837
16841
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
16842
+ OBS_SPOTS_CSV: "obsSpots.csv",
16843
+ OBS_POINTS_CSV: "obsPoints.csv",
16838
16844
  OBS_LOCATIONS_CSV: "obsLocations.csv",
16839
16845
  OBS_LABELS_CSV: "obsLabels.csv",
16840
16846
  FEATURE_LABELS_CSV: "featureLabels.csv",
@@ -16847,6 +16853,8 @@ const FileType$1 = {
16847
16853
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
16848
16854
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
16849
16855
  OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
16856
+ OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
16857
+ OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
16850
16858
  OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
16851
16859
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
16852
16860
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
@@ -16855,6 +16863,8 @@ const FileType$1 = {
16855
16863
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
16856
16864
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
16857
16865
  OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
16866
+ OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
16867
+ OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
16858
16868
  OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
16859
16869
  OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
16860
16870
  OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
@@ -16898,10 +16908,8 @@ const FileType$1 = {
16898
16908
  ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
16899
16909
  };
16900
16910
  const CoordinationType$1 = {
16901
- // Meta coordination scopes
16902
16911
  META_COORDINATION_SCOPES: "metaCoordinationScopes",
16903
16912
  META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
16904
- // Other coordination scopes
16905
16913
  DATASET: "dataset",
16906
16914
  // Entity types
16907
16915
  OBS_TYPE: "obsType",
@@ -16927,6 +16935,7 @@ const CoordinationType$1 = {
16927
16935
  SPATIAL_TARGET_X: "spatialTargetX",
16928
16936
  SPATIAL_TARGET_Y: "spatialTargetY",
16929
16937
  SPATIAL_TARGET_Z: "spatialTargetZ",
16938
+ SPATIAL_TARGET_T: "spatialTargetT",
16930
16939
  SPATIAL_ROTATION_X: "spatialRotationX",
16931
16940
  SPATIAL_ROTATION_Y: "spatialRotationY",
16932
16941
  SPATIAL_ROTATION_Z: "spatialRotationZ",
@@ -16964,7 +16973,46 @@ const CoordinationType$1 = {
16964
16973
  GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
16965
16974
  GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
16966
16975
  FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
16967
- TOOLTIPS_VISIBLE: "tooltipsVisible"
16976
+ TOOLTIPS_VISIBLE: "tooltipsVisible",
16977
+ FILE_UID: "fileUid",
16978
+ IMAGE_LAYER: "imageLayer",
16979
+ IMAGE_CHANNEL: "imageChannel",
16980
+ SEGMENTATION_LAYER: "segmentationLayer",
16981
+ SEGMENTATION_CHANNEL: "segmentationChannel",
16982
+ SPATIAL_TARGET_C: "spatialTargetC",
16983
+ SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
16984
+ SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
16985
+ SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
16986
+ SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
16987
+ SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
16988
+ SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
16989
+ SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
16990
+ SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
16991
+ SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
16992
+ SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
16993
+ SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
16994
+ PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
16995
+ // For 3D volume rendering
16996
+ SPATIAL_RENDERING_MODE: "spatialRenderingMode",
16997
+ VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
16998
+ SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
16999
+ // For clipping plane sliders
17000
+ SPATIAL_SLICE_X: "spatialSliceX",
17001
+ SPATIAL_SLICE_Y: "spatialSliceY",
17002
+ SPATIAL_SLICE_Z: "spatialSliceZ",
17003
+ // For spatial spot and point layers
17004
+ SPOT_LAYER: "spotLayer",
17005
+ POINT_LAYER: "pointLayer",
17006
+ SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
17007
+ SPATIAL_SPOT_FILLED: "spatialSpotFilled",
17008
+ SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
17009
+ SPATIAL_LAYER_COLOR: "spatialLayerColor",
17010
+ PIXEL_HIGHLIGHT: "pixelHighlight",
17011
+ TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
17012
+ LEGEND_VISIBLE: "legendVisible",
17013
+ SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
17014
+ SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
17015
+ SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
16968
17016
  };
16969
17017
  const COMPONENT_COORDINATION_TYPES = {
16970
17018
  [ViewType$1.SCATTERPLOT]: [
@@ -17068,6 +17116,77 @@ const COMPONENT_COORDINATION_TYPES = {
17068
17116
  CoordinationType$1.MOLECULE_HIGHLIGHT,
17069
17117
  CoordinationType$1.TOOLTIPS_VISIBLE
17070
17118
  ],
17119
+ [ViewType$1.SPATIAL_BETA]: [
17120
+ CoordinationType$1.META_COORDINATION_SCOPES,
17121
+ CoordinationType$1.META_COORDINATION_SCOPES_BY,
17122
+ CoordinationType$1.DATASET,
17123
+ CoordinationType$1.OBS_TYPE,
17124
+ CoordinationType$1.OBS_LABELS_TYPE,
17125
+ CoordinationType$1.FEATURE_TYPE,
17126
+ CoordinationType$1.FEATURE_VALUE_TYPE,
17127
+ CoordinationType$1.SPATIAL_ZOOM,
17128
+ CoordinationType$1.SPATIAL_ROTATION,
17129
+ CoordinationType$1.SPATIAL_POINT_LAYER,
17130
+ CoordinationType$1.SPATIAL_NEIGHBORHOOD_LAYER,
17131
+ CoordinationType$1.SPATIAL_TARGET_X,
17132
+ CoordinationType$1.SPATIAL_TARGET_Y,
17133
+ CoordinationType$1.SPATIAL_TARGET_Z,
17134
+ CoordinationType$1.SPATIAL_TARGET_T,
17135
+ CoordinationType$1.SPATIAL_ROTATION_X,
17136
+ CoordinationType$1.SPATIAL_ROTATION_Y,
17137
+ CoordinationType$1.SPATIAL_ROTATION_Z,
17138
+ CoordinationType$1.SPATIAL_ROTATION_ORBIT,
17139
+ CoordinationType$1.SPATIAL_ORBIT_AXIS,
17140
+ CoordinationType$1.SPATIAL_AXIS_FIXED,
17141
+ CoordinationType$1.OBS_FILTER,
17142
+ CoordinationType$1.OBS_HIGHLIGHT,
17143
+ CoordinationType$1.OBS_SET_SELECTION,
17144
+ CoordinationType$1.OBS_SET_HIGHLIGHT,
17145
+ CoordinationType$1.OBS_SET_COLOR,
17146
+ CoordinationType$1.FEATURE_HIGHLIGHT,
17147
+ CoordinationType$1.FEATURE_SELECTION,
17148
+ CoordinationType$1.FEATURE_VALUE_COLORMAP,
17149
+ CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
17150
+ CoordinationType$1.OBS_COLOR_ENCODING,
17151
+ CoordinationType$1.ADDITIONAL_OBS_SETS,
17152
+ CoordinationType$1.MOLECULE_HIGHLIGHT,
17153
+ CoordinationType$1.TOOLTIPS_VISIBLE,
17154
+ CoordinationType$1.FILE_UID,
17155
+ CoordinationType$1.SPATIAL_TARGET_C,
17156
+ CoordinationType$1.SPATIAL_LAYER_VISIBLE,
17157
+ CoordinationType$1.SPATIAL_LAYER_OPACITY,
17158
+ CoordinationType$1.SPATIAL_LAYER_COLORMAP,
17159
+ CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
17160
+ CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
17161
+ CoordinationType$1.SPATIAL_CHANNEL_COLOR,
17162
+ CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
17163
+ CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
17164
+ CoordinationType$1.IMAGE_LAYER,
17165
+ CoordinationType$1.SEGMENTATION_LAYER,
17166
+ CoordinationType$1.IMAGE_CHANNEL,
17167
+ CoordinationType$1.SEGMENTATION_CHANNEL,
17168
+ CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
17169
+ CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
17170
+ CoordinationType$1.SPATIAL_CHANNEL_WINDOW,
17171
+ CoordinationType$1.SPATIAL_RENDERING_MODE,
17172
+ CoordinationType$1.VOLUMETRIC_RENDERING_ALGORITHM,
17173
+ CoordinationType$1.SPATIAL_TARGET_RESOLUTION,
17174
+ CoordinationType$1.SPATIAL_SLICE_X,
17175
+ CoordinationType$1.SPATIAL_SLICE_Y,
17176
+ CoordinationType$1.SPATIAL_SLICE_Z,
17177
+ CoordinationType$1.SPOT_LAYER,
17178
+ CoordinationType$1.POINT_LAYER,
17179
+ CoordinationType$1.SPATIAL_SPOT_RADIUS,
17180
+ CoordinationType$1.SPATIAL_SPOT_FILLED,
17181
+ CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
17182
+ CoordinationType$1.SPATIAL_LAYER_COLOR,
17183
+ CoordinationType$1.PIXEL_HIGHLIGHT,
17184
+ CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
17185
+ CoordinationType$1.LEGEND_VISIBLE,
17186
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_VISIBLE,
17187
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
17188
+ CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE
17189
+ ],
17071
17190
  [ViewType$1.HEATMAP]: [
17072
17191
  CoordinationType$1.DATASET,
17073
17192
  CoordinationType$1.OBS_TYPE,
@@ -17173,6 +17292,61 @@ const COMPONENT_COORDINATION_TYPES = {
17173
17292
  CoordinationType$1.SPATIAL_ROTATION_ORBIT,
17174
17293
  CoordinationType$1.SPATIAL_ORBIT_AXIS
17175
17294
  ],
17295
+ [ViewType$1.LAYER_CONTROLLER_BETA]: [
17296
+ CoordinationType$1.META_COORDINATION_SCOPES,
17297
+ CoordinationType$1.META_COORDINATION_SCOPES_BY,
17298
+ CoordinationType$1.DATASET,
17299
+ CoordinationType$1.OBS_TYPE,
17300
+ CoordinationType$1.FEATURE_TYPE,
17301
+ CoordinationType$1.FEATURE_VALUE_TYPE,
17302
+ CoordinationType$1.SPATIAL_POINT_LAYER,
17303
+ CoordinationType$1.SPATIAL_NEIGHBORHOOD_LAYER,
17304
+ CoordinationType$1.SPATIAL_ZOOM,
17305
+ CoordinationType$1.SPATIAL_TARGET_X,
17306
+ CoordinationType$1.SPATIAL_TARGET_Y,
17307
+ CoordinationType$1.SPATIAL_TARGET_Z,
17308
+ CoordinationType$1.SPATIAL_TARGET_T,
17309
+ CoordinationType$1.SPATIAL_ROTATION_X,
17310
+ CoordinationType$1.SPATIAL_ROTATION_Y,
17311
+ CoordinationType$1.SPATIAL_ROTATION_Z,
17312
+ CoordinationType$1.SPATIAL_ROTATION_ORBIT,
17313
+ CoordinationType$1.SPATIAL_ORBIT_AXIS,
17314
+ CoordinationType$1.FILE_UID,
17315
+ CoordinationType$1.SPATIAL_TARGET_C,
17316
+ CoordinationType$1.SPATIAL_LAYER_VISIBLE,
17317
+ CoordinationType$1.SPATIAL_LAYER_OPACITY,
17318
+ CoordinationType$1.SPATIAL_LAYER_COLORMAP,
17319
+ CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
17320
+ CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
17321
+ CoordinationType$1.SPATIAL_CHANNEL_COLOR,
17322
+ CoordinationType$1.SPATIAL_SEGMENTATION_FILLED,
17323
+ CoordinationType$1.SPATIAL_SEGMENTATION_STROKE_WIDTH,
17324
+ CoordinationType$1.IMAGE_CHANNEL,
17325
+ CoordinationType$1.SEGMENTATION_CHANNEL,
17326
+ CoordinationType$1.SPATIAL_CHANNEL_VISIBLE,
17327
+ CoordinationType$1.SPATIAL_CHANNEL_OPACITY,
17328
+ CoordinationType$1.SPATIAL_CHANNEL_WINDOW,
17329
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
17330
+ CoordinationType$1.SPATIAL_RENDERING_MODE,
17331
+ CoordinationType$1.VOLUMETRIC_RENDERING_ALGORITHM,
17332
+ CoordinationType$1.SPATIAL_TARGET_RESOLUTION,
17333
+ CoordinationType$1.SPATIAL_SLICE_X,
17334
+ CoordinationType$1.SPATIAL_SLICE_Y,
17335
+ CoordinationType$1.SPATIAL_SLICE_Z,
17336
+ CoordinationType$1.SPOT_LAYER,
17337
+ CoordinationType$1.POINT_LAYER,
17338
+ CoordinationType$1.SPATIAL_SPOT_RADIUS,
17339
+ CoordinationType$1.SPATIAL_SPOT_FILLED,
17340
+ CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
17341
+ CoordinationType$1.SPATIAL_LAYER_COLOR,
17342
+ CoordinationType$1.OBS_COLOR_ENCODING,
17343
+ CoordinationType$1.TOOLTIPS_VISIBLE,
17344
+ CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
17345
+ CoordinationType$1.LEGEND_VISIBLE,
17346
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_VISIBLE,
17347
+ CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
17348
+ CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE
17349
+ ],
17176
17350
  [ViewType$1.GENOMIC_PROFILES]: [
17177
17351
  CoordinationType$1.DATASET,
17178
17352
  CoordinationType$1.OBS_TYPE,
@@ -17628,27 +17802,6 @@ function formatBytes(bytes, decimals = 2) {
17628
17802
  const i2 = Math.floor(Math.log(bytes) / Math.log(k));
17629
17803
  return `${parseFloat((bytes / Math.pow(k, i2)).toFixed(dm))} ${sizes[i2]}`;
17630
17804
  }
17631
- const getStatsForResolution = (loader, resolution) => {
17632
- const { shape: shape2, labels } = loader[resolution];
17633
- const height = shape2[labels.indexOf("y")];
17634
- const width = shape2[labels.indexOf("x")];
17635
- const depth = shape2[labels.indexOf("z")];
17636
- const depthDownsampled = Math.max(1, depth >> resolution);
17637
- const totalBytes = 4 * height * width * depthDownsampled;
17638
- return {
17639
- height,
17640
- width,
17641
- depthDownsampled,
17642
- totalBytes
17643
- };
17644
- };
17645
- const canLoadResolution = (loader, resolution) => {
17646
- var _a2, _b, _c;
17647
- const { totalBytes, height, width, depthDownsampled } = getStatsForResolution(loader, resolution);
17648
- const maxHeapSize = ((_a2 = window.performance) == null ? void 0 : _a2.memory) && ((_c = (_b = window.performance) == null ? void 0 : _b.memory) == null ? void 0 : _c.jsHeapSizeLimit) / 2;
17649
- const maxSize = maxHeapSize || 2 ** 31 - 1;
17650
- return totalBytes < maxSize && height <= 2048 && depthDownsampled <= 2048 && width <= 2048 && depthDownsampled > 1;
17651
- };
17652
17805
  let getRandomValues$1;
17653
17806
  const rnds8$1 = new Uint8Array(16);
17654
17807
  function rng$1() {
@@ -27347,6 +27500,8 @@ const annDataObsSets = z.array(z.object({
27347
27500
  ]),
27348
27501
  scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
27349
27502
  }));
27503
+ const annDataObsSpots = annDataObsm;
27504
+ const annDataObsPoints = annDataObsm;
27350
27505
  const annDataObsLocations = annDataObsm;
27351
27506
  const annDataObsEmbedding = annDataObsm;
27352
27507
  const annDataObsSegmentations = annDataObs;
@@ -27373,10 +27528,21 @@ z.object({
27373
27528
  z.object({
27374
27529
  obsIndex: z.string(),
27375
27530
  obsEmbedding: z.array(z.string()).length(2)
27531
+ // TODO: support 3D?
27532
+ });
27533
+ z.object({
27534
+ obsIndex: z.string(),
27535
+ obsSpots: z.array(z.string()).length(2)
27536
+ // TODO: support 3D?
27537
+ });
27538
+ z.object({
27539
+ obsIndex: z.string(),
27540
+ obsPoints: z.array(z.string()).length(3)
27376
27541
  });
27377
27542
  z.object({
27378
27543
  obsIndex: z.string(),
27379
27544
  obsLocations: z.array(z.string()).length(2)
27545
+ // TODO: support 3D?
27380
27546
  });
27381
27547
  z.object({
27382
27548
  obsIndex: z.string(),
@@ -27408,6 +27574,8 @@ z.object({
27408
27574
  ]),
27409
27575
  obsFeatureMatrix: annDataObsFeatureMatrix,
27410
27576
  obsSets: annDataObsSets,
27577
+ obsSpots: annDataObsSpots,
27578
+ obsPoints: annDataObsPoints,
27411
27579
  obsLocations: annDataObsLocations,
27412
27580
  obsSegmentations: annDataObsSegmentations,
27413
27581
  obsEmbedding: z.union([
@@ -34709,7 +34877,7 @@ function negate(out, a2) {
34709
34877
  out[2] = -a2[2];
34710
34878
  return out;
34711
34879
  }
34712
- function normalize$3(out, a2) {
34880
+ function normalize$4(out, a2) {
34713
34881
  var x2 = a2[0];
34714
34882
  var y2 = a2[1];
34715
34883
  var z2 = a2[2];
@@ -36018,7 +36186,7 @@ function squaredLength$1(a2) {
36018
36186
  var w2 = a2[3];
36019
36187
  return x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2;
36020
36188
  }
36021
- function normalize$2(out, a2) {
36189
+ function normalize$3(out, a2) {
36022
36190
  var x2 = a2[0];
36023
36191
  var y2 = a2[1];
36024
36192
  var z2 = a2[2];
@@ -36655,7 +36823,7 @@ var dot$1 = dot$2;
36655
36823
  var lerp$1 = lerp$2;
36656
36824
  var length$2 = length$3;
36657
36825
  var squaredLength = squaredLength$1;
36658
- var normalize$1 = normalize$2;
36826
+ var normalize$2 = normalize$3;
36659
36827
  var rotationTo = function() {
36660
36828
  var tmpvec3 = create$3();
36661
36829
  var xUnitVec3 = fromValues(1, 0, 0);
@@ -36666,7 +36834,7 @@ var rotationTo = function() {
36666
36834
  cross(tmpvec3, xUnitVec3, a2);
36667
36835
  if (len(tmpvec3) < 1e-6)
36668
36836
  cross(tmpvec3, yUnitVec3, a2);
36669
- normalize$3(tmpvec3, tmpvec3);
36837
+ normalize$4(tmpvec3, tmpvec3);
36670
36838
  setAxisAngle(out, tmpvec3, Math.PI);
36671
36839
  return out;
36672
36840
  } else if (dot2 > 0.999999) {
@@ -36681,7 +36849,7 @@ var rotationTo = function() {
36681
36849
  out[1] = tmpvec3[1];
36682
36850
  out[2] = tmpvec3[2];
36683
36851
  out[3] = 1 + dot2;
36684
- return normalize$1(out, out);
36852
+ return normalize$2(out, out);
36685
36853
  }
36686
36854
  };
36687
36855
  }();
@@ -36707,7 +36875,7 @@ var rotationTo = function() {
36707
36875
  matr[2] = -view[0];
36708
36876
  matr[5] = -view[1];
36709
36877
  matr[8] = -view[2];
36710
- return normalize$1(out, fromMat3(out, matr));
36878
+ return normalize$2(out, fromMat3(out, matr));
36711
36879
  };
36712
36880
  })();
36713
36881
  const IDENTITY_QUATERNION = [0, 0, 0, 1];
@@ -38950,17 +39118,17 @@ let COLOR;
38950
39118
  COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
38951
39119
  COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
38952
39120
  })(COLOR || (COLOR = {}));
38953
- function getColor(color) {
39121
+ function getColor$1(color) {
38954
39122
  return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
38955
39123
  }
38956
39124
  function addColor(string, color, background) {
38957
39125
  if (!isBrowser$1 && typeof string === "string") {
38958
39126
  if (color) {
38959
- color = getColor(color);
39127
+ color = getColor$1(color);
38960
39128
  string = "\x1B[".concat(color, "m").concat(string, "\x1B[39m");
38961
39129
  }
38962
39130
  if (background) {
38963
- color = getColor(background);
39131
+ color = getColor$1(background);
38964
39132
  string = "\x1B[".concat(background + 10, "m").concat(string, "\x1B[49m");
38965
39133
  }
38966
39134
  }
@@ -69070,7 +69238,7 @@ function copyFlatRing(target, targetStartIndex, positions, size, srcStartIndex =
69070
69238
  modifyPolygonWindingDirection(target, windingDirection, windingOptions);
69071
69239
  return targetIndex;
69072
69240
  }
69073
- function normalize(polygon2, positionSize) {
69241
+ function normalize$1(polygon2, positionSize) {
69074
69242
  validate(polygon2);
69075
69243
  const positions = [];
69076
69244
  const holeIndices = [];
@@ -69176,7 +69344,7 @@ class PolygonTesselator extends Tesselator {
69176
69344
  }
69177
69345
  normalizeGeometry(polygon2) {
69178
69346
  if (this.normalize) {
69179
- const normalizedPolygon = normalize(polygon2, this.positionSize);
69347
+ const normalizedPolygon = normalize$1(polygon2, this.positionSize);
69180
69348
  if (this.opts.resolution) {
69181
69349
  return cutPolygonByGrid(getPositions(normalizedPolygon), getHoleIndices(normalizedPolygon), {
69182
69350
  size: this.positionSize,
@@ -69798,7 +69966,7 @@ class PolygonLayer extends CompositeLayer {
69798
69966
  objectInfo.index++;
69799
69967
  let polygon2 = getPolygon(object2, objectInfo);
69800
69968
  if (_normalize) {
69801
- polygon2 = normalize(polygon2, positionSize);
69969
+ polygon2 = normalize$1(polygon2, positionSize);
69802
69970
  }
69803
69971
  const {
69804
69972
  holeIndices
@@ -113625,7 +113793,7 @@ function clipExtent(x02, y02, x12, y12) {
113625
113793
  return clipStream;
113626
113794
  };
113627
113795
  }
113628
- function extent() {
113796
+ function extent$1() {
113629
113797
  var x02 = 0, y02 = 0, x12 = 960, y12 = 500, cache2, cacheStream, clip2;
113630
113798
  return clip2 = {
113631
113799
  stream: function(stream) {
@@ -115032,7 +115200,7 @@ const d3Geo$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
115032
115200
  geoBounds: bounds,
115033
115201
  geoCentroid: centroid$3,
115034
115202
  geoCircle: circle$2,
115035
- geoClipExtent: extent,
115203
+ geoClipExtent: extent$1,
115036
115204
  geoConicConformal: conicConformal,
115037
115205
  geoConicConformalRaw: conicConformalRaw,
115038
115206
  geoConicEqualArea: conicEqualArea,
@@ -134235,28 +134403,38 @@ const PASS_THROUGH_PROPS = [
134235
134403
  ];
134236
134404
  class SelectionLayer extends CompositeLayer {
134237
134405
  _selectPolygonObjects(coordinates2) {
134238
- const { onSelect, getCellCoords, cellsQuadTree, flipY } = this.props;
134406
+ const { flipY, obsLayers } = this.props;
134239
134407
  const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
134240
134408
  const selectedPolygon = polygon(flippedCoordinates);
134241
- const pickingInfos = [];
134242
- cellsQuadTree.visit((node2, x02, y02, x12, y12) => {
134243
- const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
134244
- const nodePolygon = polygon(nodePoints);
134245
- const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
134246
- const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
134247
- const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
134248
- if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
134249
- return true;
134250
- }
134251
- if (node2.data && booleanPointInPolygon$1(point([].slice.call(getCellCoords(node2.data))), selectedPolygon)) {
134252
- pickingInfos.push(node2.data);
134253
- }
134254
- return false;
134409
+ obsLayers.forEach((obsLayer) => {
134410
+ const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
134411
+ const pickingInfos = [];
134412
+ obsQuadTree == null ? void 0 : obsQuadTree.visit((node2, x02, y02, x12, y12) => {
134413
+ const nodePoints = [[[x02, y02], [x12, y02], [x12, y12], [x02, y12], [x02, y02]]];
134414
+ const nodePolygon = polygon(nodePoints);
134415
+ const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
134416
+ const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
134417
+ const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
134418
+ if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
134419
+ return true;
134420
+ }
134421
+ if (node2.data && booleanPointInPolygon$1(point([].slice.call(getObsCoords(node2.data))), selectedPolygon)) {
134422
+ pickingInfos.push(node2.data);
134423
+ }
134424
+ return false;
134425
+ });
134426
+ const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
134427
+ layerOnSelect(pickingIds);
134428
+ });
134429
+ }
134430
+ _selectEmpty() {
134431
+ const { obsLayers } = this.props;
134432
+ obsLayers.forEach((obsLayer) => {
134433
+ const { onSelect: layerOnSelect } = obsLayer;
134434
+ layerOnSelect([]);
134255
134435
  });
134256
- onSelect({ pickingInfos });
134257
134436
  }
134258
134437
  renderLayers() {
134259
- const { onSelect } = this.props;
134260
134438
  const mode = MODE_MAP[this.props.selectionType] || distEs6.ViewMode;
134261
134439
  const inheritedProps = {};
134262
134440
  PASS_THROUGH_PROPS.forEach((p) => {
@@ -134278,7 +134456,7 @@ class SelectionLayer extends CompositeLayer {
134278
134456
  const { coordinates: coordinates2 } = updatedData.features[0].geometry;
134279
134457
  this._selectPolygonObjects(coordinates2);
134280
134458
  } else if (editType === EDIT_TYPE_CLEAR) {
134281
- onSelect({ pickingInfos: [] });
134459
+ this._selectEmpty();
134282
134460
  }
134283
134461
  },
134284
134462
  _subLayerProps: {
@@ -135418,16 +135596,16 @@ function addDecoder(cases, importFn) {
135418
135596
  }
135419
135597
  cases.forEach((c) => registry$1.set(c, importFn));
135420
135598
  }
135421
- addDecoder([void 0, 1], () => import("./raw-e59a20ba.js").then((m) => m.default));
135422
- addDecoder(5, () => import("./lzw-328dcf22.js").then((m) => m.default));
135599
+ addDecoder([void 0, 1], () => import("./raw-dd52cf7d.js").then((m) => m.default));
135600
+ addDecoder(5, () => import("./lzw-3b2cc6cd.js").then((m) => m.default));
135423
135601
  addDecoder(6, () => {
135424
135602
  throw new Error("old style JPEG compression is not supported.");
135425
135603
  });
135426
- addDecoder(7, () => import("./jpeg-5e6a02ae.js").then((m) => m.default));
135427
- addDecoder([8, 32946], () => import("./deflate-460ebda8.js").then((m) => m.default));
135428
- addDecoder(32773, () => import("./packbits-d1842d12.js").then((m) => m.default));
135429
- addDecoder(34887, () => import("./lerc-f147b9b3.js").then((m) => m.default));
135430
- addDecoder(50001, () => import("./webimage-30f949aa.js").then((m) => m.default));
135604
+ addDecoder(7, () => import("./jpeg-932c57f1.js").then((m) => m.default));
135605
+ addDecoder([8, 32946], () => import("./deflate-22ea8fc3.js").then((m) => m.default));
135606
+ addDecoder(32773, () => import("./packbits-c8220e7f.js").then((m) => m.default));
135607
+ addDecoder(34887, () => import("./lerc-0db1b156.js").then((m) => m.default));
135608
+ addDecoder(50001, () => import("./webimage-d7166a5a.js").then((m) => m.default));
135431
135609
  function decodeRowAcc(row, stride) {
135432
135610
  let length2 = row.length - stride;
135433
135611
  let offset4 = 0;
@@ -142322,7 +142500,7 @@ const SIGNAL_ABORTED = "__vivSignalAborted";
142322
142500
  addDecoder(5, () => LZWDecoder);
142323
142501
  const MAX_COLOR_INTENSITY = 255;
142324
142502
  const DEFAULT_COLOR_OFF = [0, 0, 0];
142325
- const MAX_CHANNELS = 6;
142503
+ const MAX_CHANNELS$1 = 6;
142326
142504
  const DEFAULT_FONT_FAMILY = "-apple-system, 'Helvetica Neue', Arial, sans-serif";
142327
142505
  const DTYPE_VALUES = {
142328
142506
  Uint8: {
@@ -143844,7 +144022,7 @@ const AdditiveColormapExtension = class extends LayerExtension {
143844
144022
  };
143845
144023
  AdditiveColormapExtension.extensionName = "AdditiveColormapExtension";
143846
144024
  AdditiveColormapExtension.defaultProps = defaultProps$4$1;
143847
- const fs$1$1 = `uniform vec3 transparentColor;
144025
+ const fs$1$2 = `uniform vec3 transparentColor;
143848
144026
  uniform bool useTransparentColor;
143849
144027
  uniform float opacity;
143850
144028
 
@@ -143871,12 +144049,12 @@ rgba = apply_opacity(rgb);
143871
144049
  `;
143872
144050
  const colorPalette = {
143873
144051
  name: "color-palette-module",
143874
- fs: fs$1$1,
144052
+ fs: fs$1$2,
143875
144053
  inject: {
143876
144054
  "fs:DECKGL_MUTATE_COLOR": DECKGL_MUTATE_COLOR
143877
144055
  }
143878
144056
  };
143879
- function padWithDefault$2(arr, defaultValue2, padWidth) {
144057
+ function padWithDefault$3(arr, defaultValue2, padWidth) {
143880
144058
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
143881
144059
  arr.push(defaultValue2);
143882
144060
  }
@@ -143902,8 +144080,8 @@ function padColors({ colors, channelsVisible }) {
143902
144080
  const newColors = colors.map(
143903
144081
  (color, i2) => channelsVisible[i2] ? color.map((c) => c / MAX_COLOR_INTENSITY) : DEFAULT_COLOR_OFF
143904
144082
  );
143905
- const padSize = MAX_CHANNELS - newColors.length;
143906
- const paddedColors = padWithDefault$2(
144083
+ const padSize = MAX_CHANNELS$1 - newColors.length;
144084
+ const paddedColors = padWithDefault$3(
143907
144085
  newColors,
143908
144086
  DEFAULT_COLOR_OFF,
143909
144087
  padSize
@@ -144147,7 +144325,7 @@ vec4 colormap(float intensity, float opacity) {
144147
144325
  fs: fs2
144148
144326
  };
144149
144327
  }
144150
- const defaultProps$1$1 = {
144328
+ const defaultProps$1$2 = {
144151
144329
  colormap: { type: "string", value: "viridis", compare: true }
144152
144330
  };
144153
144331
  const BaseExtension$1 = class extends LayerExtension {
@@ -144157,7 +144335,7 @@ const BaseExtension$1 = class extends LayerExtension {
144157
144335
  }
144158
144336
  getShaders() {
144159
144337
  var _a2;
144160
- const name2 = ((_a2 = this == null ? void 0 : this.props) == null ? void 0 : _a2.colormap) || defaultProps$1$1.colormap.value;
144338
+ const name2 = ((_a2 = this == null ? void 0 : this.props) == null ? void 0 : _a2.colormap) || defaultProps$1$2.colormap.value;
144161
144339
  const apply_cmap = cmaps[name2];
144162
144340
  return {
144163
144341
  ...super.getShaders(),
@@ -144176,7 +144354,7 @@ const BaseExtension$1 = class extends LayerExtension {
144176
144354
  }
144177
144355
  };
144178
144356
  BaseExtension$1.extensionName = "BaseExtension";
144179
- BaseExtension$1.defaultProps = defaultProps$1$1;
144357
+ BaseExtension$1.defaultProps = defaultProps$1$2;
144180
144358
  const _BEFORE_RENDER$5 = "";
144181
144359
  const _RENDER$5 = ` float intensityArray[6] = float[6](intensityValue0, intensityValue1, intensityValue2, intensityValue3, intensityValue4, intensityValue5);
144182
144360
  float total = 0.0;
@@ -144375,7 +144553,7 @@ const channels = {
144375
144553
  function range(len2) {
144376
144554
  return [...Array(len2).keys()];
144377
144555
  }
144378
- function padWithDefault$1(arr, defaultValue2, padWidth) {
144556
+ function padWithDefault$2(arr, defaultValue2, padWidth) {
144379
144557
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
144380
144558
  arr.push(defaultValue2);
144381
144559
  }
@@ -144399,13 +144577,13 @@ function padContrastLimits({
144399
144577
  const newContrastLimits = contrastLimits.map(
144400
144578
  (slider, i2) => channelsVisible[i2] ? slider : [maxSliderValue, maxSliderValue]
144401
144579
  );
144402
- const padSize = MAX_CHANNELS - newContrastLimits.length;
144580
+ const padSize = MAX_CHANNELS$1 - newContrastLimits.length;
144403
144581
  if (padSize < 0) {
144404
144582
  throw Error(
144405
144583
  `${newContrastLimits.lengths} channels passed in, but only 6 are allowed.`
144406
144584
  );
144407
144585
  }
144408
- const paddedContrastLimits = padWithDefault$1(
144586
+ const paddedContrastLimits = padWithDefault$2(
144409
144587
  newContrastLimits,
144410
144588
  [maxSliderValue, maxSliderValue],
144411
144589
  padSize
@@ -144435,7 +144613,7 @@ function makeBoundingBox(viewState) {
144435
144613
  viewport.unproject([0, viewport.height])
144436
144614
  ];
144437
144615
  }
144438
- const fs$1 = `#define SHADER_NAME xr-layer-fragment-shader
144616
+ const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
144439
144617
 
144440
144618
  precision highp float;
144441
144619
  precision highp int;
@@ -144476,7 +144654,7 @@ void main() {
144476
144654
  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
144477
144655
  }
144478
144656
  `;
144479
- const vs$1 = `#define SHADER_NAME xr-layer-vertex-shader
144657
+ const vs$1$1 = `#define SHADER_NAME xr-layer-vertex-shader
144480
144658
 
144481
144659
  attribute vec2 texCoords;
144482
144660
  attribute vec3 positions;
@@ -144495,7 +144673,7 @@ void main(void) {
144495
144673
  DECKGL_FILTER_COLOR(color, geometry);
144496
144674
  }
144497
144675
  `;
144498
- const coreShaderModule = { fs: fs$1, vs: vs$1 };
144676
+ const coreShaderModule = { fs: fs$1$1, vs: vs$1$1 };
144499
144677
  function validateWebGL2Filter(gl, interpolation) {
144500
144678
  const canShowFloat = hasFeature(gl, FEATURES$1.TEXTURE_FLOAT);
144501
144679
  const canShowLinear = hasFeature(gl, FEATURES$1.TEXTURE_FILTER_LINEAR_FLOAT);
@@ -145586,7 +145764,7 @@ const CUBE_STRIP = [
145586
145764
  0
145587
145765
  ];
145588
145766
  const NUM_PLANES_DEFAULT = 1;
145589
- const defaultProps$1 = {
145767
+ const defaultProps$1$1 = {
145590
145768
  pickable: false,
145591
145769
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
145592
145770
  channelData: { type: "object", value: {}, compare: true },
@@ -145728,7 +145906,7 @@ const XR3DLayer = class extends Layer {
145728
145906
  });
145729
145907
  const invertedScaleMatrix = scaleMatrix.clone().invert();
145730
145908
  const invertedResolutionMatrix = resolutionMatrix.clone().invert();
145731
- const paddedClippingPlanes = padWithDefault$1(
145909
+ const paddedClippingPlanes = padWithDefault$2(
145732
145910
  clippingPlanes.map(
145733
145911
  (p) => p.clone().transform(invertedScaleMatrix).transform(invertedResolutionMatrix)
145734
145912
  ),
@@ -145818,7 +145996,7 @@ const XR3DLayer = class extends Layer {
145818
145996
  }
145819
145997
  };
145820
145998
  XR3DLayer.layerName = "XR3DLayer";
145821
- XR3DLayer.defaultProps = defaultProps$1;
145999
+ XR3DLayer.defaultProps = defaultProps$1$1;
145822
146000
  async function getVolume({
145823
146001
  source,
145824
146002
  selection,
@@ -146065,6 +146243,220 @@ function getDefaultInitialViewState(loader, viewSize, zoomBackOff = 0, use3d = f
146065
146243
  };
146066
146244
  return loaderInitialViewState;
146067
146245
  }
146246
+ const vs$1 = `
146247
+ #define SHADER_NAME bitmask-layer-vertex-shader
146248
+
146249
+ attribute vec2 texCoords;
146250
+ attribute vec3 positions;
146251
+ attribute vec3 positions64Low;
146252
+ attribute vec3 instancePickingColors;
146253
+
146254
+ varying vec2 vTexCoord;
146255
+
146256
+ void main(void) {
146257
+ geometry.worldPosition = positions;
146258
+ geometry.uv = texCoords;
146259
+ geometry.pickingColor = instancePickingColors;
146260
+ gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
146261
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
146262
+ vTexCoord = texCoords;
146263
+ vec4 color = vec4(0.0);
146264
+ DECKGL_FILTER_COLOR(color, geometry);
146265
+ }
146266
+ `;
146267
+ const fs$1 = `
146268
+ #define SHADER_NAME bitmask-layer-fragment-shader
146269
+ precision highp float;
146270
+
146271
+ ${colormaps}
146272
+
146273
+ // Data (mask) texture
146274
+ uniform sampler2D channel0;
146275
+ uniform sampler2D channel1;
146276
+ uniform sampler2D channel2;
146277
+ uniform sampler2D channel3;
146278
+ uniform sampler2D channel4;
146279
+ uniform sampler2D channel5;
146280
+
146281
+ // Color texture
146282
+ uniform sampler2D colorTex;
146283
+ uniform float colorTexHeight;
146284
+ uniform float colorTexWidth;
146285
+ uniform float hovered;
146286
+ // range
146287
+ uniform bool channelsVisible[6];
146288
+
146289
+ // Expression mapping
146290
+ uniform vec2 uColorScaleRange;
146291
+ uniform bool uIsExpressionMode;
146292
+ uniform sampler2D expressionTex;
146293
+
146294
+ // opacity
146295
+ uniform float opacity;
146296
+
146297
+ varying vec2 vTexCoord;
146298
+
146299
+ vec4 sampleAndGetColor(sampler2D dataTex, vec2 coord, bool isOn){
146300
+ float sampledData = texture(dataTex, coord).r;
146301
+ vec4 hoveredColor = float(sampledData == hovered && sampledData > 0. && hovered > 0.) * vec4(0., 0., 1., 1.);
146302
+ // Colors are laid out corresponding to ids in row-major order in the texture. So if width of the texture is 10, and you want ID 25,
146303
+ // you need coordinate (1, 4) (i.e 2 rows down, and 5 columns over indexed from 0 for a total of 25 units covered in row major order).
146304
+ vec2 colorTexCoord = vec2(mod(sampledData, colorTexWidth) / colorTexWidth, floor(sampledData / colorTexWidth) / (colorTexHeight - 1.));
146305
+ float expressionValue = texture(expressionTex, colorTexCoord).r / 255.;
146306
+ float scaledExpressionValue = (expressionValue - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));
146307
+ vec4 sampledColor = float(uIsExpressionMode) * COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)) + (1. - float(uIsExpressionMode)) * vec4(texture(colorTex, colorTexCoord).rgb, 1.);
146308
+ // Only return a color if the data is non-zero.
146309
+ return max(0., min(sampledData, 1.)) * float(isOn) * (sampledColor + hoveredColor);
146310
+ }
146311
+
146312
+ void main() {
146313
+
146314
+ gl_FragColor = sampleAndGetColor(channel0, vTexCoord, channelsVisible[0]);
146315
+
146316
+ // If the sampled color and the currently stored color (gl_FragColor) are identical, don't blend and use the sampled color,
146317
+ // otherwise just use the currently stored color. Repeat this for all channels.
146318
+ vec4 sampledColor = sampleAndGetColor(channel1, vTexCoord, channelsVisible[1]);
146319
+ gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146320
+ sampledColor = sampleAndGetColor(channel2, vTexCoord, channelsVisible[2]);
146321
+ gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146322
+ sampledColor = sampleAndGetColor(channel3, vTexCoord, channelsVisible[3]);
146323
+ gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146324
+ sampledColor = sampleAndGetColor(channel4, vTexCoord, channelsVisible[4]);
146325
+ gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146326
+ sampledColor = sampleAndGetColor(channel5, vTexCoord, channelsVisible[5]);
146327
+ gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146328
+ // Apply the opacity if there is pixel data, and if the pixel data is empty i.e no segmentation, use 0 opacity.
146329
+ gl_FragColor = vec4(gl_FragColor.rgb, (gl_FragColor.rgb == vec3(0., 0., 0.)) ? 0.0 : opacity);
146330
+
146331
+ geometry.uv = vTexCoord;
146332
+ DECKGL_FILTER_COLOR(gl_FragColor, geometry);
146333
+ }
146334
+ `;
146335
+ function padWithDefault$1(arr, defaultValue2, padWidth) {
146336
+ const newArr = [...arr];
146337
+ for (let i2 = 0; i2 < padWidth; i2 += 1) {
146338
+ newArr.push(defaultValue2);
146339
+ }
146340
+ return newArr;
146341
+ }
146342
+ const defaultProps$1 = {
146343
+ hoveredCell: { type: "number", value: null, compare: true },
146344
+ // We do not want to deep-compare cellColorData,
146345
+ // as it is potentially a TypedArray with millions of elements.
146346
+ // For `compare`: "if a number is supplied, indicates the maximum depth to deep-compare,
146347
+ // where 0 is shallow comparison and -1 is infinite depth. true is equivalent to 1."
146348
+ // Reference: https://deck.gl/docs/developer-guide/custom-layers/prop-types#array
146349
+ cellColorData: { type: "object", value: null, compare: 0 },
146350
+ colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
146351
+ // Same as with cellColorData, we do not want to deep-compare expressionData.
146352
+ expressionData: { type: "object", value: null, compare: 0 }
146353
+ };
146354
+ let BitmaskLayer$1 = class BitmaskLayer extends XRLayer {
146355
+ // eslint-disable-next-line class-methods-use-this
146356
+ getShaders() {
146357
+ const { colormap } = this.props;
146358
+ return {
146359
+ fs: fs$1,
146360
+ vs: vs$1,
146361
+ modules: [project32, picking],
146362
+ defines: {
146363
+ [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
146364
+ }
146365
+ };
146366
+ }
146367
+ updateState({ props: props2, oldProps, changeFlags }) {
146368
+ super.updateState({ props: props2, oldProps, changeFlags });
146369
+ if (props2.cellColorData !== oldProps.cellColorData) {
146370
+ this.setColorTexture();
146371
+ }
146372
+ if (props2.expressionData !== oldProps.expressionData) {
146373
+ const { expressionData, cellTexHeight, cellTexWidth } = this.props;
146374
+ const expressionTex = this.dataToTexture(expressionData, cellTexWidth, cellTexHeight);
146375
+ this.setState({ expressionTex });
146376
+ }
146377
+ if (props2.colormap !== oldProps.colormap) {
146378
+ const { gl } = this.context;
146379
+ if (this.state.model) {
146380
+ this.state.model.delete();
146381
+ }
146382
+ this.setState({ model: this._getModel(gl) });
146383
+ this.getAttributeManager().invalidateAll();
146384
+ }
146385
+ }
146386
+ setColorTexture() {
146387
+ const { cellColorData: data, cellTexHeight: height, cellTexWidth: width } = this.props;
146388
+ const colorTex = new Texture2D(this.context.gl, {
146389
+ width,
146390
+ height,
146391
+ // Only use Float32 so we don't have to write two shaders
146392
+ data,
146393
+ // we don't want or need mimaps
146394
+ mipmaps: false,
146395
+ parameters: {
146396
+ // NEAREST for integer data
146397
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
146398
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
146399
+ // CLAMP_TO_EDGE to remove tile artifacts
146400
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
146401
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
146402
+ },
146403
+ format: GL$1.RGB,
146404
+ dataFormat: GL$1.RGB,
146405
+ type: GL$1.UNSIGNED_BYTE
146406
+ });
146407
+ this.setState({ colorTex });
146408
+ }
146409
+ draw(opts2) {
146410
+ const { uniforms } = opts2;
146411
+ const { channelsVisible, hoveredCell, colorScaleLo, colorScaleHi, isExpressionMode } = this.props;
146412
+ const { textures, model, colorTex, expressionTex } = this.state;
146413
+ if (textures && model && colorTex) {
146414
+ model.setUniforms(Object.assign({}, uniforms, {
146415
+ hovered: hoveredCell || 0,
146416
+ colorTex,
146417
+ expressionTex,
146418
+ colorTexHeight: colorTex.height,
146419
+ colorTexWidth: colorTex.width,
146420
+ channelsVisible: padWithDefault$1(
146421
+ channelsVisible,
146422
+ false,
146423
+ // There are six texture entries on the shaders
146424
+ 6 - channelsVisible.length
146425
+ ),
146426
+ uColorScaleRange: [colorScaleLo, colorScaleHi],
146427
+ uIsExpressionMode: isExpressionMode,
146428
+ ...textures
146429
+ })).draw();
146430
+ }
146431
+ }
146432
+ /**
146433
+ * This function creates textures from the data
146434
+ */
146435
+ dataToTexture(data, width, height) {
146436
+ const isWebGL2On = isWebGL2$1(this.context.gl);
146437
+ return new Texture2D(this.context.gl, {
146438
+ width,
146439
+ height,
146440
+ // Only use Float32 so we don't have to write two shaders
146441
+ data: new Float32Array(data),
146442
+ // we don't want or need mimaps
146443
+ mipmaps: false,
146444
+ parameters: {
146445
+ // NEAREST for integer data
146446
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
146447
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
146448
+ // CLAMP_TO_EDGE to remove tile artifacts
146449
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
146450
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
146451
+ },
146452
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
146453
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
146454
+ type: GL$1.FLOAT
146455
+ });
146456
+ }
146457
+ };
146458
+ BitmaskLayer$1.layerName = "BitmaskLayer";
146459
+ BitmaskLayer$1.defaultProps = defaultProps$1;
146068
146460
  const vs = `
146069
146461
  #define SHADER_NAME bitmask-layer-vertex-shader
146070
146462
 
@@ -146092,6 +146484,9 @@ precision highp float;
146092
146484
 
146093
146485
  ${colormaps}
146094
146486
 
146487
+ // Note: can have a maximum of 16 textures in most browsers
146488
+ // Reference: https://webglreport.com/
146489
+
146095
146490
  // Data (mask) texture
146096
146491
  uniform sampler2D channel0;
146097
146492
  uniform sampler2D channel1;
@@ -146099,61 +146494,285 @@ uniform sampler2D channel2;
146099
146494
  uniform sampler2D channel3;
146100
146495
  uniform sampler2D channel4;
146101
146496
  uniform sampler2D channel5;
146497
+ uniform sampler2D channel6;
146102
146498
 
146103
146499
  // Color texture
146500
+ uniform float hovered;
146501
+
146502
+ // Channel-specific properties
146503
+ uniform bool channelsVisible[7];
146504
+ uniform float channelOpacities[7];
146505
+ uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
146506
+ uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
146507
+
146508
+ // TODO: can array of tuples/vec2 be used?
146509
+ uniform float channelColormapRangeStarts[7];
146510
+ uniform float channelColormapRangeEnds[7];
146511
+
146512
+ uniform float multiFeatureTexSize;
146513
+
146514
+ // Use one expressionTex for all channels, using an offset mechanism.
146515
+ uniform sampler2D valueTex;
146516
+ uniform float valueTexOffsets[7];
146517
+ uniform float valueTexHeight;
146518
+
146519
+ // Textures for set colors, using the same offset mechanism.
146104
146520
  uniform sampler2D colorTex;
146521
+ uniform float colorTexOffsets[7];
146105
146522
  uniform float colorTexHeight;
146106
- uniform float colorTexWidth;
146107
- uniform float hovered;
146108
- // range
146109
- uniform bool channelsVisible[6];
146110
146523
 
146111
- // Expression mapping
146112
- uniform vec2 uColorScaleRange;
146113
- uniform bool uIsExpressionMode;
146114
- uniform sampler2D expressionTex;
146524
+
146525
+ // Static colors
146526
+ // TODO: For some reason I cannot use uniform vec3 colors[7]; and i cannot figure out why.
146527
+ uniform vec3 color0;
146528
+ uniform vec3 color1;
146529
+ uniform vec3 color2;
146530
+ uniform vec3 color3;
146531
+ uniform vec3 color4;
146532
+ uniform vec3 color5;
146533
+ uniform vec3 color6;
146534
+
146535
+ // Info for edge-only mode
146536
+ uniform float scaleFactor;
146537
+ uniform bool channelsFilled[7];
146538
+ uniform float channelStrokeWidths[7];
146115
146539
 
146116
146540
  // opacity
146117
146541
  uniform float opacity;
146118
146542
 
146119
146543
  varying vec2 vTexCoord;
146120
146544
 
146121
- vec4 sampleAndGetColor(sampler2D dataTex, vec2 coord, bool isOn){
146545
+ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float strokeWidth, bool isOn) {
146122
146546
  float sampledData = texture(dataTex, coord).r;
146547
+ float clampedSampledData = max(0., min(sampledData, 1.));
146548
+
146549
+ bool isEdge = true;
146550
+
146551
+ if(!isFilled) {
146552
+ vec2 uTextureSize = vec2(2048.0, 2048.0);
146553
+ vec2 onePixel = vec2(1.0, 1.0) / uTextureSize;
146554
+
146555
+ // Vary the edgeSize based on user-defined stroke width.
146556
+ float edgeSize = 150.0 * strokeWidth * scaleFactor;
146557
+
146558
+ float pixN = texture(dataTex, coord + vec2(0.0, onePixel.y * edgeSize)).r;
146559
+ float pixS = texture(dataTex, coord - vec2(0.0, onePixel.y * edgeSize)).r;
146560
+ float pixW = texture(dataTex, coord + vec2(onePixel.x * edgeSize, 0.0)).r;
146561
+ float pixE = texture(dataTex, coord - vec2(onePixel.x * edgeSize, 0.0)).r;
146562
+
146563
+ float pixNW = texture(dataTex, coord + vec2(onePixel.y * edgeSize, onePixel.y * edgeSize)).r;
146564
+ float pixNE = texture(dataTex, coord + vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
146565
+ float pixSW = texture(dataTex, coord - vec2(onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
146566
+ float pixSE = texture(dataTex, coord - vec2(-1.0 * onePixel.x * edgeSize, onePixel.y * edgeSize)).r;
146567
+
146568
+ isEdge = (pixN != sampledData || pixS != sampledData || pixW != sampledData || pixE != sampledData || pixNW != sampledData || pixNE != sampledData || pixSW != sampledData || pixSE != sampledData);
146569
+ }
146570
+ // Return a tuple of (sampledData, isEdge)
146571
+ return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
146572
+ }
146573
+
146574
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
146575
+ float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
146576
+ float sampledData = sampledDataAndIsEdge.y;
146577
+ float isEdge = sampledDataAndIsEdge.z;
146578
+
146579
+
146123
146580
  vec4 hoveredColor = float(sampledData == hovered && sampledData > 0. && hovered > 0.) * vec4(0., 0., 1., 1.);
146581
+
146124
146582
  // Colors are laid out corresponding to ids in row-major order in the texture. So if width of the texture is 10, and you want ID 25,
146125
146583
  // you need coordinate (1, 4) (i.e 2 rows down, and 5 columns over indexed from 0 for a total of 25 units covered in row major order).
146126
- vec2 colorTexCoord = vec2(mod(sampledData, colorTexWidth) / colorTexWidth, floor(sampledData / colorTexWidth) / (colorTexHeight - 1.));
146127
- float expressionValue = texture(expressionTex, colorTexCoord).r / 255.;
146128
- float scaledExpressionValue = (expressionValue - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));
146129
- vec4 sampledColor = float(uIsExpressionMode) * COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)) + (1. - float(uIsExpressionMode)) * vec4(texture(colorTex, colorTexCoord).rgb, 1.);
146584
+ float offsetSampledData = sampledData + valueOffset - 1.0;
146585
+ vec2 colorTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
146586
+
146587
+ // Get expression value
146588
+ float expressionValue = texture(valueTex, colorTexCoord).r / 255.;
146589
+ float scaledExpressionValue = (expressionValue - rangeStart) / max(0.005, (rangeEnd - rangeStart));
146590
+
146591
+
146592
+ // Get set color index value
146593
+ vec2 setIndicesTexCoord = vec2(mod(offsetSampledData, multiFeatureTexSize) / multiFeatureTexSize, floor(offsetSampledData / multiFeatureTexSize) / (valueTexHeight - 1.));
146594
+ float setColorIndex = texture(valueTex, setIndicesTexCoord).r;
146595
+
146596
+ // Initialize to the default "null" color.
146597
+ vec3 setColor = vec3(200. / 255., 200. / 255., 200. / 255.);
146598
+ if(setColorIndex != 0.) {
146599
+ // Subtract one from setColorIndex because we have already checked for the "null" value.
146600
+ setColorIndex = setColorIndex - 1.;
146601
+
146602
+ float setColorOffsetR = (setColorIndex + setColorOffset) * 3.0 + 0.0;
146603
+ vec2 setColorTexCoordR = vec2(mod(setColorOffsetR, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetR / multiFeatureTexSize) / (colorTexHeight - 1.));
146604
+ float setColorR = texture(colorTex, setColorTexCoordR).r / 255.;
146605
+
146606
+ float setColorOffsetG = (setColorIndex + setColorOffset) * 3.0 + 1.0;
146607
+ vec2 setColorTexCoordG = vec2(mod(setColorOffsetG, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetG / multiFeatureTexSize) / (colorTexHeight - 1.));
146608
+ float setColorG = texture(colorTex, setColorTexCoordG).r / 255.;
146609
+
146610
+ float setColorOffsetB = (setColorIndex + setColorOffset) * 3.0 + 2.0;
146611
+ vec2 setColorTexCoordB = vec2(mod(setColorOffsetB, multiFeatureTexSize) / multiFeatureTexSize, floor(setColorOffsetB / multiFeatureTexSize) / (colorTexHeight - 1.));
146612
+ float setColorB = texture(colorTex, setColorTexCoordB).r / 255.;
146613
+
146614
+ setColor = vec3(setColorR, setColorG, setColorB);
146615
+ }
146616
+
146617
+
146618
+ vec4 sampledColor = (1. - (float(isStaticColorMode) + float(isSetColorMode))) * vec4(COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb, channelOpacity) + float(isStaticColorMode) * vec4(channelColor.rgb, channelOpacity) + float(isSetColorMode) * vec4(setColor, channelOpacity);
146130
146619
  // Only return a color if the data is non-zero.
146131
- return max(0., min(sampledData, 1.)) * float(isOn) * (sampledColor + hoveredColor);
146620
+
146621
+ return clampedSampledDataAndIsOn * isEdge * sampledColor;
146132
146622
  }
146133
146623
 
146134
146624
  void main() {
146135
146625
 
146136
- gl_FragColor = sampleAndGetColor(channel0, vTexCoord, channelsVisible[0]);
146626
+ // Get the color and alpha value for each channel.
146627
+ vec3 dat0 = sampleAndGetData(channel0, vTexCoord, channelsFilled[0], channelStrokeWidths[0], channelsVisible[0]);
146628
+ vec3 dat1 = sampleAndGetData(channel1, vTexCoord, channelsFilled[1], channelStrokeWidths[1], channelsVisible[1]);
146629
+ vec3 dat2 = sampleAndGetData(channel2, vTexCoord, channelsFilled[2], channelStrokeWidths[2], channelsVisible[2]);
146630
+ vec3 dat3 = sampleAndGetData(channel3, vTexCoord, channelsFilled[3], channelStrokeWidths[3], channelsVisible[3]);
146631
+ vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
146632
+ vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
146633
+ vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
146634
+
146635
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
146636
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
146637
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
146638
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
146639
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
146640
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
146641
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
146642
+
146643
+ // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
146644
+ float emptyDat = 0.;
146645
+ if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
146646
+ discard;
146647
+ }
146648
+
146649
+ // If the next channel color and the currently stored color (gl_FragColor) are identical,
146650
+ // or the next channel color is transparent black,
146651
+ // just use the currently stored color. Repeat this for all channels.
146137
146652
 
146138
- // If the sampled color and the currently stored color (gl_FragColor) are identical, don't blend and use the sampled color,
146139
- // otherwise just use the currently stored color. Repeat this for all channels.
146140
- vec4 sampledColor = sampleAndGetColor(channel1, vTexCoord, channelsVisible[1]);
146141
- gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146142
- sampledColor = sampleAndGetColor(channel2, vTexCoord, channelsVisible[2]);
146143
- gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146144
- sampledColor = sampleAndGetColor(channel3, vTexCoord, channelsVisible[3]);
146145
- gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146146
- sampledColor = sampleAndGetColor(channel4, vTexCoord, channelsVisible[4]);
146147
- gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146148
- sampledColor = sampleAndGetColor(channel5, vTexCoord, channelsVisible[5]);
146149
- gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;
146150
- // Apply the opacity if there is pixel data, and if the pixel data is empty i.e no segmentation, use 0 opacity.
146151
- gl_FragColor = vec4(gl_FragColor.rgb, (gl_FragColor.rgb == vec3(0., 0., 0.)) ? 0.0 : opacity);
146653
+ // Mix colors where necessary, using the alpha value of the next channel as the weight.
146654
+ // Use the maximum alpha value as the resulting alpha value.
146655
+ gl_FragColor = val0;
146656
+ gl_FragColor = (val1 == gl_FragColor || val1 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val1, val1.a).rgb, max(gl_FragColor.a, val1.a));
146657
+ gl_FragColor = (val2 == gl_FragColor || val2 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val2, val2.a).rgb, max(gl_FragColor.a, val2.a));
146658
+ gl_FragColor = (val3 == gl_FragColor || val3 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val3, val3.a).rgb, max(gl_FragColor.a, val3.a));
146659
+ gl_FragColor = (val4 == gl_FragColor || val4 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val4, val4.a).rgb, max(gl_FragColor.a, val4.a));
146660
+ gl_FragColor = (val5 == gl_FragColor || val5 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val5, val5.a).rgb, max(gl_FragColor.a, val5.a));
146661
+ gl_FragColor = (val6 == gl_FragColor || val6 == vec4(0.)) ? gl_FragColor : vec4(mix(gl_FragColor, val6, val6.a).rgb, max(gl_FragColor.a, val6.a));
146662
+
146663
+
146664
+
146665
+ // TODO: multiply the resulting channel-level opacity value by the layer-level opacity value.
146152
146666
 
146153
146667
  geometry.uv = vTexCoord;
146154
146668
  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
146155
146669
  }
146156
146670
  `;
146671
+ function extent(values2, valueof) {
146672
+ let min;
146673
+ let max;
146674
+ if (valueof === void 0) {
146675
+ for (const value of values2) {
146676
+ if (value != null) {
146677
+ if (min === void 0) {
146678
+ if (value >= value)
146679
+ min = max = value;
146680
+ } else {
146681
+ if (min > value)
146682
+ min = value;
146683
+ if (max < value)
146684
+ max = value;
146685
+ }
146686
+ }
146687
+ }
146688
+ } else {
146689
+ let index2 = -1;
146690
+ for (let value of values2) {
146691
+ if ((value = valueof(value, ++index2, values2)) != null) {
146692
+ if (min === void 0) {
146693
+ if (value >= value)
146694
+ min = max = value;
146695
+ } else {
146696
+ if (min > value)
146697
+ min = value;
146698
+ if (max < value)
146699
+ max = value;
146700
+ }
146701
+ }
146702
+ }
146703
+ }
146704
+ return [min, max];
146705
+ }
146706
+ function normalize(arr) {
146707
+ const [min, max] = extent(arr);
146708
+ const ratio = 255 / (max - min);
146709
+ const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min) * ratio)));
146710
+ return data;
146711
+ }
146712
+ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
146713
+ let totalValuesLength = 0;
146714
+ let totalColorsLength = 0;
146715
+ channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
146716
+ var _a2, _b, _c, _d, _e;
146717
+ if (isSetColorMode) {
146718
+ totalValuesLength += ((_b = (_a2 = setColorValues[channelIndex]) == null ? void 0 : _a2.obsIndex) == null ? void 0 : _b.length) || 0;
146719
+ totalColorsLength += (((_d = (_c = setColorValues[channelIndex]) == null ? void 0 : _c.setColors) == null ? void 0 : _d.length) || 0) * 3;
146720
+ } else {
146721
+ totalValuesLength += ((_e = multiFeatureValues[channelIndex]) == null ? void 0 : _e.length) || 0;
146722
+ }
146723
+ });
146724
+ const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
146725
+ const colorTexHeight = Math.max(2, Math.ceil(totalColorsLength / texSize));
146726
+ if (valueTexHeight > texSize) {
146727
+ console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
146728
+ }
146729
+ if (colorTexHeight > texSize) {
146730
+ console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
146731
+ }
146732
+ const totalData = new Uint8Array(texSize * valueTexHeight);
146733
+ const totalColors = new Uint8Array(texSize * colorTexHeight);
146734
+ const indicesOffsets = [];
146735
+ const colorsOffsets = [];
146736
+ let indexOffset = 0;
146737
+ let colorOffset = 0;
146738
+ channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
146739
+ if (isSetColorMode) {
146740
+ const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
146741
+ if (setColorIndices && setColors && obsIndex) {
146742
+ for (let i2 = 0; i2 < obsIndex.length; i2++) {
146743
+ const colorIndex = setColorIndices.get(String(i2 + 1));
146744
+ totalData[indexOffset + i2] = colorIndex === void 0 ? 0 : colorIndex + 1;
146745
+ }
146746
+ for (let i2 = 0; i2 < setColors.length; i2++) {
146747
+ const { color: [r2, g2, b] } = setColors[i2];
146748
+ totalColors[(colorOffset + i2) * 3 + 0] = r2;
146749
+ totalColors[(colorOffset + i2) * 3 + 1] = g2;
146750
+ totalColors[(colorOffset + i2) * 3 + 2] = b;
146751
+ }
146752
+ }
146753
+ indicesOffsets.push(indexOffset);
146754
+ colorsOffsets.push(colorOffset);
146755
+ indexOffset += (obsIndex == null ? void 0 : obsIndex.length) || 0;
146756
+ colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
146757
+ } else {
146758
+ const featureArr = multiFeatureValues[channelIndex];
146759
+ totalData.set(normalize(featureArr), indexOffset);
146760
+ indicesOffsets.push(indexOffset);
146761
+ indexOffset += featureArr.length;
146762
+ colorsOffsets.push(colorOffset);
146763
+ }
146764
+ });
146765
+ return [
146766
+ totalData,
146767
+ valueTexHeight,
146768
+ indicesOffsets,
146769
+ totalColors,
146770
+ colorTexHeight,
146771
+ colorsOffsets
146772
+ ];
146773
+ }
146774
+ const MAX_CHANNELS = 7;
146775
+ const MULTI_FEATURE_TEX_SIZE = 2048;
146157
146776
  function padWithDefault(arr, defaultValue2, padWidth) {
146158
146777
  const newArr = [...arr];
146159
146778
  for (let i2 = 0; i2 < padWidth; i2 += 1) {
@@ -146161,19 +146780,25 @@ function padWithDefault(arr, defaultValue2, padWidth) {
146161
146780
  }
146162
146781
  return newArr;
146163
146782
  }
146783
+ function getColor(arr) {
146784
+ return arr ? arr.map((v) => v / 255) : [0, 0, 0];
146785
+ }
146164
146786
  const defaultProps = {
146787
+ channelStrokeWidths: { type: "array", value: null, compare: true },
146788
+ channelsFilled: { type: "array", value: null, compare: true },
146789
+ channelOpacities: { type: "array", value: null, compare: true },
146790
+ channelColors: { type: "array", value: null, compare: true },
146165
146791
  hoveredCell: { type: "number", value: null, compare: true },
146166
- // We do not want to deep-compare cellColorData,
146167
- // as it is potentially a TypedArray with millions of elements.
146168
- // For `compare`: "if a number is supplied, indicates the maximum depth to deep-compare,
146169
- // where 0 is shallow comparison and -1 is infinite depth. true is equivalent to 1."
146170
- // Reference: https://deck.gl/docs/developer-guide/custom-layers/prop-types#array
146171
- cellColorData: { type: "object", value: null, compare: 0 },
146172
146792
  colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
146173
- // Same as with cellColorData, we do not want to deep-compare expressionData.
146174
- expressionData: { type: "object", value: null, compare: 0 }
146175
- };
146176
- class BitmaskLayer extends XRLayer {
146793
+ expressionData: { type: "object", value: null, compare: true },
146794
+ multiFeatureValues: { type: "array", value: null, compare: true },
146795
+ setColorValues: { type: "array", value: null, compare: true },
146796
+ channelFeatureValueColormaps: { type: "array", value: null, compare: true },
146797
+ channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
146798
+ channelIsStaticColorMode: { type: "array", value: null, compare: true },
146799
+ channelIsSetColorMode: { type: "array", value: null, compare: true }
146800
+ };
146801
+ class BitmaskLayer2 extends XRLayer {
146177
146802
  // eslint-disable-next-line class-methods-use-this
146178
146803
  getShaders() {
146179
146804
  const { colormap } = this.props;
@@ -146186,15 +146811,44 @@ class BitmaskLayer extends XRLayer {
146186
146811
  }
146187
146812
  };
146188
146813
  }
146814
+ /**
146815
+ * Override the parent loadChannelTextures to enable
146816
+ * up to eight channels (rather than six).
146817
+ * Reference: https://github.com/hms-dbmi/viv/blob/v0.13.3/packages/layers/src/xr-layer/xr-layer.js#L316
146818
+ */
146819
+ loadChannelTextures(channelData) {
146820
+ const textures = {
146821
+ channel0: null,
146822
+ channel1: null,
146823
+ channel2: null,
146824
+ channel3: null,
146825
+ channel4: null,
146826
+ channel5: null,
146827
+ channel6: null
146828
+ };
146829
+ if (this.state.textures) {
146830
+ Object.values(this.state.textures).forEach((tex) => tex && tex.delete());
146831
+ }
146832
+ if (channelData && Object.keys(channelData).length > 0 && channelData.data) {
146833
+ channelData.data.forEach((d, i2) => {
146834
+ textures[`channel${i2}`] = this.dataToTexture(d, channelData.width, channelData.height);
146835
+ }, this);
146836
+ this.setState({ textures });
146837
+ }
146838
+ }
146189
146839
  updateState({ props: props2, oldProps, changeFlags }) {
146190
146840
  super.updateState({ props: props2, oldProps, changeFlags });
146191
- if (props2.cellColorData !== oldProps.cellColorData) {
146192
- this.setColorTexture();
146193
- }
146194
- if (props2.expressionData !== oldProps.expressionData) {
146195
- const { expressionData, cellTexHeight, cellTexWidth } = this.props;
146196
- const expressionTex = this.dataToTexture(expressionData, cellTexWidth, cellTexHeight);
146197
- this.setState({ expressionTex });
146841
+ if (props2.multiFeatureValues !== oldProps.multiFeatureValues || props2.setColorValues !== oldProps.setColorValues || props2.channelIsSetColorMode !== oldProps.channelIsSetColorMode) {
146842
+ const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
146843
+ const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
146844
+ this.setState({
146845
+ valueTex,
146846
+ colorTex,
146847
+ valueTexOffsets,
146848
+ colorTexOffsets,
146849
+ valueTexHeight,
146850
+ colorTexHeight
146851
+ });
146198
146852
  }
146199
146853
  if (props2.colormap !== oldProps.colormap) {
146200
146854
  const { gl } = this.context;
@@ -146205,49 +146859,111 @@ class BitmaskLayer extends XRLayer {
146205
146859
  this.getAttributeManager().invalidateAll();
146206
146860
  }
146207
146861
  }
146208
- setColorTexture() {
146209
- const { cellColorData: data, cellTexHeight: height, cellTexWidth: width } = this.props;
146210
- const colorTex = new Texture2D(this.context.gl, {
146211
- width,
146212
- height,
146213
- // Only use Float32 so we don't have to write two shaders
146214
- data,
146215
- // we don't want or need mimaps
146216
- mipmaps: false,
146217
- parameters: {
146218
- // NEAREST for integer data
146219
- [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
146220
- [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
146221
- // CLAMP_TO_EDGE to remove tile artifacts
146222
- [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
146223
- [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
146224
- },
146225
- format: GL$1.RGB,
146226
- dataFormat: GL$1.RGB,
146227
- type: GL$1.UNSIGNED_BYTE
146228
- });
146229
- this.setState({ colorTex });
146230
- }
146231
146862
  draw(opts2) {
146232
146863
  const { uniforms } = opts2;
146233
- const { channelsVisible, hoveredCell, colorScaleLo, colorScaleHi, isExpressionMode } = this.props;
146234
- const { textures, model, colorTex, expressionTex } = this.state;
146235
- if (textures && model && colorTex) {
146864
+ const {
146865
+ channelStrokeWidths,
146866
+ channelsFilled,
146867
+ channelOpacities,
146868
+ channelColors,
146869
+ channelsVisible,
146870
+ // TODO: use `channelFeatureValueColormaps` in shader,
146871
+ // figure out how to call multiple GLSL colormap functions
146872
+ channelFeatureValueColormaps,
146873
+ channelFeatureValueColormapRanges,
146874
+ channelIsStaticColorMode,
146875
+ channelIsSetColorMode,
146876
+ hoveredCell,
146877
+ colorScaleLo,
146878
+ colorScaleHi,
146879
+ isExpressionMode,
146880
+ zoom,
146881
+ minZoom,
146882
+ maxZoom,
146883
+ zoomOffset
146884
+ // TODO: figure out if this needs to be used or not
146885
+ } = this.props;
146886
+ const {
146887
+ textures,
146888
+ model,
146889
+ // Expression and set index (and colors) textures with offsets
146890
+ valueTex,
146891
+ colorTex,
146892
+ valueTexOffsets,
146893
+ colorTexOffsets,
146894
+ valueTexHeight,
146895
+ colorTexHeight
146896
+ } = this.state;
146897
+ if (textures && model) {
146898
+ const scaleFactor = 1 / 2 ** (maxZoom - zoom);
146899
+ const colors = fromEntries(range$5(MAX_CHANNELS).map((i2) => [`color${i2}`, getColor(channelColors[i2])]));
146236
146900
  model.setUniforms(Object.assign({}, uniforms, {
146237
- hovered: hoveredCell || 0,
146901
+ ...colors,
146902
+ // Bitmask image channel data textures
146903
+ ...textures,
146904
+ multiFeatureTexSize: MULTI_FEATURE_TEX_SIZE,
146905
+ // Expression textures with offsets
146906
+ valueTex,
146907
+ valueTexOffsets: padWithDefault(valueTexOffsets, 0, MAX_CHANNELS - valueTexOffsets.length),
146908
+ valueTexHeight,
146909
+ // Set indices and colors textures with offsets
146238
146910
  colorTex,
146239
- expressionTex,
146240
- colorTexHeight: colorTex.height,
146241
- colorTexWidth: colorTex.width,
146911
+ colorTexOffsets: padWithDefault(colorTexOffsets, 0, MAX_CHANNELS - colorTexOffsets.length),
146912
+ colorTexHeight,
146913
+ // Visualization properties
146914
+ channelsFilled: padWithDefault(
146915
+ channelsFilled,
146916
+ true,
146917
+ // There are six texture entries on the shaders
146918
+ MAX_CHANNELS - channelsFilled.length
146919
+ ),
146920
+ channelOpacities: padWithDefault(
146921
+ channelOpacities,
146922
+ 0,
146923
+ // There are six texture entries on the shaders
146924
+ MAX_CHANNELS - channelOpacities.length
146925
+ ),
146926
+ channelStrokeWidths: padWithDefault(
146927
+ channelStrokeWidths,
146928
+ 1,
146929
+ // There are six texture entries on the shaders
146930
+ MAX_CHANNELS - channelStrokeWidths.length
146931
+ ),
146932
+ channelColormapRangeStarts: padWithDefault(
146933
+ channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
146934
+ 0,
146935
+ // There are six texture entries on the shaders
146936
+ MAX_CHANNELS - channelFeatureValueColormapRanges.length
146937
+ ),
146938
+ channelColormapRangeEnds: padWithDefault(
146939
+ channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[1]) || 1),
146940
+ 1,
146941
+ // There are six texture entries on the shaders
146942
+ MAX_CHANNELS - channelFeatureValueColormapRanges.length
146943
+ ),
146944
+ channelIsStaticColorMode: padWithDefault(
146945
+ channelIsStaticColorMode,
146946
+ true,
146947
+ // There are six texture entries on the shaders
146948
+ MAX_CHANNELS - channelIsStaticColorMode.length
146949
+ ),
146950
+ channelIsSetColorMode: padWithDefault(
146951
+ channelIsSetColorMode,
146952
+ false,
146953
+ // There are six texture entries on the shaders
146954
+ MAX_CHANNELS - channelIsSetColorMode.length
146955
+ ),
146956
+ hovered: hoveredCell || 0,
146242
146957
  channelsVisible: padWithDefault(
146243
146958
  channelsVisible,
146244
146959
  false,
146245
146960
  // There are six texture entries on the shaders
146246
- 6 - channelsVisible.length
146961
+ MAX_CHANNELS - channelsVisible.length
146247
146962
  ),
146248
- uColorScaleRange: [colorScaleLo, colorScaleHi],
146249
- uIsExpressionMode: isExpressionMode,
146250
- ...textures
146963
+ // uColorScaleRange: [colorScaleLo, colorScaleHi],
146964
+ // uIsExpressionMode: isExpressionMode,
146965
+ // uIsOutlined: false,
146966
+ scaleFactor
146251
146967
  })).draw();
146252
146968
  }
146253
146969
  }
@@ -146276,28 +146992,94 @@ class BitmaskLayer extends XRLayer {
146276
146992
  type: GL$1.FLOAT
146277
146993
  });
146278
146994
  }
146995
+ multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
146996
+ const isWebGL2On = isWebGL2$1(this.context.gl);
146997
+ const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
146998
+ return [
146999
+ // Color indices texture
147000
+ new Texture2D(this.context.gl, {
147001
+ width: MULTI_FEATURE_TEX_SIZE,
147002
+ height: valueTexHeight,
147003
+ // Only use Float32 so we don't have to write two shaders
147004
+ data: new Float32Array(totalData),
147005
+ // we don't want or need mimaps
147006
+ mipmaps: false,
147007
+ parameters: {
147008
+ // NEAREST for integer data
147009
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
147010
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
147011
+ // CLAMP_TO_EDGE to remove tile artifacts
147012
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
147013
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
147014
+ },
147015
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
147016
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
147017
+ type: GL$1.FLOAT
147018
+ }),
147019
+ // Colors texture
147020
+ new Texture2D(this.context.gl, {
147021
+ width: MULTI_FEATURE_TEX_SIZE,
147022
+ height: colorTexHeight,
147023
+ // Only use Float32 so we don't have to write two shaders
147024
+ data: new Float32Array(totalColors),
147025
+ // we don't want or need mimaps
147026
+ mipmaps: false,
147027
+ parameters: {
147028
+ // NEAREST for integer data
147029
+ [GL$1.TEXTURE_MIN_FILTER]: GL$1.NEAREST,
147030
+ [GL$1.TEXTURE_MAG_FILTER]: GL$1.NEAREST,
147031
+ // CLAMP_TO_EDGE to remove tile artifacts
147032
+ [GL$1.TEXTURE_WRAP_S]: GL$1.CLAMP_TO_EDGE,
147033
+ [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
147034
+ },
147035
+ format: isWebGL2On ? GL$1.R32F : GL$1.LUMINANCE,
147036
+ dataFormat: isWebGL2On ? GL$1.RED : GL$1.LUMINANCE,
147037
+ type: GL$1.FLOAT
147038
+ }),
147039
+ // Offsets
147040
+ indicesOffsets,
147041
+ colorsOffsets,
147042
+ // Texture heights
147043
+ valueTexHeight,
147044
+ colorTexHeight
147045
+ ];
147046
+ }
147047
+ }
147048
+ BitmaskLayer2.layerName = "BitmaskLayer";
147049
+ BitmaskLayer2.defaultProps = defaultProps;
147050
+ const toRgbUIString = (on, arr, theme) => {
147051
+ const color = on || theme === "light" && (arr == null ? void 0 : arr.every((i2) => i2 === 255)) ? [220, 220, 220] : arr;
147052
+ return `rgb(${color})`;
147053
+ };
147054
+ function filterSelection(loader, selection) {
147055
+ if (!selection) {
147056
+ return selection;
147057
+ }
147058
+ const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
147059
+ const { labels } = data;
147060
+ return fromEntries(Object.entries(selection).filter(([key]) => labels.includes(key)));
146279
147061
  }
146280
- BitmaskLayer.layerName = "BitmaskLayer";
146281
- BitmaskLayer.defaultProps = defaultProps;
146282
- async function getSingleSelectionStats2D$1({ loader, selection }) {
147062
+ async function getSingleSelectionStats2D({ loader, selection }) {
146283
147063
  const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
146284
- const raster = await data.getRaster({ selection });
147064
+ const filteredSelection = filterSelection(loader, selection);
147065
+ const raster = await data.getRaster({ selection: filteredSelection });
146285
147066
  const selectionStats = getChannelStats(raster.data);
146286
147067
  const { domain, contrastLimits: slider } = selectionStats;
146287
147068
  return { domain, slider };
146288
147069
  }
146289
- async function getSingleSelectionStats3D$1({ loader, selection }) {
147070
+ async function getSingleSelectionStats3D({ loader, selection }) {
146290
147071
  const lowResSource = loader[loader.length - 1];
147072
+ const filteredSelection = filterSelection(lowResSource, selection);
146291
147073
  const { shape: shape2, labels } = lowResSource;
146292
147074
  const sizeZ = shape2[labels.indexOf("z")] >> loader.length - 1;
146293
147075
  const raster0 = await lowResSource.getRaster({
146294
- selection: { ...selection, z: 0 }
147076
+ selection: { ...filteredSelection, z: 0 }
146295
147077
  });
146296
147078
  const rasterMid = await lowResSource.getRaster({
146297
- selection: { ...selection, z: Math.floor(sizeZ / 2) }
147079
+ selection: { ...filteredSelection, z: Math.floor(sizeZ / 2) }
146298
147080
  });
146299
147081
  const rasterTop = await lowResSource.getRaster({
146300
- selection: { ...selection, z: Math.max(0, sizeZ - 1) }
147082
+ selection: { ...filteredSelection, z: Math.max(0, sizeZ - 1) }
146301
147083
  });
146302
147084
  const stats0 = getChannelStats(raster0.data);
146303
147085
  const statsMid = getChannelStats(rasterMid.data);
@@ -146313,16 +147095,55 @@ async function getSingleSelectionStats3D$1({ loader, selection }) {
146313
147095
  ]
146314
147096
  };
146315
147097
  }
146316
- const getSingleSelectionStats$1 = async ({ loader, selection, use3d }) => {
146317
- const getStats = use3d ? getSingleSelectionStats3D$1 : getSingleSelectionStats2D$1;
147098
+ const getSingleSelectionStats = async ({ loader, selection, use3d }) => {
147099
+ const getStats = use3d ? getSingleSelectionStats3D : getSingleSelectionStats2D;
146318
147100
  return getStats({ loader, selection });
146319
147101
  };
146320
- const getMultiSelectionStats$1 = async ({ loader, selections, use3d }) => {
146321
- const stats = await Promise.all(selections.map((selection) => getSingleSelectionStats$1({ loader, selection, use3d })));
147102
+ const getMultiSelectionStats = async ({ loader, selections, use3d }) => {
147103
+ const stats = await Promise.all(selections.map((selection) => getSingleSelectionStats({ loader, selection, use3d })));
146322
147104
  const domains = stats.map((stat) => stat.domain);
146323
147105
  const sliders = stats.map((stat) => stat.slider);
146324
147106
  return { domains, sliders };
146325
147107
  };
147108
+ function getPhysicalSizeScalingMatrix(loader) {
147109
+ var _a2;
147110
+ const { x: x2, y: y2, z: z2 } = ((_a2 = loader == null ? void 0 : loader.meta) == null ? void 0 : _a2.physicalSizes) ?? {};
147111
+ if ((x2 == null ? void 0 : x2.size) && (y2 == null ? void 0 : y2.size) && (z2 == null ? void 0 : z2.size)) {
147112
+ const min = Math.min(z2.size, x2.size, y2.size);
147113
+ const ratio = [x2.size / min, y2.size / min, z2.size / min];
147114
+ return new Matrix4().scale(ratio);
147115
+ }
147116
+ return new Matrix4().identity();
147117
+ }
147118
+ function getBoundingCube(loader) {
147119
+ const source = Array.isArray(loader) ? loader[0] : loader;
147120
+ const { shape: shape2, labels } = source;
147121
+ const physicalSizeScalingMatrix = getPhysicalSizeScalingMatrix(source);
147122
+ const xSlice = [0, physicalSizeScalingMatrix[0] * shape2[labels.indexOf("x")]];
147123
+ const ySlice = [0, physicalSizeScalingMatrix[5] * shape2[labels.indexOf("y")]];
147124
+ const zSlice = [
147125
+ 0,
147126
+ physicalSizeScalingMatrix[10] * shape2[labels.indexOf("z")]
147127
+ ];
147128
+ return [xSlice, ySlice, zSlice];
147129
+ }
147130
+ function abbreviateNumber(value) {
147131
+ const maxLength = 5;
147132
+ let maxNaiveDigits = maxLength;
147133
+ if (!Number.isInteger(value)) {
147134
+ --maxNaiveDigits;
147135
+ }
147136
+ if (value < 1) {
147137
+ --maxNaiveDigits;
147138
+ }
147139
+ const naive = Intl.NumberFormat("en-US", {
147140
+ maximumSignificantDigits: maxNaiveDigits,
147141
+ useGrouping: false
147142
+ }).format(value);
147143
+ if (naive.length <= maxLength)
147144
+ return naive;
147145
+ return value.toExponential(0);
147146
+ }
146326
147147
  const GLOBAL_LABELS = ["z", "t"];
146327
147148
  const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
146328
147149
  const DEFAULT_RASTER_LAYER_PROPS = {
@@ -146339,6 +147160,27 @@ function getSourceFromLoader(loader, level) {
146339
147160
  const source = Array.isArray(data) ? data[level || data.length - 1] : data;
146340
147161
  return source;
146341
147162
  }
147163
+ const getStatsForResolution = (loader, resolution) => {
147164
+ const { shape: shape2, labels } = loader[resolution];
147165
+ const height = shape2[labels.indexOf("y")];
147166
+ const width = shape2[labels.indexOf("x")];
147167
+ const depth = shape2[labels.indexOf("z")];
147168
+ const depthDownsampled = Math.max(1, depth >> resolution);
147169
+ const totalBytes = 4 * height * width * depthDownsampled;
147170
+ return {
147171
+ height,
147172
+ width,
147173
+ depthDownsampled,
147174
+ totalBytes
147175
+ };
147176
+ };
147177
+ const canLoadResolution = (loader, resolution) => {
147178
+ var _a2, _b, _c;
147179
+ const { totalBytes, height, width, depthDownsampled } = getStatsForResolution(loader, resolution);
147180
+ const maxHeapSize = ((_a2 = window.performance) == null ? void 0 : _a2.memory) && ((_c = (_b = window.performance) == null ? void 0 : _b.memory) == null ? void 0 : _c.jsHeapSizeLimit) / 2;
147181
+ const maxSize = maxHeapSize || 2 ** 31 - 1;
147182
+ return totalBytes < maxSize && height <= 2048 && depthDownsampled <= 2048 && width <= 2048 && depthDownsampled > 1;
147183
+ };
146342
147184
  function isRgb(loader, channels2) {
146343
147185
  const source = getSourceFromLoader(loader);
146344
147186
  const { shape: shape2, dtype, labels } = source;
@@ -146380,7 +147222,7 @@ async function initializeLayerChannels(loader, use3d) {
146380
147222
  const source = getSourceFromLoader(loader);
146381
147223
  let defaultSelection = buildDefaultSelection(source);
146382
147224
  defaultSelection = isInterleaved(source.shape) ? [{ ...defaultSelection[0], c: 0 }] : defaultSelection;
146383
- const stats = await getMultiSelectionStats$1({
147225
+ const stats = await getMultiSelectionStats({
146384
147226
  loader: loader.data,
146385
147227
  selections: defaultSelection,
146386
147228
  use3d
@@ -146402,6 +147244,17 @@ async function initializeLayerChannels(loader, use3d) {
146402
147244
  });
146403
147245
  return result;
146404
147246
  }
147247
+ function getDomains() {
147248
+ const domains = {};
147249
+ const needMin = ["Int8", "Int16", "Int32"];
147250
+ Object.keys(DTYPE_VALUES).forEach((dtype) => {
147251
+ const { max } = DTYPE_VALUES[dtype];
147252
+ const min = needMin.includes(dtype) ? -(max + 1) : 0;
147253
+ domains[dtype] = [min, max];
147254
+ });
147255
+ return domains;
147256
+ }
147257
+ const DOMAINS = getDomains();
146405
147258
  const AddIcon = createSvgIcon(/* @__PURE__ */ React.createElement("path", {
146406
147259
  d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
146407
147260
  }), "Add");
@@ -146442,31 +147295,29 @@ const useChannelSliderStyles = makeStyles((theme) => ({
146442
147295
  }
146443
147296
  }
146444
147297
  }));
146445
- function MuiSpan(props2) {
146446
- const { children } = props2;
146447
- const classes = useSpanStyles();
146448
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.span, children });
146449
- }
146450
147298
  const useSelectStyles = makeStyles(() => ({
146451
147299
  selectRoot: {
146452
147300
  padding: 0,
146453
147301
  height: "auto",
146454
- margin: "4px 0"
147302
+ margin: "4px 0",
147303
+ fontSize: "14px",
147304
+ width: "100%"
146455
147305
  }
146456
147306
  }));
146457
- const sharedControllerStyles = {
146458
- width: "100%",
146459
- flexDirection: "column"
146460
- };
146461
147307
  const useControllerSectionStyles = makeStyles(() => ({
146462
147308
  layerControllerRoot: {
146463
- ...sharedControllerStyles,
147309
+ width: "100%",
147310
+ flexDirection: "column",
146464
147311
  padding: "0px 8px"
147312
+ },
147313
+ layerControllerGrid: {
147314
+ marginTop: "10px"
146465
147315
  }
146466
147316
  }));
146467
147317
  const useAccordionStyles = makeStyles((theme) => ({
146468
147318
  accordionDetailsRoot: {
146469
- ...sharedControllerStyles,
147319
+ width: "100%",
147320
+ flexDirection: "column",
146470
147321
  padding: "8px 8px 24px 8px"
146471
147322
  },
146472
147323
  accordionSummaryRoot: {
@@ -146559,6 +147410,11 @@ const useStyles$1 = makeStyles(() => ({
146559
147410
  paddingRight: "2px"
146560
147411
  }
146561
147412
  }));
147413
+ function MuiSpan(props2) {
147414
+ const { children } = props2;
147415
+ const classes = useSpanStyles();
147416
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.span, children });
147417
+ }
146562
147418
  function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUpdate }) {
146563
147419
  const [open, setOpen] = useState(false);
146564
147420
  const classes = useStyles$1();
@@ -146603,114 +147459,6 @@ function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUp
146603
147459
  }
146604
147460
  );
146605
147461
  }
146606
- function getDomains() {
146607
- const domains = {};
146608
- const needMin = ["Int8", "Int16", "Int32"];
146609
- Object.keys(DTYPE_VALUES).forEach((dtype) => {
146610
- const { max } = DTYPE_VALUES[dtype];
146611
- const min = needMin.includes(dtype) ? -(max + 1) : 0;
146612
- domains[dtype] = [min, max];
146613
- });
146614
- return domains;
146615
- }
146616
- const DOMAINS = getDomains();
146617
- const toRgbUIString = (on, arr, theme) => {
146618
- const color = on || theme === "light" && arr.every((i2) => i2 === 255) ? [220, 220, 220] : arr;
146619
- return `rgb(${color})`;
146620
- };
146621
- async function getSingleSelectionStats2D({ loader, selection }) {
146622
- const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
146623
- const raster = await data.getRaster({ selection });
146624
- const selectionStats = getChannelStats(raster.data);
146625
- const { domain, contrastLimits: slider } = selectionStats;
146626
- return { domain, slider };
146627
- }
146628
- async function getSingleSelectionStats3D({ loader, selection }) {
146629
- const lowResSource = loader[loader.length - 1];
146630
- const { shape: shape2, labels } = lowResSource;
146631
- const sizeZ = shape2[labels.indexOf("z")] >> loader.length - 1;
146632
- const raster0 = await lowResSource.getRaster({
146633
- selection: { ...selection, z: 0 }
146634
- });
146635
- const rasterMid = await lowResSource.getRaster({
146636
- selection: { ...selection, z: Math.floor(sizeZ / 2) }
146637
- });
146638
- const rasterTop = await lowResSource.getRaster({
146639
- selection: { ...selection, z: Math.max(0, sizeZ - 1) }
146640
- });
146641
- const stats0 = getChannelStats(raster0.data);
146642
- const statsMid = getChannelStats(rasterMid.data);
146643
- const statsTop = getChannelStats(rasterTop.data);
146644
- return {
146645
- domain: [
146646
- Math.min(stats0.domain[0], statsMid.domain[0], statsTop.domain[0]),
146647
- Math.max(stats0.domain[1], statsMid.domain[1], statsTop.domain[1])
146648
- ],
146649
- slider: [
146650
- Math.min(
146651
- stats0.contrastLimits[0],
146652
- statsMid.contrastLimits[0],
146653
- statsTop.contrastLimits[0]
146654
- ),
146655
- Math.max(
146656
- stats0.contrastLimits[1],
146657
- statsMid.contrastLimits[1],
146658
- statsTop.contrastLimits[1]
146659
- )
146660
- ]
146661
- };
146662
- }
146663
- const getSingleSelectionStats = async ({ loader, selection, use3d }) => {
146664
- const getStats = use3d ? getSingleSelectionStats3D : getSingleSelectionStats2D;
146665
- return getStats({ loader, selection });
146666
- };
146667
- const getMultiSelectionStats = async ({ loader, selections, use3d }) => {
146668
- const stats = await Promise.all(
146669
- selections.map((selection) => getSingleSelectionStats({ loader, selection, use3d }))
146670
- );
146671
- const domains = stats.map((stat) => stat.domain);
146672
- const sliders = stats.map((stat) => stat.slider);
146673
- return { domains, sliders };
146674
- };
146675
- function getPhysicalSizeScalingMatrix(loader) {
146676
- var _a2;
146677
- const { x: x2, y: y2, z: z2 } = ((_a2 = loader == null ? void 0 : loader.meta) == null ? void 0 : _a2.physicalSizes) ?? {};
146678
- if ((x2 == null ? void 0 : x2.size) && (y2 == null ? void 0 : y2.size) && (z2 == null ? void 0 : z2.size)) {
146679
- const min = Math.min(z2.size, x2.size, y2.size);
146680
- const ratio = [x2.size / min, y2.size / min, z2.size / min];
146681
- return new Matrix4().scale(ratio);
146682
- }
146683
- return new Matrix4().identity();
146684
- }
146685
- function getBoundingCube(loader) {
146686
- const source = Array.isArray(loader) ? loader[0] : loader;
146687
- const { shape: shape2, labels } = source;
146688
- const physicalSizeScalingMatrix = getPhysicalSizeScalingMatrix(source);
146689
- const xSlice = [0, physicalSizeScalingMatrix[0] * shape2[labels.indexOf("x")]];
146690
- const ySlice = [0, physicalSizeScalingMatrix[5] * shape2[labels.indexOf("y")]];
146691
- const zSlice = [
146692
- 0,
146693
- physicalSizeScalingMatrix[10] * shape2[labels.indexOf("z")]
146694
- ];
146695
- return [xSlice, ySlice, zSlice];
146696
- }
146697
- function abbreviateNumber$1(value) {
146698
- const maxLength = 5;
146699
- let maxNaiveDigits = maxLength;
146700
- if (!Number.isInteger(value)) {
146701
- --maxNaiveDigits;
146702
- }
146703
- if (value < 1) {
146704
- --maxNaiveDigits;
146705
- }
146706
- const naive = Intl.NumberFormat("en-US", {
146707
- maximumSignificantDigits: maxNaiveDigits,
146708
- useGrouping: false
146709
- }).format(value);
146710
- if (naive.length <= maxLength)
146711
- return naive;
146712
- return value.toExponential(0);
146713
- }
146714
147462
  function ChannelSelectionDropdown({
146715
147463
  handleChange,
146716
147464
  disabled,
@@ -146747,23 +147495,6 @@ function ChannelVisibilityCheckbox({
146747
147495
  }
146748
147496
  );
146749
147497
  }
146750
- function abbreviateNumber(value) {
146751
- const maxLength = 5;
146752
- let maxNaiveDigits = maxLength;
146753
- if (!Number.isInteger(value)) {
146754
- --maxNaiveDigits;
146755
- }
146756
- if (value < 1) {
146757
- --maxNaiveDigits;
146758
- }
146759
- const naive = Intl.NumberFormat("en-US", {
146760
- maximumSignificantDigits: maxNaiveDigits,
146761
- useGrouping: false
146762
- }).format(value);
146763
- if (naive.length <= maxLength)
146764
- return naive;
146765
- return value.toExponential(0);
146766
- }
146767
147498
  function ChannelSlider({
146768
147499
  color,
146769
147500
  slider = [0, 0],
@@ -147039,6 +147770,132 @@ function VectorLayerController(props2) {
147039
147770
  ] })
147040
147771
  ] }) });
147041
147772
  }
147773
+ const $b5e257d569688ac6$var$defaultContext = {
147774
+ prefix: String(Math.round(Math.random() * 1e10)),
147775
+ current: 0
147776
+ };
147777
+ const $b5e257d569688ac6$var$SSRContext = /* @__PURE__ */ React__default.createContext($b5e257d569688ac6$var$defaultContext);
147778
+ const $b5e257d569688ac6$var$IsSSRContext = /* @__PURE__ */ React__default.createContext(false);
147779
+ let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
147780
+ let $b5e257d569688ac6$var$componentIds = /* @__PURE__ */ new WeakMap();
147781
+ function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
147782
+ let ctx = useContext($b5e257d569688ac6$var$SSRContext);
147783
+ let ref = useRef(null);
147784
+ if (ref.current === null && !isDisabled) {
147785
+ var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner;
147786
+ let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
147787
+ if (currentOwner) {
147788
+ let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
147789
+ if (prevComponentValue == null)
147790
+ $b5e257d569688ac6$var$componentIds.set(currentOwner, {
147791
+ id: ctx.current,
147792
+ state: currentOwner.memoizedState
147793
+ });
147794
+ else if (currentOwner.memoizedState !== prevComponentValue.state) {
147795
+ ctx.current = prevComponentValue.id;
147796
+ $b5e257d569688ac6$var$componentIds.delete(currentOwner);
147797
+ }
147798
+ }
147799
+ ref.current = ++ctx.current;
147800
+ }
147801
+ return ref.current;
147802
+ }
147803
+ function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
147804
+ let ctx = useContext($b5e257d569688ac6$var$SSRContext);
147805
+ if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM)
147806
+ console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
147807
+ let counter2 = $b5e257d569688ac6$var$useCounter(!!defaultId);
147808
+ let prefix2 = ctx === $b5e257d569688ac6$var$defaultContext && false ? "react-aria" : `react-aria${ctx.prefix}`;
147809
+ return defaultId || `${prefix2}-${counter2}`;
147810
+ }
147811
+ function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
147812
+ let id = React__default.useId();
147813
+ let [didSSR] = useState($b5e257d569688ac6$export$535bd6ca7f90a273());
147814
+ let prefix2 = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
147815
+ return defaultId || `${prefix2}-${id}`;
147816
+ }
147817
+ const $b5e257d569688ac6$export$619500959fc48b26 = typeof React__default["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
147818
+ function $b5e257d569688ac6$var$getSnapshot() {
147819
+ return false;
147820
+ }
147821
+ function $b5e257d569688ac6$var$getServerSnapshot() {
147822
+ return true;
147823
+ }
147824
+ function $b5e257d569688ac6$var$subscribe(onStoreChange) {
147825
+ return () => {
147826
+ };
147827
+ }
147828
+ function $b5e257d569688ac6$export$535bd6ca7f90a273() {
147829
+ if (typeof React__default["useSyncExternalStore"] === "function")
147830
+ return React__default["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
147831
+ return useContext($b5e257d569688ac6$var$IsSSRContext);
147832
+ }
147833
+ const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React__default.useLayoutEffect : () => {
147834
+ };
147835
+ let $bdb11010cef70236$var$idsUpdaterMap = /* @__PURE__ */ new Map();
147836
+ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
147837
+ let [value, setValue] = useState(defaultId);
147838
+ let nextId = useRef(null);
147839
+ let res = $b5e257d569688ac6$export$619500959fc48b26(value);
147840
+ let updateValue = useCallback((val) => {
147841
+ nextId.current = val;
147842
+ }, []);
147843
+ $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
147844
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
147845
+ let r2 = res;
147846
+ return () => {
147847
+ $bdb11010cef70236$var$idsUpdaterMap.delete(r2);
147848
+ };
147849
+ }, [
147850
+ res
147851
+ ]);
147852
+ useEffect(() => {
147853
+ let newId = nextId.current;
147854
+ if (newId) {
147855
+ nextId.current = null;
147856
+ setValue(newId);
147857
+ }
147858
+ });
147859
+ return res;
147860
+ }
147861
+ let $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
147862
+ let $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
147863
+ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
147864
+ if (typeof window === "undefined")
147865
+ return;
147866
+ let onTransitionStart = (e2) => {
147867
+ let transitions2 = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
147868
+ if (!transitions2) {
147869
+ transitions2 = /* @__PURE__ */ new Set();
147870
+ $bbed8b41f857bcc0$var$transitionsByElement.set(e2.target, transitions2);
147871
+ e2.target.addEventListener("transitioncancel", onTransitionEnd);
147872
+ }
147873
+ transitions2.add(e2.propertyName);
147874
+ };
147875
+ let onTransitionEnd = (e2) => {
147876
+ let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
147877
+ if (!properties)
147878
+ return;
147879
+ properties.delete(e2.propertyName);
147880
+ if (properties.size === 0) {
147881
+ e2.target.removeEventListener("transitioncancel", onTransitionEnd);
147882
+ $bbed8b41f857bcc0$var$transitionsByElement.delete(e2.target);
147883
+ }
147884
+ if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
147885
+ for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)
147886
+ cb();
147887
+ $bbed8b41f857bcc0$var$transitionCallbacks.clear();
147888
+ }
147889
+ };
147890
+ document.body.addEventListener("transitionrun", onTransitionStart);
147891
+ document.body.addEventListener("transitionend", onTransitionEnd);
147892
+ }
147893
+ if (typeof document !== "undefined") {
147894
+ if (document.readyState !== "loading")
147895
+ $bbed8b41f857bcc0$var$setupGlobalEvents();
147896
+ else
147897
+ document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
147898
+ }
147042
147899
  const DOMAIN_OPTIONS = ["Full", "Min/Max"];
147043
147900
  function VolumeDropdown({
147044
147901
  loader: loaderWithMeta,
@@ -147316,11 +148173,11 @@ function LayerOptions({
147316
148173
  const hasViewableResolutions = Boolean(Array.from({
147317
148174
  length: loader.data.length
147318
148175
  }).filter((_, res) => canLoadResolution(loader.data, res)).length);
147319
- const globalSelectionSliderId = useId();
147320
- const colormapSelectId = useId();
147321
- const domainSelectorId = useId();
147322
- const opacitySliderId = useId();
147323
- const zeroTransparentId = useId();
148176
+ const globalSelectionSliderId = $bdb11010cef70236$export$f680877a34711e37();
148177
+ const colormapSelectId = $bdb11010cef70236$export$f680877a34711e37();
148178
+ const domainSelectorId = $bdb11010cef70236$export$f680877a34711e37();
148179
+ const opacitySliderId = $bdb11010cef70236$export$f680877a34711e37();
148180
+ const zeroTransparentId = $bdb11010cef70236$export$f680877a34711e37();
147324
148181
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid$1, { container: true, direction: "column", style: { width: "100%" }, children: [
147325
148182
  hasZStack && !disable3d && hasViewableResolutions && /* @__PURE__ */ jsxRuntimeExports.jsx(
147326
148183
  VolumeDropdown,
@@ -147472,7 +148329,7 @@ const Slicer = ({
147472
148329
  value: val,
147473
148330
  onChange: (e2, v) => setVal(v),
147474
148331
  valueLabelDisplay: "auto",
147475
- valueLabelFormat: (v) => abbreviateNumber$1(v),
148332
+ valueLabelFormat: (v) => abbreviateNumber(v),
147476
148333
  "aria-label": `Volume options ${label} slider`,
147477
148334
  min,
147478
148335
  max,
@@ -147690,7 +148547,7 @@ function LayerController(props2) {
147690
148547
  channelRef.current = channels2;
147691
148548
  return void 0;
147692
148549
  }, [channels2]);
147693
- const layerControlsId = useId();
148550
+ const layerControlsId = $bdb11010cef70236$export$f680877a34711e37();
147694
148551
  const firstSelection = ((_a2 = channels2[0]) == null ? void 0 : _a2.selection) || {};
147695
148552
  const { data, channels: channelOptions } = loader;
147696
148553
  const [tab, setTab] = useState(0);
@@ -147966,7 +148823,7 @@ function LayerController(props2) {
147966
148823
  isRgb(loader, channels2) && disableChannelsIfRgbDetected ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
147967
148824
  Button$1,
147968
148825
  {
147969
- disabled: channels2.length === MAX_CHANNELS,
148826
+ disabled: channels2.length === MAX_CHANNELS$1,
147970
148827
  onClick: handleChannelAdd,
147971
148828
  fullWidth: true,
147972
148829
  variant: "outlined",
@@ -148593,5 +149450,12 @@ export {
148593
149450
  LayerControllerSubscriber as L,
148594
149451
  VectorLayerController as V,
148595
149452
  LayerController as a,
148596
- getDefaultExportFromCjs as g
149453
+ useSelectStyles as b,
149454
+ useControllerSectionStyles as c,
149455
+ useAccordionStyles as d,
149456
+ useInputLabelStyles as e,
149457
+ useOverflowEllipsisGridStyles as f,
149458
+ getDefaultExportFromCjs as g,
149459
+ useSelectionSliderStyles as h,
149460
+ useSpanStyles as u
148597
149461
  };