@vitessce/dev 3.9.5 → 3.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OrbitControls-g3V6AQrL.js → OrbitControls-L6I9M6QX.js} +1 -1
- package/dist/{ReactNeuroglancer-BKhY1M3y.js → ReactNeuroglancer-5eQa4brk.js} +1 -1
- package/dist/{deflate-bMqc070m.js → deflate-BlfSi-73.js} +1 -1
- package/dist/{higlass-B7oMqAJq.js → higlass-Dzj0Wtv9.js} +1 -1
- package/dist/{index-iE6KBbYh.js → index-CsQFLn-E.js} +3 -3
- package/dist/{index-oeCOA2zP.js → index-Cz_XfJLz.js} +2 -2
- package/dist/{index-BOSHQFXK.js → index-GnGmMble.js} +799 -197
- package/dist/index.js +1 -1
- package/dist/{jpeg-BVOGozQR.js → jpeg-GTyf0pdQ.js} +1 -1
- package/dist/{lerc-mli9SB1o.js → lerc-Cxsf6swu.js} +1 -1
- package/dist/{lzw-CzubbbMJ.js → lzw-C4E5VmNh.js} +1 -1
- package/dist/{packbits-h_xMBVqr.js → packbits-CJAiTkd4.js} +1 -1
- package/dist/{raw-C9wxSTEx.js → raw-D9awu0AB.js} +1 -1
- package/dist/{troika-three-text.esm-DwvolRZ3.js → troika-three-text.esm-IXbnNvXc.js} +1 -1
- package/dist/{webimage-D4la8kDB.js → webimage-Ca1vS7aF.js} +1 -1
- package/package.json +5 -5
|
@@ -219,6 +219,7 @@ const FileType$2 = {
|
|
|
219
219
|
// Neuroglancer
|
|
220
220
|
// Precomputed (mesh) format
|
|
221
221
|
OBS_SEGMENTATIONS_NG_PRECOMPUTED: "obsSegmentations.ng-precomputed",
|
|
222
|
+
OBS_POINTS_NG_ANNOTATIONS: "obsPoints.ng-annotations",
|
|
222
223
|
// New file types to support old file types:
|
|
223
224
|
// - cells.json
|
|
224
225
|
OBS_EMBEDDING_CELLS_JSON: "obsEmbedding.cells.json",
|
|
@@ -427,7 +428,7 @@ const ViewHelpMapping = {
|
|
|
427
428
|
FEATURE_VALUE_HISTOGRAM: "The feature value histogram displays the distribution of values (e.g., expression) for the selected feature (e.g., gene).",
|
|
428
429
|
DOT_PLOT: "The dot plot displays summary information about expression of the selected features (e.g., genes) for each selected observation set (e.g., cell type).",
|
|
429
430
|
FEATURE_BAR_PLOT: "The feature bar plot displays one bar per observation (e.g., cell) along the x-axis, where the value of a selected feature (e.g., gene) is encoded along the y-axis.",
|
|
430
|
-
NEUROGLANCER: "
|
|
431
|
+
NEUROGLANCER: "This view displays 3D meshes and points using Neuroglancer developed by Google.",
|
|
431
432
|
TREEMAP: "The treemap provides an overview of the current state of sample-level or cell-level selection and filtering.",
|
|
432
433
|
VOLCANO_PLOT: "The volcano plot displays differential expression results. Each data point represents a feature (as opposed to an observation).",
|
|
433
434
|
OBS_SET_COMPOSITION_BAR_PLOT: "The set composition bar plot displays the results of a compositional analysis conducted using the scCODA method (Büttner et al. 2021 Nature Communications).",
|
|
@@ -479,6 +480,7 @@ const ViewHelpMapping = {
|
|
|
479
480
|
[FileType$2.FEATURE_LABELS_MUDATA_ZARR]: DataType$4.FEATURE_LABELS,
|
|
480
481
|
[FileType$2.OBS_SEGMENTATIONS_GLB]: DataType$4.OBS_SEGMENTATIONS,
|
|
481
482
|
[FileType$2.OBS_SEGMENTATIONS_NG_PRECOMPUTED]: DataType$4.OBS_SEGMENTATIONS,
|
|
483
|
+
[FileType$2.OBS_POINTS_NG_ANNOTATIONS]: DataType$4.OBS_POINTS,
|
|
482
484
|
[FileType$2.IMAGE_SPATIALDATA_ZARR]: DataType$4.IMAGE,
|
|
483
485
|
[FileType$2.LABELS_SPATIALDATA_ZARR]: DataType$4.OBS_SEGMENTATIONS,
|
|
484
486
|
[FileType$2.SHAPES_SPATIALDATA_ZARR]: DataType$4.OBS_SEGMENTATIONS,
|
|
@@ -698,6 +700,8 @@ const AUTO_INDEPENDENT_COORDINATION_TYPES = [
|
|
|
698
700
|
];
|
|
699
701
|
const COMPONENT_COORDINATION_TYPES = {
|
|
700
702
|
[ViewType$2.NEUROGLANCER]: [
|
|
703
|
+
CoordinationType$2.META_COORDINATION_SCOPES,
|
|
704
|
+
CoordinationType$2.META_COORDINATION_SCOPES_BY,
|
|
701
705
|
CoordinationType$2.DATASET,
|
|
702
706
|
CoordinationType$2.SPATIAL_TARGET_X,
|
|
703
707
|
CoordinationType$2.SPATIAL_TARGET_Y,
|
|
@@ -719,7 +723,26 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
719
723
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
720
724
|
CoordinationType$2.EMBEDDING_TYPE,
|
|
721
725
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
722
|
-
CoordinationType$2.TOOLTIPS_VISIBLE
|
|
726
|
+
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
727
|
+
CoordinationType$2.FILE_UID,
|
|
728
|
+
CoordinationType$2.IMAGE_LAYER,
|
|
729
|
+
CoordinationType$2.SEGMENTATION_LAYER,
|
|
730
|
+
CoordinationType$2.IMAGE_CHANNEL,
|
|
731
|
+
CoordinationType$2.SEGMENTATION_CHANNEL,
|
|
732
|
+
CoordinationType$2.POINT_LAYER,
|
|
733
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
734
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
735
|
+
CoordinationType$2.FEATURE_HIGHLIGHT,
|
|
736
|
+
CoordinationType$2.FEATURE_SELECTION,
|
|
737
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
738
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
739
|
+
CoordinationType$2.SPATIAL_LAYER_COLOR,
|
|
740
|
+
CoordinationType$2.SPATIAL_LAYER_OPACITY,
|
|
741
|
+
CoordinationType$2.SPATIAL_LAYER_VISIBLE,
|
|
742
|
+
CoordinationType$2.SPATIAL_CHANNEL_COLOR,
|
|
743
|
+
CoordinationType$2.SPATIAL_CHANNEL_OPACITY,
|
|
744
|
+
CoordinationType$2.SPATIAL_CHANNEL_VISIBLE,
|
|
745
|
+
CoordinationType$2.LEGEND_VISIBLE
|
|
723
746
|
],
|
|
724
747
|
[ViewType$2.SCATTERPLOT]: [
|
|
725
748
|
CoordinationType$2.DATASET,
|
|
@@ -1357,7 +1380,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1357
1380
|
CoordinationType$2.HIERARCHY_LEVELS
|
|
1358
1381
|
]
|
|
1359
1382
|
};
|
|
1360
|
-
const version$6 = "3.9.
|
|
1383
|
+
const version$6 = "3.9.6";
|
|
1361
1384
|
const META_VERSION = {
|
|
1362
1385
|
version: version$6
|
|
1363
1386
|
};
|
|
@@ -83646,17 +83669,26 @@ const meshGlbSchema = z.object({
|
|
|
83646
83669
|
sceneScaleZ: z.number(),
|
|
83647
83670
|
materialSide: z.enum(["front", "back"])
|
|
83648
83671
|
}).partial().nullable();
|
|
83649
|
-
const
|
|
83672
|
+
const ngPrecomputedMeshSchema = z.object({
|
|
83650
83673
|
// TODO: Should this explicitly specify sharded vs. unsharded?
|
|
83651
83674
|
// Or can/should that be inferred from the data?
|
|
83652
|
-
|
|
83653
|
-
|
|
83654
|
-
|
|
83655
|
-
|
|
83675
|
+
// Note: None of these make sense to specify at the file level, since they
|
|
83676
|
+
// are global camera settings that would apply to all layers.
|
|
83677
|
+
// Intead, initial values should be set via the usual coordination space mechanism,
|
|
83678
|
+
// and the NeuroglancerSubscriber should handle conversion into values to pass to Neuroglancer.
|
|
83679
|
+
// dimensionX: z.number(),
|
|
83680
|
+
// dimensionY: z.number(),
|
|
83681
|
+
// dimensionZ: z.number(),
|
|
83682
|
+
// dimensionUnit: z.enum(['nm', 'um', 'µm', 'mm', 'cm', 'm']),
|
|
83656
83683
|
// TODO: should the following be passed via coordination types instead?
|
|
83657
|
-
projectionScale: z.number(),
|
|
83658
|
-
position: z.array(z.number()).length(3),
|
|
83659
|
-
projectionOrientation: z.array(z.number()).length(4)
|
|
83684
|
+
// projectionScale: z.number(),
|
|
83685
|
+
// position: z.array(z.number()).length(3),
|
|
83686
|
+
// projectionOrientation: z.array(z.number()).length(4),
|
|
83687
|
+
}).partial().nullable();
|
|
83688
|
+
const ngPointAnnotationSchema = z.object({
|
|
83689
|
+
projectionAnnotationSpacing: z.number(),
|
|
83690
|
+
featureIndexProp: z.string().optional().describe("The name of the Neuroglancer AnnotationProperty containing feature IDs. For example, specify 'gene' to use prop_gene() in the Neuroglancer shader code."),
|
|
83691
|
+
pointIndexProp: z.string().optional().describe("The name of the Neuroglancer AnnotationProperty containing point IDs. For example, specify 'point_id' to use prop_point_id() in the Neuroglancer shader code.")
|
|
83660
83692
|
}).partial().nullable();
|
|
83661
83693
|
const obsEmbeddingAnndataSchema = annDataObsEmbedding;
|
|
83662
83694
|
const obsSpotsAnndataSchema = annDataObsLocations;
|
|
@@ -230317,22 +230349,22 @@ async function getDecoder(fileDirectory) {
|
|
|
230317
230349
|
const Decoder = await importFn();
|
|
230318
230350
|
return new Decoder(fileDirectory);
|
|
230319
230351
|
}
|
|
230320
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
230321
|
-
addDecoder(5, () => import("./lzw-
|
|
230352
|
+
addDecoder([void 0, 1], () => import("./raw-D9awu0AB.js").then((m2) => m2.default));
|
|
230353
|
+
addDecoder(5, () => import("./lzw-C4E5VmNh.js").then((m2) => m2.default));
|
|
230322
230354
|
addDecoder(6, () => {
|
|
230323
230355
|
throw new Error("old style JPEG compression is not supported.");
|
|
230324
230356
|
});
|
|
230325
|
-
addDecoder(7, () => import("./jpeg-
|
|
230326
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
230327
|
-
addDecoder(32773, () => import("./packbits-
|
|
230357
|
+
addDecoder(7, () => import("./jpeg-GTyf0pdQ.js").then((m2) => m2.default));
|
|
230358
|
+
addDecoder([8, 32946], () => import("./deflate-BlfSi-73.js").then((m2) => m2.default));
|
|
230359
|
+
addDecoder(32773, () => import("./packbits-CJAiTkd4.js").then((m2) => m2.default));
|
|
230328
230360
|
addDecoder(
|
|
230329
230361
|
34887,
|
|
230330
|
-
() => import("./lerc-
|
|
230362
|
+
() => import("./lerc-Cxsf6swu.js").then(async (m2) => {
|
|
230331
230363
|
await m2.zstd.init();
|
|
230332
230364
|
return m2;
|
|
230333
230365
|
}).then((m2) => m2.default)
|
|
230334
230366
|
);
|
|
230335
|
-
addDecoder(50001, () => import("./webimage-
|
|
230367
|
+
addDecoder(50001, () => import("./webimage-Ca1vS7aF.js").then((m2) => m2.default));
|
|
230336
230368
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
230337
230369
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
230338
230370
|
}
|
|
@@ -247937,13 +247969,13 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
247937
247969
|
*/
|
|
247938
247970
|
componentDidUpdate(prevProps) {
|
|
247939
247971
|
this.viewInfoDidUpdate();
|
|
247940
|
-
const
|
|
247972
|
+
const shallowDiff2 = (propName) => prevProps[propName] !== this.props[propName];
|
|
247941
247973
|
let forceUpdate = false;
|
|
247942
|
-
if (["obsEmbedding", "obsEmbeddingIndex"].some(
|
|
247974
|
+
if (["obsEmbedding", "obsEmbeddingIndex"].some(shallowDiff2)) {
|
|
247943
247975
|
this.onUpdateCellsData();
|
|
247944
247976
|
forceUpdate = true;
|
|
247945
247977
|
}
|
|
247946
|
-
if (["stratifiedData"].some(
|
|
247978
|
+
if (["stratifiedData"].some(shallowDiff2)) {
|
|
247947
247979
|
this.onUpdateStratifiedData();
|
|
247948
247980
|
forceUpdate = true;
|
|
247949
247981
|
}
|
|
@@ -247962,7 +247994,7 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
247962
247994
|
"cellColorEncoding",
|
|
247963
247995
|
"getExpressionValue",
|
|
247964
247996
|
"embeddingPointsVisible"
|
|
247965
|
-
].some(
|
|
247997
|
+
].some(shallowDiff2)) {
|
|
247966
247998
|
this.onUpdateCellsLayer();
|
|
247967
247999
|
forceUpdate = true;
|
|
247968
248000
|
}
|
|
@@ -247974,7 +248006,7 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
247974
248006
|
"embeddingContoursVisible",
|
|
247975
248007
|
"cellSetLabelsVisible",
|
|
247976
248008
|
"cellSetLabelSize"
|
|
247977
|
-
].some(
|
|
248009
|
+
].some(shallowDiff2)) {
|
|
247978
248010
|
this.onUpdateContourLayers();
|
|
247979
248011
|
forceUpdate = true;
|
|
247980
248012
|
}
|
|
@@ -247984,11 +248016,11 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
247984
248016
|
"cellSetLabelsVisible",
|
|
247985
248017
|
"cellSetLabelSize",
|
|
247986
248018
|
"embeddingContoursVisible"
|
|
247987
|
-
].some(
|
|
248019
|
+
].some(shallowDiff2)) {
|
|
247988
248020
|
this.onUpdateCellSetsLayers(false);
|
|
247989
248021
|
forceUpdate = true;
|
|
247990
248022
|
}
|
|
247991
|
-
if (
|
|
248023
|
+
if (shallowDiff2("viewState")) {
|
|
247992
248024
|
this.onUpdateCellSetsLayers(true);
|
|
247993
248025
|
forceUpdate = true;
|
|
247994
248026
|
}
|
|
@@ -269610,21 +269642,21 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
269610
269642
|
*/
|
|
269611
269643
|
componentDidUpdate(prevProps) {
|
|
269612
269644
|
this.viewInfoDidUpdate();
|
|
269613
|
-
const
|
|
269645
|
+
const shallowDiff2 = (propName) => prevProps[propName] !== this.props[propName];
|
|
269614
269646
|
let forceUpdate = false;
|
|
269615
269647
|
if ([
|
|
269616
269648
|
"obsSegmentations",
|
|
269617
269649
|
"obsSegmentationsType",
|
|
269618
269650
|
"obsCentroids"
|
|
269619
|
-
].some(
|
|
269651
|
+
].some(shallowDiff2)) {
|
|
269620
269652
|
this.onUpdateCellsData();
|
|
269621
269653
|
forceUpdate = true;
|
|
269622
269654
|
}
|
|
269623
|
-
if (["cellColors"].some(
|
|
269655
|
+
if (["cellColors"].some(shallowDiff2)) {
|
|
269624
269656
|
this.onUpdateCellColors();
|
|
269625
269657
|
forceUpdate = true;
|
|
269626
269658
|
}
|
|
269627
|
-
if (["expressionData"].some(
|
|
269659
|
+
if (["expressionData"].some(shallowDiff2)) {
|
|
269628
269660
|
this.onUpdateExpressionData();
|
|
269629
269661
|
forceUpdate = true;
|
|
269630
269662
|
}
|
|
@@ -269643,7 +269675,7 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
269643
269675
|
"cellColorEncoding",
|
|
269644
269676
|
"geneExpressionColormap",
|
|
269645
269677
|
"segmentationLayerCallbacks"
|
|
269646
|
-
].some(
|
|
269678
|
+
].some(shallowDiff2)) {
|
|
269647
269679
|
this.onUpdateCellsLayer();
|
|
269648
269680
|
forceUpdate = true;
|
|
269649
269681
|
}
|
|
@@ -269651,7 +269683,7 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
269651
269683
|
"obsLocations",
|
|
269652
269684
|
"obsLocationsLabels",
|
|
269653
269685
|
"obsLocationsFeatureIndex"
|
|
269654
|
-
].some(
|
|
269686
|
+
].some(shallowDiff2)) {
|
|
269655
269687
|
this.onUpdateMoleculesData();
|
|
269656
269688
|
forceUpdate = true;
|
|
269657
269689
|
}
|
|
@@ -269661,15 +269693,15 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
269661
269693
|
"obsLocationsIndex",
|
|
269662
269694
|
"obsLocationsLabels",
|
|
269663
269695
|
"obsLocationsFeatureIndex"
|
|
269664
|
-
].some(
|
|
269696
|
+
].some(shallowDiff2)) {
|
|
269665
269697
|
this.onUpdateMoleculesLayer();
|
|
269666
269698
|
forceUpdate = true;
|
|
269667
269699
|
}
|
|
269668
|
-
if (["neighborhoods"].some(
|
|
269700
|
+
if (["neighborhoods"].some(shallowDiff2)) {
|
|
269669
269701
|
this.onUpdateNeighborhoodsData();
|
|
269670
269702
|
forceUpdate = true;
|
|
269671
269703
|
}
|
|
269672
|
-
if (["neighborhoodLayerDefsDefs", "neighborhoods"].some(
|
|
269704
|
+
if (["neighborhoodLayerDefsDefs", "neighborhoods"].some(shallowDiff2)) {
|
|
269673
269705
|
this.onUpdateNeighborhoodsLayer();
|
|
269674
269706
|
forceUpdate = true;
|
|
269675
269707
|
}
|
|
@@ -269683,7 +269715,7 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
269683
269715
|
"imageLayerCallbacks",
|
|
269684
269716
|
"geneExpressionColormap",
|
|
269685
269717
|
"photometricInterpretation"
|
|
269686
|
-
].some(
|
|
269718
|
+
].some(shallowDiff2)) {
|
|
269687
269719
|
this.onUpdateImages();
|
|
269688
269720
|
forceUpdate = true;
|
|
269689
269721
|
}
|
|
@@ -271433,24 +271465,24 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271433
271465
|
*/
|
|
271434
271466
|
componentDidUpdate(prevProps) {
|
|
271435
271467
|
this.viewInfoDidUpdate();
|
|
271436
|
-
const
|
|
271437
|
-
const
|
|
271468
|
+
const shallowDiff2 = (propName) => prevProps[propName] !== this.props[propName];
|
|
271469
|
+
const shallowDiffByLayer2 = (propName, scopeName) => prevProps?.[propName]?.[scopeName] !== this.props?.[propName]?.[scopeName];
|
|
271438
271470
|
const shallowDiffByChannel = (propName, firstName, secondName) => prevProps?.[propName]?.[firstName]?.[secondName] !== this.props?.[propName]?.[firstName]?.[secondName];
|
|
271439
271471
|
const shallowDiffByLayerCoordination = (propName, layerScope) => prevProps?.[propName]?.[0]?.[layerScope] !== this.props?.[propName]?.[0]?.[layerScope];
|
|
271440
271472
|
const shallowDiffByChannelCoordination = (propName, layerScope, channelScope) => prevProps?.[propName]?.[0]?.[layerScope]?.[channelScope] !== this.props?.[propName]?.[0]?.[layerScope]?.[channelScope];
|
|
271441
271473
|
let forceUpdate = false;
|
|
271442
|
-
if (
|
|
271474
|
+
if (shallowDiff2("segmentationLayerScopes")) {
|
|
271443
271475
|
this.onUpdateAllSegmentationsData();
|
|
271444
271476
|
forceUpdate = true;
|
|
271445
271477
|
} else {
|
|
271446
271478
|
this.props.segmentationLayerScopes?.forEach((layerScope) => {
|
|
271447
|
-
if (
|
|
271479
|
+
if (shallowDiffByLayer2("obsSegmentations", layerScope)) {
|
|
271448
271480
|
this.onUpdateSegmentationsData(layerScope);
|
|
271449
271481
|
forceUpdate = true;
|
|
271450
271482
|
}
|
|
271451
271483
|
});
|
|
271452
271484
|
}
|
|
271453
|
-
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(
|
|
271485
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(shallowDiff2)) {
|
|
271454
271486
|
this.onUpdateAllSegmentationsLocationsData();
|
|
271455
271487
|
forceUpdate = true;
|
|
271456
271488
|
} else {
|
|
@@ -271463,7 +271495,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271463
271495
|
});
|
|
271464
271496
|
});
|
|
271465
271497
|
}
|
|
271466
|
-
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(
|
|
271498
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(shallowDiff2)) {
|
|
271467
271499
|
this.onUpdateAllSegmentationsSetsData();
|
|
271468
271500
|
forceUpdate = true;
|
|
271469
271501
|
} else {
|
|
@@ -271476,7 +271508,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271476
271508
|
});
|
|
271477
271509
|
});
|
|
271478
271510
|
}
|
|
271479
|
-
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(
|
|
271511
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(shallowDiff2)) {
|
|
271480
271512
|
this.onUpdateAllSegmentationsIndexData();
|
|
271481
271513
|
forceUpdate = true;
|
|
271482
271514
|
} else {
|
|
@@ -271489,7 +271521,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271489
271521
|
});
|
|
271490
271522
|
});
|
|
271491
271523
|
}
|
|
271492
|
-
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(
|
|
271524
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(shallowDiff2)) {
|
|
271493
271525
|
this.onUpdateAllSegmentationsExpressionData();
|
|
271494
271526
|
forceUpdate = true;
|
|
271495
271527
|
} else {
|
|
@@ -271514,49 +271546,49 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271514
271546
|
"segmentationLayerCoordination",
|
|
271515
271547
|
"segmentationChannelScopesByLayer",
|
|
271516
271548
|
"segmentationChannelCoordination"
|
|
271517
|
-
].some(
|
|
271549
|
+
].some(shallowDiff2)) {
|
|
271518
271550
|
this.onUpdateSegmentationsLayer();
|
|
271519
271551
|
forceUpdate = true;
|
|
271520
271552
|
}
|
|
271521
|
-
if (
|
|
271553
|
+
if (shallowDiff2("spotLayerScopes")) {
|
|
271522
271554
|
this.onUpdateAllSpotsData();
|
|
271523
271555
|
forceUpdate = true;
|
|
271524
271556
|
} else {
|
|
271525
271557
|
this.props.spotLayerScopes.forEach((layerScope) => {
|
|
271526
|
-
if (
|
|
271558
|
+
if (shallowDiffByLayer2("obsSpots", layerScope)) {
|
|
271527
271559
|
this.onUpdateSpotsData(layerScope);
|
|
271528
271560
|
forceUpdate = true;
|
|
271529
271561
|
}
|
|
271530
271562
|
});
|
|
271531
271563
|
}
|
|
271532
|
-
if (
|
|
271564
|
+
if (shallowDiff2("spotLayerScopes")) {
|
|
271533
271565
|
this.onUpdateAllSpotsSetsData();
|
|
271534
271566
|
forceUpdate = true;
|
|
271535
271567
|
} else {
|
|
271536
271568
|
this.props.spotLayerScopes.forEach((layerScope) => {
|
|
271537
|
-
if (
|
|
271569
|
+
if (shallowDiffByLayer2("obsSpotsSets", layerScope) || shallowDiffByLayer2("obsSpots", layerScope) || shallowDiffByLayerCoordination("spotLayerCoordination", layerScope)) {
|
|
271538
271570
|
this.onUpdateSpotsSetsData(layerScope);
|
|
271539
271571
|
forceUpdate = true;
|
|
271540
271572
|
}
|
|
271541
271573
|
});
|
|
271542
271574
|
}
|
|
271543
|
-
if (
|
|
271575
|
+
if (shallowDiff2("spotLayerScopes")) {
|
|
271544
271576
|
this.onUpdateAllSpotsIndexData();
|
|
271545
271577
|
forceUpdate = true;
|
|
271546
271578
|
} else {
|
|
271547
271579
|
this.props.spotLayerScopes.forEach((layerScope) => {
|
|
271548
|
-
if (
|
|
271580
|
+
if (shallowDiffByLayer2("spotMatrixIndices", layerScope) || shallowDiffByLayer2("obsSpots", layerScope)) {
|
|
271549
271581
|
this.onUpdateSpotsIndexData(layerScope);
|
|
271550
271582
|
forceUpdate = true;
|
|
271551
271583
|
}
|
|
271552
271584
|
});
|
|
271553
271585
|
}
|
|
271554
|
-
if (
|
|
271586
|
+
if (shallowDiff2("spotLayerScopes")) {
|
|
271555
271587
|
this.onUpdateAllSpotsExpressionData();
|
|
271556
271588
|
forceUpdate = true;
|
|
271557
271589
|
} else {
|
|
271558
271590
|
this.props.spotLayerScopes.forEach((layerScope) => {
|
|
271559
|
-
if (
|
|
271591
|
+
if (shallowDiffByLayer2("spotMatrixIndices", layerScope) || shallowDiffByLayer2("obsSpots", layerScope) || shallowDiffByLayer2("spotMultiExpressionData", layerScope)) {
|
|
271560
271592
|
this.onUpdateSpotsExpressionData(layerScope);
|
|
271561
271593
|
forceUpdate = true;
|
|
271562
271594
|
}
|
|
@@ -271571,16 +271603,16 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271571
271603
|
// Coordination props.
|
|
271572
271604
|
"spotLayerScopes",
|
|
271573
271605
|
"spotLayerCoordination"
|
|
271574
|
-
].some(
|
|
271606
|
+
].some(shallowDiff2)) {
|
|
271575
271607
|
this.onUpdateSpotsLayer();
|
|
271576
271608
|
forceUpdate = true;
|
|
271577
271609
|
}
|
|
271578
|
-
if (
|
|
271610
|
+
if (shallowDiff2("pointLayerScopes")) {
|
|
271579
271611
|
this.onUpdateAllPointsData();
|
|
271580
271612
|
forceUpdate = true;
|
|
271581
271613
|
} else {
|
|
271582
271614
|
this.props.pointLayerScopes.forEach((layerScope) => {
|
|
271583
|
-
if (
|
|
271615
|
+
if (shallowDiffByLayer2("obsPoints", layerScope) || shallowDiffByLayer2("pointMultiObsLabels", layerScope) || shallowDiffByLayer2("pointMatrixIndices", layerScope)) {
|
|
271584
271616
|
this.onUpdatePointsData(layerScope);
|
|
271585
271617
|
forceUpdate = true;
|
|
271586
271618
|
}
|
|
@@ -271594,7 +271626,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271594
271626
|
// Coordination props.
|
|
271595
271627
|
"pointLayerScopes",
|
|
271596
271628
|
"pointLayerCoordination"
|
|
271597
|
-
].some(
|
|
271629
|
+
].some(shallowDiff2)) {
|
|
271598
271630
|
this.onUpdatePointsLayer();
|
|
271599
271631
|
forceUpdate = true;
|
|
271600
271632
|
}
|
|
@@ -271606,7 +271638,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
271606
271638
|
"imageLayerCoordination",
|
|
271607
271639
|
"imageChannelScopesByLayer",
|
|
271608
271640
|
"imageChannelCoordination"
|
|
271609
|
-
].some(
|
|
271641
|
+
].some(shallowDiff2)) {
|
|
271610
271642
|
this.onUpdateImages();
|
|
271611
271643
|
forceUpdate = true;
|
|
271612
271644
|
}
|
|
@@ -271745,12 +271777,12 @@ class ErrorBoundary2 extends React__default.Component {
|
|
|
271745
271777
|
}
|
|
271746
271778
|
}
|
|
271747
271779
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
271748
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
271780
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-CsQFLn-E.js");
|
|
271749
271781
|
return { default: SpatialWrapper2 };
|
|
271750
271782
|
});
|
|
271751
271783
|
const SpatialThreeAdapter = React__default.forwardRef((props, ref2) => jsxRuntimeExports.jsx("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsx(ErrorBoundary2, { children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazySpatialThree, { ...props }) }) }) }));
|
|
271752
271784
|
const LazySpatialAccelerated = React__default.lazy(async () => {
|
|
271753
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
271785
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-Cz_XfJLz.js");
|
|
271754
271786
|
return { default: SpatialWrapper2 };
|
|
271755
271787
|
});
|
|
271756
271788
|
const SpatialAcceleratedAdapter = React__default.forwardRef((props, ref2) => jsxRuntimeExports.jsx("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsx(ErrorBoundary2, { children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazySpatialAccelerated, { ...props }) }) }) }));
|
|
@@ -284082,7 +284114,7 @@ function HiglassGlobalStyles(props) {
|
|
|
284082
284114
|
}
|
|
284083
284115
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
284084
284116
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
284085
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
284117
|
+
const { HiGlassComponent } = await import("./higlass-Dzj0Wtv9.js");
|
|
284086
284118
|
return { default: HiGlassComponent };
|
|
284087
284119
|
});
|
|
284088
284120
|
const HG_SIZE = 800;
|
|
@@ -287029,7 +287061,7 @@ function NeuroglancerGlobalStyles(props) {
|
|
|
287029
287061
|
const { classes: classes2 } = props;
|
|
287030
287062
|
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsxRuntimeExports.jsx(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
|
|
287031
287063
|
}
|
|
287032
|
-
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-
|
|
287064
|
+
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-5eQa4brk.js"));
|
|
287033
287065
|
function createWorker() {
|
|
287034
287066
|
return new WorkerFactory();
|
|
287035
287067
|
}
|
|
@@ -287106,107 +287138,548 @@ class NeuroglancerComp extends PureComponent {
|
|
|
287106
287138
|
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(NeuroglancerGlobalStyles, { classes: classes2 }), jsxRuntimeExports.jsx("div", { className: classes2.neuroglancerWrapper, children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef }) }) })] });
|
|
287107
287139
|
}
|
|
287108
287140
|
}
|
|
287141
|
+
function useMemoCustomComparison(factory2, dependencies2, customIsEqual) {
|
|
287142
|
+
const ref2 = useRef(
|
|
287143
|
+
/** @type {{ deps: any; value: T } | undefined} */
|
|
287144
|
+
void 0
|
|
287145
|
+
);
|
|
287146
|
+
if (ref2.current === void 0 || !customIsEqual(ref2.current.deps, dependencies2)) {
|
|
287147
|
+
ref2.current = { deps: dependencies2, value: factory2() };
|
|
287148
|
+
}
|
|
287149
|
+
return ref2.current.value;
|
|
287150
|
+
}
|
|
287151
|
+
const shallowDiff = (prevDeps, nextDeps, depName) => prevDeps[depName] !== nextDeps[depName];
|
|
287152
|
+
const shallowDiffByLayer = (prevDeps, nextDeps, depName, scopeName) => prevDeps?.[depName]?.[scopeName] !== nextDeps?.[depName]?.[scopeName];
|
|
287153
|
+
const shallowDiffByChannelWithKeys = (prevDeps, nextDeps, depName, firstName, secondName, keys2) => keys2.some((k) => prevDeps?.[depName]?.[firstName]?.[secondName]?.[k] !== nextDeps?.[depName]?.[firstName]?.[secondName]?.[k]);
|
|
287154
|
+
const shallowDiffByLayerCoordinationWithKeys = (prevDeps, nextDeps, depName, layerScope, keys2) => keys2.some((k) => prevDeps?.[depName]?.[0]?.[layerScope]?.[k] !== nextDeps?.[depName]?.[0]?.[layerScope]?.[k]);
|
|
287155
|
+
const shallowDiffByChannelCoordinationWithKeys = (prevDeps, nextDeps, depName, layerScope, channelScope, keys2) => keys2.some((k) => prevDeps?.[depName]?.[0]?.[layerScope]?.[channelScope]?.[k] !== nextDeps?.[depName]?.[0]?.[layerScope]?.[channelScope]?.[k]);
|
|
287156
|
+
function customIsEqualForCellColors(prevDeps, nextDeps) {
|
|
287157
|
+
let forceUpdate = false;
|
|
287158
|
+
const curriedShallowDiff = (depName) => shallowDiff(prevDeps, nextDeps, depName);
|
|
287159
|
+
const curriedShallowDiffByChannelWithKeys = (depName, firstName, secondName, keys2) => shallowDiffByChannelWithKeys(prevDeps, nextDeps, depName, firstName, secondName, keys2);
|
|
287160
|
+
const curriedShallowDiffByChannelCoordinationWithKeys = (depName, layerScope, channelScope, keys2) => shallowDiffByChannelCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, channelScope, keys2);
|
|
287161
|
+
if (curriedShallowDiff("theme")) {
|
|
287162
|
+
forceUpdate = true;
|
|
287163
|
+
}
|
|
287164
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(curriedShallowDiff)) {
|
|
287165
|
+
forceUpdate = true;
|
|
287166
|
+
} else {
|
|
287167
|
+
nextDeps.segmentationLayerScopes?.forEach((layerScope) => {
|
|
287168
|
+
nextDeps.segmentationChannelScopesByLayer?.[layerScope]?.forEach((channelScope) => {
|
|
287169
|
+
if (curriedShallowDiffByChannelWithKeys("obsSegmentationsSetsData", layerScope, channelScope, [
|
|
287170
|
+
"obsSets",
|
|
287171
|
+
"obsIndex"
|
|
287172
|
+
]) || curriedShallowDiffByChannelCoordinationWithKeys("segmentationChannelCoordination", layerScope, channelScope, [
|
|
287173
|
+
"obsSetColor",
|
|
287174
|
+
"obsColorEncoding",
|
|
287175
|
+
"obsSetSelection",
|
|
287176
|
+
"additionalObsSets"
|
|
287177
|
+
])) {
|
|
287178
|
+
forceUpdate = true;
|
|
287179
|
+
}
|
|
287180
|
+
});
|
|
287181
|
+
});
|
|
287182
|
+
}
|
|
287183
|
+
return !forceUpdate;
|
|
287184
|
+
}
|
|
287185
|
+
function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
|
|
287186
|
+
let forceUpdate = false;
|
|
287187
|
+
const curriedShallowDiff = (depName) => shallowDiff(prevDeps, nextDeps, depName);
|
|
287188
|
+
const curriedShallowDiffByLayer = (depName, scopeName) => shallowDiffByLayer(prevDeps, nextDeps, depName, scopeName);
|
|
287189
|
+
const curriedShallowDiffByLayerCoordinationWithKeys = (depName, layerScope, keys2) => shallowDiffByLayerCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, keys2);
|
|
287190
|
+
const curriedShallowDiffByChannelCoordinationWithKeys = (depName, layerScope, channelScope, keys2) => shallowDiffByChannelCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, channelScope, keys2);
|
|
287191
|
+
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(curriedShallowDiff)) {
|
|
287192
|
+
forceUpdate = true;
|
|
287193
|
+
} else {
|
|
287194
|
+
nextDeps.segmentationLayerScopes?.forEach((layerScope) => {
|
|
287195
|
+
if (curriedShallowDiffByLayer("obsSegmentationsData", layerScope) || curriedShallowDiffByLayerCoordinationWithKeys("segmentationLayerCoordination", layerScope, [
|
|
287196
|
+
"spatialLayerVisible"
|
|
287197
|
+
])) {
|
|
287198
|
+
forceUpdate = true;
|
|
287199
|
+
}
|
|
287200
|
+
nextDeps.segmentationChannelScopesByLayer?.[layerScope]?.forEach((channelScope) => {
|
|
287201
|
+
if (curriedShallowDiffByChannelCoordinationWithKeys("segmentationChannelCoordination", layerScope, channelScope, [
|
|
287202
|
+
"spatialChannelVisible"
|
|
287203
|
+
])) {
|
|
287204
|
+
forceUpdate = true;
|
|
287205
|
+
}
|
|
287206
|
+
});
|
|
287207
|
+
});
|
|
287208
|
+
}
|
|
287209
|
+
if (curriedShallowDiff("pointLayerScopes")) {
|
|
287210
|
+
forceUpdate = true;
|
|
287211
|
+
} else {
|
|
287212
|
+
nextDeps.pointLayerScopes?.forEach((layerScope) => {
|
|
287213
|
+
if (curriedShallowDiffByLayer("obsPointsData", layerScope) || curriedShallowDiffByLayer("pointMultiIndicesData", layerScope) || curriedShallowDiffByLayerCoordinationWithKeys("pointLayerCoordination", layerScope, [
|
|
287214
|
+
"spatialLayerVisible",
|
|
287215
|
+
"obsColorEncoding",
|
|
287216
|
+
"spatialLayerColor",
|
|
287217
|
+
"featureSelection",
|
|
287218
|
+
"featureFilterMode",
|
|
287219
|
+
"featureColor"
|
|
287220
|
+
]) || Math.abs(prevDeps?.pointLayerCoordination?.[0]?.[layerScope]?.spatialLayerOpacity - nextDeps?.pointLayerCoordination?.[0]?.[layerScope]?.spatialLayerOpacity) >= 0.05) {
|
|
287221
|
+
forceUpdate = true;
|
|
287222
|
+
}
|
|
287223
|
+
});
|
|
287224
|
+
}
|
|
287225
|
+
return !forceUpdate;
|
|
287226
|
+
}
|
|
287227
|
+
function normalizeColor(rgbColor) {
|
|
287228
|
+
return rgbColor.map((c2) => c2 / 255);
|
|
287229
|
+
}
|
|
287230
|
+
function toVec3(normalizedColor) {
|
|
287231
|
+
return `vec3(${normalizedColor.join(", ")})`;
|
|
287232
|
+
}
|
|
287233
|
+
function toVec4(normalizedColor, alpha2) {
|
|
287234
|
+
return `vec4(${normalizedColor.join(", ")}, ${alpha2})`;
|
|
287235
|
+
}
|
|
287236
|
+
function getSpatialLayerColorShader(staticColor, opacity2) {
|
|
287237
|
+
const norm2 = normalizeColor(staticColor);
|
|
287238
|
+
return `
|
|
287239
|
+
void main() {
|
|
287240
|
+
setColor(${toVec4(norm2, opacity2)});
|
|
287241
|
+
}
|
|
287242
|
+
`;
|
|
287243
|
+
}
|
|
287244
|
+
function getSpatialLayerColorWithSelectionShader(staticColor, opacity2, featureIndices, defaultColor, featureIndexProp) {
|
|
287245
|
+
const normStatic = normalizeColor(staticColor);
|
|
287246
|
+
const normDefault = normalizeColor(defaultColor);
|
|
287247
|
+
const numFeatures = featureIndices.length;
|
|
287248
|
+
const indicesArr = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287249
|
+
return `
|
|
287250
|
+
void main() {
|
|
287251
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287252
|
+
${indicesArr}
|
|
287253
|
+
bool isSelected = false;
|
|
287254
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287255
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287256
|
+
isSelected = true;
|
|
287257
|
+
}
|
|
287258
|
+
}
|
|
287259
|
+
if (isSelected) {
|
|
287260
|
+
setColor(${toVec4(normStatic, opacity2)});
|
|
287261
|
+
} else {
|
|
287262
|
+
setColor(${toVec4(normDefault, opacity2)});
|
|
287263
|
+
}
|
|
287264
|
+
}
|
|
287265
|
+
`;
|
|
287266
|
+
}
|
|
287267
|
+
function getSpatialLayerColorFilteredShader(staticColor, opacity2, featureIndices, featureIndexProp) {
|
|
287268
|
+
const normStatic = normalizeColor(staticColor);
|
|
287269
|
+
const numFeatures = featureIndices.length;
|
|
287270
|
+
const indicesArr = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287271
|
+
return `
|
|
287272
|
+
void main() {
|
|
287273
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287274
|
+
${indicesArr}
|
|
287275
|
+
bool isSelected = false;
|
|
287276
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287277
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287278
|
+
isSelected = true;
|
|
287279
|
+
}
|
|
287280
|
+
}
|
|
287281
|
+
if (!isSelected) {
|
|
287282
|
+
discard;
|
|
287283
|
+
}
|
|
287284
|
+
setColor(${toVec4(normStatic, opacity2)});
|
|
287285
|
+
}
|
|
287286
|
+
`;
|
|
287287
|
+
}
|
|
287288
|
+
function getGeneSelectionNoSelectionShader(staticColor, opacity2) {
|
|
287289
|
+
const norm2 = normalizeColor(staticColor);
|
|
287290
|
+
return `
|
|
287291
|
+
void main() {
|
|
287292
|
+
setColor(${toVec4(norm2, opacity2)});
|
|
287293
|
+
}
|
|
287294
|
+
`;
|
|
287295
|
+
}
|
|
287296
|
+
function getGeneSelectionWithSelectionShader(featureIndices, featureColors, staticColor, defaultColor, opacity2, featureIndexProp) {
|
|
287297
|
+
const numFeatures = featureIndices.length;
|
|
287298
|
+
const normDefault = normalizeColor(defaultColor);
|
|
287299
|
+
const normColors = featureColors.map((c2) => normalizeColor(c2));
|
|
287300
|
+
const normStatic = normalizeColor(staticColor);
|
|
287301
|
+
const colorArr = normColors.map((c2) => c2 ? toVec3(c2) : toVec3(normStatic));
|
|
287302
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287303
|
+
const colorsDecl = `vec3 featureColors[${numFeatures}] = vec3[${numFeatures}](${colorArr.join(", ")});`;
|
|
287304
|
+
return `
|
|
287305
|
+
void main() {
|
|
287306
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287307
|
+
${indicesDecl}
|
|
287308
|
+
${colorsDecl}
|
|
287309
|
+
vec4 color = ${toVec4(normDefault, opacity2)};
|
|
287310
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287311
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287312
|
+
color = vec4(featureColors[i], ${opacity2});
|
|
287313
|
+
}
|
|
287314
|
+
}
|
|
287315
|
+
setColor(color);
|
|
287316
|
+
}
|
|
287317
|
+
`;
|
|
287318
|
+
}
|
|
287319
|
+
function getGeneSelectionFilteredShader(featureIndices, featureColors, staticColor, opacity2, featureIndexProp) {
|
|
287320
|
+
const numFeatures = featureIndices.length;
|
|
287321
|
+
const normColors = featureColors.map((c2) => normalizeColor(c2));
|
|
287322
|
+
const normStatic = normalizeColor(staticColor);
|
|
287323
|
+
const colorArr = normColors.map((c2) => c2 ? toVec3(c2) : toVec3(normStatic));
|
|
287324
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287325
|
+
const colorsDecl = `vec3 featureColors[${numFeatures}] = vec3[${numFeatures}](${colorArr.join(", ")});`;
|
|
287326
|
+
return `
|
|
287327
|
+
void main() {
|
|
287328
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287329
|
+
${indicesDecl}
|
|
287330
|
+
${colorsDecl}
|
|
287331
|
+
bool isSelected = false;
|
|
287332
|
+
vec3 matchedColor = vec3(0.0);
|
|
287333
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287334
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287335
|
+
isSelected = true;
|
|
287336
|
+
matchedColor = featureColors[i];
|
|
287337
|
+
}
|
|
287338
|
+
}
|
|
287339
|
+
if (!isSelected) {
|
|
287340
|
+
discard;
|
|
287341
|
+
}
|
|
287342
|
+
setColor(vec4(matchedColor, ${opacity2}));
|
|
287343
|
+
}
|
|
287344
|
+
`;
|
|
287345
|
+
}
|
|
287346
|
+
function getRandomByFeatureShader(opacity2, featureIndexProp) {
|
|
287347
|
+
const paletteSize = PALETTE.length;
|
|
287348
|
+
const normPalette = PALETTE.map((c2) => normalizeColor(c2));
|
|
287349
|
+
const paletteDecl = `vec3 palette[${paletteSize}] = vec3[${paletteSize}](${normPalette.map((c2) => toVec3(c2)).join(", ")});`;
|
|
287350
|
+
return `
|
|
287351
|
+
void main() {
|
|
287352
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287353
|
+
${paletteDecl}
|
|
287354
|
+
int colorIdx = geneIndex - (geneIndex / ${paletteSize}) * ${paletteSize};
|
|
287355
|
+
if (colorIdx < 0) { colorIdx = -colorIdx; }
|
|
287356
|
+
vec3 color = palette[colorIdx];
|
|
287357
|
+
setColor(vec4(color, ${opacity2}));
|
|
287358
|
+
}
|
|
287359
|
+
`;
|
|
287360
|
+
}
|
|
287361
|
+
function getRandomByFeatureWithSelectionShader(featureIndices, defaultColor, opacity2, featureIndexProp) {
|
|
287362
|
+
const paletteSize = PALETTE.length;
|
|
287363
|
+
const normPalette = PALETTE.map((c2) => normalizeColor(c2));
|
|
287364
|
+
const normDefault = normalizeColor(defaultColor);
|
|
287365
|
+
const numFeatures = featureIndices.length;
|
|
287366
|
+
const paletteDecl = `vec3 palette[${paletteSize}] = vec3[${paletteSize}](${normPalette.map((c2) => toVec3(c2)).join(", ")});`;
|
|
287367
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287368
|
+
return `
|
|
287369
|
+
void main() {
|
|
287370
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287371
|
+
${paletteDecl}
|
|
287372
|
+
${indicesDecl}
|
|
287373
|
+
bool isSelected = false;
|
|
287374
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287375
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287376
|
+
isSelected = true;
|
|
287377
|
+
}
|
|
287378
|
+
}
|
|
287379
|
+
if (isSelected) {
|
|
287380
|
+
int colorIdx = geneIndex - (geneIndex / ${paletteSize}) * ${paletteSize};
|
|
287381
|
+
if (colorIdx < 0) { colorIdx = -colorIdx; }
|
|
287382
|
+
setColor(vec4(palette[colorIdx], ${opacity2}));
|
|
287383
|
+
} else {
|
|
287384
|
+
setColor(${toVec4(normDefault, opacity2)});
|
|
287385
|
+
}
|
|
287386
|
+
}
|
|
287387
|
+
`;
|
|
287388
|
+
}
|
|
287389
|
+
function getRandomByFeatureFilteredShader(featureIndices, opacity2, featureIndexProp) {
|
|
287390
|
+
const paletteSize = PALETTE.length;
|
|
287391
|
+
const normPalette = PALETTE.map((c2) => normalizeColor(c2));
|
|
287392
|
+
const numFeatures = featureIndices.length;
|
|
287393
|
+
const paletteDecl = `vec3 palette[${paletteSize}] = vec3[${paletteSize}](${normPalette.map((c2) => toVec3(c2)).join(", ")});`;
|
|
287394
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287395
|
+
return `
|
|
287396
|
+
void main() {
|
|
287397
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287398
|
+
${paletteDecl}
|
|
287399
|
+
${indicesDecl}
|
|
287400
|
+
bool isSelected = false;
|
|
287401
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287402
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287403
|
+
isSelected = true;
|
|
287404
|
+
}
|
|
287405
|
+
}
|
|
287406
|
+
if (!isSelected) {
|
|
287407
|
+
discard;
|
|
287408
|
+
}
|
|
287409
|
+
int colorIdx = geneIndex - (geneIndex / ${paletteSize}) * ${paletteSize};
|
|
287410
|
+
if (colorIdx < 0) { colorIdx = -colorIdx; }
|
|
287411
|
+
setColor(vec4(palette[colorIdx], ${opacity2}));
|
|
287412
|
+
}
|
|
287413
|
+
`;
|
|
287414
|
+
}
|
|
287415
|
+
function hashToFloatGlsl() {
|
|
287416
|
+
return `
|
|
287417
|
+
float hashToFloat(int v, int seed) {
|
|
287418
|
+
int h = v ^ (seed * 16777619);
|
|
287419
|
+
h = h * 747796405 + 2891336453;
|
|
287420
|
+
h = ((h >> 16) ^ h) * 2654435769;
|
|
287421
|
+
h = ((h >> 16) ^ h);
|
|
287422
|
+
return float(h & 0x7FFFFFFF) / float(0x7FFFFFFF);
|
|
287423
|
+
}
|
|
287424
|
+
`;
|
|
287425
|
+
}
|
|
287426
|
+
function getRandomPerPointShader(opacity2, featureIndexProp, pointIndexProp) {
|
|
287427
|
+
return `
|
|
287428
|
+
${hashToFloatGlsl()}
|
|
287429
|
+
void main() {
|
|
287430
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287431
|
+
int pointIndex = prop_${pointIndexProp}();
|
|
287432
|
+
float r = hashToFloat(pointIndex, 0);
|
|
287433
|
+
float g = hashToFloat(pointIndex, 1);
|
|
287434
|
+
float b = hashToFloat(pointIndex, 2);
|
|
287435
|
+
setColor(vec4(r, g, b, ${opacity2}));
|
|
287436
|
+
}
|
|
287437
|
+
`;
|
|
287438
|
+
}
|
|
287439
|
+
function getRandomPerPointWithSelectionShader(featureIndices, defaultColor, opacity2, featureIndexProp, pointIndexProp) {
|
|
287440
|
+
const normDefault = normalizeColor(defaultColor);
|
|
287441
|
+
const numFeatures = featureIndices.length;
|
|
287442
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287443
|
+
return `
|
|
287444
|
+
${hashToFloatGlsl()}
|
|
287445
|
+
void main() {
|
|
287446
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287447
|
+
int pointIndex = prop_${pointIndexProp}();
|
|
287448
|
+
${indicesDecl}
|
|
287449
|
+
bool isSelected = false;
|
|
287450
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287451
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287452
|
+
isSelected = true;
|
|
287453
|
+
}
|
|
287454
|
+
}
|
|
287455
|
+
if (isSelected) {
|
|
287456
|
+
float r = hashToFloat(pointIndex, 0);
|
|
287457
|
+
float g = hashToFloat(pointIndex, 1);
|
|
287458
|
+
float b = hashToFloat(pointIndex, 2);
|
|
287459
|
+
setColor(vec4(r, g, b, ${opacity2}));
|
|
287460
|
+
} else {
|
|
287461
|
+
setColor(${toVec4(normDefault, opacity2)});
|
|
287462
|
+
}
|
|
287463
|
+
}
|
|
287464
|
+
`;
|
|
287465
|
+
}
|
|
287466
|
+
function getRandomPerPointFilteredShader(featureIndices, opacity2, featureIndexProp, pointIndexProp) {
|
|
287467
|
+
const numFeatures = featureIndices.length;
|
|
287468
|
+
const indicesDecl = `int selectedIndices[${numFeatures}] = int[${numFeatures}](${featureIndices.join(", ")});`;
|
|
287469
|
+
return `
|
|
287470
|
+
${hashToFloatGlsl()}
|
|
287471
|
+
void main() {
|
|
287472
|
+
int geneIndex = prop_${featureIndexProp}();
|
|
287473
|
+
int pointIndex = prop_${pointIndexProp}();
|
|
287474
|
+
${indicesDecl}
|
|
287475
|
+
bool isSelected = false;
|
|
287476
|
+
for (int i = 0; i < ${numFeatures}; ++i) {
|
|
287477
|
+
if (geneIndex == selectedIndices[i]) {
|
|
287478
|
+
isSelected = true;
|
|
287479
|
+
}
|
|
287480
|
+
}
|
|
287481
|
+
if (!isSelected) {
|
|
287482
|
+
discard;
|
|
287483
|
+
}
|
|
287484
|
+
float r = hashToFloat(pointIndex, 0);
|
|
287485
|
+
float g = hashToFloat(pointIndex, 1);
|
|
287486
|
+
float b = hashToFloat(pointIndex, 2);
|
|
287487
|
+
setColor(vec4(r, g, b, ${opacity2}));
|
|
287488
|
+
}
|
|
287489
|
+
`;
|
|
287490
|
+
}
|
|
287491
|
+
function getPointsShader(layerCoordination) {
|
|
287492
|
+
const { theme, featureIndex, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, featureIndexProp, pointIndexProp } = layerCoordination;
|
|
287493
|
+
const defaultColor = getDefaultColor(theme);
|
|
287494
|
+
const opacity2 = spatialLayerOpacity ?? 1;
|
|
287495
|
+
const staticColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : defaultColor;
|
|
287496
|
+
const hasFeatureSelection = Array.isArray(featureSelection) && featureSelection.length > 0;
|
|
287497
|
+
const isFiltered = featureFilterMode === "featureSelection";
|
|
287498
|
+
let featureIndices = [];
|
|
287499
|
+
if (hasFeatureSelection && Array.isArray(featureIndex)) {
|
|
287500
|
+
featureIndices = featureSelection.map((name2) => featureIndex.indexOf(name2)).filter((i2) => i2 >= 0);
|
|
287501
|
+
}
|
|
287502
|
+
const hasResolvedIndices = featureIndices.length > 0;
|
|
287503
|
+
const resolvedFeatureColors = hasResolvedIndices ? featureSelection.filter((name2) => featureIndex?.indexOf(name2) >= 0).map((name2) => {
|
|
287504
|
+
const match2 = Array.isArray(featureColor) ? featureColor.find((fc) => fc.name === name2)?.color : null;
|
|
287505
|
+
return match2 || staticColor;
|
|
287506
|
+
}) : [];
|
|
287507
|
+
if (obsColorEncoding === "spatialLayerColor") {
|
|
287508
|
+
if (!hasFeatureSelection || !hasResolvedIndices) {
|
|
287509
|
+
return getSpatialLayerColorShader(staticColor, opacity2);
|
|
287510
|
+
}
|
|
287511
|
+
if (isFiltered) {
|
|
287512
|
+
return getSpatialLayerColorFilteredShader(staticColor, opacity2, featureIndices, featureIndexProp);
|
|
287513
|
+
}
|
|
287514
|
+
return getSpatialLayerColorWithSelectionShader(staticColor, opacity2, featureIndices, defaultColor, featureIndexProp);
|
|
287515
|
+
}
|
|
287516
|
+
if (obsColorEncoding === "geneSelection") {
|
|
287517
|
+
if (!featureIndexProp) {
|
|
287518
|
+
throw new Error("In order to use gene-based color encoding for Neuroglancer Points, options.featureIndexProp must be specified for the obsPoints.ng-annotations fileType in the Vitessce configuration.");
|
|
287519
|
+
}
|
|
287520
|
+
if (!hasFeatureSelection || !hasResolvedIndices) {
|
|
287521
|
+
return getGeneSelectionNoSelectionShader(staticColor, opacity2);
|
|
287522
|
+
}
|
|
287523
|
+
if (isFiltered) {
|
|
287524
|
+
return getGeneSelectionFilteredShader(featureIndices, resolvedFeatureColors, staticColor, opacity2, featureIndexProp);
|
|
287525
|
+
}
|
|
287526
|
+
return getGeneSelectionWithSelectionShader(featureIndices, resolvedFeatureColors, staticColor, defaultColor, opacity2, featureIndexProp);
|
|
287527
|
+
}
|
|
287528
|
+
if (obsColorEncoding === "randomByFeature") {
|
|
287529
|
+
if (!featureIndexProp) {
|
|
287530
|
+
throw new Error("In order to use gene-based color encoding for Neuroglancer Points, options.featureIndexProp must be specified for the obsPoints.ng-annotations fileType in the Vitessce configuration.");
|
|
287531
|
+
}
|
|
287532
|
+
if (!hasFeatureSelection || !hasResolvedIndices) {
|
|
287533
|
+
return getRandomByFeatureShader(opacity2, featureIndexProp);
|
|
287534
|
+
}
|
|
287535
|
+
if (isFiltered) {
|
|
287536
|
+
return getRandomByFeatureFilteredShader(featureIndices, opacity2, featureIndexProp);
|
|
287537
|
+
}
|
|
287538
|
+
return getRandomByFeatureWithSelectionShader(featureIndices, defaultColor, opacity2, featureIndexProp);
|
|
287539
|
+
}
|
|
287540
|
+
if (obsColorEncoding === "random") {
|
|
287541
|
+
if (!pointIndexProp) {
|
|
287542
|
+
throw new Error("In order to use per-point color encoding for Neuroglancer Points, options.pointIndexProp must be specified for the obsPoints.ng-annotations fileType in the Vitessce configuration.");
|
|
287543
|
+
}
|
|
287544
|
+
if (!hasFeatureSelection || !hasResolvedIndices) {
|
|
287545
|
+
return getRandomPerPointShader(opacity2, featureIndexProp, pointIndexProp);
|
|
287546
|
+
}
|
|
287547
|
+
if (isFiltered) {
|
|
287548
|
+
return getRandomPerPointFilteredShader(featureIndices, opacity2, featureIndexProp, pointIndexProp);
|
|
287549
|
+
}
|
|
287550
|
+
return getRandomPerPointWithSelectionShader(featureIndices, defaultColor, opacity2, featureIndexProp, pointIndexProp);
|
|
287551
|
+
}
|
|
287552
|
+
return getSpatialLayerColorShader(staticColor, opacity2);
|
|
287553
|
+
}
|
|
287109
287554
|
const DEFAULT_NG_PROPS = {
|
|
287110
287555
|
layout: "3d",
|
|
287111
287556
|
position: [0, 0, 0],
|
|
287112
287557
|
projectionOrientation: [0, 0, 0, 1],
|
|
287113
287558
|
projectionScale: 1024,
|
|
287114
|
-
crossSectionScale: 1
|
|
287559
|
+
crossSectionScale: 1,
|
|
287560
|
+
dimensions: {
|
|
287561
|
+
x: [1, "nm"],
|
|
287562
|
+
y: [1, "nm"],
|
|
287563
|
+
z: [1, "nm"]
|
|
287564
|
+
},
|
|
287565
|
+
layers: []
|
|
287115
287566
|
};
|
|
287116
287567
|
function toPrecomputedSource(url) {
|
|
287117
287568
|
if (!url) {
|
|
287118
|
-
|
|
287569
|
+
throw new Error("toPrecomputedSource: URL is required");
|
|
287119
287570
|
}
|
|
287120
287571
|
return `precomputed://${url}`;
|
|
287121
287572
|
}
|
|
287122
|
-
|
|
287123
|
-
|
|
287124
|
-
|
|
287125
|
-
µm: 1e3,
|
|
287126
|
-
mm: 1e6,
|
|
287127
|
-
cm: 1e7,
|
|
287128
|
-
m: 1e9
|
|
287129
|
-
};
|
|
287130
|
-
function isInNanometerRange(value2, unit2, minNm = 1, maxNm = 100) {
|
|
287131
|
-
const n3 = typeof value2 === "number" ? value2 : Number(value2);
|
|
287132
|
-
if (!Number.isFinite(n3))
|
|
287133
|
-
return false;
|
|
287134
|
-
const factor = unit2 && UNIT_TO_NM[unit2];
|
|
287135
|
-
if (!factor)
|
|
287136
|
-
return false;
|
|
287137
|
-
const nm = n3 * factor;
|
|
287138
|
-
return nm >= minNm && nm <= maxNm;
|
|
287139
|
-
}
|
|
287140
|
-
function normalizeDimensionsToNanometers(opts2) {
|
|
287141
|
-
const { dimensionUnit, dimensionX, dimensionY, dimensionZ } = opts2;
|
|
287142
|
-
if (!dimensionUnit || !dimensionX || !dimensionY || !dimensionZ) {
|
|
287143
|
-
console.warn("Missing dimension info");
|
|
287573
|
+
function toNgLayerName(dataType, layerScope, channelScope = null) {
|
|
287574
|
+
if (dataType === DataType$4.OBS_SEGMENTATIONS) {
|
|
287575
|
+
return `obsSegmentations-${layerScope}-${channelScope}`;
|
|
287144
287576
|
}
|
|
287145
|
-
|
|
287146
|
-
|
|
287147
|
-
const zNm = isInNanometerRange(dimensionZ, dimensionUnit);
|
|
287148
|
-
if (!xNm || !yNm || !zNm) {
|
|
287149
|
-
console.warn("Dimension was converted to nm units");
|
|
287577
|
+
if (dataType === DataType$4.OBS_POINTS) {
|
|
287578
|
+
return `obsPoints-${layerScope}`;
|
|
287150
287579
|
}
|
|
287151
|
-
|
|
287152
|
-
x: xNm ? [dimensionX, dimensionUnit] : [1, "nm"],
|
|
287153
|
-
y: yNm ? [dimensionY, dimensionUnit] : [1, "nm"],
|
|
287154
|
-
z: zNm ? [dimensionZ, dimensionUnit] : [1, "nm"]
|
|
287155
|
-
};
|
|
287580
|
+
throw new Error(`Unsupported data type: ${dataType}`);
|
|
287156
287581
|
}
|
|
287157
|
-
function
|
|
287158
|
-
const
|
|
287159
|
-
|
|
287160
|
-
|
|
287161
|
-
|
|
287162
|
-
|
|
287163
|
-
|
|
287164
|
-
|
|
287165
|
-
|
|
287166
|
-
|
|
287167
|
-
|
|
287168
|
-
|
|
287169
|
-
|
|
287170
|
-
|
|
287171
|
-
|
|
287172
|
-
|
|
287173
|
-
|
|
287174
|
-
|
|
287175
|
-
|
|
287176
|
-
|
|
287177
|
-
|
|
287178
|
-
|
|
287179
|
-
|
|
287180
|
-
|
|
287181
|
-
|
|
287182
|
-
|
|
287183
|
-
|
|
287184
|
-
|
|
287185
|
-
|
|
287186
|
-
|
|
287187
|
-
|
|
287188
|
-
}
|
|
287189
|
-
|
|
287190
|
-
|
|
287191
|
-
|
|
287192
|
-
|
|
287193
|
-
|
|
287194
|
-
|
|
287195
|
-
|
|
287196
|
-
|
|
287197
|
-
|
|
287198
|
-
|
|
287199
|
-
|
|
287200
|
-
|
|
287201
|
-
|
|
287202
|
-
|
|
287203
|
-
|
|
287204
|
-
|
|
287205
|
-
|
|
287206
|
-
|
|
287207
|
-
|
|
287208
|
-
|
|
287209
|
-
|
|
287582
|
+
function useNeuroglancerViewerState(theme, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData) {
|
|
287583
|
+
const viewerState = useMemoCustomComparison(() => {
|
|
287584
|
+
let result = cloneDeep$1(DEFAULT_NG_PROPS);
|
|
287585
|
+
segmentationLayerScopes.forEach((layerScope) => {
|
|
287586
|
+
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
287587
|
+
const channelScopes = segmentationChannelScopesByLayer[layerScope] || [];
|
|
287588
|
+
const layerData = obsSegmentationsData[layerScope];
|
|
287589
|
+
const layerUrl = obsSegmentationsUrls[layerScope]?.[0]?.url;
|
|
287590
|
+
if (layerUrl && layerData) {
|
|
287591
|
+
const { spatialLayerVisible } = layerCoordination || {};
|
|
287592
|
+
channelScopes.forEach((channelScope) => {
|
|
287593
|
+
const channelCoordination = segmentationChannelCoordination[0]?.[layerScope]?.[channelScope];
|
|
287594
|
+
const { spatialChannelVisible } = channelCoordination || {};
|
|
287595
|
+
result = {
|
|
287596
|
+
...result,
|
|
287597
|
+
layers: [
|
|
287598
|
+
...result.layers,
|
|
287599
|
+
{
|
|
287600
|
+
type: "segmentation",
|
|
287601
|
+
source: toPrecomputedSource(layerUrl),
|
|
287602
|
+
segments: [],
|
|
287603
|
+
name: toNgLayerName(DataType$4.OBS_SEGMENTATIONS, layerScope, channelScope),
|
|
287604
|
+
visible: spatialLayerVisible && spatialChannelVisible,
|
|
287605
|
+
// Both layer and channel
|
|
287606
|
+
// visibility must be true for the layer to be visible.
|
|
287607
|
+
// TODO: update this to extract specific properties from
|
|
287608
|
+
// neuroglancerOptions as needed.
|
|
287609
|
+
...layerData.neuroglancerOptions ?? {}
|
|
287610
|
+
}
|
|
287611
|
+
]
|
|
287612
|
+
};
|
|
287613
|
+
});
|
|
287614
|
+
}
|
|
287615
|
+
});
|
|
287616
|
+
pointLayerScopes.forEach((layerScope) => {
|
|
287617
|
+
const layerCoordination = pointLayerCoordination[0][layerScope];
|
|
287618
|
+
const layerData = obsPointsData[layerScope];
|
|
287619
|
+
const layerUrl = obsPointsUrls[layerScope]?.[0]?.url;
|
|
287620
|
+
const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
|
|
287621
|
+
if (layerUrl && layerData) {
|
|
287622
|
+
const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor } = layerCoordination || {};
|
|
287623
|
+
const shader = getPointsShader({
|
|
287624
|
+
theme,
|
|
287625
|
+
featureIndex,
|
|
287626
|
+
spatialLayerOpacity,
|
|
287627
|
+
obsColorEncoding,
|
|
287628
|
+
spatialLayerColor,
|
|
287629
|
+
featureSelection,
|
|
287630
|
+
featureFilterMode,
|
|
287631
|
+
featureColor,
|
|
287632
|
+
featureIndexProp: layerData.neuroglancerOptions?.featureIndexProp,
|
|
287633
|
+
pointIndexProp: layerData.neuroglancerOptions?.pointIndexProp
|
|
287634
|
+
});
|
|
287635
|
+
result = {
|
|
287636
|
+
...result,
|
|
287637
|
+
layers: [
|
|
287638
|
+
...result.layers,
|
|
287639
|
+
{
|
|
287640
|
+
type: "annotation",
|
|
287641
|
+
source: {
|
|
287642
|
+
url: toPrecomputedSource(layerUrl),
|
|
287643
|
+
subsources: {
|
|
287644
|
+
default: true
|
|
287645
|
+
},
|
|
287646
|
+
enableDefaultSubsources: false
|
|
287647
|
+
},
|
|
287648
|
+
tab: "annotations",
|
|
287649
|
+
shader,
|
|
287650
|
+
name: toNgLayerName(DataType$4.OBS_POINTS, layerScope),
|
|
287651
|
+
visible: spatialLayerVisible,
|
|
287652
|
+
// Options from layerData.neuroglancerOptions
|
|
287653
|
+
// like projectionAnnotationSpacing:
|
|
287654
|
+
projectionAnnotationSpacing: layerData.neuroglancerOptions?.projectionAnnotationSpacing ?? 1
|
|
287655
|
+
}
|
|
287656
|
+
],
|
|
287657
|
+
// TODO: is this needed?
|
|
287658
|
+
// The selected layer here will overwrite anything
|
|
287659
|
+
// that was previously specified.
|
|
287660
|
+
selectedLayer: {
|
|
287661
|
+
// size: ? // TODO: is this needed?
|
|
287662
|
+
layer: toNgLayerName(DataType$4.OBS_POINTS, layerScope)
|
|
287663
|
+
}
|
|
287664
|
+
};
|
|
287665
|
+
}
|
|
287666
|
+
});
|
|
287667
|
+
return result;
|
|
287668
|
+
}, {
|
|
287669
|
+
theme,
|
|
287670
|
+
segmentationLayerScopes,
|
|
287671
|
+
segmentationChannelScopesByLayer,
|
|
287672
|
+
segmentationLayerCoordination,
|
|
287673
|
+
segmentationChannelCoordination,
|
|
287674
|
+
obsSegmentationsUrls,
|
|
287675
|
+
obsSegmentationsData,
|
|
287676
|
+
pointLayerScopes,
|
|
287677
|
+
pointLayerCoordination,
|
|
287678
|
+
obsPointsUrls,
|
|
287679
|
+
obsPointsData,
|
|
287680
|
+
pointMultiIndicesData
|
|
287681
|
+
}, customIsEqualForInitialViewerState);
|
|
287682
|
+
return viewerState;
|
|
287210
287683
|
}
|
|
287211
287684
|
/**
|
|
287212
287685
|
* @license
|
|
@@ -316880,9 +317353,29 @@ function rgbToHex$1(rgb2) {
|
|
|
316880
317353
|
return typeof rgb2 === "string" ? rgb2 : `#${rgb2.map((c2) => c2.toString(16).padStart(2, "0")).join("")}`;
|
|
316881
317354
|
}
|
|
316882
317355
|
function NeuroglancerSubscriber(props) {
|
|
316883
|
-
const {
|
|
317356
|
+
const {
|
|
317357
|
+
uuid: uuid2,
|
|
317358
|
+
coordinationScopes: coordinationScopesRaw,
|
|
317359
|
+
coordinationScopesBy: coordinationScopesByRaw,
|
|
317360
|
+
closeButtonVisible,
|
|
317361
|
+
downloadButtonVisible,
|
|
317362
|
+
removeGridComponent,
|
|
317363
|
+
theme,
|
|
317364
|
+
title: title2 = "Spatial",
|
|
317365
|
+
subtitle = "Powered by Neuroglancer",
|
|
317366
|
+
helpText = ViewHelpMapping.NEUROGLANCER,
|
|
317367
|
+
// Note: this is a temporary mechanism
|
|
317368
|
+
// to pass an initial NG camera state.
|
|
317369
|
+
// Ideally, all camera state should be passed via
|
|
317370
|
+
// the existing spatialZoom, spatialTargetX, spatialRotationOrbit, etc,
|
|
317371
|
+
// and then NeuroglancerSubscriber should internally convert
|
|
317372
|
+
// to NG-compatible values, which would eliminate the need for this.
|
|
317373
|
+
initialNgCameraState
|
|
317374
|
+
} = props;
|
|
316884
317375
|
const loaders = useLoaders();
|
|
317376
|
+
const mergeCoordination = useMergeCoordination();
|
|
316885
317377
|
const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
|
|
317378
|
+
const coordinationScopesBy = useCoordinationScopesBy(coordinationScopes, coordinationScopesByRaw);
|
|
316886
317379
|
const [{
|
|
316887
317380
|
dataset,
|
|
316888
317381
|
obsType,
|
|
@@ -316912,11 +317405,129 @@ function NeuroglancerSubscriber(props) {
|
|
|
316912
317405
|
setSpatialRotationOrbit: setRotationOrbit,
|
|
316913
317406
|
setSpatialZoom: setZoom
|
|
316914
317407
|
}] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.NEUROGLANCER], coordinationScopes);
|
|
317408
|
+
const [ngWidth, ngHeight, containerRef] = useGridItemSize();
|
|
317409
|
+
const [segmentationLayerScopes, segmentationChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$2.SEGMENTATION_CHANNEL, CoordinationType$2.SEGMENTATION_LAYER, coordinationScopes, coordinationScopesBy);
|
|
317410
|
+
const pointLayerScopes = useMultiCoordinationScopesNonNull(CoordinationType$2.POINT_LAYER, coordinationScopes);
|
|
317411
|
+
const segmentationLayerCoordination = useComplexCoordination([
|
|
317412
|
+
CoordinationType$2.FILE_UID,
|
|
317413
|
+
CoordinationType$2.SEGMENTATION_CHANNEL,
|
|
317414
|
+
CoordinationType$2.SPATIAL_LAYER_VISIBLE,
|
|
317415
|
+
CoordinationType$2.SPATIAL_LAYER_OPACITY
|
|
317416
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType$2.SEGMENTATION_LAYER);
|
|
317417
|
+
const segmentationChannelCoordination = useComplexCoordinationSecondary([
|
|
317418
|
+
CoordinationType$2.OBS_TYPE,
|
|
317419
|
+
CoordinationType$2.SPATIAL_TARGET_C,
|
|
317420
|
+
CoordinationType$2.SPATIAL_CHANNEL_VISIBLE,
|
|
317421
|
+
CoordinationType$2.SPATIAL_CHANNEL_OPACITY,
|
|
317422
|
+
CoordinationType$2.SPATIAL_CHANNEL_COLOR,
|
|
317423
|
+
CoordinationType$2.SPATIAL_SEGMENTATION_FILLED,
|
|
317424
|
+
CoordinationType$2.SPATIAL_SEGMENTATION_STROKE_WIDTH,
|
|
317425
|
+
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
317426
|
+
CoordinationType$2.FEATURE_SELECTION,
|
|
317427
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
317428
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
317429
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
317430
|
+
CoordinationType$2.OBS_SET_COLOR,
|
|
317431
|
+
CoordinationType$2.OBS_SET_SELECTION,
|
|
317432
|
+
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
317433
|
+
CoordinationType$2.OBS_HIGHLIGHT,
|
|
317434
|
+
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
317435
|
+
CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
317436
|
+
CoordinationType$2.LEGEND_VISIBLE
|
|
317437
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType$2.SEGMENTATION_LAYER, CoordinationType$2.SEGMENTATION_CHANNEL);
|
|
317438
|
+
const pointLayerCoordination = useComplexCoordination([
|
|
317439
|
+
CoordinationType$2.OBS_TYPE,
|
|
317440
|
+
CoordinationType$2.SPATIAL_LAYER_VISIBLE,
|
|
317441
|
+
CoordinationType$2.SPATIAL_LAYER_OPACITY,
|
|
317442
|
+
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
317443
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
317444
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
317445
|
+
CoordinationType$2.FEATURE_SELECTION,
|
|
317446
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
317447
|
+
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
317448
|
+
CoordinationType$2.SPATIAL_LAYER_COLOR,
|
|
317449
|
+
CoordinationType$2.OBS_HIGHLIGHT,
|
|
317450
|
+
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
317451
|
+
CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
317452
|
+
CoordinationType$2.LEGEND_VISIBLE
|
|
317453
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
|
|
317454
|
+
const [obsPointsData, obsPointsDataStatus, obsPointsUrls, obsPointsErrors] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
317455
|
+
const [pointMultiIndicesData, pointMultiIndicesDataStatus, pointMultiIndicesDataErrors] = usePointMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
317456
|
+
const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls, obsSegmentationsDataErrors] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
317457
|
+
const [obsSegmentationsSetsData, obsSegmentationsSetsDataStatus, obsSegmentationsSetsDataErrors] = useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
317458
|
+
const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus, segmentationMultiFeatureSelectionErrors] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
317459
|
+
const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus, segmentationMultiIndicesDataErrors] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
317460
|
+
const errors = [
|
|
317461
|
+
...obsPointsErrors,
|
|
317462
|
+
...obsSegmentationsDataErrors,
|
|
317463
|
+
...obsSegmentationsSetsDataErrors,
|
|
317464
|
+
...pointMultiIndicesDataErrors,
|
|
317465
|
+
...segmentationMultiFeatureSelectionErrors,
|
|
317466
|
+
...segmentationMultiIndicesDataErrors
|
|
317467
|
+
];
|
|
317468
|
+
const isReady = useReady([
|
|
317469
|
+
// Points
|
|
317470
|
+
obsPointsDataStatus,
|
|
317471
|
+
pointMultiIndicesDataStatus,
|
|
317472
|
+
// Segmentations
|
|
317473
|
+
obsSegmentationsDataStatus,
|
|
317474
|
+
obsSegmentationsSetsDataStatus,
|
|
317475
|
+
segmentationMultiFeatureSelectionStatus,
|
|
317476
|
+
segmentationMultiIndicesDataStatus
|
|
317477
|
+
]);
|
|
316915
317478
|
const { classes: classes2 } = useStyles$4();
|
|
316916
|
-
const
|
|
316917
|
-
|
|
316918
|
-
|
|
316919
|
-
|
|
317479
|
+
const segmentationColorMapping = useMemoCustomComparison(() => {
|
|
317480
|
+
const result = {};
|
|
317481
|
+
segmentationLayerScopes?.forEach((layerScope) => {
|
|
317482
|
+
result[layerScope] = {};
|
|
317483
|
+
segmentationChannelScopesByLayer?.[layerScope]?.forEach((channelScope) => {
|
|
317484
|
+
const { obsSets: layerSets, obsIndex: layerIndex } = obsSegmentationsSetsData?.[layerScope]?.[channelScope] || {};
|
|
317485
|
+
if (layerSets && layerIndex) {
|
|
317486
|
+
const { obsSetColor, obsColorEncoding, obsSetSelection, additionalObsSets } = segmentationChannelCoordination[0][layerScope][channelScope];
|
|
317487
|
+
const mergedCellSets = mergeObsSets(layerSets, additionalObsSets);
|
|
317488
|
+
const cellColors = getCellColors({
|
|
317489
|
+
cellSets: mergedCellSets,
|
|
317490
|
+
cellSetSelection: obsSetSelection,
|
|
317491
|
+
cellSetColor: obsSetColor,
|
|
317492
|
+
obsIndex: layerIndex,
|
|
317493
|
+
theme
|
|
317494
|
+
});
|
|
317495
|
+
const ngCellColors = {};
|
|
317496
|
+
cellColors.forEach((color2, i2) => {
|
|
317497
|
+
ngCellColors[i2] = rgbToHex$1(color2);
|
|
317498
|
+
});
|
|
317499
|
+
result[layerScope][channelScope] = ngCellColors;
|
|
317500
|
+
}
|
|
317501
|
+
});
|
|
317502
|
+
});
|
|
317503
|
+
return result;
|
|
317504
|
+
}, {
|
|
317505
|
+
// The dependencies for the comparison,
|
|
317506
|
+
// used by the custom equality function.
|
|
317507
|
+
segmentationLayerScopes,
|
|
317508
|
+
segmentationChannelScopesByLayer,
|
|
317509
|
+
obsSegmentationsSetsData,
|
|
317510
|
+
segmentationChannelCoordination,
|
|
317511
|
+
theme
|
|
317512
|
+
}, customIsEqualForCellColors);
|
|
317513
|
+
const initalViewerState = useNeuroglancerViewerState(theme, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData);
|
|
317514
|
+
const [latestViewerStateIteration, incrementLatestViewerStateIteration] = useReducer((x2) => x2 + 1, 0);
|
|
317515
|
+
const latestViewerStateRef = useRef({
|
|
317516
|
+
...initalViewerState,
|
|
317517
|
+
...initialNgCameraState ?? {}
|
|
317518
|
+
});
|
|
317519
|
+
useEffect(() => {
|
|
317520
|
+
const prevNgCameraState = {
|
|
317521
|
+
position: latestViewerStateRef.current.position,
|
|
317522
|
+
projectionOrientation: latestViewerStateRef.current.projectionOrientation,
|
|
317523
|
+
projectionScale: latestViewerStateRef.current.projectionScale
|
|
317524
|
+
};
|
|
317525
|
+
latestViewerStateRef.current = {
|
|
317526
|
+
...initalViewerState,
|
|
317527
|
+
...prevNgCameraState
|
|
317528
|
+
};
|
|
317529
|
+
incrementLatestViewerStateIteration();
|
|
317530
|
+
}, [initalViewerState]);
|
|
316920
317531
|
const initialRotationPushedRef = useRef(false);
|
|
316921
317532
|
const ngRotPushAtRef = useRef(0);
|
|
316922
317533
|
const lastInteractionSource = useRef(null);
|
|
@@ -316942,20 +317553,6 @@ function NeuroglancerSubscriber(props) {
|
|
|
316942
317553
|
tx: spatialTargetX,
|
|
316943
317554
|
ty: spatialTargetY
|
|
316944
317555
|
});
|
|
316945
|
-
const mergedCellSets = useMemo$1(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
316946
|
-
const cellColors = useMemo$1(() => getCellColors({
|
|
316947
|
-
cellSets: mergedCellSets,
|
|
316948
|
-
cellSetSelection,
|
|
316949
|
-
cellSetColor,
|
|
316950
|
-
obsIndex,
|
|
316951
|
-
theme
|
|
316952
|
-
}), [
|
|
316953
|
-
mergedCellSets,
|
|
316954
|
-
theme,
|
|
316955
|
-
cellSetColor,
|
|
316956
|
-
cellSetSelection,
|
|
316957
|
-
obsIndex
|
|
316958
|
-
]);
|
|
316959
317556
|
const handleStateUpdate = useCallback((newState) => {
|
|
316960
317557
|
lastInteractionSource.current = LAST_INTERACTION_SOURCE.neuroglancer;
|
|
316961
317558
|
const { projectionScale, projectionOrientation, position: position2 } = newState;
|
|
@@ -317047,25 +317644,12 @@ function NeuroglancerSubscriber(props) {
|
|
|
317047
317644
|
setCellSetColor,
|
|
317048
317645
|
setCellSetSelection
|
|
317049
317646
|
]);
|
|
317050
|
-
const
|
|
317051
|
-
const [batchedCellColors, setBatchedCellColors] = useState(cellColors);
|
|
317052
|
-
useEffect(() => {
|
|
317053
|
-
if (batchedUpdateTimeoutRef.current) {
|
|
317054
|
-
clearTimeout(batchedUpdateTimeoutRef.current);
|
|
317055
|
-
}
|
|
317056
|
-
batchedUpdateTimeoutRef.current = setTimeout(() => {
|
|
317057
|
-
setBatchedCellColors(cellColors);
|
|
317058
|
-
}, 100);
|
|
317059
|
-
}, [cellColors]);
|
|
317060
|
-
const cellColorMapping = useMemo$1(() => {
|
|
317061
|
-
const colorMapping = {};
|
|
317062
|
-
batchedCellColors.forEach((color2, cell2) => {
|
|
317063
|
-
colorMapping[cell2] = rgbToHex$1(color2);
|
|
317064
|
-
});
|
|
317065
|
-
return colorMapping;
|
|
317066
|
-
}, [batchedCellColors]);
|
|
317647
|
+
const cellColorMapping = useMemo$1(() => segmentationColorMapping?.[segmentationLayerScopes?.[0]]?.[segmentationChannelScopesByLayer?.[segmentationLayerScopes?.[0]]?.[0]] ?? {}, [segmentationColorMapping]);
|
|
317067
317648
|
const derivedViewerState = useMemo$1(() => {
|
|
317068
317649
|
const { current: current2 } = latestViewerStateRef;
|
|
317650
|
+
if (current2.layers.length <= 0) {
|
|
317651
|
+
return current2;
|
|
317652
|
+
}
|
|
317069
317653
|
const nextSegments = Object.keys(cellColorMapping);
|
|
317070
317654
|
const prevLayer = current2?.layers?.[0] || {};
|
|
317071
317655
|
const prevSegments = prevLayer.segments || [];
|
|
@@ -317151,12 +317735,15 @@ function NeuroglancerSubscriber(props) {
|
|
|
317151
317735
|
spatialRotationY,
|
|
317152
317736
|
spatialRotationZ,
|
|
317153
317737
|
spatialTargetX,
|
|
317154
|
-
spatialTargetY
|
|
317738
|
+
spatialTargetY,
|
|
317739
|
+
initalViewerState,
|
|
317740
|
+
latestViewerStateIteration
|
|
317155
317741
|
]);
|
|
317156
317742
|
const onSegmentHighlight = useCallback((obsId) => {
|
|
317157
317743
|
setCellHighlight(String(obsId));
|
|
317158
|
-
}, [
|
|
317159
|
-
|
|
317744
|
+
}, [setCellHighlight]);
|
|
317745
|
+
const hasLayers = derivedViewerState?.layers?.length > 0;
|
|
317746
|
+
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, info: subtitle, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady, errors, withPadding: false, children: jsxRuntimeExports.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, ref: containerRef, children: [jsxRuntimeExports.jsx("div", { style: { position: "absolute", top: 0, right: 0, zIndex: 50 }, children: jsxRuntimeExports.jsx(MultiLegend, { theme: "dark", maxHeight: ngHeight, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination }) }), hasLayers ? jsxRuntimeExports.jsx(NeuroglancerComp, { classes: classes2, onSegmentClick, onSelectHoveredCoords: onSegmentHighlight, viewerState: derivedViewerState, cellColorMapping, setViewerState: handleStateUpdate }) : null] }) });
|
|
317160
317747
|
}
|
|
317161
317748
|
const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
|
|
317162
317749
|
function CellSetExpressionPlotOptions(props) {
|
|
@@ -371886,7 +372473,7 @@ class ObsSpotsCsvLoader extends CsvLoader {
|
|
|
371886
372473
|
const payload = await this.getSourceData();
|
|
371887
372474
|
const coordinationValues = {
|
|
371888
372475
|
spotLayer: CL({
|
|
371889
|
-
obsType: "spot",
|
|
372476
|
+
obsType: this.coordinationValues?.obsType ?? "spot",
|
|
371890
372477
|
// obsColorEncoding: 'spatialLayerColor',
|
|
371891
372478
|
// spatialLayerColor: [255, 255, 255],
|
|
371892
372479
|
spatialLayerVisible: true,
|
|
@@ -371926,7 +372513,7 @@ class ObsPointsCsvLoader extends CsvLoader {
|
|
|
371926
372513
|
const payload = await this.getSourceData();
|
|
371927
372514
|
const coordinationValues = {
|
|
371928
372515
|
pointLayer: CL({
|
|
371929
|
-
obsType: "point",
|
|
372516
|
+
obsType: this.coordinationValues?.obsType ?? "point",
|
|
371930
372517
|
// obsColorEncoding: 'spatialLayerColor',
|
|
371931
372518
|
// spatialLayerColor: [255, 255, 255],
|
|
371932
372519
|
spatialLayerVisible: true,
|
|
@@ -373492,7 +374079,7 @@ class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
373492
374079
|
const { path: path2 } = this.options;
|
|
373493
374080
|
const coordinationValues = {
|
|
373494
374081
|
spotLayer: CL({
|
|
373495
|
-
obsType: "spot",
|
|
374082
|
+
obsType: this.coordinationValues?.obsType ?? "spot",
|
|
373496
374083
|
// obsColorEncoding: 'spatialLayerColor',
|
|
373497
374084
|
// spatialLayerColor: [255, 255, 255],
|
|
373498
374085
|
spatialLayerVisible: true,
|
|
@@ -373536,7 +374123,7 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
373536
374123
|
const { path: path2 } = this.options;
|
|
373537
374124
|
const coordinationValues = {
|
|
373538
374125
|
pointLayer: CL({
|
|
373539
|
-
obsType: "point",
|
|
374126
|
+
obsType: this.coordinationValues?.obsType ?? "point",
|
|
373540
374127
|
// obsColorEncoding: 'spatialLayerColor',
|
|
373541
374128
|
// spatialLayerColor: [255, 255, 255],
|
|
373542
374129
|
spatialLayerVisible: true,
|
|
@@ -375041,7 +375628,7 @@ class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
|
|
|
375041
375628
|
const spatialSpotRadius = obsRadius?.data?.[0];
|
|
375042
375629
|
const coordinationValues = {
|
|
375043
375630
|
spotLayer: CL({
|
|
375044
|
-
obsType: "spot",
|
|
375631
|
+
obsType: this.coordinationValues?.obsType ?? "spot",
|
|
375045
375632
|
// obsColorEncoding: 'spatialLayerColor',
|
|
375046
375633
|
// spatialLayerColor: [255, 255, 255],
|
|
375047
375634
|
spatialLayerVisible: true,
|
|
@@ -375256,7 +375843,7 @@ class SpatialDataObsPointsLoader extends AbstractTwoStepLoader {
|
|
|
375256
375843
|
]);
|
|
375257
375844
|
const coordinationValues = {
|
|
375258
375845
|
pointLayer: CL({
|
|
375259
|
-
obsType: "point",
|
|
375846
|
+
obsType: this.coordinationValues?.obsType ?? "point",
|
|
375260
375847
|
obsColorEncoding: "spatialLayerColor",
|
|
375261
375848
|
spatialLayerColor: [255, 255, 255],
|
|
375262
375849
|
spatialLayerVisible: true,
|
|
@@ -375324,12 +375911,26 @@ class PrecomputedMeshSource {
|
|
|
375324
375911
|
}
|
|
375325
375912
|
}
|
|
375326
375913
|
class PrecomputedMeshDataLoader extends AbstractTwoStepLoader {
|
|
375327
|
-
|
|
375328
|
-
|
|
375914
|
+
async load() {
|
|
375915
|
+
const { url, options } = this;
|
|
375329
375916
|
return new LoaderResult({
|
|
375330
375917
|
obsIndex: null,
|
|
375331
375918
|
obsSegmentations: {},
|
|
375332
|
-
obsSegmentationsType: "mesh"
|
|
375919
|
+
obsSegmentationsType: "mesh",
|
|
375920
|
+
neuroglancerOptions: options
|
|
375921
|
+
}, url);
|
|
375922
|
+
}
|
|
375923
|
+
}
|
|
375924
|
+
class NgAnnotationPointsDataLoader extends AbstractTwoStepLoader {
|
|
375925
|
+
async load() {
|
|
375926
|
+
const { url, options } = this;
|
|
375927
|
+
return new LoaderResult({
|
|
375928
|
+
obsIndex: null,
|
|
375929
|
+
obsPoints: null,
|
|
375930
|
+
featureIds: null,
|
|
375931
|
+
obsPointsModelMatrix: null,
|
|
375932
|
+
obsPointsTilingType: "neuroglancer",
|
|
375933
|
+
neuroglancerOptions: options
|
|
375333
375934
|
}, url);
|
|
375334
375935
|
}
|
|
375335
375936
|
}
|
|
@@ -397290,7 +397891,8 @@ const baseFileTypes = [
|
|
|
397290
397891
|
...makeZarrFileTypes(FileType$2.OBS_EMBEDDING_SPATIALDATA_ZARR, DataType$4.OBS_EMBEDDING, SpatialDataObsEmbeddingLoader, SpatialDataTableSource, obsEmbeddingSpatialdataSchema),
|
|
397291
397892
|
...makeZarrFileTypes(FileType$2.FEATURE_LABELS_SPATIALDATA_ZARR, DataType$4.FEATURE_LABELS, SpatialDataFeatureLabelsLoader, SpatialDataTableSource, featureLabelsAnndataSchema),
|
|
397292
397893
|
makeFileType(FileType$2.OBS_SEGMENTATIONS_GLB, DataType$4.OBS_SEGMENTATIONS, GlbDataLoader, GlbSource, meshGlbSchema),
|
|
397293
|
-
makeFileType(FileType$2.OBS_SEGMENTATIONS_NG_PRECOMPUTED, DataType$4.OBS_SEGMENTATIONS, PrecomputedMeshDataLoader, PrecomputedMeshSource,
|
|
397894
|
+
makeFileType(FileType$2.OBS_SEGMENTATIONS_NG_PRECOMPUTED, DataType$4.OBS_SEGMENTATIONS, PrecomputedMeshDataLoader, PrecomputedMeshSource, ngPrecomputedMeshSchema),
|
|
397895
|
+
makeFileType(FileType$2.OBS_POINTS_NG_ANNOTATIONS, DataType$4.OBS_POINTS, NgAnnotationPointsDataLoader, PrecomputedMeshSource, ngPointAnnotationSchema),
|
|
397294
397896
|
// All legacy file types
|
|
397295
397897
|
makeFileType(FileType$2.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR, DataType$4.OBS_FEATURE_MATRIX, MatrixZarrAsObsFeatureMatrixLoader, ZarrDataSource, z.null()),
|
|
397296
397898
|
makeFileType(FileType$2.IMAGE_RASTER_JSON, DataType$4.IMAGE, RasterJsonAsImageLoader, JsonSource, rasterJsonSchema),
|