@vitessce/dev 3.8.13 → 3.9.0
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-B_8-dIW1.js → OrbitControls-XnzJtnMh.js} +1 -1
- package/dist/{ReactNeuroglancer-BkPfN_Gu.js → ReactNeuroglancer-BTLpuV09.js} +1 -1
- package/dist/{deflate-D2hQqXWv.js → deflate-0UC3wUc7.js} +1 -1
- package/dist/{higlass-B7N72_I4.js → higlass-DTBEnOUt.js} +1 -1
- package/dist/{index-hfBQsjWd.js → index-4EtK005E.js} +2 -2
- package/dist/{index-DAHRuzlP.js → index-B-7qLcpV.js} +3 -3
- package/dist/{index-_Js3wB3q.js → index-P1FfHDqS.js} +1349 -216
- package/dist/index.js +1 -1
- package/dist/{jpeg-4T1eMJjT.js → jpeg-B-cJrwmt.js} +1 -1
- package/dist/{lerc-CYc2rNzh.js → lerc-BdcQu2oQ.js} +1 -1
- package/dist/{lzw-DegoPRcq.js → lzw-CdFWMxJD.js} +1 -1
- package/dist/{packbits-D8TtRGBA.js → packbits-C-CYBJdL.js} +1 -1
- package/dist/{raw-_5jEXNrG.js → raw-DgICW0IR.js} +1 -1
- package/dist/{troika-three-text.esm-Dl5ef-Ti.js → troika-three-text.esm-Cz3t4bdh.js} +1 -1
- package/dist/{webimage-CsMD6Fde.js → webimage-B0Qn48pR.js} +1 -1
- package/package.json +5 -5
|
@@ -301,6 +301,7 @@ const CoordinationType$2 = {
|
|
|
301
301
|
OBS_SET_HIGHLIGHT: "obsSetHighlight",
|
|
302
302
|
OBS_SET_EXPANSION: "obsSetExpansion",
|
|
303
303
|
OBS_SET_COLOR: "obsSetColor",
|
|
304
|
+
FEATURE_COLOR: "featureColor",
|
|
304
305
|
FEATURE_HIGHLIGHT: "featureHighlight",
|
|
305
306
|
FEATURE_SELECTION: "featureSelection",
|
|
306
307
|
FEATURE_SET_SELECTION: "featureSetSelection",
|
|
@@ -907,6 +908,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
907
908
|
CoordinationType$2.OBS_SET_FILTER,
|
|
908
909
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
909
910
|
CoordinationType$2.OBS_SET_COLOR,
|
|
911
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
912
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
910
913
|
CoordinationType$2.FEATURE_HIGHLIGHT,
|
|
911
914
|
CoordinationType$2.FEATURE_SELECTION,
|
|
912
915
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
@@ -1121,6 +1124,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1121
1124
|
CoordinationType$2.SPATIAL_SPOT_STROKE_WIDTH,
|
|
1122
1125
|
CoordinationType$2.SPATIAL_LAYER_COLOR,
|
|
1123
1126
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
1127
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
1128
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
1124
1129
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
1125
1130
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
1126
1131
|
CoordinationType$2.FEATURE_SELECTION,
|
|
@@ -1340,7 +1345,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1340
1345
|
CoordinationType$2.HIERARCHY_LEVELS
|
|
1341
1346
|
]
|
|
1342
1347
|
};
|
|
1343
|
-
const version$6 = "3.
|
|
1348
|
+
const version$6 = "3.9.0";
|
|
1344
1349
|
const META_VERSION = {
|
|
1345
1350
|
version: version$6
|
|
1346
1351
|
};
|
|
@@ -29569,7 +29574,7 @@ var _span$3;
|
|
|
29569
29574
|
const useUtilityClasses$1l = (ownerState) => {
|
|
29570
29575
|
const {
|
|
29571
29576
|
classes: classes2,
|
|
29572
|
-
contained,
|
|
29577
|
+
contained: contained2,
|
|
29573
29578
|
size: size2,
|
|
29574
29579
|
disabled,
|
|
29575
29580
|
error: error2,
|
|
@@ -29578,7 +29583,7 @@ const useUtilityClasses$1l = (ownerState) => {
|
|
|
29578
29583
|
required: required2
|
|
29579
29584
|
} = ownerState;
|
|
29580
29585
|
const slots = {
|
|
29581
|
-
root: ["root", disabled && "disabled", error2 && "error", size2 && `size${capitalize$1(size2)}`,
|
|
29586
|
+
root: ["root", disabled && "disabled", error2 && "error", size2 && `size${capitalize$1(size2)}`, contained2 && "contained", focused && "focused", filled && "filled", required2 && "required"]
|
|
29582
29587
|
};
|
|
29583
29588
|
return composeClasses(slots, getFormHelperTextUtilityClasses, classes2);
|
|
29584
29589
|
};
|
|
@@ -31352,6 +31357,90 @@ ListItemText.propTypes = {
|
|
|
31352
31357
|
*/
|
|
31353
31358
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
31354
31359
|
};
|
|
31360
|
+
function getListItemIconUtilityClass(slot) {
|
|
31361
|
+
return generateUtilityClass("MuiListItemIcon", slot);
|
|
31362
|
+
}
|
|
31363
|
+
const listItemIconClasses = generateUtilityClasses("MuiListItemIcon", ["root", "alignItemsFlexStart"]);
|
|
31364
|
+
const useUtilityClasses$1e = (ownerState) => {
|
|
31365
|
+
const {
|
|
31366
|
+
alignItems,
|
|
31367
|
+
classes: classes2
|
|
31368
|
+
} = ownerState;
|
|
31369
|
+
const slots = {
|
|
31370
|
+
root: ["root", alignItems === "flex-start" && "alignItemsFlexStart"]
|
|
31371
|
+
};
|
|
31372
|
+
return composeClasses(slots, getListItemIconUtilityClass, classes2);
|
|
31373
|
+
};
|
|
31374
|
+
const ListItemIconRoot = styled("div", {
|
|
31375
|
+
name: "MuiListItemIcon",
|
|
31376
|
+
slot: "Root",
|
|
31377
|
+
overridesResolver: (props, styles2) => {
|
|
31378
|
+
const {
|
|
31379
|
+
ownerState
|
|
31380
|
+
} = props;
|
|
31381
|
+
return [styles2.root, ownerState.alignItems === "flex-start" && styles2.alignItemsFlexStart];
|
|
31382
|
+
}
|
|
31383
|
+
})(memoTheme(({
|
|
31384
|
+
theme
|
|
31385
|
+
}) => ({
|
|
31386
|
+
minWidth: 56,
|
|
31387
|
+
color: (theme.vars || theme).palette.action.active,
|
|
31388
|
+
flexShrink: 0,
|
|
31389
|
+
display: "inline-flex",
|
|
31390
|
+
variants: [{
|
|
31391
|
+
props: {
|
|
31392
|
+
alignItems: "flex-start"
|
|
31393
|
+
},
|
|
31394
|
+
style: {
|
|
31395
|
+
marginTop: 8
|
|
31396
|
+
}
|
|
31397
|
+
}]
|
|
31398
|
+
})));
|
|
31399
|
+
const ListItemIcon = /* @__PURE__ */ React.forwardRef(function ListItemIcon2(inProps, ref2) {
|
|
31400
|
+
const props = useDefaultProps({
|
|
31401
|
+
props: inProps,
|
|
31402
|
+
name: "MuiListItemIcon"
|
|
31403
|
+
});
|
|
31404
|
+
const {
|
|
31405
|
+
className,
|
|
31406
|
+
...other
|
|
31407
|
+
} = props;
|
|
31408
|
+
const context2 = React.useContext(ListContext);
|
|
31409
|
+
const ownerState = {
|
|
31410
|
+
...props,
|
|
31411
|
+
alignItems: context2.alignItems
|
|
31412
|
+
};
|
|
31413
|
+
const classes2 = useUtilityClasses$1e(ownerState);
|
|
31414
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemIconRoot, {
|
|
31415
|
+
className: clsx$1(classes2.root, className),
|
|
31416
|
+
ownerState,
|
|
31417
|
+
ref: ref2,
|
|
31418
|
+
...other
|
|
31419
|
+
});
|
|
31420
|
+
});
|
|
31421
|
+
ListItemIcon.propTypes = {
|
|
31422
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
31423
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
31424
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
31425
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
31426
|
+
/**
|
|
31427
|
+
* The content of the component, normally `Icon`, `SvgIcon`,
|
|
31428
|
+
* or a `@mui/icons-material` SVG icon element.
|
|
31429
|
+
*/
|
|
31430
|
+
children: PropTypes.node,
|
|
31431
|
+
/**
|
|
31432
|
+
* Override or extend the styles applied to the component.
|
|
31433
|
+
*/
|
|
31434
|
+
classes: PropTypes.object,
|
|
31435
|
+
/**
|
|
31436
|
+
* @ignore
|
|
31437
|
+
*/
|
|
31438
|
+
className: PropTypes.string,
|
|
31439
|
+
/**
|
|
31440
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
31441
|
+
*/
|
|
31442
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
31443
|
+
};
|
|
31355
31444
|
function getScrollbarSize$1(win2 = window) {
|
|
31356
31445
|
const documentWidth = win2.document.documentElement.clientWidth;
|
|
31357
31446
|
return win2.innerWidth - documentWidth;
|
|
@@ -31603,7 +31692,7 @@ function getDividerUtilityClass(slot) {
|
|
|
31603
31692
|
return generateUtilityClass("MuiDivider", slot);
|
|
31604
31693
|
}
|
|
31605
31694
|
const dividerClasses = generateUtilityClasses("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]);
|
|
31606
|
-
const useUtilityClasses$
|
|
31695
|
+
const useUtilityClasses$1d = (ownerState) => {
|
|
31607
31696
|
const {
|
|
31608
31697
|
absolute: absolute2,
|
|
31609
31698
|
children: children3,
|
|
@@ -31817,7 +31906,7 @@ const Divider$1 = /* @__PURE__ */ React.forwardRef(function Divider2(inProps, re
|
|
|
31817
31906
|
textAlign: textAlign2,
|
|
31818
31907
|
variant
|
|
31819
31908
|
};
|
|
31820
|
-
const classes2 = useUtilityClasses$
|
|
31909
|
+
const classes2 = useUtilityClasses$1d(ownerState);
|
|
31821
31910
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(DividerRoot, {
|
|
31822
31911
|
as: component,
|
|
31823
31912
|
className: clsx$1(classes2.root, className),
|
|
@@ -31899,90 +31988,6 @@ Divider$1.propTypes = {
|
|
|
31899
31988
|
*/
|
|
31900
31989
|
variant: PropTypes.oneOfType([PropTypes.oneOf(["fullWidth", "inset", "middle"]), PropTypes.string])
|
|
31901
31990
|
};
|
|
31902
|
-
function getListItemIconUtilityClass(slot) {
|
|
31903
|
-
return generateUtilityClass("MuiListItemIcon", slot);
|
|
31904
|
-
}
|
|
31905
|
-
const listItemIconClasses = generateUtilityClasses("MuiListItemIcon", ["root", "alignItemsFlexStart"]);
|
|
31906
|
-
const useUtilityClasses$1d = (ownerState) => {
|
|
31907
|
-
const {
|
|
31908
|
-
alignItems,
|
|
31909
|
-
classes: classes2
|
|
31910
|
-
} = ownerState;
|
|
31911
|
-
const slots = {
|
|
31912
|
-
root: ["root", alignItems === "flex-start" && "alignItemsFlexStart"]
|
|
31913
|
-
};
|
|
31914
|
-
return composeClasses(slots, getListItemIconUtilityClass, classes2);
|
|
31915
|
-
};
|
|
31916
|
-
const ListItemIconRoot = styled("div", {
|
|
31917
|
-
name: "MuiListItemIcon",
|
|
31918
|
-
slot: "Root",
|
|
31919
|
-
overridesResolver: (props, styles2) => {
|
|
31920
|
-
const {
|
|
31921
|
-
ownerState
|
|
31922
|
-
} = props;
|
|
31923
|
-
return [styles2.root, ownerState.alignItems === "flex-start" && styles2.alignItemsFlexStart];
|
|
31924
|
-
}
|
|
31925
|
-
})(memoTheme(({
|
|
31926
|
-
theme
|
|
31927
|
-
}) => ({
|
|
31928
|
-
minWidth: 56,
|
|
31929
|
-
color: (theme.vars || theme).palette.action.active,
|
|
31930
|
-
flexShrink: 0,
|
|
31931
|
-
display: "inline-flex",
|
|
31932
|
-
variants: [{
|
|
31933
|
-
props: {
|
|
31934
|
-
alignItems: "flex-start"
|
|
31935
|
-
},
|
|
31936
|
-
style: {
|
|
31937
|
-
marginTop: 8
|
|
31938
|
-
}
|
|
31939
|
-
}]
|
|
31940
|
-
})));
|
|
31941
|
-
const ListItemIcon = /* @__PURE__ */ React.forwardRef(function ListItemIcon2(inProps, ref2) {
|
|
31942
|
-
const props = useDefaultProps({
|
|
31943
|
-
props: inProps,
|
|
31944
|
-
name: "MuiListItemIcon"
|
|
31945
|
-
});
|
|
31946
|
-
const {
|
|
31947
|
-
className,
|
|
31948
|
-
...other
|
|
31949
|
-
} = props;
|
|
31950
|
-
const context2 = React.useContext(ListContext);
|
|
31951
|
-
const ownerState = {
|
|
31952
|
-
...props,
|
|
31953
|
-
alignItems: context2.alignItems
|
|
31954
|
-
};
|
|
31955
|
-
const classes2 = useUtilityClasses$1d(ownerState);
|
|
31956
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ListItemIconRoot, {
|
|
31957
|
-
className: clsx$1(classes2.root, className),
|
|
31958
|
-
ownerState,
|
|
31959
|
-
ref: ref2,
|
|
31960
|
-
...other
|
|
31961
|
-
});
|
|
31962
|
-
});
|
|
31963
|
-
ListItemIcon.propTypes = {
|
|
31964
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
31965
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
31966
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
31967
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
31968
|
-
/**
|
|
31969
|
-
* The content of the component, normally `Icon`, `SvgIcon`,
|
|
31970
|
-
* or a `@mui/icons-material` SVG icon element.
|
|
31971
|
-
*/
|
|
31972
|
-
children: PropTypes.node,
|
|
31973
|
-
/**
|
|
31974
|
-
* Override or extend the styles applied to the component.
|
|
31975
|
-
*/
|
|
31976
|
-
classes: PropTypes.object,
|
|
31977
|
-
/**
|
|
31978
|
-
* @ignore
|
|
31979
|
-
*/
|
|
31980
|
-
className: PropTypes.string,
|
|
31981
|
-
/**
|
|
31982
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
31983
|
-
*/
|
|
31984
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
31985
|
-
};
|
|
31986
31991
|
function getMenuItemUtilityClass(slot) {
|
|
31987
31992
|
return generateUtilityClass("MuiMenuItem", slot);
|
|
31988
31993
|
}
|
|
@@ -83649,7 +83654,7 @@ const AUXILIARY_COORDINATION_TYPES_MAP = {
|
|
|
83649
83654
|
spatialImageLayer: ["imageLayerCallbacks", "areLoadingImageChannels"],
|
|
83650
83655
|
spatialSegmentationLayer: ["segmentationLayerCallbacks", "areLoadingSegmentationChannels"],
|
|
83651
83656
|
spatialAcceleratedVolumeLoadingProgress: ["volumeLoadingProgress"],
|
|
83652
|
-
|
|
83657
|
+
spatialTiledPointsLoadingProgress: ["tiledPointsLoadingProgress"]
|
|
83653
83658
|
};
|
|
83654
83659
|
const mapCoordinationScopes = (coordinationScopes) => {
|
|
83655
83660
|
const newCoordinationScopes = {};
|
|
@@ -92642,6 +92647,23 @@ function usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loader
|
|
|
92642
92647
|
const [indicesData, indicesDataStatus, indicesDataErrors] = useObsLabelsMultiLevel(loaders, dataset, false, matchOnObj, 1);
|
|
92643
92648
|
return [indicesData, indicesDataStatus, indicesDataErrors];
|
|
92644
92649
|
}
|
|
92650
|
+
function usePointMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
92651
|
+
const obsFeatureMatrixCoordination = useComplexCoordination([
|
|
92652
|
+
// We currently do not specify obsType or featureValueType here,
|
|
92653
|
+
// since for points we are only interested in the var table
|
|
92654
|
+
// to get the info about each feature (gene).
|
|
92655
|
+
CoordinationType$2.FEATURE_TYPE
|
|
92656
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
|
|
92657
|
+
const matchOnObj = useMemo$1(
|
|
92658
|
+
() => obsFeatureMatrixCoordination[0],
|
|
92659
|
+
// imageCoordination reference changes each render,
|
|
92660
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
92661
|
+
// indirect dependencies here.
|
|
92662
|
+
[coordinationScopes, coordinationScopesBy]
|
|
92663
|
+
);
|
|
92664
|
+
const [indicesData, indicesDataStatus, indicesDataErrors] = useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, false, matchOnObj, 1);
|
|
92665
|
+
return [indicesData, indicesDataStatus, indicesDataErrors];
|
|
92666
|
+
}
|
|
92645
92667
|
function useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
92646
92668
|
const obsTypeCoordination = useComplexCoordinationSecondary([
|
|
92647
92669
|
CoordinationType$2.OBS_TYPE
|
|
@@ -189810,14 +189832,14 @@ class RBush {
|
|
|
189810
189832
|
search(bbox2) {
|
|
189811
189833
|
let node2 = this.data;
|
|
189812
189834
|
const result = [];
|
|
189813
|
-
if (!intersects$
|
|
189835
|
+
if (!intersects$4(bbox2, node2)) return result;
|
|
189814
189836
|
const toBBox = this.toBBox;
|
|
189815
189837
|
const nodesToSearch = [];
|
|
189816
189838
|
while (node2) {
|
|
189817
189839
|
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
189818
189840
|
const child = node2.children[i2];
|
|
189819
189841
|
const childBBox = node2.leaf ? toBBox(child) : child;
|
|
189820
|
-
if (intersects$
|
|
189842
|
+
if (intersects$4(bbox2, childBBox)) {
|
|
189821
189843
|
if (node2.leaf) result.push(child);
|
|
189822
189844
|
else if (contains$3(bbox2, childBBox)) this._all(child, result);
|
|
189823
189845
|
else nodesToSearch.push(child);
|
|
@@ -189829,13 +189851,13 @@ class RBush {
|
|
|
189829
189851
|
}
|
|
189830
189852
|
collides(bbox2) {
|
|
189831
189853
|
let node2 = this.data;
|
|
189832
|
-
if (!intersects$
|
|
189854
|
+
if (!intersects$4(bbox2, node2)) return false;
|
|
189833
189855
|
const nodesToSearch = [];
|
|
189834
189856
|
while (node2) {
|
|
189835
189857
|
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
189836
189858
|
const child = node2.children[i2];
|
|
189837
189859
|
const childBBox = node2.leaf ? this.toBBox(child) : child;
|
|
189838
|
-
if (intersects$
|
|
189860
|
+
if (intersects$4(bbox2, childBBox)) {
|
|
189839
189861
|
if (node2.leaf || contains$3(bbox2, childBBox)) return true;
|
|
189840
189862
|
nodesToSearch.push(child);
|
|
189841
189863
|
}
|
|
@@ -190147,7 +190169,7 @@ function intersectionArea(a2, b2) {
|
|
|
190147
190169
|
function contains$3(a2, b2) {
|
|
190148
190170
|
return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
|
|
190149
190171
|
}
|
|
190150
|
-
function intersects$
|
|
190172
|
+
function intersects$4(a2, b2) {
|
|
190151
190173
|
return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
|
|
190152
190174
|
}
|
|
190153
190175
|
function createNode(children3) {
|
|
@@ -229014,22 +229036,22 @@ async function getDecoder(fileDirectory) {
|
|
|
229014
229036
|
const Decoder = await importFn();
|
|
229015
229037
|
return new Decoder(fileDirectory);
|
|
229016
229038
|
}
|
|
229017
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
229018
|
-
addDecoder(5, () => import("./lzw-
|
|
229039
|
+
addDecoder([void 0, 1], () => import("./raw-DgICW0IR.js").then((m2) => m2.default));
|
|
229040
|
+
addDecoder(5, () => import("./lzw-CdFWMxJD.js").then((m2) => m2.default));
|
|
229019
229041
|
addDecoder(6, () => {
|
|
229020
229042
|
throw new Error("old style JPEG compression is not supported.");
|
|
229021
229043
|
});
|
|
229022
|
-
addDecoder(7, () => import("./jpeg-
|
|
229023
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
229024
|
-
addDecoder(32773, () => import("./packbits-
|
|
229044
|
+
addDecoder(7, () => import("./jpeg-B-cJrwmt.js").then((m2) => m2.default));
|
|
229045
|
+
addDecoder([8, 32946], () => import("./deflate-0UC3wUc7.js").then((m2) => m2.default));
|
|
229046
|
+
addDecoder(32773, () => import("./packbits-C-CYBJdL.js").then((m2) => m2.default));
|
|
229025
229047
|
addDecoder(
|
|
229026
229048
|
34887,
|
|
229027
|
-
() => import("./lerc-
|
|
229049
|
+
() => import("./lerc-BdcQu2oQ.js").then(async (m2) => {
|
|
229028
229050
|
await m2.zstd.init();
|
|
229029
229051
|
return m2;
|
|
229030
229052
|
}).then((m2) => m2.default)
|
|
229031
229053
|
);
|
|
229032
|
-
addDecoder(50001, () => import("./webimage-
|
|
229054
|
+
addDecoder(50001, () => import("./webimage-B0Qn48pR.js").then((m2) => m2.default));
|
|
229033
229055
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
229034
229056
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
229035
229057
|
}
|
|
@@ -250955,6 +250977,7 @@ function Legend(props) {
|
|
|
250955
250977
|
positionRelative = false,
|
|
250956
250978
|
highContrast = false,
|
|
250957
250979
|
obsType,
|
|
250980
|
+
isPointsLayer = false,
|
|
250958
250981
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
250959
250982
|
featureType: _featureType = void 0,
|
|
250960
250983
|
// Unused but accepted for API compatibility
|
|
@@ -250962,6 +250985,9 @@ function Legend(props) {
|
|
|
250962
250985
|
considerSelections = true,
|
|
250963
250986
|
obsColorEncoding,
|
|
250964
250987
|
featureSelection,
|
|
250988
|
+
featureFilterMode,
|
|
250989
|
+
featureColor,
|
|
250990
|
+
featureIndex,
|
|
250965
250991
|
featureLabelsMap,
|
|
250966
250992
|
featureValueColormap,
|
|
250967
250993
|
featureValueColormapRange,
|
|
@@ -251005,15 +251031,94 @@ function Legend(props) {
|
|
|
251005
251031
|
debouncedSetRange(rangeValue);
|
|
251006
251032
|
}
|
|
251007
251033
|
}, [debouncedSetRange]);
|
|
251034
|
+
const obsLabel = capitalize$3(obsType ?? null);
|
|
251008
251035
|
const isDarkTheme = theme === "dark";
|
|
251009
|
-
const isStaticColor = obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor";
|
|
251010
|
-
const isSetColor = obsColorEncoding === "cellSetSelection";
|
|
251036
|
+
const isStaticColor = !isPointsLayer && (obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor");
|
|
251037
|
+
const isSetColor = !isPointsLayer && obsColorEncoding === "cellSetSelection";
|
|
251011
251038
|
const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme ?? "light");
|
|
251012
251039
|
const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme ?? "light");
|
|
251013
251040
|
const staticColor = obsColorEncoding === "spatialChannelColor" ? channelColor : layerColor;
|
|
251014
|
-
const visible = visibleProp && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && (obsSetSelection?.length ?? 0) > 0 && (obsSetColor?.length ?? 0) > 0 || isStaticColor);
|
|
251041
|
+
const visible = visibleProp && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && (obsSetSelection?.length ?? 0) > 0 && (obsSetColor?.length ?? 0) > 0 || isStaticColor || isPointsLayer);
|
|
251042
|
+
const pointsLegendElements = [];
|
|
251043
|
+
if (isPointsLayer) {
|
|
251044
|
+
const MAX_NUM_COLORS = 10;
|
|
251045
|
+
const hasFeatureSelection = Array.isArray(featureSelection) && featureSelection.length > 0;
|
|
251046
|
+
const showUnselected = featureFilterMode !== "featureSelection";
|
|
251047
|
+
if (obsColorEncoding === "spatialLayerColor") {
|
|
251048
|
+
if (!hasFeatureSelection) {
|
|
251049
|
+
pointsLegendElements.push({
|
|
251050
|
+
name: obsLabel,
|
|
251051
|
+
color: staticColor
|
|
251052
|
+
});
|
|
251053
|
+
} else {
|
|
251054
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
251055
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
251056
|
+
pointsLegendElements.push({
|
|
251057
|
+
name: featureName,
|
|
251058
|
+
color: staticColor
|
|
251059
|
+
});
|
|
251060
|
+
});
|
|
251061
|
+
}
|
|
251062
|
+
} else if (obsColorEncoding === "geneSelection") {
|
|
251063
|
+
if (!hasFeatureSelection) {
|
|
251064
|
+
pointsLegendElements.push({
|
|
251065
|
+
name: obsLabel,
|
|
251066
|
+
color: staticColor
|
|
251067
|
+
});
|
|
251068
|
+
} else {
|
|
251069
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
251070
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
251071
|
+
const featureColorMatch = Array.isArray(featureColor) ? featureColor.find((fc) => fc.name === featureName)?.color : null;
|
|
251072
|
+
pointsLegendElements.push({
|
|
251073
|
+
name: featureName,
|
|
251074
|
+
// If no color is specified for this feature, use staticColor.
|
|
251075
|
+
color: featureColorMatch ?? staticColor
|
|
251076
|
+
});
|
|
251077
|
+
});
|
|
251078
|
+
}
|
|
251079
|
+
} else if (obsColorEncoding === "randomByFeature") {
|
|
251080
|
+
if (!hasFeatureSelection) {
|
|
251081
|
+
pointsLegendElements.push({
|
|
251082
|
+
name: obsLabel,
|
|
251083
|
+
// For now, using black and white for this.
|
|
251084
|
+
// (It should not match any color in PALETTE)
|
|
251085
|
+
color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
|
|
251086
|
+
});
|
|
251087
|
+
} else {
|
|
251088
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
251089
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
251090
|
+
const varIndex = (featureIndex ?? []).indexOf(featureName);
|
|
251091
|
+
const featureColorMatch = varIndex >= 0 ? PALETTE[varIndex % PALETTE.length] : null;
|
|
251092
|
+
pointsLegendElements.push({
|
|
251093
|
+
name: featureName,
|
|
251094
|
+
// If no color is specified for this feature, use staticColor.
|
|
251095
|
+
color: featureColorMatch ?? staticColor
|
|
251096
|
+
});
|
|
251097
|
+
});
|
|
251098
|
+
}
|
|
251099
|
+
} else if (obsColorEncoding === "random") {
|
|
251100
|
+
pointsLegendElements.push({
|
|
251101
|
+
name: obsLabel,
|
|
251102
|
+
// For now, using black and white for this.
|
|
251103
|
+
// (It should not match any color in PALETTE)
|
|
251104
|
+
color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
|
|
251105
|
+
});
|
|
251106
|
+
}
|
|
251107
|
+
if (showUnselected) {
|
|
251108
|
+
pointsLegendElements.push({
|
|
251109
|
+
name: "Unselected",
|
|
251110
|
+
color: getDefaultColor(theme ?? "light")
|
|
251111
|
+
});
|
|
251112
|
+
}
|
|
251113
|
+
}
|
|
251015
251114
|
const levelZeroNames = useMemo$1(() => Array.from(new Set(obsSetSelection?.map((setPath) => setPath[0]) || [])), [obsSetSelection]);
|
|
251016
|
-
const dynamicHeight =
|
|
251115
|
+
const dynamicHeight = isPointsLayer ? (
|
|
251116
|
+
// Height logic for points layers.
|
|
251117
|
+
pointsLegendElements.length * (rectHeight + rectMarginY) + titleHeight
|
|
251118
|
+
) : (
|
|
251119
|
+
// Height logic for non-points layers.
|
|
251120
|
+
isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + (obsSetSelection?.length ?? 0) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0)
|
|
251121
|
+
);
|
|
251017
251122
|
const availHeight = maxHeight2 !== null ? Math.max(0, maxHeight2 - 4) : Infinity;
|
|
251018
251123
|
const needsScroll = Number.isFinite(availHeight) && dynamicHeight > availHeight + 1;
|
|
251019
251124
|
useEffect(() => {
|
|
@@ -251025,8 +251130,8 @@ function Legend(props) {
|
|
|
251025
251130
|
svg2.selectAll("g").remove();
|
|
251026
251131
|
svg2.attr("width", width2).attr("height", dynamicHeight);
|
|
251027
251132
|
const g2 = svg2.append("g").attr("width", width2).attr("height", dynamicHeight);
|
|
251028
|
-
const showInteractiveSlider2 = setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
251029
|
-
if (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "")) {
|
|
251133
|
+
const showInteractiveSlider2 = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
251134
|
+
if (!isPointsLayer && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? ""))) {
|
|
251030
251135
|
const combinedExtent = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null) || [0, 1];
|
|
251031
251136
|
const [xMin, xMax] = combinedExtent;
|
|
251032
251137
|
if (featureValueColormap && pointsVisible) {
|
|
@@ -251086,10 +251191,10 @@ function Legend(props) {
|
|
|
251086
251191
|
});
|
|
251087
251192
|
}
|
|
251088
251193
|
}
|
|
251089
|
-
if (isStaticColor) {
|
|
251194
|
+
if (!isPointsLayer && isStaticColor) {
|
|
251090
251195
|
g2.append("rect").attr("x", 0).attr("y", titleHeight).attr("width", width2 - 4).attr("height", rectHeight).attr("fill", `rgb(${staticColor[0]},${staticColor[1]},${staticColor[2]})`);
|
|
251091
251196
|
}
|
|
251092
|
-
if (isSetColor && obsSetSelection && obsSetColor) {
|
|
251197
|
+
if (!isPointsLayer && isSetColor && obsSetSelection && obsSetColor) {
|
|
251093
251198
|
const obsSetSelectionByLevelZero = {};
|
|
251094
251199
|
obsSetSelection.forEach((setPath) => {
|
|
251095
251200
|
const levelZeroName = setPath[0];
|
|
@@ -251110,6 +251215,16 @@ function Legend(props) {
|
|
|
251110
251215
|
});
|
|
251111
251216
|
});
|
|
251112
251217
|
}
|
|
251218
|
+
if (isPointsLayer) {
|
|
251219
|
+
let y2 = 0;
|
|
251220
|
+
g2.append("text").attr("text-anchor", "start").attr("dominant-baseline", "hanging").attr("x", 0).attr("y", y2).text("Points").style("font-size", "9px").style("fill", foregroundColor);
|
|
251221
|
+
y2 += titleHeight;
|
|
251222
|
+
pointsLegendElements.forEach(({ name: name2, color: color2 }) => {
|
|
251223
|
+
g2.append("rect").attr("x", 0).attr("y", y2).attr("width", rectHeight).attr("height", rectHeight).attr("fill", `rgb(${color2[0]},${color2[1]},${color2[2]})`);
|
|
251224
|
+
g2.append("text").attr("text-anchor", "start").attr("dominant-baseline", "hanging").attr("x", rectHeight + rectMarginX).attr("y", y2).text(name2).style("font-size", "9px").style("fill", foregroundColor);
|
|
251225
|
+
y2 += rectHeight + rectMarginY;
|
|
251226
|
+
});
|
|
251227
|
+
}
|
|
251113
251228
|
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureSelection.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName) : null;
|
|
251114
251229
|
let featureSelectionLabelRawStr = "";
|
|
251115
251230
|
if (featureAggregationStrategy === "first") {
|
|
@@ -251136,12 +251251,11 @@ function Legend(props) {
|
|
|
251136
251251
|
}
|
|
251137
251252
|
const combinedMissing = combineMissings(missing ?? null, featureAggregationStrategy ?? null);
|
|
251138
251253
|
const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
|
|
251139
|
-
const obsLabel = capitalize$3(obsType ?? null);
|
|
251140
251254
|
const featureLabel = considerSelections ? featureSelectionLabel || capitalize$3(featureValueType ?? null) : capitalize$3(featureValueType ?? null);
|
|
251141
251255
|
const mainLabel = showObsLabel ? obsLabel : featureLabel;
|
|
251142
251256
|
const subLabel = showObsLabel ? featureLabel : null;
|
|
251143
251257
|
const hasSubLabel = subLabel !== null;
|
|
251144
|
-
if (!isSetColor) {
|
|
251258
|
+
if (!isPointsLayer && !isSetColor) {
|
|
251145
251259
|
g2.append("text").attr("text-anchor", hasSubLabel ? "start" : "end").attr("dominant-baseline", "hanging").attr("x", hasSubLabel ? 0 : width2 - 4).attr("y", 0).text(mainLabel ?? "").style("font-size", "10px").style("fill", foregroundColor);
|
|
251146
251260
|
if (hasSubLabel) {
|
|
251147
251261
|
g2.append("text").attr("text-anchor", "end").attr("dominant-baseline", "hanging").attr("x", width2 - 5).attr("y", titleHeight + rectHeight).text(subLabel ?? "").style("font-size", "9px").style("fill", foregroundColor);
|
|
@@ -251180,7 +251294,7 @@ function Legend(props) {
|
|
|
251180
251294
|
showObsLabel,
|
|
251181
251295
|
staticColor
|
|
251182
251296
|
]);
|
|
251183
|
-
const showInteractiveSlider = setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
251297
|
+
const showInteractiveSlider = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
251184
251298
|
const globalExtent = useMemo$1(() => {
|
|
251185
251299
|
const combined = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null);
|
|
251186
251300
|
return combined || [0, 1];
|
|
@@ -251253,7 +251367,8 @@ function MultiLegend(props) {
|
|
|
251253
251367
|
spotMultiFeatureLabels,
|
|
251254
251368
|
// Points
|
|
251255
251369
|
pointLayerScopes,
|
|
251256
|
-
pointLayerCoordination
|
|
251370
|
+
pointLayerCoordination,
|
|
251371
|
+
pointMultiIndicesData
|
|
251257
251372
|
} = props;
|
|
251258
251373
|
const { classes: classes2 } = useStyles$o();
|
|
251259
251374
|
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].reverse(), [segmentationLayerScopes]);
|
|
@@ -251264,7 +251379,8 @@ function MultiLegend(props) {
|
|
|
251264
251379
|
const layerSetters = pointLayerCoordination?.[1]?.[layerScope];
|
|
251265
251380
|
if (!layerCoordination)
|
|
251266
251381
|
return null;
|
|
251267
|
-
const { spatialLayerVisible, obsColorEncoding, obsType, featureType, featureValueType, featureSelection, featureValueColormap, featureValueColormapRange, spatialLayerColor, legendVisible } = layerCoordination;
|
|
251382
|
+
const { spatialLayerVisible, obsColorEncoding, obsType, featureType, featureValueType, featureSelection, featureColor, featureFilterMode, featureValueColormap, featureValueColormapRange, spatialLayerColor, legendVisible } = layerCoordination;
|
|
251383
|
+
const pointIndicesData = pointMultiIndicesData?.[layerScope];
|
|
251268
251384
|
const { setFeatureValueColormapRange } = layerSetters || {};
|
|
251269
251385
|
const isStaticColor = obsColorEncoding === "spatialLayerColor";
|
|
251270
251386
|
const height2 = isStaticColor ? 20 : 36;
|
|
@@ -251281,6 +251397,10 @@ function MultiLegend(props) {
|
|
|
251281
251397
|
obsColorEncoding,
|
|
251282
251398
|
spatialLayerColor,
|
|
251283
251399
|
featureSelection,
|
|
251400
|
+
featureFilterMode,
|
|
251401
|
+
featureColor,
|
|
251402
|
+
featureIndex: pointIndicesData?.featureIndex,
|
|
251403
|
+
isPointsLayer: true,
|
|
251284
251404
|
// featureLabelsMap={featureLabelsMap} // TODO
|
|
251285
251405
|
featureValueColormap: featureValueColormap || "viridis",
|
|
251286
251406
|
featureValueColormapRange: featureValueColormapRange || [0, 1],
|
|
@@ -268915,6 +269035,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
268915
269035
|
this.obsSpotsQuadTree = {};
|
|
268916
269036
|
this.obsPointsData = {};
|
|
268917
269037
|
this.obsPointsQuadTree = {};
|
|
269038
|
+
this.obsPointsLoadingStatus = {};
|
|
268918
269039
|
this.imageLayers = [];
|
|
268919
269040
|
this.obsSegmentationsLayers = [];
|
|
268920
269041
|
this.obsSpotsLayers = [];
|
|
@@ -269095,10 +269216,131 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
269095
269216
|
});
|
|
269096
269217
|
}
|
|
269097
269218
|
createPointLayer(layerScope, layerCoordination, layerObsPoints) {
|
|
269098
|
-
const { theme, delegateHover, targetZ } = this.props;
|
|
269099
|
-
const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor } = layerCoordination;
|
|
269100
|
-
const
|
|
269219
|
+
const { theme, delegateHover, targetZ, pointMatrixIndices, setTiledPointsLoadingProgress } = this.props;
|
|
269220
|
+
const { spatialLayerVisible, spatialLayerOpacity, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor } = layerCoordination;
|
|
269221
|
+
const pointFeatureIndex = pointMatrixIndices?.[layerScope]?.featureIndex;
|
|
269222
|
+
let featureIndices = [];
|
|
269223
|
+
if (Array.isArray(featureSelection) && featureSelection.length >= 1) {
|
|
269224
|
+
if (pointFeatureIndex) {
|
|
269225
|
+
featureIndices = featureSelection.map((geneName) => pointFeatureIndex.indexOf(geneName)).filter((i2) => i2 >= 0);
|
|
269226
|
+
}
|
|
269227
|
+
}
|
|
269101
269228
|
const staticColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme);
|
|
269229
|
+
const defaultColor = getDefaultColor(theme);
|
|
269230
|
+
let getFillColor = null;
|
|
269231
|
+
const hasFeatureSelection = Array.isArray(featureSelection) && featureSelection.length > 0;
|
|
269232
|
+
const showUnselected = featureFilterMode !== "featureSelection";
|
|
269233
|
+
const hasMultipleFeaturesSelected = Array.isArray(featureIndices) && featureIndices.length > 1;
|
|
269234
|
+
if (obsColorEncoding === "spatialLayerColor") {
|
|
269235
|
+
getFillColor = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
269236
|
+
if (!hasFeatureSelection || featureIndices.includes(data2.src.featureIndices[index2])) {
|
|
269237
|
+
target2[0] = staticColor[0];
|
|
269238
|
+
target2[1] = staticColor[1];
|
|
269239
|
+
target2[2] = staticColor[2];
|
|
269240
|
+
target2[3] = 255;
|
|
269241
|
+
return target2;
|
|
269242
|
+
}
|
|
269243
|
+
if (!showUnselected) {
|
|
269244
|
+
if (hasMultipleFeaturesSelected) {
|
|
269245
|
+
target2[3] = 0;
|
|
269246
|
+
}
|
|
269247
|
+
return target2;
|
|
269248
|
+
}
|
|
269249
|
+
target2[0] = defaultColor[0];
|
|
269250
|
+
target2[1] = defaultColor[1];
|
|
269251
|
+
target2[2] = defaultColor[2];
|
|
269252
|
+
target2[3] = 255;
|
|
269253
|
+
return target2;
|
|
269254
|
+
};
|
|
269255
|
+
} else if (obsColorEncoding === "geneSelection") {
|
|
269256
|
+
getFillColor = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
269257
|
+
if (!hasFeatureSelection) {
|
|
269258
|
+
target2[0] = staticColor[0];
|
|
269259
|
+
target2[1] = staticColor[1];
|
|
269260
|
+
target2[2] = staticColor[2];
|
|
269261
|
+
target2[3] = 255;
|
|
269262
|
+
return target2;
|
|
269263
|
+
}
|
|
269264
|
+
const isSelected = featureIndices.includes(data2.src.featureIndices[index2]);
|
|
269265
|
+
if (isSelected) {
|
|
269266
|
+
const featureName = pointFeatureIndex?.[data2.src.featureIndices[index2]];
|
|
269267
|
+
const featureColorMatch = Array.isArray(featureColor) ? featureColor.find((fc) => fc.name === featureName)?.color : null;
|
|
269268
|
+
if (featureColorMatch) {
|
|
269269
|
+
target2[0] = featureColorMatch[0];
|
|
269270
|
+
target2[1] = featureColorMatch[1];
|
|
269271
|
+
target2[2] = featureColorMatch[2];
|
|
269272
|
+
target2[3] = 255;
|
|
269273
|
+
return target2;
|
|
269274
|
+
}
|
|
269275
|
+
target2[0] = staticColor[0];
|
|
269276
|
+
target2[1] = staticColor[1];
|
|
269277
|
+
target2[2] = staticColor[2];
|
|
269278
|
+
target2[3] = 255;
|
|
269279
|
+
return target2;
|
|
269280
|
+
}
|
|
269281
|
+
if (!showUnselected) {
|
|
269282
|
+
if (hasMultipleFeaturesSelected) {
|
|
269283
|
+
target2[3] = 0;
|
|
269284
|
+
}
|
|
269285
|
+
return target2;
|
|
269286
|
+
}
|
|
269287
|
+
target2[0] = defaultColor[0];
|
|
269288
|
+
target2[1] = defaultColor[1];
|
|
269289
|
+
target2[2] = defaultColor[2];
|
|
269290
|
+
target2[3] = 255;
|
|
269291
|
+
return target2;
|
|
269292
|
+
};
|
|
269293
|
+
} else if (obsColorEncoding === "randomByFeature") {
|
|
269294
|
+
{
|
|
269295
|
+
getFillColor = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
269296
|
+
if (!hasFeatureSelection || featureIndices.includes(data2.src.featureIndices[index2])) {
|
|
269297
|
+
const varIndex = data2.src.featureIndices[index2];
|
|
269298
|
+
const color2 = PALETTE[varIndex % PALETTE.length];
|
|
269299
|
+
target2[0] = color2[0];
|
|
269300
|
+
target2[1] = color2[1];
|
|
269301
|
+
target2[2] = color2[2];
|
|
269302
|
+
target2[3] = 255;
|
|
269303
|
+
return target2;
|
|
269304
|
+
}
|
|
269305
|
+
if (!showUnselected) {
|
|
269306
|
+
if (hasMultipleFeaturesSelected) {
|
|
269307
|
+
target2[3] = 0;
|
|
269308
|
+
}
|
|
269309
|
+
return target2;
|
|
269310
|
+
}
|
|
269311
|
+
target2[0] = defaultColor[0];
|
|
269312
|
+
target2[1] = defaultColor[1];
|
|
269313
|
+
target2[2] = defaultColor[2];
|
|
269314
|
+
target2[3] = 255;
|
|
269315
|
+
return target2;
|
|
269316
|
+
};
|
|
269317
|
+
}
|
|
269318
|
+
} else if (obsColorEncoding === "random") {
|
|
269319
|
+
{
|
|
269320
|
+
getFillColor = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
269321
|
+
if (!hasFeatureSelection || featureIndices.includes(data2.src.featureIndices[index2])) {
|
|
269322
|
+
const color2 = PALETTE[index2 % PALETTE.length];
|
|
269323
|
+
target2[0] = color2[0];
|
|
269324
|
+
target2[1] = color2[1];
|
|
269325
|
+
target2[2] = color2[2];
|
|
269326
|
+
target2[3] = 255;
|
|
269327
|
+
return target2;
|
|
269328
|
+
}
|
|
269329
|
+
if (!showUnselected) {
|
|
269330
|
+
if (hasMultipleFeaturesSelected) {
|
|
269331
|
+
target2[3] = 0;
|
|
269332
|
+
}
|
|
269333
|
+
return target2;
|
|
269334
|
+
}
|
|
269335
|
+
target2[0] = defaultColor[0];
|
|
269336
|
+
target2[1] = defaultColor[1];
|
|
269337
|
+
target2[2] = defaultColor[2];
|
|
269338
|
+
target2[3] = 255;
|
|
269339
|
+
return target2;
|
|
269340
|
+
};
|
|
269341
|
+
}
|
|
269342
|
+
}
|
|
269343
|
+
const isStaticColor = obsColorEncoding === "spatialLayerColor";
|
|
269102
269344
|
const getMoleculeColor = (object2, { data: data2, index: index2, target: target2 }) => {
|
|
269103
269345
|
const obsId = data2.src.obsIndex[index2];
|
|
269104
269346
|
if (data2.src.obsLabelsMap && data2.src.uniqueObsLabels && data2.src.PALETTE) {
|
|
@@ -269110,11 +269352,131 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
269110
269352
|
}
|
|
269111
269353
|
return target2;
|
|
269112
269354
|
};
|
|
269113
|
-
const { obsPointsModelMatrix, obsPoints } = this.obsPointsData?.[layerScope]?.src ?? {};
|
|
269114
|
-
|
|
269355
|
+
const { obsPointsModelMatrix, obsPoints, obsPointsTilingType, loadPointsInRect } = this.obsPointsData?.[layerScope]?.src ?? {};
|
|
269356
|
+
obsPoints?.shape?.[0] === 3;
|
|
269115
269357
|
const modelMatrix2 = obsPointsModelMatrix?.clone();
|
|
269116
|
-
if (
|
|
269117
|
-
|
|
269358
|
+
if (obsPointsTilingType === "tiled") {
|
|
269359
|
+
return new TileLayer({
|
|
269360
|
+
id: `Tiled-${POINT_LAYER_PREFIX}${layerScope}`,
|
|
269361
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
269362
|
+
// NOTE: picking is not working due to https://github.com/vitessce/vitessce/issues/2039
|
|
269363
|
+
modelMatrix: modelMatrix2,
|
|
269364
|
+
pickable: true,
|
|
269365
|
+
autoHighlight: true,
|
|
269366
|
+
onHover: (info2) => delegateHover(info2, "point", layerScope),
|
|
269367
|
+
opacity: spatialLayerOpacity,
|
|
269368
|
+
visible: spatialLayerVisible,
|
|
269369
|
+
// Since points are tiled but not multi-resolution,
|
|
269370
|
+
// it provides no benefit to request tiles at different zoom levels.
|
|
269371
|
+
// TODO: Should this value be the same for
|
|
269372
|
+
// every dataset, or do we need to
|
|
269373
|
+
// adjust based on the extent/density of the
|
|
269374
|
+
// point data (and/or account for modelMatrix, etc)?
|
|
269375
|
+
maxZoom: -1,
|
|
269376
|
+
minZoom: -1,
|
|
269377
|
+
tileSize: 512,
|
|
269378
|
+
// refinementStrategy: 'no-overlap',
|
|
269379
|
+
getTileData: async (tileInfo) => {
|
|
269380
|
+
const { index: index2, signal, bbox: bbox2, zoom: zoom2 } = tileInfo;
|
|
269381
|
+
const { z: z2, x: x2, y: y2 } = index2;
|
|
269382
|
+
this.obsPointsLoadingStatus = {
|
|
269383
|
+
...this.obsPointsLoadingStatus,
|
|
269384
|
+
[`${layerScope}-${z2}-${x2}-${y2}`]: "loading"
|
|
269385
|
+
};
|
|
269386
|
+
setTiledPointsLoadingProgress(this.obsPointsLoadingStatus);
|
|
269387
|
+
signal.addEventListener("abort", () => {
|
|
269388
|
+
this.obsPointsLoadingStatus = {
|
|
269389
|
+
...this.obsPointsLoadingStatus,
|
|
269390
|
+
[`${layerScope}-${z2}-${x2}-${y2}`]: "aborted"
|
|
269391
|
+
};
|
|
269392
|
+
setTiledPointsLoadingProgress(this.obsPointsLoadingStatus);
|
|
269393
|
+
});
|
|
269394
|
+
const pointsInTile = await loadPointsInRect(bbox2, signal);
|
|
269395
|
+
this.obsPointsLoadingStatus = {
|
|
269396
|
+
...this.obsPointsLoadingStatus,
|
|
269397
|
+
[`${layerScope}-${z2}-${x2}-${y2}`]: "success"
|
|
269398
|
+
};
|
|
269399
|
+
setTiledPointsLoadingProgress(this.obsPointsLoadingStatus);
|
|
269400
|
+
return {
|
|
269401
|
+
src: pointsInTile.data,
|
|
269402
|
+
length: pointsInTile.shape?.[1] || 0
|
|
269403
|
+
};
|
|
269404
|
+
},
|
|
269405
|
+
renderSubLayers: (subLayerProps) => {
|
|
269406
|
+
const { bbox: bbox2, content: tileData } = subLayerProps.tile;
|
|
269407
|
+
const { left: left2, top: top2, right: right2, bottom: bottom2 } = bbox2;
|
|
269408
|
+
const hasFeatureIndicesMinMax = !showUnselected && Array.isArray(featureIndices) && featureIndices.length === 1;
|
|
269409
|
+
const FILTER_PLACEHOLDER = 0;
|
|
269410
|
+
const featureIndicesMinMax = hasFeatureIndicesMinMax ? [featureIndices[0], featureIndices[0]] : [FILTER_PLACEHOLDER, FILTER_PLACEHOLDER];
|
|
269411
|
+
return new ScatterplotLayer(subLayerProps, {
|
|
269412
|
+
bounds: [left2, top2, right2, bottom2],
|
|
269413
|
+
data: tileData,
|
|
269414
|
+
getRadius: 5,
|
|
269415
|
+
radiusMaxPixels: 3,
|
|
269416
|
+
// getPosition: d => d,
|
|
269417
|
+
// getFillColor: [255, 0, 0],
|
|
269418
|
+
getPosition: (object2, { data: data2, index: index2, target: target2 }) => {
|
|
269419
|
+
target2[0] = data2.src.x[index2];
|
|
269420
|
+
target2[1] = data2.src.y[index2];
|
|
269421
|
+
target2[2] = 0;
|
|
269422
|
+
return target2;
|
|
269423
|
+
},
|
|
269424
|
+
getFillColor,
|
|
269425
|
+
// TODO: Is the picking stuff needed here in the Sublayer, or in the parent TileLayer?
|
|
269426
|
+
pickable: true,
|
|
269427
|
+
autoHighlight: true,
|
|
269428
|
+
onHover: (info2) => delegateHover(info2, "point", layerScope),
|
|
269429
|
+
// Use GPU filtering to filter to only the points in the tile bounding box,
|
|
269430
|
+
// since the row groups may contain points from other tiles.
|
|
269431
|
+
// Note: this can be improved using filterCategories,
|
|
269432
|
+
// but it is not available until post-v9 deck.gl/extensions.
|
|
269433
|
+
filterRange: [[left2, right2], [top2, bottom2], featureIndicesMinMax],
|
|
269434
|
+
getFilterValue: hasFeatureIndicesMinMax ? (object2, { data: data2, index: index2 }) => [
|
|
269435
|
+
data2.src.x[index2],
|
|
269436
|
+
data2.src.y[index2],
|
|
269437
|
+
data2.src.featureIndices[index2]
|
|
269438
|
+
] : (object2, { data: data2, index: index2 }) => [
|
|
269439
|
+
data2.src.x[index2],
|
|
269440
|
+
data2.src.y[index2],
|
|
269441
|
+
FILTER_PLACEHOLDER
|
|
269442
|
+
],
|
|
269443
|
+
extensions: [
|
|
269444
|
+
new DataFilterExtension({ filterSize: 3 })
|
|
269445
|
+
],
|
|
269446
|
+
updateTriggers: {
|
|
269447
|
+
getFillColor: [
|
|
269448
|
+
showUnselected,
|
|
269449
|
+
featureColor,
|
|
269450
|
+
obsColorEncoding,
|
|
269451
|
+
spatialLayerColor,
|
|
269452
|
+
featureSelection,
|
|
269453
|
+
hasMultipleFeaturesSelected
|
|
269454
|
+
],
|
|
269455
|
+
getFilterValue: [hasFeatureIndicesMinMax, showUnselected, featureSelection],
|
|
269456
|
+
filterRange: [hasFeatureIndicesMinMax, showUnselected, featureSelection]
|
|
269457
|
+
}
|
|
269458
|
+
});
|
|
269459
|
+
},
|
|
269460
|
+
updateTriggers: {
|
|
269461
|
+
getTileData: [
|
|
269462
|
+
showUnselected,
|
|
269463
|
+
featureColor,
|
|
269464
|
+
obsColorEncoding,
|
|
269465
|
+
spatialLayerColor,
|
|
269466
|
+
featureSelection,
|
|
269467
|
+
hasMultipleFeaturesSelected
|
|
269468
|
+
]
|
|
269469
|
+
}
|
|
269470
|
+
/*
|
|
269471
|
+
onTileError: (error) => {
|
|
269472
|
+
|
|
269473
|
+
},
|
|
269474
|
+
onViewportLoad: (loadedTiles) => {
|
|
269475
|
+
// Called when all tiles in the current viewport are loaded.
|
|
269476
|
+
// An array of loaded Tile instances are passed as argument to this function.
|
|
269477
|
+
},
|
|
269478
|
+
*/
|
|
269479
|
+
});
|
|
269118
269480
|
}
|
|
269119
269481
|
return new ScatterplotLayer({
|
|
269120
269482
|
id: `${POINT_LAYER_PREFIX}${layerScope}`,
|
|
@@ -269141,16 +269503,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
269141
269503
|
getFillColor: [obsColorEncoding, staticColor],
|
|
269142
269504
|
getLineColor: [obsColorEncoding, staticColor]
|
|
269143
269505
|
},
|
|
269144
|
-
...
|
|
269145
|
-
// TODO: support targetT filtering as well.
|
|
269146
|
-
// TODO: allow filtering by Z coordinate (rather than slice index)
|
|
269147
|
-
// Reference: https://github.com/vitessce/vitessce/issues/2194
|
|
269148
|
-
filterRange: [targetZ, targetZ],
|
|
269149
|
-
getFilterValue: (object2, { data: data2, index: index2 }) => data2.src.obsPoints.data[2][index2],
|
|
269150
|
-
extensions: [
|
|
269151
|
-
new DataFilterExtension({ filterSize: 1 })
|
|
269152
|
-
]
|
|
269153
|
-
} : {}
|
|
269506
|
+
...{}
|
|
269154
269507
|
});
|
|
269155
269508
|
}
|
|
269156
269509
|
createSelectionLayer() {
|
|
@@ -269690,28 +270043,45 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
269690
270043
|
}
|
|
269691
270044
|
onUpdatePointsData(layerScope) {
|
|
269692
270045
|
const { obsPoints, pointMultiObsLabels } = this.props;
|
|
269693
|
-
const { obsIndex, obsPoints: layerObsPoints, obsPointsModelMatrix } = obsPoints?.[layerScope] || {};
|
|
270046
|
+
const { obsIndex, obsPoints: layerObsPoints, obsPointsModelMatrix, loadPointsInRect, obsPointsTilingType } = obsPoints?.[layerScope] || {};
|
|
269694
270047
|
const { obsIndex: obsLabelsIndex, obsLabels } = pointMultiObsLabels?.[layerScope] || {};
|
|
269695
|
-
if (
|
|
269696
|
-
const getCellCoords = makeDefaultGetObsCoords(layerObsPoints);
|
|
269697
|
-
this.obsPointsQuadTree[layerScope] = createQuadTree(layerObsPoints, getCellCoords);
|
|
270048
|
+
if (obsPointsTilingType === "tiled") {
|
|
269698
270049
|
this.obsPointsData[layerScope] = {
|
|
269699
270050
|
src: {
|
|
269700
|
-
|
|
269701
|
-
|
|
270051
|
+
obsPointsTilingType,
|
|
270052
|
+
obsIndex: null,
|
|
270053
|
+
obsPoints: null,
|
|
269702
270054
|
obsPointsModelMatrix,
|
|
269703
270055
|
obsLabelsMap: null,
|
|
269704
270056
|
uniqueObsLabels: null,
|
|
269705
|
-
PALETTE: null
|
|
270057
|
+
PALETTE: null,
|
|
270058
|
+
loadPointsInRect
|
|
269706
270059
|
},
|
|
269707
|
-
length:
|
|
270060
|
+
length: null
|
|
269708
270061
|
};
|
|
269709
|
-
|
|
269710
|
-
|
|
269711
|
-
const
|
|
269712
|
-
this.
|
|
269713
|
-
this.obsPointsData[layerScope]
|
|
269714
|
-
|
|
270062
|
+
} else {
|
|
270063
|
+
if (layerObsPoints) {
|
|
270064
|
+
const getCellCoords = makeDefaultGetObsCoords(layerObsPoints);
|
|
270065
|
+
this.obsPointsQuadTree[layerScope] = createQuadTree(layerObsPoints, getCellCoords);
|
|
270066
|
+
this.obsPointsData[layerScope] = {
|
|
270067
|
+
src: {
|
|
270068
|
+
obsPointsTilingType,
|
|
270069
|
+
obsIndex,
|
|
270070
|
+
obsPoints: layerObsPoints,
|
|
270071
|
+
obsPointsModelMatrix,
|
|
270072
|
+
obsLabelsMap: null,
|
|
270073
|
+
uniqueObsLabels: null,
|
|
270074
|
+
PALETTE: null
|
|
270075
|
+
},
|
|
270076
|
+
length: layerObsPoints.shape[1]
|
|
270077
|
+
};
|
|
270078
|
+
if (obsLabels) {
|
|
270079
|
+
const obsLabelsMap = new Map(obsLabelsIndex.map((key2, i2) => [key2, obsLabels[i2]]));
|
|
270080
|
+
const uniqueObsLabels = Array.from(new Set(obsLabels));
|
|
270081
|
+
this.obsPointsData[layerScope].src.obsLabelsMap = obsLabelsMap;
|
|
270082
|
+
this.obsPointsData[layerScope].src.uniqueObsLabels = uniqueObsLabels;
|
|
270083
|
+
this.obsPointsData[layerScope].src.PALETTE = PALETTE;
|
|
270084
|
+
}
|
|
269715
270085
|
}
|
|
269716
270086
|
}
|
|
269717
270087
|
}
|
|
@@ -269920,6 +270290,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
269920
270290
|
// Data props.
|
|
269921
270291
|
"obsPoints",
|
|
269922
270292
|
"pointMultiObsLabels",
|
|
270293
|
+
"pointMatrixIndices",
|
|
269923
270294
|
// Coordination props.
|
|
269924
270295
|
"pointLayerScopes",
|
|
269925
270296
|
"pointLayerCoordination"
|
|
@@ -270074,12 +270445,12 @@ class ErrorBoundary2 extends React__default.Component {
|
|
|
270074
270445
|
}
|
|
270075
270446
|
}
|
|
270076
270447
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
270077
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
270448
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-B-7qLcpV.js");
|
|
270078
270449
|
return { default: SpatialWrapper2 };
|
|
270079
270450
|
});
|
|
270080
270451
|
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 }) }) }) }));
|
|
270081
270452
|
const LazySpatialAccelerated = React__default.lazy(async () => {
|
|
270082
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
270453
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-4EtK005E.js");
|
|
270083
270454
|
return { default: SpatialWrapper2 };
|
|
270084
270455
|
});
|
|
270085
270456
|
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 }) }) }) }));
|
|
@@ -270194,12 +270565,22 @@ const DEFAULT_VIEW_STATE = {
|
|
|
270194
270565
|
const SET_VIEW_STATE_NOOP = () => {
|
|
270195
270566
|
};
|
|
270196
270567
|
function getHoverData(hoverInfo, layerType) {
|
|
270197
|
-
const { coordinate, sourceLayer: layer, tile } = hoverInfo;
|
|
270198
|
-
if (layerType === "segmentation-bitmask" || layerType === "image") {
|
|
270568
|
+
const { coordinate, sourceLayer: layer, tile, index: pointIndex } = hoverInfo;
|
|
270569
|
+
if (layerType === "segmentation-bitmask" || layerType === "image" || layerType === "point") {
|
|
270199
270570
|
if (coordinate && layer) {
|
|
270200
270571
|
if (layer.id.startsWith("Tiled") && tile) {
|
|
270201
270572
|
const { content: content2, bbox: bbox2, index: { z: z2 } } = tile;
|
|
270202
270573
|
if (content2) {
|
|
270574
|
+
if (layerType === "point" && pointIndex >= 0) {
|
|
270575
|
+
const { src } = content2 || {};
|
|
270576
|
+
const { x: x2, y: y2, featureIndices } = src || {};
|
|
270577
|
+
return {
|
|
270578
|
+
pointIndex,
|
|
270579
|
+
x: x2?.[pointIndex],
|
|
270580
|
+
y: y2?.[pointIndex],
|
|
270581
|
+
featureIndex: featureIndices?.[pointIndex]
|
|
270582
|
+
};
|
|
270583
|
+
}
|
|
270203
270584
|
const { data: data2, width: width2, height: height2 } = content2;
|
|
270204
270585
|
const { left: left2, right: right2, top: top2, bottom: bottom2 } = bbox2;
|
|
270205
270586
|
const bounds2 = [
|
|
@@ -270377,6 +270758,8 @@ function SpatialSubscriber(props) {
|
|
|
270377
270758
|
CoordinationType$2.SPATIAL_LAYER_VISIBLE,
|
|
270378
270759
|
CoordinationType$2.SPATIAL_LAYER_OPACITY,
|
|
270379
270760
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
270761
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
270762
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
270380
270763
|
CoordinationType$2.FEATURE_SELECTION,
|
|
270381
270764
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
270382
270765
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
@@ -270387,7 +270770,10 @@ function SpatialSubscriber(props) {
|
|
|
270387
270770
|
CoordinationType$2.LEGEND_VISIBLE
|
|
270388
270771
|
], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
|
|
270389
270772
|
const [volumeLoadingStatus, setVolumeLoadingStatus] = useState(null);
|
|
270390
|
-
const [{ volumeLoadingProgress }, { setVolumeLoadingProgress }] = useAuxiliaryCoordination([
|
|
270773
|
+
const [{ volumeLoadingProgress, tiledPointsLoadingProgress }, { setVolumeLoadingProgress, setTiledPointsLoadingProgress }] = useAuxiliaryCoordination([
|
|
270774
|
+
"spatialAcceleratedVolumeLoadingProgress",
|
|
270775
|
+
"spatialTiledPointsLoadingProgress"
|
|
270776
|
+
], coordinationScopes);
|
|
270391
270777
|
useEffect(() => {
|
|
270392
270778
|
if (volumeLoadingStatus && volumeLoadingStatus.loadingProgress) {
|
|
270393
270779
|
setVolumeLoadingProgress(volumeLoadingStatus);
|
|
@@ -270404,6 +270790,7 @@ function SpatialSubscriber(props) {
|
|
|
270404
270790
|
const height2 = threeFor3d && deckHeight === void 0 ? threeHeight : deckHeight;
|
|
270405
270791
|
const [obsPointsData, obsPointsDataStatus, obsPointsUrls, obsPointsErrors] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
270406
270792
|
const [pointMultiObsLabelsData, pointMultiObsLabelsDataStatus, pointMultiObsLabelsErrors] = usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
270793
|
+
const [pointMultiIndicesData, pointMultiIndicesDataStatus, pointMultiIndicesDataErrors] = usePointMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
270407
270794
|
const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls, obsSpotsErrors] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
270408
270795
|
const [obsSpotsSetsData, obsSpotsSetsDataStatus, obsSpotSetsUrls, obsSpotsSetsErrors] = useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
270409
270796
|
const [obsSpotsFeatureLabelsData, obsSpotsFeatureLabelsDataStatus, obsSpotsFeatureLabelsUrls, obsSpotsFeatureLabelsErrors] = useSpotMultiFeatureLabels(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
@@ -270437,6 +270824,7 @@ function SpatialSubscriber(props) {
|
|
|
270437
270824
|
...spotMultiFeatureSelectionErrors,
|
|
270438
270825
|
...spotMultiIndicesDataErrors,
|
|
270439
270826
|
...pointMultiObsLabelsErrors,
|
|
270827
|
+
...pointMultiIndicesDataErrors,
|
|
270440
270828
|
...segmentationMultiFeatureSelectionErrors,
|
|
270441
270829
|
...segmentationMultiIndicesDataErrors,
|
|
270442
270830
|
...obsSegmentationsLocationsDataErrors
|
|
@@ -270456,6 +270844,7 @@ function SpatialSubscriber(props) {
|
|
|
270456
270844
|
// Points
|
|
270457
270845
|
obsPointsDataStatus,
|
|
270458
270846
|
pointMultiObsLabelsDataStatus,
|
|
270847
|
+
pointMultiIndicesDataStatus,
|
|
270459
270848
|
// Segmentations
|
|
270460
270849
|
obsSegmentationsDataStatus,
|
|
270461
270850
|
obsSegmentationsSetsDataStatus,
|
|
@@ -270643,14 +271032,19 @@ function SpatialSubscriber(props) {
|
|
|
270643
271032
|
pointLayerScopes?.forEach((pointLayerScope) => {
|
|
270644
271033
|
const { setObsHighlight } = pointLayerCoordination?.[1]?.[pointLayerScope] || {};
|
|
270645
271034
|
if (hoverData && layerType === "point" && layerScope === pointLayerScope) {
|
|
270646
|
-
|
|
270647
|
-
const { obsIndex } = obsPointsData?.[pointLayerScope] || {};
|
|
270648
|
-
const obsId = obsIndex?.[obsI];
|
|
270649
|
-
if (obsIndex && obsId) {
|
|
271035
|
+
if (typeof hoverData === "object" && hoverData?.pointIndex) {
|
|
270650
271036
|
showAnyTooltip = true;
|
|
270651
|
-
setObsHighlight(
|
|
271037
|
+
setObsHighlight(hoverData.pointIndex);
|
|
270652
271038
|
} else {
|
|
270653
|
-
|
|
271039
|
+
const obsI = hoverData;
|
|
271040
|
+
const { obsIndex } = obsPointsData?.[pointLayerScope] || {};
|
|
271041
|
+
const obsId = obsIndex?.[obsI];
|
|
271042
|
+
if (obsIndex && obsId) {
|
|
271043
|
+
showAnyTooltip = true;
|
|
271044
|
+
setObsHighlight(obsId);
|
|
271045
|
+
} else {
|
|
271046
|
+
setObsHighlight(null);
|
|
271047
|
+
}
|
|
270654
271048
|
}
|
|
270655
271049
|
} else {
|
|
270656
271050
|
setObsHighlight(null);
|
|
@@ -270692,7 +271086,7 @@ function SpatialSubscriber(props) {
|
|
|
270692
271086
|
target: [targetX2, targetY2, targetZ],
|
|
270693
271087
|
rotationX,
|
|
270694
271088
|
rotationOrbit
|
|
270695
|
-
} : DEFAULT_VIEW_STATE, orbitAxis, spatialAxisFixed, setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP, originalViewState, spatialRenderingMode, updateViewInfo: setComponentViewInfo, delegateHover, obsPoints: obsPointsData, pointLayerScopes, pointLayerCoordination, pointMultiObsLabels: pointMultiObsLabelsData, obsSpots: obsSpotsData, spotLayerScopes, spotLayerCoordination, obsSpotsSets: obsSpotsSetsData, spotMatrixIndices: spotMultiIndicesData, spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentations: obsSegmentationsData, obsSegmentationsLocations: obsSegmentationsLocationsData, obsSegmentationsSets: obsSegmentationsSetsData, segmentationMatrixIndices: segmentationMultiIndicesData, segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData, bitmaskValueIsIndex, images: imageData, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination }), !disableTooltip && jsxRuntimeExports.jsx(SpatialTooltipSubscriber, {
|
|
271089
|
+
} : DEFAULT_VIEW_STATE, orbitAxis, spatialAxisFixed, setViewState: isValidViewState ? setViewState : SET_VIEW_STATE_NOOP, originalViewState, spatialRenderingMode, updateViewInfo: setComponentViewInfo, delegateHover, obsPoints: obsPointsData, pointLayerScopes, pointLayerCoordination, pointMultiObsLabels: pointMultiObsLabelsData, pointMatrixIndices: pointMultiIndicesData, obsSpots: obsSpotsData, spotLayerScopes, spotLayerCoordination, obsSpotsSets: obsSpotsSetsData, spotMatrixIndices: spotMultiIndicesData, spotMultiExpressionData: spotMultiExpressionNormDataAggregated || spotMultiExpressionNormData, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, obsSegmentations: obsSegmentationsData, obsSegmentationsLocations: obsSegmentationsLocationsData, obsSegmentationsSets: obsSegmentationsSetsData, segmentationMatrixIndices: segmentationMultiIndicesData, segmentationMultiExpressionData: segmentationMultiExpressionNormDataAggregated || segmentationMultiExpressionNormData, bitmaskValueIsIndex, images: imageData, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination, setTiledPointsLoadingProgress }), !disableTooltip && jsxRuntimeExports.jsx(SpatialTooltipSubscriber, {
|
|
270696
271090
|
parentUuid: uuid2,
|
|
270697
271091
|
width: width2,
|
|
270698
271092
|
height: height2,
|
|
@@ -270733,7 +271127,8 @@ function SpatialSubscriber(props) {
|
|
|
270733
271127
|
spotMultiFeatureLabels: obsSpotsFeatureLabelsData,
|
|
270734
271128
|
// Points
|
|
270735
271129
|
pointLayerScopes,
|
|
270736
|
-
pointLayerCoordination
|
|
271130
|
+
pointLayerCoordination,
|
|
271131
|
+
pointMultiIndicesData
|
|
270737
271132
|
}
|
|
270738
271133
|
), jsxRuntimeExports.jsx(
|
|
270739
271134
|
ChannelNamesLegend,
|
|
@@ -279695,17 +280090,35 @@ function SpotLayerController(props) {
|
|
|
279695
280090
|
return jsxRuntimeExports.jsx(Grid$1, { className: lcClasses.layerControllerGrid, children: jsxRuntimeExports.jsx(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxRuntimeExports.jsxs(Grid$1, { container: true, direction: "row", justifyContent: "space-between", children: [jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle spot layer visibility", children: jsxRuntimeExports.jsx(Visibility, {}) }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsxRuntimeExports.jsx(Grid$1, { size: 6, children: jsxRuntimeExports.jsx(Typography, { className: menuClasses.imageLayerName, children: label2 }) }), jsxRuntimeExports.jsx(Grid$1, { size: 2, children: jsxRuntimeExports.jsx(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(SpotLayerEllipsisMenu, { filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(SvgSpots, { className: classes2.layerTypeSpotIcon }) })] }) }) });
|
|
279696
280091
|
}
|
|
279697
280092
|
const useStyles$e = makeStyles()(() => ({
|
|
280093
|
+
pointLayerButton: {
|
|
280094
|
+
borderStyle: "dashed",
|
|
280095
|
+
marginTop: "10px",
|
|
280096
|
+
marginBottom: "10px",
|
|
280097
|
+
fontWeight: 400
|
|
280098
|
+
},
|
|
280099
|
+
pointFeatureControllerGrid: {
|
|
280100
|
+
padding: "0",
|
|
280101
|
+
flexWrap: "nowrap"
|
|
280102
|
+
},
|
|
280103
|
+
pointFeatureExpansionButton: {
|
|
280104
|
+
display: "inline-block",
|
|
280105
|
+
margin: 0,
|
|
280106
|
+
padding: 0,
|
|
280107
|
+
minWidth: 0,
|
|
280108
|
+
lineHeight: 1,
|
|
280109
|
+
width: "50%"
|
|
280110
|
+
},
|
|
279698
280111
|
layerTypePointIcon: {
|
|
279699
280112
|
height: "100%",
|
|
279700
|
-
|
|
280113
|
+
paddingLeft: "2px",
|
|
279701
280114
|
fill: "currentColor",
|
|
279702
|
-
fontSize: "
|
|
280115
|
+
fontSize: "14px",
|
|
279703
280116
|
width: "50%",
|
|
279704
|
-
maxWidth: "
|
|
280117
|
+
maxWidth: "16px"
|
|
279705
280118
|
}
|
|
279706
280119
|
}));
|
|
279707
280120
|
function PointLayerEllipsisMenu(props) {
|
|
279708
|
-
const { featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
280121
|
+
const { featureSelection, featureFilterMode, setFeatureFilterMode, obsColorEncoding, setObsColorEncoding, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
279709
280122
|
const [open2, setOpen] = useState(false);
|
|
279710
280123
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
279711
280124
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
@@ -279714,17 +280127,84 @@ function PointLayerEllipsisMenu(props) {
|
|
|
279714
280127
|
const tooltipsVisibleId = $bdb11010cef70236$export$f680877a34711e37();
|
|
279715
280128
|
const crosshairsVisibleId = $bdb11010cef70236$export$f680877a34711e37();
|
|
279716
280129
|
const legendVisibleId = $bdb11010cef70236$export$f680877a34711e37();
|
|
279717
|
-
|
|
280130
|
+
const featureFilterModeId = $bdb11010cef70236$export$f680877a34711e37();
|
|
280131
|
+
return jsxRuntimeExports.jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsxRuntimeExports.jsx(MoreVertIcon, {}), buttonClassName: menuClasses.imageLayerMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, withPaper: true, "aria-label": "Open point layer options menu", children: [jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: quantitativeColormapId, children: "Color Encoding: " }), jsxRuntimeExports.jsxs(NativeSelect, { onChange: (e3) => setObsColorEncoding(e3.target.value), value: obsColorEncoding, inputProps: { id: quantitativeColormapId, "aria-label": "Color encoding selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsxRuntimeExports.jsx("option", { value: "spatialLayerColor", children: "Static Color" }), jsxRuntimeExports.jsx("option", { value: "geneSelection", children: "Feature Color" }), jsxRuntimeExports.jsx("option", { value: "randomByFeature", children: "Random Color per Feature" }), jsxRuntimeExports.jsx("option", { value: "random", children: "Random Color per Point" })] })] }), jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: featureFilterModeId, children: "Filter to Feature Selection: " }), jsxRuntimeExports.jsx(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: featureFilterMode === "featureSelection", onChange: (e3, v) => setFeatureFilterMode(v ? "featureSelection" : null), slotProps: { input: { id: featureFilterModeId, "aria-label": "Toggle feature filter mode" } } })] }), jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapRangeId, children: "Colormap Range: " }), jsxRuntimeExports.jsx(Slider, { disabled: obsColorEncoding !== "geneSelection", value: featureValueColormapRange, min: 0, max: 1, step: 0.01, onChange: (e3, v) => setFeatureValueColormapRange(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: colormapRangeId, getAriaLabel: (index2) => index2 === 0 ? "Low value colormap range slider" : "High value colormap range slider" })] }), jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsxRuntimeExports.jsx(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Toggle tooltip visibility" } } })] }), jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: crosshairsVisibleId, children: "Tooltip Crosshairs Visible: " }), jsxRuntimeExports.jsx(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipCrosshairsVisible, onChange: (e3, v) => setTooltipCrosshairsVisible(v), slotProps: { input: { id: crosshairsVisibleId, "aria-label": "Toggle tooltip crosshair visibility" } } })] }), jsxRuntimeExports.jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsxRuntimeExports.jsx("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: legendVisibleId, children: "Legend Visible: " }), jsxRuntimeExports.jsx(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: legendVisible, onChange: (e3, v) => setLegendVisible(v), slotProps: { input: { id: legendVisibleId, "aria-label": "Toggle legend visibility" } } })] })] });
|
|
279718
280132
|
}
|
|
279719
280133
|
function PointLayerController(props) {
|
|
279720
|
-
const { theme, layerScope, layerCoordination, setLayerCoordination, palette = null } = props;
|
|
279721
|
-
const
|
|
279722
|
-
const
|
|
280134
|
+
const { theme, layerScope, layerCoordination, setLayerCoordination, palette = null, pointMatrixIndicesData, tiledPointsLoadingProgress } = props;
|
|
280135
|
+
const [open2, setOpen] = useState(false);
|
|
280136
|
+
const loadingDoneFraction = useMemo$1(() => {
|
|
280137
|
+
if (tiledPointsLoadingProgress && typeof tiledPointsLoadingProgress === "object") {
|
|
280138
|
+
return 1 - Object.values(tiledPointsLoadingProgress).filter((status) => status === "loading").length / Object.values(tiledPointsLoadingProgress).length;
|
|
280139
|
+
}
|
|
280140
|
+
return 1;
|
|
280141
|
+
}, [tiledPointsLoadingProgress]);
|
|
280142
|
+
const { obsType, spatialLayerVisible: visible, spatialLayerOpacity: opacity2, obsColorEncoding, featureColor, featureFilterMode, featureSelection, featureValueColormap, featureValueColormapRange, spatialLayerColor, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = layerCoordination;
|
|
280143
|
+
const { setSpatialLayerVisible: setVisible, setSpatialLayerOpacity: setOpacity2, setObsColorEncoding, setFeatureColor, setFeatureFilterMode, setFeatureSelection, setFeatureValueColormap, setFeatureValueColormapRange, setSpatialLayerColor, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = setLayerCoordination;
|
|
279723
280144
|
const label2 = capitalize$3(obsType);
|
|
279724
280145
|
const visibleSetting = typeof visible === "boolean" ? visible : true;
|
|
279725
280146
|
const Visibility = useMemo$1(() => visibleSetting ? VisibilityIcon : VisibilityOffIcon, [visibleSetting]);
|
|
279726
|
-
const
|
|
279727
|
-
|
|
280147
|
+
const hasUnspecifiedFeatureColors = useMemo$1(() => {
|
|
280148
|
+
if (Array.isArray(featureSelection)) {
|
|
280149
|
+
if (Array.isArray(featureColor)) {
|
|
280150
|
+
return featureSelection.some((featureName) => {
|
|
280151
|
+
const colorForFeature = featureColor.find((fc) => fc.name === featureName);
|
|
280152
|
+
return !colorForFeature;
|
|
280153
|
+
});
|
|
280154
|
+
}
|
|
280155
|
+
return featureSelection.length > 0;
|
|
280156
|
+
}
|
|
280157
|
+
return true;
|
|
280158
|
+
}, [featureColor, featureSelection]);
|
|
280159
|
+
const isStaticColor = obsColorEncoding === "spatialLayerColor" || obsColorEncoding === "geneSelection";
|
|
280160
|
+
const showStaticColor = obsColorEncoding === "spatialLayerColor" || obsColorEncoding === "geneSelection" && hasUnspecifiedFeatureColors;
|
|
280161
|
+
const isColormap = false;
|
|
280162
|
+
const hasSingleSelectedFeature = obsColorEncoding === "geneSelection" && Array.isArray(featureSelection) && featureSelection.length === 1;
|
|
280163
|
+
const color2 = useMemo$1(() => {
|
|
280164
|
+
if (showStaticColor) {
|
|
280165
|
+
return spatialLayerColor;
|
|
280166
|
+
}
|
|
280167
|
+
if (hasSingleSelectedFeature) {
|
|
280168
|
+
const selectedFeatureColor = featureColor?.find((fc) => fc.name === featureSelection[0])?.color;
|
|
280169
|
+
if (selectedFeatureColor) {
|
|
280170
|
+
return selectedFeatureColor;
|
|
280171
|
+
}
|
|
280172
|
+
}
|
|
280173
|
+
return null;
|
|
280174
|
+
}, [
|
|
280175
|
+
hasSingleSelectedFeature,
|
|
280176
|
+
spatialLayerColor,
|
|
280177
|
+
featureColor,
|
|
280178
|
+
featureSelection,
|
|
280179
|
+
showStaticColor
|
|
280180
|
+
]);
|
|
280181
|
+
const setColor2 = useCallback((newColor) => {
|
|
280182
|
+
if (showStaticColor) {
|
|
280183
|
+
setSpatialLayerColor(newColor);
|
|
280184
|
+
} else if (hasSingleSelectedFeature) {
|
|
280185
|
+
const featureColorIndex = featureColor?.findIndex((fc) => fc.name === featureSelection[0]);
|
|
280186
|
+
if (featureColorIndex !== void 0 && featureColorIndex >= 0) {
|
|
280187
|
+
const newFeatureColor = [...featureColor];
|
|
280188
|
+
newFeatureColor[featureColorIndex] = {
|
|
280189
|
+
name: featureSelection[0],
|
|
280190
|
+
color: newColor
|
|
280191
|
+
};
|
|
280192
|
+
setFeatureColor(newFeatureColor);
|
|
280193
|
+
} else {
|
|
280194
|
+
setFeatureColor([
|
|
280195
|
+
...featureColor,
|
|
280196
|
+
{ name: featureSelection[0], color: newColor }
|
|
280197
|
+
]);
|
|
280198
|
+
}
|
|
280199
|
+
}
|
|
280200
|
+
}, [
|
|
280201
|
+
hasSingleSelectedFeature,
|
|
280202
|
+
setSpatialLayerColor,
|
|
280203
|
+
featureColor,
|
|
280204
|
+
setFeatureColor,
|
|
280205
|
+
featureSelection,
|
|
280206
|
+
showStaticColor
|
|
280207
|
+
]);
|
|
279728
280208
|
const { classes: classes2 } = useStyles$e();
|
|
279729
280209
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
279730
280210
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
@@ -279733,7 +280213,10 @@ function PointLayerController(props) {
|
|
|
279733
280213
|
setVisible(nextVisible);
|
|
279734
280214
|
}, [visible, setVisible]);
|
|
279735
280215
|
const handleOpacityChange = useCallback((e3, v) => setOpacity2(v), [setOpacity2]);
|
|
279736
|
-
|
|
280216
|
+
useCallback(() => setOpen((prev2) => !prev2), []);
|
|
280217
|
+
const [coloringTabIndex, setColoringTabIndex] = useState(0);
|
|
280218
|
+
const { featureIndex } = pointMatrixIndicesData || {};
|
|
280219
|
+
return jsxRuntimeExports.jsx(Grid$1, { className: lcClasses.layerControllerGrid, children: jsxRuntimeExports.jsxs(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: [jsxRuntimeExports.jsxs(Grid$1, { container: true, direction: "row", justifyContent: "space-between", children: [jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle layer visibility", children: jsxRuntimeExports.jsx(Visibility, {}) }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsxRuntimeExports.jsx(Grid$1, { size: 6, children: jsxRuntimeExports.jsx(Typography, { className: menuClasses.imageLayerName, children: label2 }) }), jsxRuntimeExports.jsx(Grid$1, { size: 2, children: jsxRuntimeExports.jsx(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(PointLayerEllipsisMenu, { featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, featureFilterMode, setFeatureFilterMode }) }), jsxRuntimeExports.jsxs(Grid$1, { size: 1, container: true, direction: "row", children: [jsxRuntimeExports.jsx(SvgPoints, { className: classes2.layerTypePointIcon }), null] })] }), loadingDoneFraction < 1 ? jsxRuntimeExports.jsx(Grid$1, { size: 12, container: true, direction: "column", justifyContent: "space-between", className: classes2.pointFeatureControllerGrid, children: jsxRuntimeExports.jsx(LinearProgress, { variant: loadingDoneFraction === 0 ? "indeterminate" : "determinate", value: loadingDoneFraction * 100 }) }) : null, null] }) });
|
|
279737
280220
|
}
|
|
279738
280221
|
const useStyles$d = makeStyles()(() => ({
|
|
279739
280222
|
layerTypeSegmentationIcon: {
|
|
@@ -280045,7 +280528,7 @@ function ImageLayerEllipsisMenu(props) {
|
|
|
280045
280528
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
280046
280529
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
280047
280530
|
const [localLodSliderValue, setLocalLodSliderValue] = useState(convertLodFactorToLogarithmicSliderValue(spatialLodFactor || 1));
|
|
280048
|
-
|
|
280531
|
+
useEffect(() => {
|
|
280049
280532
|
setLocalLodSliderValue(convertLodFactorToLogarithmicSliderValue(spatialLodFactor || 1));
|
|
280050
280533
|
}, [spatialLodFactor]);
|
|
280051
280534
|
const is3dMode = spatialRenderingMode === "3D";
|
|
@@ -280181,7 +280664,7 @@ function GlobalDimensionSlider(props) {
|
|
|
280181
280664
|
return jsxRuntimeExports.jsx(Grid$1, { className: lcClasses.layerControllerGrid, children: jsxRuntimeExports.jsx(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxRuntimeExports.jsxs(Grid$1, { container: true, direction: "row", justifyContent: "space-between", children: [jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(SvgDimensions, { className: classes2.dimensionsIcon }) }), jsxRuntimeExports.jsx(Grid$1, { size: 1, children: jsxRuntimeExports.jsx(Typography, { className: classes2.dimensionLabel, children: label2 }) }), jsxRuntimeExports.jsx(Grid$1, { size: 8, children: jsxRuntimeExports.jsx(Slider, { value: targetValue, min: min2, max: max2, step: 1, onChange: (e3, v) => setTargetValue(v), className: classes2.dimensionSlider, valueLabelDisplay: "auto", orientation: "horizontal", disabled: spatialRenderingMode === "3D", "aria-label": `${label2}-slice slider` }) }), jsxRuntimeExports.jsx(Grid$1, { size: 2, children: isForZ ? jsxRuntimeExports.jsx(FormGroup, { row: true, className: classes2.switchFormGroup, children: jsxRuntimeExports.jsx(FormControlLabel$1, { control: jsxRuntimeExports.jsx(Switch, { color: "primary", checked: spatialRenderingMode === "3D", onChange: handleRenderingModeChange, name: "is3dMode" }), label: "3D" }) }) : null })] }) }) });
|
|
280182
280665
|
}
|
|
280183
280666
|
function LayerController(props) {
|
|
280184
|
-
const { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, volumeLoadingStatus } = props;
|
|
280667
|
+
const { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, volumeLoadingStatus, tiledPointsLoadingProgress } = props;
|
|
280185
280668
|
const anyLayerHasT = Object.values(images || {}).some((image2) => image2?.image?.instance.hasTStack());
|
|
280186
280669
|
const anyLayerHasZ = Object.values(images || {}).some((image2) => image2?.image?.instance.hasZStack());
|
|
280187
280670
|
const maxT = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumT()), 1) - 1;
|
|
@@ -280190,7 +280673,7 @@ function LayerController(props) {
|
|
|
280190
280673
|
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].reverse(), [segmentationLayerScopes]);
|
|
280191
280674
|
const reversedSpotLayerScopes = useMemo$1(() => [...spotLayerScopes || []].reverse(), [spotLayerScopes]);
|
|
280192
280675
|
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].reverse(), [pointLayerScopes]);
|
|
280193
|
-
return jsxRuntimeExports.jsxs("div", { children: [anyLayerHasZ ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode }) : null, anyLayerHasT ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null, pointLayerScopes && reversedPointLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(PointLayerController, { theme, layerScope, layerCoordination: pointLayerCoordination[0][layerScope], setLayerCoordination: pointLayerCoordination[1][layerScope] }, layerScope)), spotLayerScopes && reversedSpotLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SpotLayerController, { theme, layerScope, layerCoordination: spotLayerCoordination[0][layerScope], setLayerCoordination: spotLayerCoordination[1][layerScope] }, layerScope)), segmentationLayerScopes && reversedSegmentationLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SegmentationLayerController, { theme, layerScope, layerCoordination: segmentationLayerCoordination[0][layerScope], setLayerCoordination: segmentationLayerCoordination[1][layerScope], channelScopes: segmentationChannelScopesByLayer[layerScope], channelCoordination: segmentationChannelCoordination[0][layerScope], setChannelCoordination: segmentationChannelCoordination[1][layerScope] }, layerScope)), imageLayerScopes && reversedImageLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(ImageLayerController, { theme, coordinationScopesRaw, layerScope, layerCoordination: imageLayerCoordination[0][layerScope], setLayerCoordination: imageLayerCoordination[1][layerScope], channelScopes: imageChannelScopesByLayer[layerScope], channelCoordination: imageChannelCoordination[0][layerScope], setChannelCoordination: imageChannelCoordination[1][layerScope], image: images[layerScope]?.image?.instance, featureIndex: images[layerScope]?.featureIndex, targetT, targetZ, spatialRenderingMode, volumeLoadingProgress: volumeLoadingStatus?.loadingProgress, onStopVolumeLoading: volumeLoadingStatus?.onStopLoading, onRestartVolumeLoading: volumeLoadingStatus?.onRestartLoading, volumeStillRef: volumeLoadingStatus?.stillRef }, layerScope))] });
|
|
280676
|
+
return jsxRuntimeExports.jsxs("div", { children: [anyLayerHasZ ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode }) : null, anyLayerHasT ? jsxRuntimeExports.jsx(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null, pointLayerScopes && reversedPointLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(PointLayerController, { theme, layerScope, layerCoordination: pointLayerCoordination[0][layerScope], setLayerCoordination: pointLayerCoordination[1][layerScope], pointMatrixIndicesData: pointMultiIndicesData?.[layerScope], tiledPointsLoadingProgress }, layerScope)), spotLayerScopes && reversedSpotLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SpotLayerController, { theme, layerScope, layerCoordination: spotLayerCoordination[0][layerScope], setLayerCoordination: spotLayerCoordination[1][layerScope] }, layerScope)), segmentationLayerScopes && reversedSegmentationLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(SegmentationLayerController, { theme, layerScope, layerCoordination: segmentationLayerCoordination[0][layerScope], setLayerCoordination: segmentationLayerCoordination[1][layerScope], channelScopes: segmentationChannelScopesByLayer[layerScope], channelCoordination: segmentationChannelCoordination[0][layerScope], setChannelCoordination: segmentationChannelCoordination[1][layerScope] }, layerScope)), imageLayerScopes && reversedImageLayerScopes.map((layerScope) => jsxRuntimeExports.jsx(ImageLayerController, { theme, coordinationScopesRaw, layerScope, layerCoordination: imageLayerCoordination[0][layerScope], setLayerCoordination: imageLayerCoordination[1][layerScope], channelScopes: imageChannelScopesByLayer[layerScope], channelCoordination: imageChannelCoordination[0][layerScope], setChannelCoordination: imageChannelCoordination[1][layerScope], image: images[layerScope]?.image?.instance, featureIndex: images[layerScope]?.featureIndex, targetT, targetZ, spatialRenderingMode, volumeLoadingProgress: volumeLoadingStatus?.loadingProgress, onStopVolumeLoading: volumeLoadingStatus?.onStopLoading, onRestartVolumeLoading: volumeLoadingStatus?.onRestartLoading, volumeStillRef: volumeLoadingStatus?.stillRef }, layerScope))] });
|
|
280194
280677
|
}
|
|
280195
280678
|
function LayerControllerSubscriber(props) {
|
|
280196
280679
|
const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid: uuid2 } = props;
|
|
@@ -280274,6 +280757,8 @@ function LayerControllerSubscriber(props) {
|
|
|
280274
280757
|
CoordinationType$2.SPATIAL_LAYER_OPACITY,
|
|
280275
280758
|
CoordinationType$2.SPATIAL_SPOT_RADIUS,
|
|
280276
280759
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
280760
|
+
CoordinationType$2.FEATURE_COLOR,
|
|
280761
|
+
CoordinationType$2.FEATURE_FILTER_MODE,
|
|
280277
280762
|
CoordinationType$2.FEATURE_SELECTION,
|
|
280278
280763
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
280279
280764
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
@@ -280282,7 +280767,10 @@ function LayerControllerSubscriber(props) {
|
|
|
280282
280767
|
CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
280283
280768
|
CoordinationType$2.LEGEND_VISIBLE
|
|
280284
280769
|
], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
|
|
280285
|
-
const [{ volumeLoadingProgress: volumeLoadingStatus }] = useAuxiliaryCoordination([
|
|
280770
|
+
const [{ volumeLoadingProgress: volumeLoadingStatus, tiledPointsLoadingProgress }] = useAuxiliaryCoordination([
|
|
280771
|
+
"spatialAcceleratedVolumeLoadingProgress",
|
|
280772
|
+
"spatialTiledPointsLoadingProgress"
|
|
280773
|
+
], coordinationScopes);
|
|
280286
280774
|
const [spatialLayout] = useComponentLayout("spatial", ["spatialImageLayer"], coordinationScopes);
|
|
280287
280775
|
const layerControllerRef = useRef();
|
|
280288
280776
|
useClosestVitessceContainerSize(layerControllerRef);
|
|
@@ -280291,19 +280779,22 @@ function LayerControllerSubscriber(props) {
|
|
|
280291
280779
|
const [imageData, imageDataStatus, imageUrls, imageErrors] = useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
280292
280780
|
const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls, obsSpotsErrors] = useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
280293
280781
|
const [obsPointsData, obsPointsDataStatus, obsPointsUrls, obsPointsErrors] = useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
280782
|
+
const [pointMultiIndicesData, pointMultiIndicesDataStatus, pointMultiIndicesDataErrors] = usePointMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
280294
280783
|
const errors = [
|
|
280295
280784
|
...obsSegmentationsErrors,
|
|
280296
280785
|
...imageErrors,
|
|
280297
280786
|
...obsSpotsErrors,
|
|
280298
|
-
...obsPointsErrors
|
|
280787
|
+
...obsPointsErrors,
|
|
280788
|
+
...pointMultiIndicesDataErrors
|
|
280299
280789
|
];
|
|
280300
280790
|
const isReady = useReady([
|
|
280301
280791
|
obsSpotsDataStatus,
|
|
280302
280792
|
obsPointsDataStatus,
|
|
280303
280793
|
obsSegmentationsDataStatus,
|
|
280304
|
-
imageDataStatus
|
|
280794
|
+
imageDataStatus,
|
|
280795
|
+
pointMultiIndicesDataStatus
|
|
280305
280796
|
]);
|
|
280306
|
-
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, children: jsxRuntimeExports.jsx(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, volumeLoadingStatus }) });
|
|
280797
|
+
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, children: jsxRuntimeExports.jsx(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, volumeLoadingStatus, tiledPointsLoadingProgress }) });
|
|
280307
280798
|
}
|
|
280308
280799
|
function LinkController(props) {
|
|
280309
280800
|
const { linkIDInit, authToken, linkEndpoint, websocketEndpoint, fileTypes, coordinationTypes, stores } = props;
|
|
@@ -282203,7 +282694,7 @@ function HiglassGlobalStyles(props) {
|
|
|
282203
282694
|
}
|
|
282204
282695
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
282205
282696
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
282206
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
282697
|
+
const { HiGlassComponent } = await import("./higlass-DTBEnOUt.js");
|
|
282207
282698
|
return { default: HiGlassComponent };
|
|
282208
282699
|
});
|
|
282209
282700
|
const HG_SIZE = 800;
|
|
@@ -285150,7 +285641,7 @@ function NeuroglancerGlobalStyles(props) {
|
|
|
285150
285641
|
const { classes: classes2 } = props;
|
|
285151
285642
|
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsxRuntimeExports.jsx(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
|
|
285152
285643
|
}
|
|
285153
|
-
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-
|
|
285644
|
+
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-BTLpuV09.js"));
|
|
285154
285645
|
function createWorker() {
|
|
285155
285646
|
return new WorkerFactory();
|
|
285156
285647
|
}
|
|
@@ -306324,7 +306815,7 @@ function cureLocalIntersections(start2, triangles, dim) {
|
|
|
306324
306815
|
let p = start2;
|
|
306325
306816
|
do {
|
|
306326
306817
|
const a2 = p.prev, b2 = p.next.next;
|
|
306327
|
-
if (!equals$1(a2, b2) && intersects$
|
|
306818
|
+
if (!equals$1(a2, b2) && intersects$3(a2, p, p.next, b2) && locallyInside(a2, b2) && locallyInside(b2, a2)) {
|
|
306328
306819
|
triangles.push(a2.i / dim | 0);
|
|
306329
306820
|
triangles.push(p.i / dim | 0);
|
|
306330
306821
|
triangles.push(b2.i / dim | 0);
|
|
@@ -306502,7 +306993,7 @@ function area$3(p, q, r3) {
|
|
|
306502
306993
|
function equals$1(p1, p2) {
|
|
306503
306994
|
return p1.x === p2.x && p1.y === p2.y;
|
|
306504
306995
|
}
|
|
306505
|
-
function intersects$
|
|
306996
|
+
function intersects$3(p1, q1, p2, q2) {
|
|
306506
306997
|
const o1 = sign$2(area$3(p1, q1, p2));
|
|
306507
306998
|
const o2 = sign$2(area$3(p1, q1, q2));
|
|
306508
306999
|
const o3 = sign$2(area$3(p2, q2, p1));
|
|
@@ -306523,7 +307014,7 @@ function sign$2(num) {
|
|
|
306523
307014
|
function intersectsPolygon(a2, b2) {
|
|
306524
307015
|
let p = a2;
|
|
306525
307016
|
do {
|
|
306526
|
-
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b2.i && p.next.i !== b2.i && intersects$
|
|
307017
|
+
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b2.i && p.next.i !== b2.i && intersects$3(p, p.next, a2, b2)) return true;
|
|
306527
307018
|
p = p.next;
|
|
306528
307019
|
} while (p !== a2);
|
|
306529
307020
|
return false;
|
|
@@ -335534,7 +336025,7 @@ function place(b2, a2, c2) {
|
|
|
335534
336025
|
c2.y = a2.y;
|
|
335535
336026
|
}
|
|
335536
336027
|
}
|
|
335537
|
-
function intersects$
|
|
336028
|
+
function intersects$2(a2, b2) {
|
|
335538
336029
|
var dr = a2.r + b2.r - 1e-6, dx = b2.x - a2.x, dy = b2.y - a2.y;
|
|
335539
336030
|
return dr > 0 && dr * dr > dx * dx + dy * dy;
|
|
335540
336031
|
}
|
|
@@ -335564,13 +336055,13 @@ function packSiblingsRandom(circles, random2) {
|
|
|
335564
336055
|
j = b2.next, k = a2.previous, sj = b2._.r, sk = a2._.r;
|
|
335565
336056
|
do {
|
|
335566
336057
|
if (sj <= sk) {
|
|
335567
|
-
if (intersects$
|
|
336058
|
+
if (intersects$2(j._, c2._)) {
|
|
335568
336059
|
b2 = j, a2.next = b2, b2.previous = a2, --i2;
|
|
335569
336060
|
continue pack;
|
|
335570
336061
|
}
|
|
335571
336062
|
sj += j._.r, j = j.next;
|
|
335572
336063
|
} else {
|
|
335573
|
-
if (intersects$
|
|
336064
|
+
if (intersects$2(k._, c2._)) {
|
|
335574
336065
|
a2 = k, a2.next = b2, b2.previous = a2, --i2;
|
|
335575
336066
|
continue pack;
|
|
335576
336067
|
}
|
|
@@ -370040,7 +370531,7 @@ class ObsPointsCsvLoader extends CsvLoader {
|
|
|
370040
370531
|
data: [obsLocationsX, obsLocationsY],
|
|
370041
370532
|
shape: [2, obsLocationsX.length]
|
|
370042
370533
|
};
|
|
370043
|
-
this.cachedResult = { obsIndex, obsPoints };
|
|
370534
|
+
this.cachedResult = { obsIndex, obsPoints, obsPointsTilingType: "full" };
|
|
370044
370535
|
return this.cachedResult;
|
|
370045
370536
|
}
|
|
370046
370537
|
async load() {
|
|
@@ -371672,7 +372163,7 @@ class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
371672
372163
|
this.dataSource.loadObsIndex(path2),
|
|
371673
372164
|
this.loadPoints()
|
|
371674
372165
|
]);
|
|
371675
|
-
return new LoaderResult({ obsIndex, obsPoints }, null, coordinationValues);
|
|
372166
|
+
return new LoaderResult({ obsIndex, obsPoints, obsPointsTilingType: "full" }, null, coordinationValues);
|
|
371676
372167
|
}
|
|
371677
372168
|
}
|
|
371678
372169
|
class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
@@ -373307,6 +373798,17 @@ class SpatialDataObsPointsLoader extends AbstractTwoStepLoader {
|
|
|
373307
373798
|
this.locations = locations;
|
|
373308
373799
|
return this.locations;
|
|
373309
373800
|
}
|
|
373801
|
+
async loadPointsInRect(bounds2, signal) {
|
|
373802
|
+
const { path: path2 } = this.options;
|
|
373803
|
+
let locations;
|
|
373804
|
+
const formatVersion = await this.dataSource.getPointsFormatVersion(path2);
|
|
373805
|
+
if (formatVersion === "0.1") {
|
|
373806
|
+
locations = await this.dataSource.loadPointsInRect(path2, bounds2, signal);
|
|
373807
|
+
} else {
|
|
373808
|
+
throw new UnknownSpatialDataFormatError("Only points format version 0.1 is supported.");
|
|
373809
|
+
}
|
|
373810
|
+
return locations;
|
|
373811
|
+
}
|
|
373310
373812
|
async loadObsIndex() {
|
|
373311
373813
|
const { tablePath, path: path2 } = this.options;
|
|
373312
373814
|
if (tablePath) {
|
|
@@ -373319,11 +373821,26 @@ class SpatialDataObsPointsLoader extends AbstractTwoStepLoader {
|
|
|
373319
373821
|
}
|
|
373320
373822
|
return null;
|
|
373321
373823
|
}
|
|
373824
|
+
async supportsTiling() {
|
|
373825
|
+
const { path: path2 } = this.options;
|
|
373826
|
+
const [formatVersion, zattrs, hasRequiredColumnsAndRowGroupSize] = await Promise.all([
|
|
373827
|
+
// Check the points format version.
|
|
373828
|
+
this.dataSource.getPointsFormatVersion(path2),
|
|
373829
|
+
// Check for the presence of bounding_box metadata.
|
|
373830
|
+
this.dataSource.loadSpatialDataElementAttrs(path2),
|
|
373831
|
+
// Check the size of parquet row groups,
|
|
373832
|
+
// and for the presence of morton_code_2d and feature_index columns.
|
|
373833
|
+
this.dataSource.supportsLoadPointsInRect(path2)
|
|
373834
|
+
]);
|
|
373835
|
+
const isSupportedVersion = formatVersion === "0.1";
|
|
373836
|
+
const boundingBox = zattrs?.bounding_box;
|
|
373837
|
+
const hasBoundingBox2D = typeof boundingBox?.x_max === "number" && typeof boundingBox?.x_min === "number" && typeof boundingBox?.y_max === "number" && typeof boundingBox?.y_min === "number";
|
|
373838
|
+
return isSupportedVersion && hasBoundingBox2D && hasRequiredColumnsAndRowGroupSize;
|
|
373839
|
+
}
|
|
373322
373840
|
async load() {
|
|
373323
|
-
const [
|
|
373324
|
-
this.
|
|
373325
|
-
this.
|
|
373326
|
-
this.loadModelMatrix()
|
|
373841
|
+
const [modelMatrix2, supportsTiling] = await Promise.all([
|
|
373842
|
+
this.loadModelMatrix(),
|
|
373843
|
+
this.supportsTiling()
|
|
373327
373844
|
]);
|
|
373328
373845
|
const coordinationValues = {
|
|
373329
373846
|
pointLayer: CL({
|
|
@@ -373339,7 +373856,36 @@ class SpatialDataObsPointsLoader extends AbstractTwoStepLoader {
|
|
|
373339
373856
|
// additionalObsSets: null,
|
|
373340
373857
|
})
|
|
373341
373858
|
};
|
|
373342
|
-
|
|
373859
|
+
let obsIndex = null;
|
|
373860
|
+
let obsPoints = null;
|
|
373861
|
+
const featureIndices = null;
|
|
373862
|
+
if (!supportsTiling) {
|
|
373863
|
+
[obsIndex, obsPoints] = await Promise.all([
|
|
373864
|
+
this.loadObsIndex(),
|
|
373865
|
+
this.loadPoints()
|
|
373866
|
+
]);
|
|
373867
|
+
}
|
|
373868
|
+
return new LoaderResult({
|
|
373869
|
+
/* obsIndex: ["1"], // TEMP
|
|
373870
|
+
obsPoints: { // TEMP
|
|
373871
|
+
shape: [2, 1],
|
|
373872
|
+
data: [[0], [0]],
|
|
373873
|
+
}, */
|
|
373874
|
+
// These will be null if tiling is supported.
|
|
373875
|
+
obsIndex,
|
|
373876
|
+
obsPoints,
|
|
373877
|
+
featureIndices,
|
|
373878
|
+
obsPointsModelMatrix: modelMatrix2,
|
|
373879
|
+
// Return 'tiled' if the morton_code_2d column
|
|
373880
|
+
// and bounding_box metadata are present,
|
|
373881
|
+
// and the row group size is small enough.
|
|
373882
|
+
// Otherwise, return 'full'.
|
|
373883
|
+
obsPointsTilingType: supportsTiling ? "tiled" : "full",
|
|
373884
|
+
// TEMPORARY: probably makes more sense to pass the loader instance all the way down.
|
|
373885
|
+
// Caller can then decide whether to use loader.load vs. loader.loadPointsInRect.
|
|
373886
|
+
// May need another function such as loader.supportsPointInRect() true/false.
|
|
373887
|
+
loadPointsInRect: this.loadPointsInRect.bind(this)
|
|
373888
|
+
}, null, coordinationValues);
|
|
373343
373889
|
}
|
|
373344
373890
|
}
|
|
373345
373891
|
class SpatialDataObsSetsLoader extends ObsSetsAnndataLoader {
|
|
@@ -382734,13 +383280,470 @@ function tableFromIPC(input) {
|
|
|
382734
383280
|
}
|
|
382735
383281
|
return new Table(reader.readAll());
|
|
382736
383282
|
}
|
|
383283
|
+
const MORTON_CODE_NUM_BITS = 32;
|
|
383284
|
+
const MORTON_CODE_VALUE_MAX = 2 ** (MORTON_CODE_NUM_BITS / 2) - 1;
|
|
383285
|
+
function origCoordToNormCoord(origCoord, origXMin, origXMax, origYMin, origYMax) {
|
|
383286
|
+
const [origX, origY] = origCoord;
|
|
383287
|
+
const origXRange = origXMax - origXMin;
|
|
383288
|
+
const origYRange = origYMax - origYMin;
|
|
383289
|
+
return [
|
|
383290
|
+
// Clamp to zero at low end, since using unsigned ints.
|
|
383291
|
+
Math.max(Math.floor((origX - origXMin) / origXRange * MORTON_CODE_VALUE_MAX), 0),
|
|
383292
|
+
Math.max(Math.floor((origY - origYMin) / origYRange * MORTON_CODE_VALUE_MAX), 0)
|
|
383293
|
+
];
|
|
383294
|
+
}
|
|
383295
|
+
function intersects$1(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1) {
|
|
383296
|
+
return !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
|
|
383297
|
+
}
|
|
383298
|
+
function contained(ix0, iy0, ix1, iy1, ox0, oy0, ox1, oy1) {
|
|
383299
|
+
return ox0 <= ix0 && ix0 <= ix1 && ix1 <= ox1 && (oy0 <= iy0 && iy0 <= iy1 && iy1 <= oy1);
|
|
383300
|
+
}
|
|
383301
|
+
function pointInside(x2, y2, rx0, ry0, rx1, ry1) {
|
|
383302
|
+
return rx0 <= x2 && x2 <= rx1 && (ry0 <= y2 && y2 <= ry1);
|
|
383303
|
+
}
|
|
383304
|
+
function cellRange(prefix2, level, bits) {
|
|
383305
|
+
const shift2 = 2 * (bits - level);
|
|
383306
|
+
const power = 2 ** shift2;
|
|
383307
|
+
const lo = prefix2 * power;
|
|
383308
|
+
const hi = (prefix2 + 1) * power - 1;
|
|
383309
|
+
return [lo, hi];
|
|
383310
|
+
}
|
|
383311
|
+
function mergeAdjacent(intervals2) {
|
|
383312
|
+
if (intervals2.length === 0) {
|
|
383313
|
+
return [];
|
|
383314
|
+
}
|
|
383315
|
+
intervals2.sort((a2, b2) => a2[0] - b2[0]);
|
|
383316
|
+
const merged = [intervals2[0]];
|
|
383317
|
+
for (let i2 = 1; i2 < intervals2.length; i2++) {
|
|
383318
|
+
const [lo, hi] = intervals2[i2];
|
|
383319
|
+
const [mlo, mhi] = merged[merged.length - 1];
|
|
383320
|
+
if (lo <= mhi + 1) {
|
|
383321
|
+
merged[merged.length - 1] = [mlo, Math.max(mhi, hi)];
|
|
383322
|
+
} else {
|
|
383323
|
+
merged.push([lo, hi]);
|
|
383324
|
+
}
|
|
383325
|
+
}
|
|
383326
|
+
return merged;
|
|
383327
|
+
}
|
|
383328
|
+
function zcoverRectangle(rx0, ry0, rx1, ry1, bits, stopLevel = null, merge2 = true) {
|
|
383329
|
+
const maxCoord = (1 << bits) - 1;
|
|
383330
|
+
if (!(rx0 >= 0 && rx0 <= rx1 && rx1 <= maxCoord && ry0 >= 0 && ry0 <= ry1 && ry1 <= maxCoord)) {
|
|
383331
|
+
throw new Error("Rectangle out of bounds for given bits.");
|
|
383332
|
+
}
|
|
383333
|
+
const intervals2 = [];
|
|
383334
|
+
const stack2 = [[0, 0, 0, 0, maxCoord, maxCoord]];
|
|
383335
|
+
while (stack2.length > 0) {
|
|
383336
|
+
const [prefix2, level, xmin, ymin, xmax, ymax] = stack2.pop();
|
|
383337
|
+
if (!intersects$1(xmin, ymin, xmax, ymax, rx0, ry0, rx1, ry1)) {
|
|
383338
|
+
continue;
|
|
383339
|
+
}
|
|
383340
|
+
if (stopLevel !== null && level === stopLevel) {
|
|
383341
|
+
intervals2.push(cellRange(prefix2, level, bits));
|
|
383342
|
+
continue;
|
|
383343
|
+
}
|
|
383344
|
+
if (contained(xmin, ymin, xmax, ymax, rx0, ry0, rx1, ry1)) {
|
|
383345
|
+
intervals2.push(cellRange(prefix2, level, bits));
|
|
383346
|
+
continue;
|
|
383347
|
+
}
|
|
383348
|
+
if (level === bits) {
|
|
383349
|
+
if (pointInside(xmin, ymin, rx0, ry0, rx1, ry1)) {
|
|
383350
|
+
intervals2.push(cellRange(prefix2, level, bits));
|
|
383351
|
+
}
|
|
383352
|
+
continue;
|
|
383353
|
+
}
|
|
383354
|
+
const midx = Math.floor((xmin + xmax) / 2);
|
|
383355
|
+
const midy = Math.floor((ymin + ymax) / 2);
|
|
383356
|
+
stack2.push([prefix2 << 2 | 0, level + 1, xmin, ymin, midx, midy]);
|
|
383357
|
+
stack2.push([prefix2 << 2 | 1, level + 1, midx + 1, ymin, xmax, midy]);
|
|
383358
|
+
stack2.push([prefix2 << 2 | 2, level + 1, xmin, midy + 1, midx, ymax]);
|
|
383359
|
+
stack2.push([prefix2 << 2 | 3, level + 1, midx + 1, midy + 1, xmax, ymax]);
|
|
383360
|
+
}
|
|
383361
|
+
return merge2 ? mergeAdjacent(intervals2) : intervals2;
|
|
383362
|
+
}
|
|
383363
|
+
function sdataMortonQueryRectAux(boundingBox, origRect) {
|
|
383364
|
+
const xMin = boundingBox.x_min;
|
|
383365
|
+
const xMax = boundingBox.x_max;
|
|
383366
|
+
const yMin = boundingBox.y_min;
|
|
383367
|
+
const yMax = boundingBox.y_max;
|
|
383368
|
+
const normRect = [
|
|
383369
|
+
origCoordToNormCoord(origRect[0], xMin, xMax, yMin, yMax),
|
|
383370
|
+
origCoordToNormCoord(origRect[1], xMin, xMax, yMin, yMax)
|
|
383371
|
+
];
|
|
383372
|
+
const mortonIntervals = zcoverRectangle(normRect[0][0], normRect[0][1], normRect[1][0], normRect[1][1], 16, null, true);
|
|
383373
|
+
return mortonIntervals;
|
|
383374
|
+
}
|
|
382737
383375
|
async function getParquetModule() {
|
|
382738
383376
|
const module2 = await import(
|
|
382739
383377
|
/* webpackIgnore: true */
|
|
382740
|
-
"https://
|
|
383378
|
+
"https://cdn.vitessce.io/parquet-wasm@2c23652/esm/parquet_wasm.js"
|
|
382741
383379
|
);
|
|
382742
383380
|
await module2.default();
|
|
382743
|
-
return {
|
|
383381
|
+
return {
|
|
383382
|
+
readParquet: module2.readParquet,
|
|
383383
|
+
readSchema: module2.readSchema,
|
|
383384
|
+
readMetadata: module2.readMetadata,
|
|
383385
|
+
// Added in fork
|
|
383386
|
+
readParquetRowGroup: module2.readParquetRowGroup
|
|
383387
|
+
// Added in fork
|
|
383388
|
+
};
|
|
383389
|
+
}
|
|
383390
|
+
async function _getParquetModule({ queryClient }) {
|
|
383391
|
+
return queryClient.fetchQuery({
|
|
383392
|
+
queryKey: ["parquetModule"],
|
|
383393
|
+
staleTime: Infinity,
|
|
383394
|
+
queryFn: getParquetModule,
|
|
383395
|
+
meta: { queryClient }
|
|
383396
|
+
});
|
|
383397
|
+
}
|
|
383398
|
+
async function _loadParquetBytes({ queryClient, store }, parquetPath, rangeQuery = void 0, partIndex = void 0) {
|
|
383399
|
+
return queryClient.fetchQuery({
|
|
383400
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetBytes", parquetPath, rangeQuery, partIndex],
|
|
383401
|
+
staleTime: Infinity,
|
|
383402
|
+
queryFn: async (ctx) => {
|
|
383403
|
+
const store2 = ctx.meta?.store;
|
|
383404
|
+
const rangeQuery2 = ctx.queryKey[3];
|
|
383405
|
+
const { offset: offset2, length: length2, suffixLength } = rangeQuery2 || {};
|
|
383406
|
+
let getter2 = (path2) => store2.get(path2);
|
|
383407
|
+
if (rangeQuery2 !== void 0 && store2.getRange) {
|
|
383408
|
+
if (suffixLength !== void 0) {
|
|
383409
|
+
getter2 = (path2) => store2.getRange(path2, {
|
|
383410
|
+
suffixLength
|
|
383411
|
+
});
|
|
383412
|
+
} else {
|
|
383413
|
+
getter2 = (path2) => store2.getRange(path2, {
|
|
383414
|
+
offset: offset2,
|
|
383415
|
+
length: length2
|
|
383416
|
+
});
|
|
383417
|
+
}
|
|
383418
|
+
}
|
|
383419
|
+
let parquetBytes;
|
|
383420
|
+
if (partIndex === void 0) {
|
|
383421
|
+
parquetBytes = await getter2(`/${parquetPath}`);
|
|
383422
|
+
}
|
|
383423
|
+
if (!parquetBytes) {
|
|
383424
|
+
const part0Path = `${parquetPath}/part.${partIndex ?? 0}.parquet`;
|
|
383425
|
+
parquetBytes = await getter2(`/${part0Path}`);
|
|
383426
|
+
}
|
|
383427
|
+
return parquetBytes;
|
|
383428
|
+
},
|
|
383429
|
+
meta: { store }
|
|
383430
|
+
});
|
|
383431
|
+
}
|
|
383432
|
+
async function _loadParquetSchemaBytes({ queryClient, store }, parquetPath, partIndex = void 0) {
|
|
383433
|
+
return queryClient.fetchQuery({
|
|
383434
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetSchemaBytes", parquetPath, partIndex],
|
|
383435
|
+
staleTime: Infinity,
|
|
383436
|
+
queryFn: async (ctx) => {
|
|
383437
|
+
const store2 = ctx.meta?.store;
|
|
383438
|
+
if (store2.getRange) {
|
|
383439
|
+
const TAIL_LENGTH = 8;
|
|
383440
|
+
let partZeroPath = parquetPath;
|
|
383441
|
+
let tailBytes = await store2.getRange(`/${partZeroPath}`, {
|
|
383442
|
+
suffixLength: TAIL_LENGTH
|
|
383443
|
+
});
|
|
383444
|
+
if (!tailBytes) {
|
|
383445
|
+
partZeroPath = `${parquetPath}/part.${partIndex ?? 0}.parquet`;
|
|
383446
|
+
tailBytes = await store2.getRange(`/${partZeroPath}`, {
|
|
383447
|
+
suffixLength: TAIL_LENGTH
|
|
383448
|
+
});
|
|
383449
|
+
}
|
|
383450
|
+
if (!tailBytes || tailBytes.length < TAIL_LENGTH) {
|
|
383451
|
+
throw new Error(`Failed to load parquet footerLength for ${partZeroPath}`);
|
|
383452
|
+
}
|
|
383453
|
+
const footerLength = new DataView(tailBytes.buffer).getInt32(0, true);
|
|
383454
|
+
const magic = new TextDecoder().decode(tailBytes.slice(4, 8));
|
|
383455
|
+
if (magic !== "PAR1") {
|
|
383456
|
+
throw new Error("Invalid Parquet file: missing PAR1 magic number");
|
|
383457
|
+
}
|
|
383458
|
+
const footerBytes = await store2.getRange(`/${partZeroPath}`, {
|
|
383459
|
+
suffixLength: footerLength + TAIL_LENGTH
|
|
383460
|
+
});
|
|
383461
|
+
if (!footerBytes || footerBytes.length !== footerLength + TAIL_LENGTH) {
|
|
383462
|
+
throw new Error(`Failed to load parquet footer bytes for ${parquetPath}`);
|
|
383463
|
+
}
|
|
383464
|
+
return footerBytes;
|
|
383465
|
+
}
|
|
383466
|
+
return null;
|
|
383467
|
+
},
|
|
383468
|
+
meta: { queryClient, store }
|
|
383469
|
+
});
|
|
383470
|
+
}
|
|
383471
|
+
async function _loadParquetMetadataByPart({ queryClient, store }, parquetPath) {
|
|
383472
|
+
return queryClient.fetchQuery({
|
|
383473
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetMetadataByPart", parquetPath],
|
|
383474
|
+
staleTime: Infinity,
|
|
383475
|
+
queryFn: async (ctx) => {
|
|
383476
|
+
const queryClient2 = (
|
|
383477
|
+
/** @type {QueryClient} */
|
|
383478
|
+
ctx.meta?.queryClient
|
|
383479
|
+
);
|
|
383480
|
+
const { readSchema, readMetadata } = await _getParquetModule({ queryClient: queryClient2 });
|
|
383481
|
+
let partIndex = 0;
|
|
383482
|
+
let numParts;
|
|
383483
|
+
const allMetadata = [];
|
|
383484
|
+
do {
|
|
383485
|
+
try {
|
|
383486
|
+
const schemaBytes = await _loadParquetSchemaBytes({ queryClient: queryClient2, store }, parquetPath, partIndex);
|
|
383487
|
+
if (schemaBytes) {
|
|
383488
|
+
const wasmSchema = readSchema(schemaBytes);
|
|
383489
|
+
const arrowTableForSchema = tableFromIPC(wasmSchema.intoIPCStream());
|
|
383490
|
+
const partMetadata = readMetadata(schemaBytes);
|
|
383491
|
+
const partInfo = {
|
|
383492
|
+
schema: arrowTableForSchema,
|
|
383493
|
+
schemaBytes,
|
|
383494
|
+
metadata: partMetadata
|
|
383495
|
+
};
|
|
383496
|
+
allMetadata.push(partInfo);
|
|
383497
|
+
partIndex += 1;
|
|
383498
|
+
}
|
|
383499
|
+
} catch (error2) {
|
|
383500
|
+
if (error2.message.includes("Failed to load parquet footerLength")) {
|
|
383501
|
+
numParts = partIndex;
|
|
383502
|
+
}
|
|
383503
|
+
}
|
|
383504
|
+
} while (numParts === void 0);
|
|
383505
|
+
const metadata2 = {
|
|
383506
|
+
numRows: 0,
|
|
383507
|
+
numRowGroups: 0,
|
|
383508
|
+
numRowsPerGroup: 0,
|
|
383509
|
+
schema: null
|
|
383510
|
+
};
|
|
383511
|
+
if (allMetadata.length > 0) {
|
|
383512
|
+
const firstPart = allMetadata[0];
|
|
383513
|
+
metadata2.numRows = allMetadata.reduce((sum2, part) => sum2 + part.metadata.fileMetadata().numRows(), 0);
|
|
383514
|
+
metadata2.numRowGroups = allMetadata.reduce((sum2, part) => sum2 + part.metadata.numRowGroups(), 0);
|
|
383515
|
+
metadata2.numRowsPerGroup = firstPart.metadata.rowGroup(0).numRows();
|
|
383516
|
+
metadata2.schema = firstPart.schema.schema;
|
|
383517
|
+
}
|
|
383518
|
+
const result = {
|
|
383519
|
+
...metadata2,
|
|
383520
|
+
// TODO: extract metadata per part and rowGroup into plain objects that match the hyparquet parquetMetadata() return value?
|
|
383521
|
+
// This will also make it easier to test.
|
|
383522
|
+
parts: allMetadata
|
|
383523
|
+
};
|
|
383524
|
+
return result;
|
|
383525
|
+
},
|
|
383526
|
+
meta: { queryClient }
|
|
383527
|
+
});
|
|
383528
|
+
}
|
|
383529
|
+
async function _loadParquetRowGroupByGroupIndex({ queryClient, store }, parquetPath, rowGroupIndex) {
|
|
383530
|
+
return queryClient.fetchQuery({
|
|
383531
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetRowGroupByGroupIndex", parquetPath, rowGroupIndex],
|
|
383532
|
+
staleTime: Infinity,
|
|
383533
|
+
queryFn: async (ctx) => {
|
|
383534
|
+
const queryClient2 = (
|
|
383535
|
+
/** @type {QueryClient} */
|
|
383536
|
+
ctx.meta?.queryClient
|
|
383537
|
+
);
|
|
383538
|
+
const store2 = ctx.meta?.store;
|
|
383539
|
+
const { readParquetRowGroup } = await _getParquetModule({ queryClient: queryClient2 });
|
|
383540
|
+
const allMetadata = await _loadParquetMetadataByPart({ queryClient: queryClient2, store: store2 }, parquetPath);
|
|
383541
|
+
if (rowGroupIndex < 0 || rowGroupIndex >= allMetadata.numRowGroups) {
|
|
383542
|
+
throw new Error(`Row group index ${rowGroupIndex} is out of bounds for parquet table with ${allMetadata.numRowGroups} row groups.`);
|
|
383543
|
+
}
|
|
383544
|
+
let partIndex;
|
|
383545
|
+
let cumulativeRowGroups = 0;
|
|
383546
|
+
for (let i2 = 0; i2 < allMetadata.parts.length; i2++) {
|
|
383547
|
+
const part = allMetadata.parts[i2];
|
|
383548
|
+
const numRowGroupsInPart = part.metadata.numRowGroups();
|
|
383549
|
+
if (rowGroupIndex < cumulativeRowGroups + numRowGroupsInPart) {
|
|
383550
|
+
partIndex = i2;
|
|
383551
|
+
break;
|
|
383552
|
+
}
|
|
383553
|
+
cumulativeRowGroups += numRowGroupsInPart;
|
|
383554
|
+
}
|
|
383555
|
+
if (partIndex === void 0) {
|
|
383556
|
+
throw new Error(`Failed to find part containing row group index ${rowGroupIndex}.`);
|
|
383557
|
+
}
|
|
383558
|
+
const partMetadata = allMetadata.parts[partIndex].metadata;
|
|
383559
|
+
const { schemaBytes } = allMetadata.parts[partIndex];
|
|
383560
|
+
const rowGroupIndexRelativeToPart = rowGroupIndex - cumulativeRowGroups;
|
|
383561
|
+
const rowGroupMetadata = partMetadata.rowGroup(rowGroupIndexRelativeToPart);
|
|
383562
|
+
const rowGroupFileOffset = rowGroupMetadata.fileOffset();
|
|
383563
|
+
const rowGroupCompressedSize = rowGroupMetadata.compressedSize();
|
|
383564
|
+
const rowGroupBytes = await _loadParquetBytes({ queryClient: queryClient2, store: store2 }, parquetPath, { offset: rowGroupFileOffset, length: rowGroupCompressedSize }, partIndex);
|
|
383565
|
+
const rowGroupIPC = readParquetRowGroup(schemaBytes, rowGroupBytes, rowGroupIndexRelativeToPart).intoIPCStream();
|
|
383566
|
+
const rowGroupTable = tableFromIPC(rowGroupIPC);
|
|
383567
|
+
return rowGroupTable;
|
|
383568
|
+
},
|
|
383569
|
+
meta: { queryClient, store }
|
|
383570
|
+
});
|
|
383571
|
+
}
|
|
383572
|
+
async function _loadParquetRowGroupColumnExtent({ queryClient, store }, parquetPath, columnName, rowGroupIndex) {
|
|
383573
|
+
return queryClient.fetchQuery({
|
|
383574
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetRowGroupColumnExtent", parquetPath, columnName, rowGroupIndex],
|
|
383575
|
+
staleTime: Infinity,
|
|
383576
|
+
queryFn: async (ctx) => {
|
|
383577
|
+
const queryClient2 = (
|
|
383578
|
+
/** @type {QueryClient} */
|
|
383579
|
+
ctx.meta?.queryClient
|
|
383580
|
+
);
|
|
383581
|
+
const store2 = ctx.meta?.store;
|
|
383582
|
+
const rowGroupTable = await _loadParquetRowGroupByGroupIndex({ queryClient: queryClient2, store: store2 }, parquetPath, rowGroupIndex);
|
|
383583
|
+
const column2 = rowGroupTable.getChild(columnName);
|
|
383584
|
+
if (!column2) {
|
|
383585
|
+
throw new Error(`Column ${columnName} not found in row group ${rowGroupIndex} of parquet table at ${parquetPath}.`);
|
|
383586
|
+
}
|
|
383587
|
+
if (column2.length === 0) {
|
|
383588
|
+
return { min: null, max: null };
|
|
383589
|
+
}
|
|
383590
|
+
return { min: column2.get(0), max: column2.get(column2.length - 1) };
|
|
383591
|
+
},
|
|
383592
|
+
meta: { queryClient, store }
|
|
383593
|
+
});
|
|
383594
|
+
}
|
|
383595
|
+
function getCachedInRangeSync(queryClient, parquetPath, columnName, lo, hi) {
|
|
383596
|
+
const queryCache = queryClient.getQueryCache();
|
|
383597
|
+
const prevQueries = queryCache.findAll({
|
|
383598
|
+
// Note: Must (manually) keep in sync with queryKey used in _loadParquetRowGroupColumnExtent.
|
|
383599
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetRowGroupColumnExtent", parquetPath, columnName],
|
|
383600
|
+
exact: false
|
|
383601
|
+
});
|
|
383602
|
+
const cachedRowGroupInfo = prevQueries.map((q) => {
|
|
383603
|
+
if (!(q.state.status === "success" && !q.state.isInvalidated)) {
|
|
383604
|
+
return null;
|
|
383605
|
+
}
|
|
383606
|
+
return {
|
|
383607
|
+
queryKey: q.queryKey,
|
|
383608
|
+
index: q.queryKey[4],
|
|
383609
|
+
status: q.state.status,
|
|
383610
|
+
min: q.state.data?.min,
|
|
383611
|
+
max: q.state.data?.max
|
|
383612
|
+
};
|
|
383613
|
+
}).filter((v) => v !== null).toSorted((a2, b2) => a2.index - b2.index);
|
|
383614
|
+
return cachedRowGroupInfo.filter((c2) => c2.index >= lo && c2.index < hi);
|
|
383615
|
+
}
|
|
383616
|
+
async function getCachedInRange(queryClient, parquetPath, columnName, lo, hi) {
|
|
383617
|
+
const queryCache = queryClient.getQueryCache();
|
|
383618
|
+
const prevQueries = queryCache.findAll({
|
|
383619
|
+
// Note: Must (manually) keep in sync with queryKey used in _loadParquetRowGroupColumnExtent.
|
|
383620
|
+
queryKey: ["SpatialDataTableSource", "_loadParquetRowGroupColumnExtent", parquetPath, columnName],
|
|
383621
|
+
exact: false
|
|
383622
|
+
});
|
|
383623
|
+
const cachedRowGroupInfo = prevQueries.map((q) => ({
|
|
383624
|
+
queryKey: q.queryKey,
|
|
383625
|
+
index: q.queryKey[4],
|
|
383626
|
+
status: q.state.status,
|
|
383627
|
+
min: q.state.data?.min,
|
|
383628
|
+
max: q.state.data?.max
|
|
383629
|
+
})).filter((v) => v !== null).toSorted((a2, b2) => a2.index - b2.index);
|
|
383630
|
+
const cachedInRange = cachedRowGroupInfo.filter((c2) => c2.index >= lo && c2.index < hi);
|
|
383631
|
+
const pendingQueries = cachedInRange.filter((c2) => c2.status !== "success");
|
|
383632
|
+
if (pendingQueries.length === 0) {
|
|
383633
|
+
return cachedInRange;
|
|
383634
|
+
}
|
|
383635
|
+
const pendingPromises = pendingQueries.map((c2) => queryClient.ensureQueryData({
|
|
383636
|
+
queryKey: c2.queryKey
|
|
383637
|
+
}));
|
|
383638
|
+
await Promise.all(pendingPromises);
|
|
383639
|
+
return getCachedInRangeSync(queryClient, parquetPath, columnName, lo, hi);
|
|
383640
|
+
}
|
|
383641
|
+
async function _bisectRowGroupsRight({ queryClient, store }, parquetPath, columnName, targetValue) {
|
|
383642
|
+
return queryClient.fetchQuery({
|
|
383643
|
+
queryKey: ["SpatialDataTableSource", "_bisectRowGroupsRight", parquetPath, columnName, targetValue],
|
|
383644
|
+
staleTime: Infinity,
|
|
383645
|
+
queryFn: async (ctx) => {
|
|
383646
|
+
const queryClient2 = (
|
|
383647
|
+
/** @type {QueryClient} */
|
|
383648
|
+
ctx.meta?.queryClient
|
|
383649
|
+
);
|
|
383650
|
+
const store2 = ctx.meta?.store;
|
|
383651
|
+
const allMetadata = await _loadParquetMetadataByPart({ queryClient: queryClient2, store: store2 }, parquetPath);
|
|
383652
|
+
const { numRowGroups } = allMetadata;
|
|
383653
|
+
let lo = 0;
|
|
383654
|
+
let hi = numRowGroups;
|
|
383655
|
+
while (lo < hi) {
|
|
383656
|
+
const cachedInRange = await getCachedInRange(queryClient2, parquetPath, columnName, lo, hi);
|
|
383657
|
+
const betterLo = cachedInRange.slice().reverse().find((c2) => c2.index > lo && targetValue >= c2.max);
|
|
383658
|
+
if (betterLo) {
|
|
383659
|
+
lo = Math.min(hi, betterLo.index + 1);
|
|
383660
|
+
}
|
|
383661
|
+
const betterHi = cachedInRange.find((c2) => targetValue < c2.min);
|
|
383662
|
+
if (betterHi) {
|
|
383663
|
+
hi = Math.max(lo, betterHi.index - 1);
|
|
383664
|
+
}
|
|
383665
|
+
if (lo >= hi) {
|
|
383666
|
+
break;
|
|
383667
|
+
}
|
|
383668
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
383669
|
+
const { max: midVal } = await _loadParquetRowGroupColumnExtent({ queryClient: queryClient2, store: store2 }, parquetPath, columnName, mid);
|
|
383670
|
+
if (midVal === null || targetValue <= midVal) {
|
|
383671
|
+
hi = mid;
|
|
383672
|
+
} else {
|
|
383673
|
+
lo = mid + 1;
|
|
383674
|
+
}
|
|
383675
|
+
}
|
|
383676
|
+
return lo;
|
|
383677
|
+
},
|
|
383678
|
+
meta: { queryClient, store }
|
|
383679
|
+
});
|
|
383680
|
+
}
|
|
383681
|
+
async function _rectToRowGroupIndices({ queryClient, store }, parquetPath, tileBbox, allPointsBbox) {
|
|
383682
|
+
return queryClient.fetchQuery({
|
|
383683
|
+
queryKey: ["SpatialDataTableSource", "_rectToRowGroupIndices", parquetPath, tileBbox, allPointsBbox],
|
|
383684
|
+
staleTime: Infinity,
|
|
383685
|
+
queryFn: async (ctx) => {
|
|
383686
|
+
const queryClient2 = (
|
|
383687
|
+
/** @type {QueryClient} */
|
|
383688
|
+
ctx.meta?.queryClient
|
|
383689
|
+
);
|
|
383690
|
+
const store2 = ctx.meta?.store;
|
|
383691
|
+
const mortonIntervals = sdataMortonQueryRectAux(allPointsBbox, [
|
|
383692
|
+
[tileBbox.left, tileBbox.top],
|
|
383693
|
+
// TODO: is this backwards (bottom/top)?
|
|
383694
|
+
[tileBbox.right, tileBbox.bottom]
|
|
383695
|
+
]);
|
|
383696
|
+
let coveredRowGroupIndices = [];
|
|
383697
|
+
const intervalsSpanMultipleRowGroups = async (startIndex, endIndex) => {
|
|
383698
|
+
if (startIndex > endIndex) {
|
|
383699
|
+
return [false, null];
|
|
383700
|
+
}
|
|
383701
|
+
const [startMin, startMax] = mortonIntervals[startIndex];
|
|
383702
|
+
const [endMin, endMax] = mortonIntervals[endIndex];
|
|
383703
|
+
const [rowGroupIndexMin, rowGroupIndexMax] = await Promise.all([
|
|
383704
|
+
_bisectRowGroupsRight({ queryClient: queryClient2, store: store2 }, parquetPath, "morton_code_2d", startMin),
|
|
383705
|
+
_bisectRowGroupsRight({ queryClient: queryClient2, store: store2 }, parquetPath, "morton_code_2d", endMax)
|
|
383706
|
+
]);
|
|
383707
|
+
if (rowGroupIndexMin === rowGroupIndexMax) {
|
|
383708
|
+
return [false, [rowGroupIndexMin]];
|
|
383709
|
+
}
|
|
383710
|
+
if (rowGroupIndexMin + 1 === rowGroupIndexMax || rowGroupIndexMin - 1 === rowGroupIndexMax) {
|
|
383711
|
+
return [false, [rowGroupIndexMin, rowGroupIndexMax]];
|
|
383712
|
+
}
|
|
383713
|
+
return [true, null];
|
|
383714
|
+
};
|
|
383715
|
+
const intervalIndicesToCheck = [[0, mortonIntervals.length - 1]];
|
|
383716
|
+
while (intervalIndicesToCheck.length > 0) {
|
|
383717
|
+
const [startIndex, endIndex] = intervalIndicesToCheck.pop();
|
|
383718
|
+
const [spansMultipleRowGroups, rowGroupIndices] = await intervalsSpanMultipleRowGroups(startIndex, endIndex);
|
|
383719
|
+
if (!spansMultipleRowGroups) {
|
|
383720
|
+
if (rowGroupIndices !== null) {
|
|
383721
|
+
coveredRowGroupIndices = coveredRowGroupIndices.concat(rowGroupIndices);
|
|
383722
|
+
}
|
|
383723
|
+
} else {
|
|
383724
|
+
if (startIndex === endIndex) {
|
|
383725
|
+
const [intervalMin, intervalMax] = mortonIntervals[startIndex];
|
|
383726
|
+
const [rowGroupIndexMin, rowGroupIndexMax] = await Promise.all([
|
|
383727
|
+
_bisectRowGroupsRight({ queryClient: queryClient2, store: store2 }, parquetPath, "morton_code_2d", intervalMin),
|
|
383728
|
+
_bisectRowGroupsRight({ queryClient: queryClient2, store: store2 }, parquetPath, "morton_code_2d", intervalMax)
|
|
383729
|
+
]);
|
|
383730
|
+
if (rowGroupIndexMin <= rowGroupIndexMax) {
|
|
383731
|
+
coveredRowGroupIndices = coveredRowGroupIndices.concat(range$b(rowGroupIndexMin, rowGroupIndexMax + 1));
|
|
383732
|
+
} else {
|
|
383733
|
+
coveredRowGroupIndices = coveredRowGroupIndices.concat(range$b(rowGroupIndexMax, rowGroupIndexMin + 1));
|
|
383734
|
+
}
|
|
383735
|
+
} else {
|
|
383736
|
+
const midIndex = Math.floor((startIndex + endIndex) / 2);
|
|
383737
|
+
intervalIndicesToCheck.push([startIndex, midIndex]);
|
|
383738
|
+
intervalIndicesToCheck.push([midIndex + 1, endIndex]);
|
|
383739
|
+
}
|
|
383740
|
+
}
|
|
383741
|
+
}
|
|
383742
|
+
const uniqueCoveredRowGroupIndices = Array.from(new Set(coveredRowGroupIndices));
|
|
383743
|
+
return uniqueCoveredRowGroupIndices;
|
|
383744
|
+
},
|
|
383745
|
+
meta: { queryClient, store }
|
|
383746
|
+
});
|
|
382744
383747
|
}
|
|
382745
383748
|
function tableToIndexColumnName(arrowTable) {
|
|
382746
383749
|
const pandasMetadata = arrowTable.schema.metadata.get("pandas");
|
|
@@ -382794,14 +383797,17 @@ function getVarPath(arrPath) {
|
|
|
382794
383797
|
class SpatialDataTableSource extends AnnDataSource {
|
|
382795
383798
|
/**
|
|
382796
383799
|
*
|
|
382797
|
-
* @param {DataSourceParams} params
|
|
383800
|
+
* @param {DataSourceParams & { queryClient: QueryClient }} params
|
|
382798
383801
|
*/
|
|
382799
383802
|
constructor(params2) {
|
|
382800
383803
|
super(params2);
|
|
383804
|
+
const { queryClient } = params2;
|
|
383805
|
+
this.queryClient = queryClient;
|
|
382801
383806
|
this.parquetModulePromise = getParquetModule();
|
|
382802
383807
|
this.rootAttrs = null;
|
|
382803
383808
|
this.elementAttrs = {};
|
|
382804
383809
|
this.parquetTableBytes = {};
|
|
383810
|
+
this.parquetTableIsDirectory = {};
|
|
382805
383811
|
this.obsIndices = {};
|
|
382806
383812
|
this.varIndices = {};
|
|
382807
383813
|
this.varAliases = {};
|
|
@@ -382855,17 +383861,19 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
382855
383861
|
* relative to the store root.
|
|
382856
383862
|
* @returns {Promise<Uint8Array|undefined>} The parquet file bytes.
|
|
382857
383863
|
*/
|
|
382858
|
-
async loadParquetBytes(parquetPath) {
|
|
382859
|
-
|
|
382860
|
-
|
|
383864
|
+
async loadParquetBytes(parquetPath, offset2 = void 0, length2 = void 0, partIndex = void 0) {
|
|
383865
|
+
const { store } = this.storeRoot;
|
|
383866
|
+
let getter2 = (path2) => store.get(path2);
|
|
383867
|
+
if (offset2 !== void 0 && length2 !== void 0 && store.getRange) {
|
|
383868
|
+
getter2 = (path2) => store.getRange(path2, {
|
|
383869
|
+
offset: offset2,
|
|
383870
|
+
length: length2
|
|
383871
|
+
});
|
|
382861
383872
|
}
|
|
382862
|
-
let parquetBytes = await
|
|
383873
|
+
let parquetBytes = await getter2(`/${parquetPath}`);
|
|
382863
383874
|
if (!parquetBytes) {
|
|
382864
|
-
const part0Path = `${parquetPath}/part
|
|
382865
|
-
parquetBytes = await
|
|
382866
|
-
}
|
|
382867
|
-
if (parquetBytes) {
|
|
382868
|
-
this.parquetTableBytes[parquetPath] = parquetBytes;
|
|
383875
|
+
const part0Path = `${parquetPath}/part.${partIndex ?? 0}.parquet`;
|
|
383876
|
+
parquetBytes = await getter2(`/${part0Path}`);
|
|
382869
383877
|
}
|
|
382870
383878
|
return parquetBytes;
|
|
382871
383879
|
}
|
|
@@ -382884,7 +383892,7 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
382884
383892
|
* @returns {Promise<Uint8Array|null>} The parquet file bytes,
|
|
382885
383893
|
* or null if the store does not support getRange.
|
|
382886
383894
|
*/
|
|
382887
|
-
async loadParquetSchemaBytes(parquetPath) {
|
|
383895
|
+
async loadParquetSchemaBytes(parquetPath, partIndex = void 0) {
|
|
382888
383896
|
const { store } = this.storeRoot;
|
|
382889
383897
|
if (store.getRange) {
|
|
382890
383898
|
const TAIL_LENGTH = 8;
|
|
@@ -382892,12 +383900,10 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
382892
383900
|
let tailBytes = await store.getRange(`/${partZeroPath}`, {
|
|
382893
383901
|
suffixLength: TAIL_LENGTH
|
|
382894
383902
|
});
|
|
382895
|
-
|
|
382896
|
-
|
|
382897
|
-
|
|
382898
|
-
|
|
382899
|
-
});
|
|
382900
|
-
}
|
|
383903
|
+
partZeroPath = `${parquetPath}/part.${partIndex ?? 0}.parquet`;
|
|
383904
|
+
tailBytes = await store.getRange(`/${partZeroPath}`, {
|
|
383905
|
+
suffixLength: TAIL_LENGTH
|
|
383906
|
+
});
|
|
382901
383907
|
if (!tailBytes || tailBytes.length < TAIL_LENGTH) {
|
|
382902
383908
|
throw new Error(`Failed to load parquet footerLength for ${parquetPath}`);
|
|
382903
383909
|
}
|
|
@@ -382959,7 +383965,7 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
382959
383965
|
const schemaBytes = await this.loadParquetSchemaBytes(parquetPath);
|
|
382960
383966
|
if (schemaBytes) {
|
|
382961
383967
|
const wasmSchema = readSchema(schemaBytes);
|
|
382962
|
-
const arrowTableForSchema =
|
|
383968
|
+
const arrowTableForSchema = tableFromIPC(wasmSchema.intoIPCStream());
|
|
382963
383969
|
indexColumnName = tableToIndexColumnName(arrowTableForSchema);
|
|
382964
383970
|
}
|
|
382965
383971
|
} catch (e3) {
|
|
@@ -382975,14 +383981,14 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
382975
383981
|
}
|
|
382976
383982
|
if (columns2 && !indexColumnName) {
|
|
382977
383983
|
const wasmSchema = readSchema(parquetBytes);
|
|
382978
|
-
const arrowTableForSchema =
|
|
383984
|
+
const arrowTableForSchema = tableFromIPC(wasmSchema.intoIPCStream());
|
|
382979
383985
|
indexColumnName = tableToIndexColumnName(arrowTableForSchema);
|
|
382980
383986
|
}
|
|
382981
383987
|
if (options.columns && indexColumnName) {
|
|
382982
383988
|
options.columns = [...options.columns, indexColumnName];
|
|
382983
383989
|
}
|
|
382984
383990
|
const wasmTable = readParquet(parquetBytes, options);
|
|
382985
|
-
const arrowTable =
|
|
383991
|
+
const arrowTable = tableFromIPC(wasmTable.intoIPCStream());
|
|
382986
383992
|
return arrowTable;
|
|
382987
383993
|
}
|
|
382988
383994
|
// TABLE-SPECIFIC METHODS
|
|
@@ -383046,6 +384052,93 @@ class SpatialDataTableSource extends AnnDataSource {
|
|
|
383046
384052
|
this.varAliases[varPath] = this.varAliases[varPath].map((val, ind) => val ? val.concat(` (${index2[ind]})`) : index2[ind]);
|
|
383047
384053
|
return this.varAliases[varPath];
|
|
383048
384054
|
}
|
|
384055
|
+
async _supportsTiledPoints(parquetPath) {
|
|
384056
|
+
const { queryClient } = this;
|
|
384057
|
+
const { store } = this.storeRoot;
|
|
384058
|
+
const allMetadata = await _loadParquetMetadataByPart({ queryClient, store }, parquetPath);
|
|
384059
|
+
const { numRowsPerGroup } = allMetadata;
|
|
384060
|
+
const numRowsTotal = allMetadata.numRows;
|
|
384061
|
+
if (numRowsPerGroup >= 1e5) {
|
|
384062
|
+
if (numRowsTotal > 5e6) {
|
|
384063
|
+
throw new Error(`The Parquet table at ${parquetPath} has ${numRowsTotal} total rows, which necessitates tiled loading, but it was not possible because the row group size is too large (${numRowsPerGroup}). See the Vitessce documentation at Data Troubleshooting -> Points for more details.`);
|
|
384064
|
+
}
|
|
384065
|
+
return false;
|
|
384066
|
+
}
|
|
384067
|
+
const requiredColumns = ["x", "y", "feature_index", "morton_code_2d"];
|
|
384068
|
+
const hasColumns = allMetadata?.schema?.fields?.map((f2) => f2.name);
|
|
384069
|
+
if (!hasColumns) {
|
|
384070
|
+
return false;
|
|
384071
|
+
}
|
|
384072
|
+
const hasRequiredColumns = requiredColumns.every((col) => hasColumns.includes(col));
|
|
384073
|
+
if (!hasRequiredColumns && numRowsTotal > 5e6) {
|
|
384074
|
+
throw new Error(`The Parquet table at ${parquetPath} has ${numRowsTotal} total rows, which necessitates tiled loading, but it was not possible because the required columns are missing. Required columns: ${requiredColumns.join(", ")}. Found columns: ${hasColumns.join(", ")}. See the Vitessce documentation at Data Troubleshooting -> Points for more details.`);
|
|
384075
|
+
}
|
|
384076
|
+
return hasRequiredColumns;
|
|
384077
|
+
}
|
|
384078
|
+
/**
|
|
384079
|
+
* Load point data using a tiled approach.
|
|
384080
|
+
* @param {string} parquetPath A path to a parquet file (or directory).
|
|
384081
|
+
* @param {{ left: number, top: number, right: number, bottom: number }} tileBbox
|
|
384082
|
+
* @param {{ x_min: number, y_min: number, x_max: number, y_max: number }} allPointsBbox
|
|
384083
|
+
* @param {string[]|undefined} columns An optional list of column names to load.
|
|
384084
|
+
* @returns
|
|
384085
|
+
*/
|
|
384086
|
+
async loadParquetTableInRect(parquetPath, tileBbox, allPointsBbox, signal) {
|
|
384087
|
+
const { queryClient } = this;
|
|
384088
|
+
const { store } = this.storeRoot;
|
|
384089
|
+
const TILE_SIZE2 = 256;
|
|
384090
|
+
let tileBboxes = [];
|
|
384091
|
+
if (tileBbox.right - tileBbox.left > TILE_SIZE2 || tileBbox.bottom - tileBbox.top > TILE_SIZE2) {
|
|
384092
|
+
const xSteps = Math.ceil((tileBbox.right - tileBbox.left) / TILE_SIZE2);
|
|
384093
|
+
const ySteps = Math.ceil((tileBbox.bottom - tileBbox.top) / TILE_SIZE2);
|
|
384094
|
+
const xStepSize = (tileBbox.right - tileBbox.left) / xSteps;
|
|
384095
|
+
const yStepSize = (tileBbox.bottom - tileBbox.top) / ySteps;
|
|
384096
|
+
for (let i2 = 0; i2 < xSteps; i2++) {
|
|
384097
|
+
for (let j = 0; j < ySteps; j++) {
|
|
384098
|
+
const subTileBbox = {
|
|
384099
|
+
left: tileBbox.left + i2 * xStepSize,
|
|
384100
|
+
right: Math.min(tileBbox.left + (i2 + 1) * xStepSize, tileBbox.right),
|
|
384101
|
+
top: tileBbox.top + j * yStepSize,
|
|
384102
|
+
bottom: Math.min(tileBbox.top + (j + 1) * yStepSize, tileBbox.bottom)
|
|
384103
|
+
};
|
|
384104
|
+
tileBboxes.push(subTileBbox);
|
|
384105
|
+
}
|
|
384106
|
+
}
|
|
384107
|
+
} else {
|
|
384108
|
+
tileBboxes = [tileBbox];
|
|
384109
|
+
}
|
|
384110
|
+
const rowGroupIndicesPerTile = await Promise.all(tileBboxes.map(async (subTileBbox) => _rectToRowGroupIndices({ queryClient, store }, parquetPath, subTileBbox, allPointsBbox)));
|
|
384111
|
+
const uniqueCoveredRowGroupIndices = Array.from(new Set(rowGroupIndicesPerTile.flat())).toSorted((a2, b2) => a2 - b2);
|
|
384112
|
+
const allMetadata = await _loadParquetMetadataByPart({ queryClient, store }, parquetPath);
|
|
384113
|
+
const { numRowsPerGroup } = allMetadata;
|
|
384114
|
+
const numRowGroups = uniqueCoveredRowGroupIndices.length;
|
|
384115
|
+
const totalNumRows = numRowsPerGroup * numRowGroups;
|
|
384116
|
+
const xArr = new Float32Array(totalNumRows);
|
|
384117
|
+
const yArr = new Float32Array(totalNumRows);
|
|
384118
|
+
const featureIndexArr = new Uint32Array(totalNumRows);
|
|
384119
|
+
const rowGroupTables = await Promise.all(uniqueCoveredRowGroupIndices.map(async (rowGroupIndex) => _loadParquetRowGroupByGroupIndex({ queryClient, store }, parquetPath, rowGroupIndex)));
|
|
384120
|
+
let rowOffset = 0;
|
|
384121
|
+
rowGroupTables.forEach((table2) => {
|
|
384122
|
+
const xColumn = table2.getChild("x");
|
|
384123
|
+
const yColumn = table2.getChild("y");
|
|
384124
|
+
const featureIndexColumn = table2.getChild("feature_index");
|
|
384125
|
+
if (!xColumn || !yColumn || !featureIndexColumn) {
|
|
384126
|
+
throw new Error(`Missing required column in parquet table at ${parquetPath}. Required columns: x, y, feature_index`);
|
|
384127
|
+
}
|
|
384128
|
+
xArr.set(xColumn.toArray(), rowOffset);
|
|
384129
|
+
yArr.set(yColumn.toArray(), rowOffset);
|
|
384130
|
+
featureIndexArr.set(featureIndexColumn.toArray(), rowOffset);
|
|
384131
|
+
rowOffset += numRowsPerGroup;
|
|
384132
|
+
});
|
|
384133
|
+
return {
|
|
384134
|
+
data: {
|
|
384135
|
+
x: xArr,
|
|
384136
|
+
y: yArr,
|
|
384137
|
+
featureIndices: featureIndexArr
|
|
384138
|
+
},
|
|
384139
|
+
shape: [3, totalNumRows]
|
|
384140
|
+
};
|
|
384141
|
+
}
|
|
383049
384142
|
}
|
|
383050
384143
|
class BaseEvent {
|
|
383051
384144
|
/**
|
|
@@ -389201,6 +390294,33 @@ class SpatialDataPointsSource extends SpatialDataTableSource {
|
|
|
389201
390294
|
data: axisColumnArrs
|
|
389202
390295
|
};
|
|
389203
390296
|
}
|
|
390297
|
+
/**
|
|
390298
|
+
*
|
|
390299
|
+
* @param {string} elementPath
|
|
390300
|
+
* @param {{ left: number, top: number, right: number, bottom: number }} tileBbox
|
|
390301
|
+
* @returns {Promise<{
|
|
390302
|
+
* data: [ZarrTypedArray<any>, ZarrTypedArray<any>],
|
|
390303
|
+
* shape: [number, number],
|
|
390304
|
+
* }>} A promise for a zarr array containing the data.
|
|
390305
|
+
*/
|
|
390306
|
+
async loadPointsInRect(elementPath, tileBbox, signal) {
|
|
390307
|
+
const parquetPath = getParquetPath(elementPath);
|
|
390308
|
+
const zattrs = await this.loadSpatialDataElementAttrs(elementPath);
|
|
390309
|
+
const {
|
|
390310
|
+
// axes,
|
|
390311
|
+
// spatialdata_attrs: spatialDataAttrs,
|
|
390312
|
+
// The bounding box (extent) of all points.
|
|
390313
|
+
// Required for un-normalization from uints back to floats.
|
|
390314
|
+
// TODO: decide whether these will be stored here or somewhere else.
|
|
390315
|
+
// Reference: https://github.com/vitessce/vitessce-python/pull/476#issuecomment-3362656956
|
|
390316
|
+
bounding_box: allPointsBbox
|
|
390317
|
+
} = zattrs;
|
|
390318
|
+
return this.loadParquetTableInRect(parquetPath, tileBbox, allPointsBbox, signal);
|
|
390319
|
+
}
|
|
390320
|
+
async supportsLoadPointsInRect(elementPath) {
|
|
390321
|
+
const parquetPath = getParquetPath(elementPath);
|
|
390322
|
+
return this._supportsTiledPoints(parquetPath);
|
|
390323
|
+
}
|
|
389204
390324
|
}
|
|
389205
390325
|
class OmeTiffSource {
|
|
389206
390326
|
constructor({ url, requestInit: requestInit2 }) {
|
|
@@ -395307,7 +396427,20 @@ const baseCoordinationTypes = [
|
|
|
395307
396427
|
path: obsSetPath,
|
|
395308
396428
|
color: rgbArray
|
|
395309
396429
|
})).nullable()),
|
|
395310
|
-
new PluginCoordinationType(CoordinationType$2.
|
|
396430
|
+
new PluginCoordinationType(CoordinationType$2.FEATURE_COLOR, null, z.array(z.object({
|
|
396431
|
+
name: z.string(),
|
|
396432
|
+
color: rgbArray
|
|
396433
|
+
})).nullable()),
|
|
396434
|
+
new PluginCoordinationType(CoordinationType$2.OBS_COLOR_ENCODING, "cellSetSelection", z.enum([
|
|
396435
|
+
"geneSelection",
|
|
396436
|
+
"cellSetSelection",
|
|
396437
|
+
"spatialChannelColor",
|
|
396438
|
+
"spatialLayerColor",
|
|
396439
|
+
"obsLabels",
|
|
396440
|
+
// For point coloring.
|
|
396441
|
+
"random",
|
|
396442
|
+
"randomByFeature"
|
|
396443
|
+
])),
|
|
395311
396444
|
new PluginCoordinationType(CoordinationType$2.FEATURE_FILTER, null, z.array(z.string()).nullable()),
|
|
395312
396445
|
new PluginCoordinationType(CoordinationType$2.FEATURE_HIGHLIGHT, null, z.string().nullable()),
|
|
395313
396446
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION, null, z.array(z.string()).nullable()),
|
|
@@ -395325,7 +396458,7 @@ const baseCoordinationTypes = [
|
|
|
395325
396458
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_SELECTION, null, z.array(obsSetPath).nullable()),
|
|
395326
396459
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION_MODE, null, z.enum(["featureSelection", "featureSetSelection"]).nullable()),
|
|
395327
396460
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_FILTER, null, z.array(obsSetPath).nullable()),
|
|
395328
|
-
new PluginCoordinationType(CoordinationType$2.FEATURE_FILTER_MODE, null, z.enum(["featureFilter", "featureSetFilter"]).nullable()),
|
|
396461
|
+
new PluginCoordinationType(CoordinationType$2.FEATURE_FILTER_MODE, null, z.enum(["featureFilter", "featureSetFilter", "featureSelection"]).nullable()),
|
|
395329
396462
|
new PluginCoordinationType(CoordinationType$2.FEATURE_VALUE_TRANSFORM, null, z.enum(["log1p", "arcsinh"]).nullable()),
|
|
395330
396463
|
new PluginCoordinationType(CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT, 1, z.number()),
|
|
395331
396464
|
new PluginCoordinationType(CoordinationType$2.FEATURE_VALUE_POSITIVITY_THRESHOLD, 0, z.number()),
|