@vitessce/all 4.1.0 → 4.1.2
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/{GeometryAndMeshXR-Cm-io8sr.js → GeometryAndMeshXR-Bjs1Ruhx.js} +1 -1
- package/dist/{ReactNeuroglancer-CGw5kiSQ.js → ReactNeuroglancer-9V3VAS-Y.js} +90 -27
- package/dist/{XREnterButton-Cvh0jhTZ.js → XREnterButton-CSkdz0V0.js} +1 -1
- package/dist/{XRSceneComponents-D1dNWCd8.js → XRSceneComponents-D8sYIzX0.js} +1 -1
- package/dist/{XRWrapper-DMvuX589.js → XRWrapper-op8Avjd6.js} +2 -2
- package/dist/{deflate-Bfp4Ro1o.js → deflate-fHER2jFf.js} +1 -1
- package/dist/{higlass-R6f4spnl.js → higlass-CAqsuvzB.js} +1 -1
- package/dist/{index-BpNOtGFe.js → index-B_ToVxzC.js} +5 -5
- package/dist/{index-b1x98NVi.js → index-CO-QVcb0.js} +1 -1
- package/dist/{index-BXZvRgQM.js → index-zwNOYbwy.js} +1122 -618
- package/dist/index.js +15 -13
- package/dist/{jpeg-BshoD8Vn.js → jpeg-DmU-OL1-.js} +1 -1
- package/dist/{lerc-Wpo0Q58k.js → lerc-BVAXzWm2.js} +1 -1
- package/dist/{lzw-bn_buOKr.js → lzw-DBPKnFIn.js} +1 -1
- package/dist/{packbits-CQxjn7MJ.js → packbits-hvcFV7pJ.js} +1 -1
- package/dist/{raw-DuVejors.js → raw-CEMGBBAD.js} +1 -1
- package/dist/{webimage-BVwps2SV.js → webimage-Bgcea_jr.js} +1 -1
- package/dist/{xrStore-Cc3xse27.js → xrStore-Cg8RL1U5.js} +1 -1
- package/dist-tsc/base-plugins.d.ts +1 -1
- package/dist-tsc/base-plugins.d.ts.map +1 -1
- package/dist-tsc/base-plugins.js +4 -2
- package/dist-tsc/base-plugins.js.map +1 -1
- package/dist-tsc/index.d.ts +1 -1
- package/dist-tsc/index.d.ts.map +1 -1
- package/dist-tsc/index.js +1 -1
- package/dist-tsc/index.js.map +1 -1
- package/package.json +34 -34
- package/src/base-plugins.ts +4 -0
- package/src/index.ts +2 -0
|
@@ -6803,6 +6803,19 @@ function isAnnotationFrameViewStateChange(prevViewState, nextViewState, frameVie
|
|
|
6803
6803
|
const changedKeys = TRANSITION_VIEW_STATE_KEYS.filter((key2) => prevViewState[key2] !== nextViewState[key2]);
|
|
6804
6804
|
return changedKeys.length > 0 && changedKeys.every((key2) => typeof prevViewState[key2] === "number" && typeof nextViewState[key2] === "number" && frameViewState[key2] === nextViewState[key2]);
|
|
6805
6805
|
}
|
|
6806
|
+
const UNIT_TO_METERS = {
|
|
6807
|
+
m: 1,
|
|
6808
|
+
meter: 1,
|
|
6809
|
+
mm: 1e-3,
|
|
6810
|
+
millimeter: 1e-3,
|
|
6811
|
+
um: 1e-6,
|
|
6812
|
+
µm: 1e-6,
|
|
6813
|
+
μm: 1e-6,
|
|
6814
|
+
micrometer: 1e-6,
|
|
6815
|
+
micron: 1e-6,
|
|
6816
|
+
nm: 1e-9,
|
|
6817
|
+
nanometer: 1e-9
|
|
6818
|
+
};
|
|
6806
6819
|
configSchema1_0_0.shape.coordinationSpace.unwrap();
|
|
6807
6820
|
configSchema1_0_0.shape.layout.element.shape.coordinationScopes.unwrap();
|
|
6808
6821
|
function upgradeReplaceViewProp(prefix2, view, coordinationSpace) {
|
|
@@ -9456,6 +9469,7 @@ const FileType$1 = {
|
|
|
9456
9469
|
// Precomputed (mesh) format
|
|
9457
9470
|
OBS_SEGMENTATIONS_NG_PRECOMPUTED: "obsSegmentations.ng-precomputed",
|
|
9458
9471
|
OBS_POINTS_NG_ANNOTATIONS: "obsPoints.ng-annotations",
|
|
9472
|
+
OBS_LOCATIONS_NG_ANNOTATIONS: "obsLocations.ng-annotations",
|
|
9459
9473
|
// New file types to support old file types:
|
|
9460
9474
|
// - cells.json
|
|
9461
9475
|
OBS_EMBEDDING_CELLS_JSON: "obsEmbedding.cells.json",
|
|
@@ -9616,6 +9630,7 @@ const CoordinationType$1 = {
|
|
|
9616
9630
|
PIXEL_HIGHLIGHT: "pixelHighlight",
|
|
9617
9631
|
// Per-image-layer
|
|
9618
9632
|
TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
|
|
9633
|
+
TOOLTIP_OBS_SETS_MODE: "tooltipObsSetsMode",
|
|
9619
9634
|
LEGEND_VISIBLE: "legendVisible",
|
|
9620
9635
|
SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
|
|
9621
9636
|
SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
|
|
@@ -9733,6 +9748,7 @@ const ViewHelpMapping = {
|
|
|
9733
9748
|
[FileType$1.OBS_SEGMENTATIONS_GLB]: DataType$3.OBS_SEGMENTATIONS,
|
|
9734
9749
|
[FileType$1.OBS_SEGMENTATIONS_NG_PRECOMPUTED]: DataType$3.OBS_SEGMENTATIONS,
|
|
9735
9750
|
[FileType$1.OBS_POINTS_NG_ANNOTATIONS]: DataType$3.OBS_POINTS,
|
|
9751
|
+
[FileType$1.OBS_LOCATIONS_NG_ANNOTATIONS]: DataType$3.OBS_LOCATIONS,
|
|
9736
9752
|
[FileType$1.IMAGE_SPATIALDATA_ZARR]: DataType$3.IMAGE,
|
|
9737
9753
|
[FileType$1.LABELS_SPATIALDATA_ZARR]: DataType$3.OBS_SEGMENTATIONS,
|
|
9738
9754
|
[FileType$1.SHAPES_SPATIALDATA_ZARR]: DataType$3.OBS_SEGMENTATIONS,
|
|
@@ -9977,6 +9993,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
9977
9993
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
9978
9994
|
CoordinationType$1.SPATIAL_ZOOM,
|
|
9979
9995
|
CoordinationType$1.SPATIAL_CAMERA_SNAPSHOT,
|
|
9996
|
+
CoordinationType$1.SPATIAL_RENDERING_MODE,
|
|
9980
9997
|
CoordinationType$1.OBS_FILTER,
|
|
9981
9998
|
CoordinationType$1.OBS_HIGHLIGHT,
|
|
9982
9999
|
CoordinationType$1.OBS_SET_SELECTION,
|
|
@@ -10044,6 +10061,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10044
10061
|
CoordinationType$1.OBS_COLOR_ENCODING,
|
|
10045
10062
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
10046
10063
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
10064
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE,
|
|
10047
10065
|
CoordinationType$1.SAMPLE_TYPE,
|
|
10048
10066
|
CoordinationType$1.SAMPLE_SET_SELECTION,
|
|
10049
10067
|
CoordinationType$1.SAMPLE_SET_FILTER,
|
|
@@ -10095,6 +10113,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10095
10113
|
CoordinationType$1.OBS_COLOR_ENCODING,
|
|
10096
10114
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
10097
10115
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
10116
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE,
|
|
10098
10117
|
CoordinationType$1.SAMPLE_TYPE,
|
|
10099
10118
|
CoordinationType$1.SAMPLE_SET_SELECTION,
|
|
10100
10119
|
CoordinationType$1.SAMPLE_SET_FILTER,
|
|
@@ -10176,6 +10195,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10176
10195
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
10177
10196
|
CoordinationType$1.MOLECULE_HIGHLIGHT,
|
|
10178
10197
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
10198
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE,
|
|
10179
10199
|
CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
|
|
10180
10200
|
CoordinationType$1.ANNOTATION_STORY,
|
|
10181
10201
|
CoordinationType$1.ANNOTATION_SHAPES,
|
|
@@ -10183,7 +10203,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10183
10203
|
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
10184
10204
|
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
10185
10205
|
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
10186
|
-
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
10206
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM,
|
|
10207
|
+
CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER
|
|
10187
10208
|
],
|
|
10188
10209
|
[ViewType$1.SPATIAL_BETA]: [
|
|
10189
10210
|
CoordinationType$1.META_COORDINATION_SCOPES,
|
|
@@ -10225,6 +10246,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10225
10246
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
10226
10247
|
CoordinationType$1.MOLECULE_HIGHLIGHT,
|
|
10227
10248
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
10249
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE,
|
|
10228
10250
|
CoordinationType$1.FILE_UID,
|
|
10229
10251
|
CoordinationType$1.SPATIAL_TARGET_C,
|
|
10230
10252
|
CoordinationType$1.SPATIAL_LAYER_VISIBLE,
|
|
@@ -10308,7 +10330,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10308
10330
|
CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
|
|
10309
10331
|
CoordinationType$1.OBS_COLOR_ENCODING,
|
|
10310
10332
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
10311
|
-
CoordinationType$1.TOOLTIPS_VISIBLE
|
|
10333
|
+
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
10334
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE
|
|
10312
10335
|
],
|
|
10313
10336
|
[ViewType$1.OBS_SETS]: [
|
|
10314
10337
|
CoordinationType$1.DATASET,
|
|
@@ -10399,7 +10422,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10399
10422
|
CoordinationType$1.SPATIAL_ROTATION_Z,
|
|
10400
10423
|
CoordinationType$1.SPATIAL_ROTATION_ORBIT,
|
|
10401
10424
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
10402
|
-
CoordinationType$1.PHOTOMETRIC_INTERPRETATION
|
|
10425
|
+
CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
|
|
10426
|
+
CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER
|
|
10403
10427
|
],
|
|
10404
10428
|
[ViewType$1.LAYER_CONTROLLER_BETA]: [
|
|
10405
10429
|
CoordinationType$1.META_COORDINATION_SCOPES,
|
|
@@ -11180,14 +11204,15 @@ const ngPrecomputedMeshSchema = z.object({
|
|
|
11180
11204
|
subsources: z.record(z.boolean()).describe("Subsources are the individual data components of a source (e.g. meshes, skeletons, etc.). Each entry explicitly enables or disables a subsource.").optional(),
|
|
11181
11205
|
enableDefaultSubsources: z.boolean().describe("When true (default), automatically loads all subsources (defined in mesh metadata), when false loads what is explicitly enabled in `subsources`.").optional()
|
|
11182
11206
|
}).partial().nullable();
|
|
11207
|
+
const ngAnnotationTransformSchema = z.object({
|
|
11208
|
+
matrix: z.array(z.array(z.number())),
|
|
11209
|
+
outputDimensions: z.record(z.tuple([z.number(), z.string()]))
|
|
11210
|
+
}).optional().describe("A coordinate transformation matrix to apply to the annotation layer source to map annotation coordinates to the global coordinate space.");
|
|
11183
11211
|
const ngPointAnnotationSchema = z.object({
|
|
11184
11212
|
projectionAnnotationSpacing: z.number(),
|
|
11185
11213
|
featureIndexProp: z.string().optional().describe("The name of the Neuroglancer AnnotationProperty containing feature IDs. For example, specify 'gene' to use prop_gene() in the Neuroglancer shader code."),
|
|
11186
11214
|
pointIndexProp: z.string().optional().describe("The name of the Neuroglancer AnnotationProperty containing point IDs. For example, specify 'point_id' to use prop_point_id() in the Neuroglancer shader code."),
|
|
11187
|
-
transform:
|
|
11188
|
-
matrix: z.array(z.array(z.number())),
|
|
11189
|
-
outputDimensions: z.record(z.tuple([z.number(), z.string()]))
|
|
11190
|
-
}).optional().describe("A coordinate transformation matrix to apply to the annotation layer source to map annotation coordinates to the global coordinate space."),
|
|
11215
|
+
transform: ngAnnotationTransformSchema,
|
|
11191
11216
|
// Note: See comments in neuroglancer-sorger.js
|
|
11192
11217
|
// We may remove these in the future, pending clarification
|
|
11193
11218
|
// to questions in the tissue-map-tools repo
|
|
@@ -11196,6 +11221,14 @@ const ngPointAnnotationSchema = z.object({
|
|
|
11196
11221
|
quantitativeColorProp: z.string().optional(),
|
|
11197
11222
|
quantitativeColorMax: z.number().optional()
|
|
11198
11223
|
}).partial().nullable();
|
|
11224
|
+
const ngLocationsAnnotationSchema = z.object({
|
|
11225
|
+
projectionAnnotationSpacing: z.number(),
|
|
11226
|
+
transform: ngAnnotationTransformSchema,
|
|
11227
|
+
segmentIdProp: z.string().optional().describe("The name of the Neuroglancer AnnotationProperty holding the mesh segment ID (e.g. 'cell_id'). Defaults to 'id' when the annotation info declares it."),
|
|
11228
|
+
// Used when the corresponding segmentation channel uses obsColorEncoding 'geneSelection'.
|
|
11229
|
+
quantitativeColorProp: z.string().optional(),
|
|
11230
|
+
quantitativeColorMax: z.number().optional()
|
|
11231
|
+
}).partial().nullable();
|
|
11199
11232
|
const obsEmbeddingAnndataSchema = annDataObsEmbedding;
|
|
11200
11233
|
const obsSpotsAnndataSchema = annDataObsLocations;
|
|
11201
11234
|
const obsPointsAnndataSchema = annDataObsLocations;
|
|
@@ -20316,7 +20349,7 @@ const { tss } = createTss({
|
|
|
20316
20349
|
},
|
|
20317
20350
|
"usePlugin": useMuiThemeStyleOverridesPlugin
|
|
20318
20351
|
});
|
|
20319
|
-
const useStyles$
|
|
20352
|
+
const useStyles$z = tss.create({});
|
|
20320
20353
|
function createChainedFunction$1(...funcs) {
|
|
20321
20354
|
return funcs.reduce((acc, func) => {
|
|
20322
20355
|
if (func == null) {
|
|
@@ -79913,7 +79946,7 @@ const Popper = React.forwardRef((props, ref2) => {
|
|
|
79913
79946
|
}, [handlePopperRef]);
|
|
79914
79947
|
React.useImperativeHandle(popperRefProp, () => popperRef.current, []);
|
|
79915
79948
|
const [exited, setExited] = React.useState(true);
|
|
79916
|
-
const { theme } = useStyles$
|
|
79949
|
+
const { theme } = useStyles$z();
|
|
79917
79950
|
const rtlPlacement = flipPlacement(initialPlacement, theme);
|
|
79918
79951
|
const [placement, setPlacement] = React.useState(rtlPlacement);
|
|
79919
79952
|
React.useEffect(() => {
|
|
@@ -80668,7 +80701,7 @@ var VariableSizeList$1 = /* @__PURE__ */ createListComponent({
|
|
|
80668
80701
|
});
|
|
80669
80702
|
const VariableSizeList = VariableSizeList$1;
|
|
80670
80703
|
const LIST_ROW_HEIGHT$1 = 48;
|
|
80671
|
-
const useStyles$
|
|
80704
|
+
const useStyles$y = makeStyles()(() => ({
|
|
80672
80705
|
searchInput: {
|
|
80673
80706
|
lineHeight: "initial",
|
|
80674
80707
|
height: "auto !important"
|
|
@@ -80708,7 +80741,7 @@ const ListboxComponent$1 = React__default.forwardRef((props, ref2) => {
|
|
|
80708
80741
|
});
|
|
80709
80742
|
function SimpleAutocomplete(props) {
|
|
80710
80743
|
const { getMatches, onChange, textInputLabel = "Enter a gene", getItemLabel = (option) => option.label } = props;
|
|
80711
|
-
const { classes: classes2 } = useStyles$
|
|
80744
|
+
const { classes: classes2 } = useStyles$y();
|
|
80712
80745
|
const [potentialItems, setPotentialItems] = useState([]);
|
|
80713
80746
|
const handleInputChange = async (_event, value2) => {
|
|
80714
80747
|
if (!value2) {
|
|
@@ -90258,7 +90291,7 @@ function defaultUrlTransform(value2) {
|
|
|
90258
90291
|
}
|
|
90259
90292
|
return "";
|
|
90260
90293
|
}
|
|
90261
|
-
const useStyles$
|
|
90294
|
+
const useStyles$x = makeStyles()((theme) => ({
|
|
90262
90295
|
description: {
|
|
90263
90296
|
"& p, details, table": {
|
|
90264
90297
|
fontSize: "80%",
|
|
@@ -90295,7 +90328,7 @@ const useStyles$y = makeStyles()((theme) => ({
|
|
|
90295
90328
|
}));
|
|
90296
90329
|
function Description(props) {
|
|
90297
90330
|
const { description: description2, metadata: metadata2, descriptionType } = props;
|
|
90298
|
-
const { classes: classes2 } = useStyles$
|
|
90331
|
+
const { classes: classes2 } = useStyles$x();
|
|
90299
90332
|
return jsxs("div", { className: classes2.description, children: [descriptionType && descriptionType === DescriptionType.MARKDOWN ? jsx$1(Markdown, { children: description2 }) : jsx$1("p", { children: description2 }), metadata2 && Array.from(metadata2.entries()).map(([layerIndex, { name: layerName, metadata: metadataRecord }]) => metadataRecord && Object.entries(metadataRecord).length > 0 ? jsxs("details", { children: [jsx$1("summary", { children: layerName }), jsx$1("div", { className: classes2.metadataContainer, children: jsx$1("table", { children: jsx$1("tbody", { children: Object.entries(metadataRecord).map(([key2, value2]) => jsxs("tr", { children: [jsx$1("th", { title: key2, children: key2 }), jsx$1("td", { title: value2, children: value2 })] }, key2)) }) }) })] }, layerIndex) : null)] });
|
|
90300
90333
|
}
|
|
90301
90334
|
function DescriptionSubscriber(props) {
|
|
@@ -93190,6 +93223,12 @@ function findChangedHierarchy(prevSelectedPaths, currSelectedPaths) {
|
|
|
93190
93223
|
const changedPath = newlySelectedPaths.length > 0 ? newlySelectedPaths[0] : unselectedPaths[0];
|
|
93191
93224
|
return changedPath.slice(0, -1);
|
|
93192
93225
|
}
|
|
93226
|
+
function filterObsMembershipForTooltip(obsMembership, obsSetSelection, tooltipObsSetsMode) {
|
|
93227
|
+
if (tooltipObsSetsMode !== "selected") {
|
|
93228
|
+
return obsMembership;
|
|
93229
|
+
}
|
|
93230
|
+
return obsMembership.filter((path2) => obsSetSelection?.some((selectedPath) => selectedPath[0] === path2[0]));
|
|
93231
|
+
}
|
|
93193
93232
|
var EOL$1 = {}, EOF$1 = {}, QUOTE$1 = 34, NEWLINE$1 = 10, RETURN$1 = 13;
|
|
93194
93233
|
function objectConverter$1(columns2) {
|
|
93195
93234
|
return new Function("d", "return {" + columns2.map(function(name2, i2) {
|
|
@@ -100854,7 +100893,7 @@ const Tooltip$2 = /* @__PURE__ */ React.forwardRef((props, ref2) => {
|
|
|
100854
100893
|
}, extraProps), getChildren());
|
|
100855
100894
|
});
|
|
100856
100895
|
const nodeHeight = 32;
|
|
100857
|
-
const useStyles$
|
|
100896
|
+
const useStyles$w = makeStyles()((theme) => ({
|
|
100858
100897
|
setsManager: {
|
|
100859
100898
|
position: "relative",
|
|
100860
100899
|
width: "100%",
|
|
@@ -101021,7 +101060,7 @@ const useStyles$x = makeStyles()((theme) => ({
|
|
|
101021
101060
|
}));
|
|
101022
101061
|
function SetsManagerTreeGlobalStyles(props) {
|
|
101023
101062
|
const { classes: classes2 } = props;
|
|
101024
|
-
const { theme } = useStyles$
|
|
101063
|
+
const { theme } = useStyles$z();
|
|
101025
101064
|
return jsx$1(ScopedGlobalStyles, { parentClassName: classes2.setsManagerTree, styles: {
|
|
101026
101065
|
".rc-tree": {
|
|
101027
101066
|
paddingLeft: "0",
|
|
@@ -101362,7 +101401,7 @@ function HelpTooltipGlobalStyles(props) {
|
|
|
101362
101401
|
}
|
|
101363
101402
|
function PopoverGlobalStyles(props) {
|
|
101364
101403
|
const { classes: classes2 } = props;
|
|
101365
|
-
const { theme } = useStyles$
|
|
101404
|
+
const { theme } = useStyles$z();
|
|
101366
101405
|
return jsx$1(ScopedGlobalStyles, { parentClassName: classes2.popover, styles: {
|
|
101367
101406
|
".rc-tooltip-inner": {
|
|
101368
101407
|
boxSizing: "border-box",
|
|
@@ -106046,7 +106085,7 @@ function NamedSetNodeStatic(props) {
|
|
|
106046
106085
|
const onClick = level === 0 && !expanded ? () => onCheckLevel(nodeKey, nextLevelToCheck) : () => onNodeView(path2);
|
|
106047
106086
|
const tooltipProps = disableTooltip ? { visible: false } : {};
|
|
106048
106087
|
const popoverMenuConfig = makeNodeViewMenuConfig(props);
|
|
106049
|
-
const { classes: classes2 } = useStyles$
|
|
106088
|
+
const { classes: classes2 } = useStyles$w();
|
|
106050
106089
|
return jsxs("span", { children: [jsx$1(HelpTooltip, { title: tooltipText, ...tooltipProps, children: jsx$1("button", { type: "button", onClick, onKeyPress: (e3) => callbackOnKeyPress(e3, "v", () => onNodeView(path2)), className: classes2.titleButton, children: title2 }) }), popoverMenuConfig.length > 0 ? jsx$1(PopoverMenu, { menuConfig: makeNodeViewMenuConfig(props), color: level > 0 && editable ? color2 || getDefaultColor(theme) : null, setColor: (c2) => onNodeSetColor(path2, c2), children: jsx$1("span", { children: jsx$1(SvgMenu, { className: classes2.nodeMenuIcon, "aria-label": "Open Node View Menu" }) }) }) : null, level > 0 && isChecking ? checkbox2 : null, level > 0 && jsx$1("span", { className: classes2.nodeSizeLabel, children: niceSize })] });
|
|
106051
106090
|
}
|
|
106052
106091
|
function NamedSetNodeEditing(props) {
|
|
@@ -106058,7 +106097,7 @@ function NamedSetNodeEditing(props) {
|
|
|
106058
106097
|
onNodeSetName(path2, currentTitle, true);
|
|
106059
106098
|
}
|
|
106060
106099
|
}
|
|
106061
|
-
const { classes: classes2 } = useStyles$
|
|
106100
|
+
const { classes: classes2 } = useStyles$w();
|
|
106062
106101
|
return jsxs("span", { className: classes2.titleButtonWithInput, children: [jsx$1("input", {
|
|
106063
106102
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
106064
106103
|
autoFocus: true,
|
|
@@ -106084,7 +106123,7 @@ function LevelsButtons(props) {
|
|
|
106084
106123
|
onCheckLevel(nodeKey, newLevel);
|
|
106085
106124
|
}
|
|
106086
106125
|
}
|
|
106087
|
-
const { classes: classes2 } = useStyles$
|
|
106126
|
+
const { classes: classes2 } = useStyles$w();
|
|
106088
106127
|
return jsx$1("div", { className: classes2.levelButtonsContainer, children: range$d(1, height2 + 1).map((i2) => {
|
|
106089
106128
|
const isChecked = isEqual$3(path2, checkedLevelPath) && i2 === checkedLevelIndex;
|
|
106090
106129
|
return jsx$1("div", { children: jsx$1(HelpTooltip, { title: getLevelTooltipText(i2), children: jsx$1("input", { className: clsx(classes2.levelRadioButton, { [classes2.levelRadioButtonChecked]: isChecked && !hasColorEncoding }), type: "checkbox", value: i2, checked: isChecked && hasColorEncoding, onChange: onCheck }) }) }, i2);
|
|
@@ -106168,7 +106207,7 @@ let TreeNode$1 = class TreeNode extends TreeNode$2 {
|
|
|
106168
106207
|
};
|
|
106169
106208
|
function PlusButton(props) {
|
|
106170
106209
|
const { datatype, onError, onImportTree, onCreateLevelZeroNode, importable, editable } = props;
|
|
106171
|
-
const { classes: classes2 } = useStyles$
|
|
106210
|
+
const { classes: classes2 } = useStyles$w();
|
|
106172
106211
|
const onImport = useCallback((importHandler, mimeType) => () => {
|
|
106173
106212
|
const uploadInputNode = document.createElement("input");
|
|
106174
106213
|
uploadInputNode.setAttribute("type", "file");
|
|
@@ -106285,7 +106324,7 @@ function SetsManager(props) {
|
|
|
106285
106324
|
}, onNodeCheckNewName, onNodeSetIsEditing: setIsEditingNodeName, onNodeRemove, onExportLevelZeroNodeJSON, onExportLevelZeroNodeTabular, onExportSetJSON, disableTooltip: isDragging, onDragStart: () => setIsDragging(true), onDragEnd: () => setIsDragging(false), children: renderTreeNodes(node2.children, readOnly, newPath) }, pathToKey$1(newPath));
|
|
106286
106325
|
});
|
|
106287
106326
|
}
|
|
106288
|
-
const { classes: classes2 } = useStyles$
|
|
106327
|
+
const { classes: classes2 } = useStyles$w();
|
|
106289
106328
|
return jsxs("div", { className: classes2.setsManager, children: [jsx$1(SetsManagerTreeGlobalStyles, { classes: classes2 }), jsxs("div", { className: classes2.setsManagerTree, children: [jsx$1(Tree$1, { draggable: false, checkable, checkedKeys: setSelectionKeys, expandedKeys: setExpansionKeys, autoExpandParent, onCheck: (checkedKeys, info2) => onCheckNode(info2.node.props.nodeKey, info2.checked), onExpand: (expandedKeys, info2) => onExpandNode(expandedKeys, info2.node.props.nodeKey, info2.expanded), children: renderTreeNodes(processedSets.tree, true, []) }), jsx$1(Tree$1, { draggable: true, checkable, checkedKeys: additionalSetSelectionKeys, expandedKeys: additionalSetExpansionKeys, autoExpandParent, onCheck: (checkedKeys, info2) => onCheckNode(info2.node.props.nodeKey, info2.checked), onExpand: (expandedKeys, info2) => onExpandNode(expandedKeys, info2.node.props.nodeKey, info2.expanded), onDrop: (info2) => {
|
|
106290
106329
|
const { eventKey: dropKey } = info2.node.props;
|
|
106291
106330
|
const { eventKey: dragKey } = info2.dragNode.props;
|
|
@@ -210886,22 +210925,22 @@ async function getDecoder(fileDirectory) {
|
|
|
210886
210925
|
const Decoder = await importFn();
|
|
210887
210926
|
return new Decoder(fileDirectory);
|
|
210888
210927
|
}
|
|
210889
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
210890
|
-
addDecoder(5, () => import("./lzw-
|
|
210928
|
+
addDecoder([void 0, 1], () => import("./raw-CEMGBBAD.js").then((m2) => m2.default));
|
|
210929
|
+
addDecoder(5, () => import("./lzw-DBPKnFIn.js").then((m2) => m2.default));
|
|
210891
210930
|
addDecoder(6, () => {
|
|
210892
210931
|
throw new Error("old style JPEG compression is not supported.");
|
|
210893
210932
|
});
|
|
210894
|
-
addDecoder(7, () => import("./jpeg-
|
|
210895
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
210896
|
-
addDecoder(32773, () => import("./packbits-
|
|
210933
|
+
addDecoder(7, () => import("./jpeg-DmU-OL1-.js").then((m2) => m2.default));
|
|
210934
|
+
addDecoder([8, 32946], () => import("./deflate-fHER2jFf.js").then((m2) => m2.default));
|
|
210935
|
+
addDecoder(32773, () => import("./packbits-hvcFV7pJ.js").then((m2) => m2.default));
|
|
210897
210936
|
addDecoder(
|
|
210898
210937
|
34887,
|
|
210899
|
-
() => import("./lerc-
|
|
210938
|
+
() => import("./lerc-BVAXzWm2.js").then(async (m2) => {
|
|
210900
210939
|
await m2.zstd.init();
|
|
210901
210940
|
return m2;
|
|
210902
210941
|
}).then((m2) => m2.default)
|
|
210903
210942
|
);
|
|
210904
|
-
addDecoder(50001, () => import("./webimage-
|
|
210943
|
+
addDecoder(50001, () => import("./webimage-Bgcea_jr.js").then((m2) => m2.default));
|
|
210905
210944
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
210906
210945
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
210907
210946
|
}
|
|
@@ -233204,7 +233243,7 @@ class RawView extends View$2 {
|
|
|
233204
233243
|
return OrbitController2;
|
|
233205
233244
|
}
|
|
233206
233245
|
}
|
|
233207
|
-
const useStyles$
|
|
233246
|
+
const useStyles$v = makeStyles()(() => ({
|
|
233208
233247
|
toolButton: {
|
|
233209
233248
|
display: "inline-flex",
|
|
233210
233249
|
"&:active": {
|
|
@@ -233266,12 +233305,12 @@ const useStyles$w = makeStyles()(() => ({
|
|
|
233266
233305
|
}));
|
|
233267
233306
|
function IconTool(props) {
|
|
233268
233307
|
const { alt, onClick, isActive: isActive2, children: children3 } = props;
|
|
233269
|
-
const { classes: classes2 } = useStyles$
|
|
233308
|
+
const { classes: classes2 } = useStyles$v();
|
|
233270
233309
|
return jsx$1("button", { className: clsx(classes2.toolIcon, { [classes2.toolActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
|
|
233271
233310
|
}
|
|
233272
233311
|
function IconButton(props) {
|
|
233273
233312
|
const { alt, onClick, children: children3 } = props;
|
|
233274
|
-
const { classes: classes2 } = useStyles$
|
|
233313
|
+
const { classes: classes2 } = useStyles$v();
|
|
233275
233314
|
return jsx$1("button", { className: clsx(classes2.toolIcon, classes2.toolButton), onClick, type: "button", title: alt, children: children3 });
|
|
233276
233315
|
}
|
|
233277
233316
|
function ToolMenu(props) {
|
|
@@ -233279,7 +233318,7 @@ function ToolMenu(props) {
|
|
|
233279
233318
|
const lassoIconAltText = "Select lasso";
|
|
233280
233319
|
const { setActiveTool, activeTool, visibleTools = { pan: true, selectLasso: true, recenter: true }, recenterOnClick = () => {
|
|
233281
233320
|
} } = props;
|
|
233282
|
-
const { classes: classes2 } = useStyles$
|
|
233321
|
+
const { classes: classes2 } = useStyles$v();
|
|
233283
233322
|
const onRecenterButtonCLick = () => {
|
|
233284
233323
|
recenterOnClick();
|
|
233285
233324
|
};
|
|
@@ -233323,6 +233362,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233323
233362
|
};
|
|
233324
233363
|
this.lastApplied = null;
|
|
233325
233364
|
this.transitionEndViewState = null;
|
|
233365
|
+
this.finishedTransitionEndViewState = null;
|
|
233326
233366
|
this.viewport = null;
|
|
233327
233367
|
this.threeCamera = null;
|
|
233328
233368
|
this.orbitControls = null;
|
|
@@ -233399,6 +233439,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233399
233439
|
* Called by DeckGL when a viewState transition ends.
|
|
233400
233440
|
*/
|
|
233401
233441
|
onTransitionEnd() {
|
|
233442
|
+
this.finishedTransitionEndViewState = this.transitionEndViewState;
|
|
233402
233443
|
this.transitionEndViewState = null;
|
|
233403
233444
|
this.setState({ transitionViewState: null });
|
|
233404
233445
|
}
|
|
@@ -233409,6 +233450,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233409
233450
|
* Instead, the stale transitionViewState is ignored by getDeckViewState.
|
|
233410
233451
|
*/
|
|
233411
233452
|
onTransitionInterrupt() {
|
|
233453
|
+
this.finishedTransitionEndViewState = this.transitionEndViewState;
|
|
233412
233454
|
this.transitionEndViewState = null;
|
|
233413
233455
|
}
|
|
233414
233456
|
/**
|
|
@@ -233421,6 +233463,13 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233421
233463
|
if (transitionViewState && transitionViewState.endViewState === this.transitionEndViewState && isSameZoomAndTarget(viewState, this.transitionEndViewState)) {
|
|
233422
233464
|
return transitionViewState.viewState;
|
|
233423
233465
|
}
|
|
233466
|
+
if (!isSameZoomAndTarget(viewState, this.finishedTransitionEndViewState)) {
|
|
233467
|
+
this.finishedTransitionEndViewState = null;
|
|
233468
|
+
}
|
|
233469
|
+
if (this.finishedTransitionEndViewState) {
|
|
233470
|
+
const { transitionDuration, transitionInterpolator, ...viewStateWithoutTransition } = viewState;
|
|
233471
|
+
return viewStateWithoutTransition;
|
|
233472
|
+
}
|
|
233424
233473
|
if (viewState.transitionDuration) {
|
|
233425
233474
|
return {
|
|
233426
233475
|
...viewState,
|
|
@@ -233577,7 +233626,8 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233577
233626
|
const canvas = deckRef?.current?.deck?.canvas;
|
|
233578
233627
|
if (!canvas || !spatialCameraSnapshot)
|
|
233579
233628
|
return;
|
|
233580
|
-
const
|
|
233629
|
+
const { fovDegrees, projectionScale } = spatialCameraSnapshot;
|
|
233630
|
+
const camera = new PerspectiveCamera(fovDegrees, 1, Math.max(projectionScale * 1e-4, 1e-3), Math.max(projectionScale * 100, 1e5));
|
|
233581
233631
|
camera.updateProjectionMatrix();
|
|
233582
233632
|
const eventTarget = canvas.parentElement ?? canvas;
|
|
233583
233633
|
const controls = new OrbitControls(camera, eventTarget);
|
|
@@ -233732,8 +233782,8 @@ class AbstractSpatialOrScatterplot extends PureComponent {
|
|
|
233732
233782
|
viewState: {
|
|
233733
233783
|
viewMatrix: rawViewMatrix,
|
|
233734
233784
|
fovy: fovDegrees,
|
|
233735
|
-
near:
|
|
233736
|
-
far: 1e5
|
|
233785
|
+
near: Math.max(projectionScale * 1e-4, 1e-3),
|
|
233786
|
+
far: Math.max(projectionScale * 100, 1e5)
|
|
233737
233787
|
}
|
|
233738
233788
|
});
|
|
233739
233789
|
} else if (use3d) {
|
|
@@ -234758,7 +234808,7 @@ function ScatterplotOptions(props) {
|
|
|
234758
234808
|
id: `feature-aggregation-strategy-${scatterplotOptionsId}`
|
|
234759
234809
|
}, children: FEATURE_AGGREGATION_STRATEGIES$2.map((opt) => jsx$1("option", { value: opt, children: capitalize$3(opt) }, opt)) }) })] }) : null] });
|
|
234760
234810
|
}
|
|
234761
|
-
const useStyles$
|
|
234811
|
+
const useStyles$u = makeStyles()((theme) => ({
|
|
234762
234812
|
tooltipAnchor: {
|
|
234763
234813
|
position: "relative",
|
|
234764
234814
|
width: "0px",
|
|
@@ -234789,7 +234839,7 @@ const useStyles$v = makeStyles()((theme) => ({
|
|
|
234789
234839
|
function Tooltip3(props) {
|
|
234790
234840
|
const { x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props;
|
|
234791
234841
|
const ref2 = useRef();
|
|
234792
|
-
const { classes: classes2 } = useStyles$
|
|
234842
|
+
const { classes: classes2 } = useStyles$u();
|
|
234793
234843
|
const [placementX, setPlacementX] = useState("start");
|
|
234794
234844
|
const [placementY, setPlacementY] = useState("bottom");
|
|
234795
234845
|
const getTooltipContainer = useVitessceContainer(ref2);
|
|
@@ -234805,7 +234855,7 @@ function Tooltip3(props) {
|
|
|
234805
234855
|
}, [x2, y2, parentWidth, parentHeight]);
|
|
234806
234856
|
return jsx$1("div", { ref: ref2, className: classes2.tooltipAnchor, children: ref2 && ref2.current ? jsx$1(Popper, { open: true, anchorEl: ref2.current, container: getTooltipContainer, transition: true, placement: `${placementY}-${placementX}`, children: jsx$1(Paper, { elevation: 8, className: classes2.tooltipContent, children: children3 }) }) : null });
|
|
234807
234857
|
}
|
|
234808
|
-
const useStyles$
|
|
234858
|
+
const useStyles$t = makeStyles()((theme) => ({
|
|
234809
234859
|
cellEmphasisCrosshair: {
|
|
234810
234860
|
zIndex: 50,
|
|
234811
234861
|
position: "absolute",
|
|
@@ -234816,7 +234866,7 @@ const useStyles$u = makeStyles()((theme) => ({
|
|
|
234816
234866
|
}));
|
|
234817
234867
|
function Tooltip2D(props) {
|
|
234818
234868
|
const { parentUuid, sourceUuid, x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props;
|
|
234819
|
-
const { classes: classes2 } = useStyles$
|
|
234869
|
+
const { classes: classes2 } = useStyles$t();
|
|
234820
234870
|
if (x2 < 0 || x2 > parentWidth || y2 < 0 || y2 > parentHeight) {
|
|
234821
234871
|
return null;
|
|
234822
234872
|
}
|
|
@@ -238728,7 +238778,7 @@ function getXlinkHref(cmap) {
|
|
|
238728
238778
|
const xlinkHref = ramp(color2.copy().domain(quantize$3(interpolate$1$1(0, 1), n3))).toDataURL();
|
|
238729
238779
|
return xlinkHref;
|
|
238730
238780
|
}
|
|
238731
|
-
const useStyles$
|
|
238781
|
+
const useStyles$s = makeStyles()(() => ({
|
|
238732
238782
|
legend: {
|
|
238733
238783
|
position: "relative",
|
|
238734
238784
|
// Needed for absolute positioning of slider overlay
|
|
@@ -238925,7 +238975,7 @@ function Legend(props) {
|
|
|
238925
238975
|
contourThresholds
|
|
238926
238976
|
} = props;
|
|
238927
238977
|
const svgRef = useRef(null);
|
|
238928
|
-
const { classes: classes2 } = useStyles$
|
|
238978
|
+
const { classes: classes2 } = useStyles$s();
|
|
238929
238979
|
const [localRange, setLocalRange] = useState(featureValueColormapRange);
|
|
238930
238980
|
useEffect(() => {
|
|
238931
238981
|
setLocalRange(featureValueColormapRange);
|
|
@@ -239259,7 +239309,7 @@ function Legend(props) {
|
|
|
239259
239309
|
}
|
|
239260
239310
|
} })] })] });
|
|
239261
239311
|
}
|
|
239262
|
-
const useStyles$
|
|
239312
|
+
const useStyles$r = makeStyles()(() => ({
|
|
239263
239313
|
multiLegend: {
|
|
239264
239314
|
position: "absolute",
|
|
239265
239315
|
top: "0px",
|
|
@@ -239286,7 +239336,7 @@ function MultiLegend(props) {
|
|
|
239286
239336
|
pointLayerCoordination,
|
|
239287
239337
|
pointMultiIndicesData
|
|
239288
239338
|
} = props;
|
|
239289
|
-
const { classes: classes2 } = useStyles$
|
|
239339
|
+
const { classes: classes2 } = useStyles$r();
|
|
239290
239340
|
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].reverse(), [segmentationLayerScopes]);
|
|
239291
239341
|
const reversedSpotLayerScopes = useMemo$1(() => [...spotLayerScopes || []].reverse(), [spotLayerScopes]);
|
|
239292
239342
|
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].reverse(), [pointLayerScopes]);
|
|
@@ -239379,13 +239429,16 @@ function MultiLegend(props) {
|
|
|
239379
239429
|
}) : null;
|
|
239380
239430
|
}) : null] });
|
|
239381
239431
|
}
|
|
239382
|
-
const useStyles$
|
|
239432
|
+
const useStyles$q = makeStyles()(() => ({
|
|
239383
239433
|
channelNamesLegendContainer: {
|
|
239384
239434
|
position: "absolute",
|
|
239385
239435
|
bottom: "0px",
|
|
239386
239436
|
left: "0px",
|
|
239387
239437
|
paddingLeft: "10px",
|
|
239388
|
-
paddingBottom: "10px"
|
|
239438
|
+
paddingBottom: "10px",
|
|
239439
|
+
// Keep long channel names within the view so they can be truncated.
|
|
239440
|
+
maxWidth: "90%",
|
|
239441
|
+
boxSizing: "border-box"
|
|
239389
239442
|
},
|
|
239390
239443
|
channelNamesLegendLayer: {
|
|
239391
239444
|
display: "flex"
|
|
@@ -239402,7 +239455,7 @@ const useStyles$r = makeStyles()(() => ({
|
|
|
239402
239455
|
}));
|
|
239403
239456
|
function ChannelNamesLegend(props) {
|
|
239404
239457
|
const { images, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination } = props;
|
|
239405
|
-
const { classes: classes2 } = useStyles$
|
|
239458
|
+
const { classes: classes2 } = useStyles$q();
|
|
239406
239459
|
const reversedImageLayerScopes = useMemo$1(() => [...imageLayerScopes || []].reverse(), [imageLayerScopes]);
|
|
239407
239460
|
return jsx$1("div", { className: classes2.channelNamesLegendContainer, children: imageLayerScopes ? reversedImageLayerScopes.map((layerScope) => {
|
|
239408
239461
|
const layerCoordination = imageLayerCoordination[0][layerScope];
|
|
@@ -239420,7 +239473,7 @@ function ChannelNamesLegend(props) {
|
|
|
239420
239473
|
const channelNames = imageWrapperInstance?.getChannelNames();
|
|
239421
239474
|
const channelIndex = imageWrapperInstance?.getChannelIndex(spatialTargetC);
|
|
239422
239475
|
const channelName = channelIndex !== void 0 ? channelNames?.[channelIndex] : void 0;
|
|
239423
|
-
return spatialLayerVisible && spatialChannelVisible && spatialChannelLabelsVisible ? jsx$1(Typography, { variant: "h6", className: classes2.channelNameText, style: {
|
|
239476
|
+
return spatialLayerVisible && spatialChannelVisible && spatialChannelLabelsVisible ? jsx$1(Typography, { variant: "h6", className: classes2.channelNameText, noWrap: true, title: channelName, style: {
|
|
239424
239477
|
color: rgbColor,
|
|
239425
239478
|
fontSize: `${spatialChannelLabelSize}px`
|
|
239426
239479
|
}, children: channelName }, `${layerScope}-${cScope}-${channelIndex}-${rgbColor}`) : null;
|
|
@@ -239432,6 +239485,7 @@ const DEFAULT_FEATURE_AGGREGATION_STRATEGY$3 = "first";
|
|
|
239432
239485
|
function EmbeddingScatterplotSubscriber(props) {
|
|
239433
239486
|
const {
|
|
239434
239487
|
uuid: uuid2,
|
|
239488
|
+
viewUid: viewUidFromProps,
|
|
239435
239489
|
closeButtonVisible,
|
|
239436
239490
|
downloadButtonVisible,
|
|
239437
239491
|
removeGridComponent,
|
|
@@ -239448,18 +239502,19 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
239448
239502
|
// Passed down from the ancestor <Vitessce/> or <VitS/> component.
|
|
239449
239503
|
areAnnotationsEditable
|
|
239450
239504
|
} = props;
|
|
239505
|
+
const viewUid = viewUidFromProps ?? uuid2;
|
|
239451
239506
|
const loaders = useLoaders();
|
|
239452
239507
|
const [
|
|
239453
239508
|
// eslint-disable-next-line no-unused-vars
|
|
239454
239509
|
coordinationScopes,
|
|
239455
239510
|
_coordinationScopesBy,
|
|
239456
239511
|
coordinationValues
|
|
239457
|
-
] = useViewMapping(
|
|
239512
|
+
] = useViewMapping(viewUid);
|
|
239458
239513
|
const setComponentHover = useSetComponentHover();
|
|
239459
239514
|
const setComponentViewInfo = useSetComponentViewInfo(uuid2);
|
|
239460
|
-
useAnnotationFrameCoordination(
|
|
239461
|
-
const [{ dataset, obsType, featureType, featureValueType, sampleType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, sampleSetSelection: sampleSetSelectionFromCoordination, sampleSetColor, embeddingPointsVisible, embeddingContoursVisible, embeddingContoursFilled, embeddingContourPercentiles: contourPercentiles, contourColorEncoding, contourColor, featureAggregationStrategy, annotationStory, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, annotationTransitionDuration, annotationEditable, annotationFrameIndex }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setEmbeddingPointsVisible, setEmbeddingContoursVisible, setEmbeddingContoursFilled, setEmbeddingContourPercentiles: setContourPercentiles, setContourColorEncoding, setFeatureAggregationStrategy, setAnnotationStory }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SCATTERPLOT], coordinationScopes, coordinationValues,
|
|
239462
|
-
const annotationEditingProps = useAnnotationEditingForView(
|
|
239515
|
+
useAnnotationFrameCoordination(viewUid, coordinationScopes, coordinationValues);
|
|
239516
|
+
const [{ dataset, obsType, featureType, featureValueType, sampleType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, tooltipObsSetsMode, sampleSetSelection: sampleSetSelectionFromCoordination, sampleSetColor, embeddingPointsVisible, embeddingContoursVisible, embeddingContoursFilled, embeddingContourPercentiles: contourPercentiles, contourColorEncoding, contourColor, featureAggregationStrategy, annotationStory, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, annotationTransitionDuration, annotationEditable, annotationFrameIndex }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setEmbeddingPointsVisible, setEmbeddingContoursVisible, setEmbeddingContoursFilled, setEmbeddingContourPercentiles: setContourPercentiles, setContourColorEncoding, setFeatureAggregationStrategy, setAnnotationStory }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SCATTERPLOT], coordinationScopes, coordinationValues, viewUid);
|
|
239517
|
+
const annotationEditingProps = useAnnotationEditingForView(viewUid, Boolean(areAnnotationsEditable && annotationEditable && typeof annotationFrameIndex === "number"));
|
|
239463
239518
|
const { embeddingZoom: initialZoom, embeddingTargetX: initialTargetX, embeddingTargetY: initialTargetY } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SCATTERPLOT], coordinationScopes, coordinationValues);
|
|
239464
239519
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
239465
239520
|
const sampleSetSelection = sampleSetSelectionFromProps || sampleSetSelectionFromCoordination;
|
|
@@ -239635,7 +239690,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
239635
239690
|
initialTargetY,
|
|
239636
239691
|
averageFillDensity
|
|
239637
239692
|
]);
|
|
239638
|
-
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
|
|
239693
|
+
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership, cellSetSelection, tooltipObsSetsMode);
|
|
239639
239694
|
const allCellsSelected = !(deferredCellSetSelection && mergedCellSets);
|
|
239640
239695
|
const getCellIsSelected = useCallback((object2, { index: index2 }) => allCellsSelected || obsColorIndices.colorIndices[index2] !== 0 ? 1 : 0, [allCellsSelected, obsColorIndices]);
|
|
239641
239696
|
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
@@ -239745,7 +239800,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
239745
239800
|
featureAggregationStrategyToUse,
|
|
239746
239801
|
obsSetsColumns
|
|
239747
239802
|
]);
|
|
239748
|
-
const annotationFrameCoordinationValues = getAnnotationFrameCoordinationValues(annotationStory, annotationFrameIndex,
|
|
239803
|
+
const annotationFrameCoordinationValues = getAnnotationFrameCoordinationValues(annotationStory, annotationFrameIndex, viewUid);
|
|
239749
239804
|
const annotationTransitionProps = useAnnotationFrameTransition({ zoom: zoom2, targetX: targetX2, targetY: targetY2 }, {
|
|
239750
239805
|
zoom: annotationFrameCoordinationValues?.[CoordinationType$1.EMBEDDING_ZOOM],
|
|
239751
239806
|
targetX: annotationFrameCoordinationValues?.[CoordinationType$1.EMBEDDING_TARGET_X],
|
|
@@ -239841,7 +239896,7 @@ function DualEmbeddingScatterplotSubscriber(props) {
|
|
|
239841
239896
|
const isCaseCtrl = Array.isArray(sampleSetSelection) && sampleSetSelection.length === 2;
|
|
239842
239897
|
const caseSampleSetSelection = useMemo$1(() => sampleSetSelection?.[0] ? [sampleSetSelection[0]] : null, [sampleSetSelection]);
|
|
239843
239898
|
const ctrlSampleSetSelection = useMemo$1(() => sampleSetSelection?.[1] ? [sampleSetSelection[1]] : null, [sampleSetSelection]);
|
|
239844
|
-
return jsxs("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "row" }, children: [jsx$1("div", { style: { width: isCaseCtrl ? "50%" : "100%", display: "flex", flexDirection: "column" }, children: jsx$1(EmbeddingScatterplotSubscriber, { ...props, uuid: `${uuid2}-case`, title: isCaseCtrl ? `Scatterplot (${embeddingType}), ${caseSampleSetSelection?.[0]?.at(-1)}` : null, sampleSetSelection: caseSampleSetSelection }) }), isCaseCtrl ? jsx$1("div", { style: { width: "50%", display: "flex", flexDirection: "column" }, children: jsx$1(EmbeddingScatterplotSubscriber, { ...props, uuid: `${uuid2}-ctrl`, title: `Scatterplot (${embeddingType}), ${ctrlSampleSetSelection?.[0]?.at(-1)}`, sampleSetSelection: ctrlSampleSetSelection }) }) : null] });
|
|
239899
|
+
return jsxs("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "row" }, children: [jsx$1("div", { style: { width: isCaseCtrl ? "50%" : "100%", display: "flex", flexDirection: "column" }, children: jsx$1(EmbeddingScatterplotSubscriber, { ...props, uuid: `${uuid2}-case`, viewUid: uuid2, title: isCaseCtrl ? `Scatterplot (${embeddingType}), ${caseSampleSetSelection?.[0]?.at(-1)}` : null, sampleSetSelection: caseSampleSetSelection }) }), isCaseCtrl ? jsx$1("div", { style: { width: "50%", display: "flex", flexDirection: "column" }, children: jsx$1(EmbeddingScatterplotSubscriber, { ...props, uuid: `${uuid2}-ctrl`, viewUid: uuid2, title: `Scatterplot (${embeddingType}), ${ctrlSampleSetSelection?.[0]?.at(-1)}`, sampleSetSelection: ctrlSampleSetSelection }) }) : null] });
|
|
239845
239900
|
}
|
|
239846
239901
|
function GatingScatterplotOptions(props) {
|
|
239847
239902
|
const { featureType, gatingFeatureSelectionX, setGatingFeatureSelectionX, gatingFeatureSelectionY, setGatingFeatureSelectionY, gatingFeatureValueTransform, setGatingFeatureValueTransform, gatingFeatureValueTransformCoefficient, setGatingFeatureValueTransformCoefficient, geneSelectOptions, transformOptions } = props;
|
|
@@ -259977,7 +260032,7 @@ function SpatialSubscriber$1(props) {
|
|
|
259977
260032
|
const setComponentHover = useSetComponentHover();
|
|
259978
260033
|
const setComponentViewInfo = useSetComponentViewInfo(uuid2);
|
|
259979
260034
|
useAnnotationFrameCoordination(uuid2, coordinationScopes);
|
|
259980
|
-
const [{ dataset, obsType, featureType, featureValueType, spatialZoom: zoom2, spatialTargetX: targetX2, spatialTargetY: targetY2, spatialTargetZ: targetZ, spatialRotationX: rotationX, spatialRotationY: rotationY, spatialRotationZ: rotationZ, spatialRotationOrbit: rotationOrbit, spatialOrbitAxis: orbitAxis, spatialImageLayer: imageLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, spatialNeighborhoodLayer: neighborhoodsLayer, obsFilter: cellFilter, obsHighlight: cellHighlight, moleculeHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, spatialAxisFixed, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, photometricInterpretation: photometricInterpretationFromCoordination, featureAggregationStrategy, annotationStory, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, annotationTransitionDuration, annotationEditable, annotationFrameIndex }, { setSpatialZoom: setZoom, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialOrbitAxis: setOrbitAxis, setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialNeighborhoodLayer: setNeighborhoodsLayer, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setMoleculeHighlight, setSpatialAxisFixed, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setFeatureAggregationStrategy, setAnnotationStory }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL], coordinationScopes);
|
|
260035
|
+
const [{ dataset, obsType, featureType, featureValueType, spatialZoom: zoom2, spatialTargetX: targetX2, spatialTargetY: targetY2, spatialTargetZ: targetZ, spatialRotationX: rotationX, spatialRotationY: rotationY, spatialRotationZ: rotationZ, spatialRotationOrbit: rotationOrbit, spatialOrbitAxis: orbitAxis, spatialImageLayer: imageLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, spatialNeighborhoodLayer: neighborhoodsLayer, obsFilter: cellFilter, obsHighlight: cellHighlight, moleculeHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, spatialAxisFixed, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, tooltipObsSetsMode, photometricInterpretation: photometricInterpretationFromCoordination, featureAggregationStrategy, annotationStory, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, annotationTransitionDuration, annotationEditable, annotationFrameIndex }, { setSpatialZoom: setZoom, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialOrbitAxis: setOrbitAxis, setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialNeighborhoodLayer: setNeighborhoodsLayer, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setMoleculeHighlight, setSpatialAxisFixed, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setFeatureAggregationStrategy, setAnnotationStory }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL], coordinationScopes);
|
|
259981
260036
|
const annotationEditingProps = useAnnotationEditingForView(uuid2, Boolean(areAnnotationsEditable && annotationEditable && typeof annotationFrameIndex === "number"));
|
|
259982
260037
|
const { spatialZoom: initialZoom, spatialTargetX: initialTargetX, spatialTargetY: initialTargetY, spatialTargetZ: initialTargetZ } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL], coordinationScopes);
|
|
259983
260038
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
@@ -260146,7 +260201,7 @@ function SpatialSubscriber$1(props) {
|
|
|
260146
260201
|
matrixObsIndex
|
|
260147
260202
|
]);
|
|
260148
260203
|
const cellSelection = useMemo$1(() => Array.from(cellColors.keys()), [cellColors]);
|
|
260149
|
-
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
|
|
260204
|
+
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership, cellSetSelection, tooltipObsSetsMode);
|
|
260150
260205
|
const getTooltipObsInfo = useCallback((tooltipObsId, tooltipObsType) => {
|
|
260151
260206
|
if (tooltipObsType === HOVER_MODE.MOLECULE_LAYER) {
|
|
260152
260207
|
return {
|
|
@@ -261131,8 +261186,9 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
261131
261186
|
const layerDefModelMatrix = image2?.obsSegmentations?.instance?.getModelMatrix();
|
|
261132
261187
|
let selections;
|
|
261133
261188
|
const hasChannelDimension = image2?.obsSegmentations?.instance?.hasDimC();
|
|
261189
|
+
const zIndex2 = image2?.obsSegmentations?.instance?.getClampedZIndex(targetZ) ?? 0;
|
|
261134
261190
|
const nextLoaderSelection = channelScopes.map((cScope) => filterSelection(data2, {
|
|
261135
|
-
z:
|
|
261191
|
+
z: zIndex2,
|
|
261136
261192
|
t: targetT,
|
|
261137
261193
|
c: hasChannelDimension ? image2?.obsSegmentations?.instance?.getChannelIndex(channelCoordination[cScope][CoordinationType$1.SPATIAL_TARGET_C]) : void 0
|
|
261138
261194
|
}));
|
|
@@ -261235,13 +261291,14 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
|
|
|
261235
261291
|
const yMirror = new Matrix4$1().translate([0, yExtent, 0]).scale([1, -1, 1]);
|
|
261236
261292
|
layerDefModelMatrix = new Matrix4$1(rawModelMatrix).multiplyRight(yMirror);
|
|
261237
261293
|
}
|
|
261294
|
+
const zIndex2 = image2?.image?.instance?.getClampedZIndex(targetZ) ?? 0;
|
|
261238
261295
|
let selections;
|
|
261239
261296
|
const nextLoaderSelection = isRgb2 ? [0, 1, 2].map((targetC) => filterSelection(data2, {
|
|
261240
|
-
z:
|
|
261297
|
+
z: zIndex2,
|
|
261241
261298
|
t: targetT,
|
|
261242
261299
|
c: targetC
|
|
261243
261300
|
})) : channelScopes.map((cScope) => filterSelection(data2, {
|
|
261244
|
-
z:
|
|
261301
|
+
z: zIndex2,
|
|
261245
261302
|
t: targetT,
|
|
261246
261303
|
c: image2?.image?.instance?.getChannelIndex(channelCoordination[cScope][CoordinationType$1.SPATIAL_TARGET_C])
|
|
261247
261304
|
}));
|
|
@@ -261985,7 +262042,7 @@ function getXY(obsHighlight, viewInfo, obsIndex, obsLocations, useHoverInfoForTo
|
|
|
261985
262042
|
const projectedObsCoord = viewInfo?.project(obsCoord);
|
|
261986
262043
|
return [projectedObsCoord?.[0], projectedObsCoord?.[1]];
|
|
261987
262044
|
}
|
|
261988
|
-
function getObsInfo(obsSetsData, obsType, obsId) {
|
|
262045
|
+
function getObsInfo(obsSetsData, obsType, obsId, obsSetSelection, tooltipObsSetsMode) {
|
|
261989
262046
|
let result = {
|
|
261990
262047
|
[`${capitalize$3(obsType)} ID`]: obsId
|
|
261991
262048
|
};
|
|
@@ -261994,7 +262051,7 @@ function getObsInfo(obsSetsData, obsType, obsId) {
|
|
|
261994
262051
|
if (obsMembership) {
|
|
261995
262052
|
result = {
|
|
261996
262053
|
...result,
|
|
261997
|
-
...Object.fromEntries(obsMembership.flatMap((path2) => path2.slice(1).map((pathEl, elLevel) => [
|
|
262054
|
+
...Object.fromEntries(filterObsMembershipForTooltip(obsMembership, obsSetSelection, tooltipObsSetsMode).flatMap((path2) => path2.slice(1).map((pathEl, elLevel) => [
|
|
261998
262055
|
`${path2[0]}${path2.length > 2 ? ` L${elLevel + 1}` : ""}`,
|
|
261999
262056
|
pathEl
|
|
262000
262057
|
])))
|
|
@@ -262040,9 +262097,9 @@ function SpatialTooltipSubscriber(props) {
|
|
|
262040
262097
|
"Pixel Value": JSON.stringify(pixelHighlight)
|
|
262041
262098
|
}, x: projectedHoverCoord?.[0], y: projectedHoverCoord?.[1] + (yOffset += 30), featureType, featureLabelsMap }, layerScope) : null;
|
|
262042
262099
|
}), segmentationLayerScopes?.flatMap((layerScope) => segmentationChannelScopesByLayer?.[layerScope]?.map((channelScope) => {
|
|
262043
|
-
const { obsType, obsHighlight, tooltipsVisible, tooltipCrosshairsVisible, spatialChannelVisible } = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope] || {};
|
|
262100
|
+
const { obsType, obsHighlight, tooltipsVisible, tooltipCrosshairsVisible, spatialChannelVisible, obsSetSelection, tooltipObsSetsMode } = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope] || {};
|
|
262044
262101
|
const obsSetsData = obsSegmentationsSetsData?.[layerScope]?.[channelScope];
|
|
262045
|
-
const obsInfo = getObsInfo(obsSetsData, obsType, obsHighlight);
|
|
262102
|
+
const obsInfo = getObsInfo(obsSetsData, obsType, obsHighlight, obsSetSelection, tooltipObsSetsMode);
|
|
262046
262103
|
if (!obsHighlight || !spatialChannelVisible || !tooltipsVisible && !tooltipCrosshairsVisible)
|
|
262047
262104
|
return null;
|
|
262048
262105
|
const { obsIndex, obsLocations } = obsSegmentationsLocations?.[layerScope]?.[channelScope] || {};
|
|
@@ -262099,16 +262156,16 @@ class ErrorBoundary extends React__default.Component {
|
|
|
262099
262156
|
}
|
|
262100
262157
|
}
|
|
262101
262158
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
262102
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
262159
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-B_ToVxzC.js").then((n3) => n3.a);
|
|
262103
262160
|
return { default: SpatialWrapper2 };
|
|
262104
262161
|
});
|
|
262105
262162
|
const SpatialThreeAdapter = React__default.forwardRef((props, ref2) => jsx$1("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsx$1(ErrorBoundary, { fallback: jsx$1("div", { children: "3D spatial view is not available in this environment." }), children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: jsx$1(LazySpatialThree, { ...props }) }) }) }));
|
|
262106
262163
|
const LazySpatialAccelerated = React__default.lazy(async () => {
|
|
262107
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
262164
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-CO-QVcb0.js");
|
|
262108
262165
|
return { default: SpatialWrapper2 };
|
|
262109
262166
|
});
|
|
262110
262167
|
const SpatialAcceleratedAdapter = React__default.forwardRef((props, ref2) => jsx$1("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsx$1(ErrorBoundary, { fallback: jsx$1("div", { children: "3D spatial view is not available in this environment." }), children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: jsx$1(LazySpatialAccelerated, { ...props }) }) }) }));
|
|
262111
|
-
const useStyles$
|
|
262168
|
+
const useStyles$p = makeStyles()(() => ({
|
|
262112
262169
|
spatialBetaCameraLabel: {
|
|
262113
262170
|
padding: "0px 0px 0px 16px"
|
|
262114
262171
|
},
|
|
@@ -262119,7 +262176,7 @@ const useStyles$q = makeStyles()(() => ({
|
|
|
262119
262176
|
function SpatialOptions(props) {
|
|
262120
262177
|
const { spatialAxisFixed, setSpatialAxisFixed, use3d } = props;
|
|
262121
262178
|
const toggleAxisId = $bdb11010cef70236$export$f680877a34711e37();
|
|
262122
|
-
const { classes: classes2 } = useStyles$
|
|
262179
|
+
const { classes: classes2 } = useStyles$p();
|
|
262123
262180
|
return jsx$1(OptionsContainer, { children: jsxs(TableRow, { children: [jsx$1(TableCell, { className: classes2.spatialBetaCameraLabel, variant: "head", scope: "row", children: jsx$1("label", { htmlFor: `spatial-camera-axis-${toggleAxisId}`, children: "Fix Camera Axis" }) }), jsx$1(TableCell, { className: classes2.spatialBetaToggleBox, variant: "body", children: jsx$1(Checkbox$1, { onClick: () => setSpatialAxisFixed(!spatialAxisFixed), disabled: !use3d, checked: Boolean(spatialAxisFixed), slotProps: { input: {
|
|
262124
262181
|
"aria-label": "Fix or not fix spatial camera axis",
|
|
262125
262182
|
id: `spatial-camera-axis-${toggleAxisId}`
|
|
@@ -262361,7 +262418,7 @@ function SpatialSubscriber(props) {
|
|
|
262361
262418
|
}] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL_BETA], coordinationScopes);
|
|
262362
262419
|
const annotationEditingProps = useAnnotationEditingForView(uuid2, Boolean(areAnnotationsEditable && annotationEditable && typeof annotationFrameIndex === "number"));
|
|
262363
262420
|
const { spatialZoom: initialZoom, spatialTargetX: initialTargetX, spatialTargetY: initialTargetY, spatialTargetZ: initialTargetZ } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.SPATIAL_BETA], coordinationScopes);
|
|
262364
|
-
const hasSpatialCameraSnapshot = Boolean(spatialCameraSnapshot);
|
|
262421
|
+
const hasSpatialCameraSnapshot = Boolean(spatialCameraSnapshot) && spatialRenderingMode === "3D";
|
|
262365
262422
|
const [segmentationLayerScopes, segmentationChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$1.SEGMENTATION_CHANNEL, CoordinationType$1.SEGMENTATION_LAYER, coordinationScopes, coordinationScopesBy);
|
|
262366
262423
|
const [imageLayerScopes, imageChannelScopesByLayer] = useMultiCoordinationScopesSecondaryNonNull(CoordinationType$1.IMAGE_CHANNEL, CoordinationType$1.IMAGE_LAYER, coordinationScopes, coordinationScopesBy);
|
|
262367
262424
|
const spotLayerScopes = useMultiCoordinationScopesNonNull(CoordinationType$1.SPOT_LAYER, coordinationScopes);
|
|
@@ -262391,6 +262448,7 @@ function SpatialSubscriber(props) {
|
|
|
262391
262448
|
CoordinationType$1.OBS_HIGHLIGHT,
|
|
262392
262449
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
262393
262450
|
CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
262451
|
+
CoordinationType$1.TOOLTIP_OBS_SETS_MODE,
|
|
262394
262452
|
CoordinationType$1.LEGEND_VISIBLE
|
|
262395
262453
|
], coordinationScopes, coordinationScopesBy, CoordinationType$1.SEGMENTATION_LAYER, CoordinationType$1.SEGMENTATION_CHANNEL);
|
|
262396
262454
|
const imageLayerCoordination = useComplexCoordination([
|
|
@@ -262588,6 +262646,28 @@ function SpatialSubscriber(props) {
|
|
|
262588
262646
|
segmentationChannelScopesByLayer
|
|
262589
262647
|
]
|
|
262590
262648
|
);
|
|
262649
|
+
const sceneMetersPerUnit = useMemo$1(() => {
|
|
262650
|
+
const firstLayer = Object.values(imageData ?? {})[0];
|
|
262651
|
+
return firstLayer?.image?.instance?.getSceneMetersPerUnit() ?? null;
|
|
262652
|
+
}, [imageData]);
|
|
262653
|
+
const sceneCameraSnapshot = useMemo$1(() => {
|
|
262654
|
+
if (!spatialCameraSnapshot)
|
|
262655
|
+
return null;
|
|
262656
|
+
const inMpu = spatialCameraSnapshot.metersPerUnit;
|
|
262657
|
+
if (!sceneMetersPerUnit || !inMpu || inMpu === sceneMetersPerUnit) {
|
|
262658
|
+
return spatialCameraSnapshot;
|
|
262659
|
+
}
|
|
262660
|
+
const k = inMpu / sceneMetersPerUnit;
|
|
262661
|
+
return {
|
|
262662
|
+
...spatialCameraSnapshot,
|
|
262663
|
+
position: spatialCameraSnapshot.position.map((p) => p * k),
|
|
262664
|
+
projectionScale: spatialCameraSnapshot.projectionScale * k,
|
|
262665
|
+
metersPerUnit: sceneMetersPerUnit
|
|
262666
|
+
};
|
|
262667
|
+
}, [spatialCameraSnapshot, sceneMetersPerUnit]);
|
|
262668
|
+
const setSceneCameraSnapshot = useCallback((snapshot) => {
|
|
262669
|
+
setSpatialCameraSnapshot({ ...snapshot, metersPerUnit: sceneMetersPerUnit });
|
|
262670
|
+
}, [setSpatialCameraSnapshot, sceneMetersPerUnit]);
|
|
262591
262671
|
useEffect(() => {
|
|
262592
262672
|
if (width2 && height2) {
|
|
262593
262673
|
if (typeof initialTargetX !== "number" || typeof initialTargetY !== "number") {
|
|
@@ -262622,6 +262702,10 @@ function SpatialSubscriber(props) {
|
|
|
262622
262702
|
if (prevIs3dMode.current === is3dMode) {
|
|
262623
262703
|
return;
|
|
262624
262704
|
}
|
|
262705
|
+
if (hasSpatialCameraSnapshot) {
|
|
262706
|
+
prevIs3dMode.current = is3dMode;
|
|
262707
|
+
return;
|
|
262708
|
+
}
|
|
262625
262709
|
if (typeof defaultTargetX !== "number" || typeof defaultTargetY !== "number") {
|
|
262626
262710
|
return;
|
|
262627
262711
|
}
|
|
@@ -262632,7 +262716,14 @@ function SpatialSubscriber(props) {
|
|
|
262632
262716
|
setZoom(defaultZoom);
|
|
262633
262717
|
setRotationX(is3dMode ? 0 : null);
|
|
262634
262718
|
setRotationOrbit(is3dMode ? 0 : null);
|
|
262635
|
-
}, [
|
|
262719
|
+
}, [
|
|
262720
|
+
is3dMode,
|
|
262721
|
+
hasSpatialCameraSnapshot,
|
|
262722
|
+
defaultTargetX,
|
|
262723
|
+
defaultTargetY,
|
|
262724
|
+
defaultTargetZ,
|
|
262725
|
+
defaultZoom
|
|
262726
|
+
]);
|
|
262636
262727
|
const annotationFrameCoordinationValues = getAnnotationFrameCoordinationValues(annotationStory, annotationFrameIndex, uuid2);
|
|
262637
262728
|
const annotationTransitionProps = useAnnotationFrameTransition(
|
|
262638
262729
|
{ zoom: zoom2, targetX: targetX2, targetY: targetY2 },
|
|
@@ -262813,7 +262904,7 @@ function SpatialSubscriber(props) {
|
|
|
262813
262904
|
rotationX,
|
|
262814
262905
|
rotationOrbit,
|
|
262815
262906
|
...annotationTransitionProps
|
|
262816
|
-
} : 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, spatialCameraSnapshot: hasSpatialCameraSnapshot ?
|
|
262907
|
+
} : 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, spatialCameraSnapshot: hasSpatialCameraSnapshot ? sceneCameraSnapshot : null, setSpatialCameraSnapshot: hasSpatialCameraSnapshot ? setSceneCameraSnapshot : null, annotationShapes, annotationOverlayVisible, annotationSemanticZoom, hideRecenter: hasSpatialCameraSnapshot, ...annotationEditingProps }), !disableTooltip && jsx$1(SpatialTooltipSubscriber, {
|
|
262817
262908
|
parentUuid: uuid2,
|
|
262818
262909
|
width: width2,
|
|
262819
262910
|
height: height2,
|
|
@@ -263710,7 +263801,7 @@ function HeatmapSubscriber(props) {
|
|
|
263710
263801
|
const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
|
|
263711
263802
|
const setComponentHover = useSetComponentHover();
|
|
263712
263803
|
const setComponentViewInfo = useSetComponentViewInfo(uuid2);
|
|
263713
|
-
const [{ dataset, obsType, featureType, featureValueType, heatmapZoomX: zoomX, heatmapTargetX: targetX2, heatmapTargetY: targetY2, featureSelection: geneSelection, obsHighlight: cellHighlight, featureHighlight: geneHighlight, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible }, { setHeatmapZoomX: setZoomX, setHeatmapZoomY: setZoomY, setHeatmapTargetX: setTargetX, setHeatmapTargetY: setTargetY, setObsHighlight: setCellHighlight, setFeatureSelection: setGeneSelection, setObsColorEncoding: setCellColorEncoding, setFeatureHighlight: setGeneHighlight, setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor, setFeatureValueColormapRange: setGeneExpressionColormapRange, setFeatureValueColormap: setGeneExpressionColormap, setTooltipsVisible }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.HEATMAP], coordinationScopes);
|
|
263804
|
+
const [{ dataset, obsType, featureType, featureValueType, heatmapZoomX: zoomX, heatmapTargetX: targetX2, heatmapTargetY: targetY2, featureSelection: geneSelection, obsHighlight: cellHighlight, featureHighlight: geneHighlight, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, tooltipObsSetsMode }, { setHeatmapZoomX: setZoomX, setHeatmapZoomY: setZoomY, setHeatmapTargetX: setTargetX, setHeatmapTargetY: setTargetY, setObsHighlight: setCellHighlight, setFeatureSelection: setGeneSelection, setObsColorEncoding: setCellColorEncoding, setFeatureHighlight: setGeneHighlight, setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor, setFeatureValueColormapRange: setGeneExpressionColormapRange, setFeatureValueColormap: setGeneExpressionColormap, setTooltipsVisible }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.HEATMAP], coordinationScopes);
|
|
263714
263805
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
263715
263806
|
const observationsPluralLabel = pluralize(observationsLabel);
|
|
263716
263807
|
const variablesLabel = variablesLabelOverride || featureType;
|
|
@@ -263764,7 +263855,7 @@ function HeatmapSubscriber(props) {
|
|
|
263764
263855
|
cellSetSelection,
|
|
263765
263856
|
obsIndex
|
|
263766
263857
|
]);
|
|
263767
|
-
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
|
|
263858
|
+
const getObsInfo2 = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership, cellSetSelection, tooltipObsSetsMode);
|
|
263768
263859
|
const getObsMembership = useGetObsMembership(obsSetsMembership);
|
|
263769
263860
|
const getFeatureInfo = useCallback((featureId2) => {
|
|
263770
263861
|
if (featureId2) {
|
|
@@ -270230,7 +270321,7 @@ _defineProperty$3(WindowScroller, "defaultProps", {
|
|
|
270230
270321
|
serverHeight: 0,
|
|
270231
270322
|
serverWidth: 0
|
|
270232
270323
|
});
|
|
270233
|
-
const useStyles$
|
|
270324
|
+
const useStyles$o = makeStyles()((theme) => ({
|
|
270234
270325
|
selectableTable: {
|
|
270235
270326
|
flex: "1 1 auto",
|
|
270236
270327
|
outline: "none"
|
|
@@ -270380,7 +270471,7 @@ function SelectableTable(props) {
|
|
|
270380
270471
|
onChange(null);
|
|
270381
270472
|
}
|
|
270382
270473
|
}, [selectedRows, allowMultiple]);
|
|
270383
|
-
const { classes: classes2 } = useStyles$
|
|
270474
|
+
const { classes: classes2 } = useStyles$o();
|
|
270384
270475
|
const inputUuid = v4$1();
|
|
270385
270476
|
const rowRenderer = ({ index: index2, style: style2 }) => (
|
|
270386
270477
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
@@ -270409,7 +270500,7 @@ const FEATURELIST_SORT_OPTIONS = [
|
|
|
270409
270500
|
"original"
|
|
270410
270501
|
];
|
|
270411
270502
|
const ALT_COLNAME = "Alternate ID";
|
|
270412
|
-
const useStyles$
|
|
270503
|
+
const useStyles$n = makeStyles()(() => ({
|
|
270413
270504
|
searchBar: {
|
|
270414
270505
|
marginTop: "10px",
|
|
270415
270506
|
marginLeft: "10px",
|
|
@@ -270422,7 +270513,7 @@ const useStyles$o = makeStyles()(() => ({
|
|
|
270422
270513
|
}));
|
|
270423
270514
|
function FeatureList(props) {
|
|
270424
270515
|
const { width: width2, height: height2, hasColorEncoding, geneList = [], featureLabelsMap, geneSelection = [], geneFilter = null, setGeneSelection, enableMultiSelect, requireShiftForMultiSelect, showFeatureTable, featureListSort, featureListSortKey, hasFeatureLabels, primaryColumnName } = props;
|
|
270425
|
-
const { classes: classes2 } = useStyles$
|
|
270516
|
+
const { classes: classes2 } = useStyles$n();
|
|
270426
270517
|
const [searchTerm, setSearchTerm] = useState("");
|
|
270427
270518
|
const selectableTableSortKey = featureListSortKey === "featureIndex" ? "key" : "name";
|
|
270428
270519
|
const searchResults = useMemo$1(() => geneList.filter((gene) => gene.toLowerCase().includes(searchTerm.toLowerCase()) || featureLabelsMap?.get(gene)?.toLowerCase().includes(searchTerm.toLowerCase()) || featureLabelsMap?.get(cleanFeatureId(gene))?.toLowerCase().includes(searchTerm.toLowerCase())), [geneList, searchTerm, featureLabelsMap]);
|
|
@@ -270495,7 +270586,7 @@ function FeatureListOptions(props) {
|
|
|
270495
270586
|
id: `feature-list-show-alternative-ids-${featureListId}`
|
|
270496
270587
|
} } }) })] })] }) : null] });
|
|
270497
270588
|
}
|
|
270498
|
-
const useStyles$
|
|
270589
|
+
const useStyles$m = makeStyles()((theme) => ({
|
|
270499
270590
|
featureListContainer: {
|
|
270500
270591
|
width: "100%",
|
|
270501
270592
|
height: "100%",
|
|
@@ -270510,7 +270601,7 @@ function FeatureListSubscriber(props) {
|
|
|
270510
270601
|
const loaders = useLoaders();
|
|
270511
270602
|
const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
|
|
270512
270603
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
270513
|
-
const { classes: classes2 } = useStyles$
|
|
270604
|
+
const { classes: classes2 } = useStyles$m();
|
|
270514
270605
|
const [{ dataset, obsType, featureType, featureSelection: geneSelection, featureFilter: geneFilter, obsColorEncoding: cellColorEncoding }, { setFeatureSelection: setGeneSelection, setFeatureFilter: setGeneFilter, setFeatureHighlight: setGeneHighlight, setObsColorEncoding: setCellColorEncoding }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.FEATURE_LIST], coordinationScopes);
|
|
270515
270606
|
const variablesLabel = variablesLabelOverride || featureType;
|
|
270516
270607
|
const title2 = titleOverride || `${capitalize$3(variablesLabel)} List`;
|
|
@@ -270645,7 +270736,7 @@ const useSelectionSliderStyles = makeStyles()(() => ({
|
|
|
270645
270736
|
backgroundColor: "rgba(128, 128, 128, 0.7)"
|
|
270646
270737
|
}
|
|
270647
270738
|
}));
|
|
270648
|
-
const useStyles$
|
|
270739
|
+
const useStyles$l = makeStyles()((theme) => ({
|
|
270649
270740
|
paletteContainer: {
|
|
270650
270741
|
width: "70px",
|
|
270651
270742
|
height: "40px",
|
|
@@ -270666,10 +270757,10 @@ const useStyles$m = makeStyles()((theme) => ({
|
|
|
270666
270757
|
}
|
|
270667
270758
|
}));
|
|
270668
270759
|
const ColorPalette = ({ handleChange }) => {
|
|
270669
|
-
const { classes: classes2 } = useStyles$
|
|
270760
|
+
const { classes: classes2 } = useStyles$l();
|
|
270670
270761
|
return jsx$1("div", { className: classes2.paletteContainer, "aria-label": "Color swatch", children: VIEWER_PALETTE.map((color2) => jsx$1(IconButton$1, { className: classes2.button, onClick: () => handleChange(color2), "aria-label": `Change color to ${color2}`, children: jsx$1(LensIcon, { fontSize: "small", style: { color: `rgb(${color2})` }, className: classes2.icon }) }, color2)) });
|
|
270671
270762
|
};
|
|
270672
|
-
const useStyles$
|
|
270763
|
+
const useStyles$k = makeStyles()(() => ({
|
|
270673
270764
|
menuButton: {
|
|
270674
270765
|
backgroundColor: "transparent"
|
|
270675
270766
|
},
|
|
@@ -270688,7 +270779,7 @@ function MuiSpan(props) {
|
|
|
270688
270779
|
}
|
|
270689
270780
|
function ChannelOptions$1({ handlePropertyChange, handleChannelRemove, handleIQRUpdate }) {
|
|
270690
270781
|
const [open2, setOpen] = useState(false);
|
|
270691
|
-
const { classes: classes2 } = useStyles$
|
|
270782
|
+
const { classes: classes2 } = useStyles$k();
|
|
270692
270783
|
const handleColorSelect = (color2) => {
|
|
270693
270784
|
handlePropertyChange("color", color2);
|
|
270694
270785
|
};
|
|
@@ -270698,9 +270789,23 @@ function ChannelOptions$1({ handlePropertyChange, handleChannelRemove, handleIQR
|
|
|
270698
270789
|
};
|
|
270699
270790
|
return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, { fontSize: "small" }), buttonClassName: classes2.menuButton, "aria-label": "Open channel options menu", children: [jsx$1(MenuItem, { dense: true, disableGutters: true, onClick: handleRemove, "aria-label": "Click to remove channel", children: jsx$1(MuiSpan, { children: "Remove" }) }), jsx$1(MenuItem, { dense: true, disableGutters: true, onClick: handleIQRUpdate, "aria-label": "Click to use IQR for channel", children: jsx$1(MuiSpan, { children: "Use IQR" }) }), jsx$1(MenuItem, { dense: true, disableGutters: true, className: classes2.colors, "aria-label": "Click to select color for channel", children: jsx$1(ColorPalette, { handleChange: handleColorSelect }) })] });
|
|
270700
270791
|
}
|
|
270701
|
-
|
|
270792
|
+
const CHANNELS_SORT_ORDER_OPTIONS = [
|
|
270793
|
+
{ value: "original", label: "Original" },
|
|
270794
|
+
{ value: "alphabetical", label: "Alphabetical" }
|
|
270795
|
+
];
|
|
270796
|
+
function getSortedChannelOptions(channelNames, channelsSortOrder) {
|
|
270797
|
+
if (!Array.isArray(channelNames))
|
|
270798
|
+
return [];
|
|
270799
|
+
const options = channelNames.map((channelName, channelIndex) => ({ channelName, channelIndex }));
|
|
270800
|
+
if (channelsSortOrder === "alphabetical") {
|
|
270801
|
+
return options.sort((a2, b2) => String(a2.channelName).localeCompare(String(b2.channelName), void 0, { numeric: true, sensitivity: "base" }));
|
|
270802
|
+
}
|
|
270803
|
+
return options;
|
|
270804
|
+
}
|
|
270805
|
+
function ChannelSelectionDropdown$1({ handleChange, disabled, channelOptions, selectionIndex, channelsSortOrder }) {
|
|
270702
270806
|
const { classes: classes2 } = useSelectStyles();
|
|
270703
|
-
|
|
270807
|
+
const sortedOptions = useMemo$1(() => getSortedChannelOptions(channelOptions, channelsSortOrder), [channelOptions, channelsSortOrder]);
|
|
270808
|
+
return jsx$1(NativeSelect, { classes: { root: classes2.selectRoot }, value: selectionIndex, onChange: (e3) => handleChange(Number(e3.target.value)), inputProps: { "aria-label": "Select a channel" }, children: sortedOptions.map(({ channelName, channelIndex }) => jsx$1("option", { disabled, value: channelIndex, children: channelName }, `${channelName}-${channelIndex}`)) });
|
|
270704
270809
|
}
|
|
270705
270810
|
function ChannelVisibilityCheckbox$1({ color: color2, checked, toggle: toggle2, disabled }) {
|
|
270706
270811
|
return jsx$1(Checkbox$1, { onChange: toggle2, checked, disabled, sx: { paddingLeft: 0 }, style: { color: color2, "&$checked": { color: color2 } }, slotProps: {
|
|
@@ -270724,7 +270829,7 @@ function ChannelSlider$1({ color: color2, slider = [0, 0], handleChange, domain:
|
|
|
270724
270829
|
return `${labelPrefix} for ${color2} colormap channel`;
|
|
270725
270830
|
}, getAriaValueText: () => `Current colormap values: ${color2}-${slider}`, min: min2, max: max2, step, orientation: "horizontal", style: { color: color2, marginTop: "7px" }, disabled });
|
|
270726
270831
|
}
|
|
270727
|
-
function RasterChannelController({ visibility = false, slider, color: color2, channels: channels2, channelId, domainType: newDomainType, dimName, theme, loader: loader2, colormapOn, channelOptions, handlePropertyChange, handleChannelRemove, handleIQRUpdate, selectionIndex, isLoading, use3d: newUse3d }) {
|
|
270832
|
+
function RasterChannelController({ visibility = false, slider, color: color2, channels: channels2, channelId, domainType: newDomainType, dimName, theme, loader: loader2, colormapOn, channelOptions, handlePropertyChange, handleChannelRemove, handleIQRUpdate, selectionIndex, isLoading, use3d: newUse3d, channelsSortOrder }) {
|
|
270728
270833
|
const { dtype } = getSourceFromLoader(loader2);
|
|
270729
270834
|
const [domain2, setDomain] = useState(null);
|
|
270730
270835
|
const [domainType, setDomainType] = useState(null);
|
|
@@ -270797,15 +270902,15 @@ function RasterChannelController({ visibility = false, slider, color: color2, ch
|
|
|
270797
270902
|
justifyContent: "center"
|
|
270798
270903
|
}, children: [jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270799
270904
|
justifyContent: "space-between"
|
|
270800
|
-
}, children: [jsx$1(Grid$1, { size: 10, children: jsx$1(ChannelSelectionDropdown$1, { handleChange: (v) => handlePropertyChange("selection", createSelection(v)), selectionIndex, channelOptions, disabled: isLoading }) }), jsx$1(Grid$1, { size: 1, sx: { marginTop: "4px" }, children: jsx$1(ChannelOptions$1, { handlePropertyChange, handleChannelRemove, handleIQRUpdate, disabled: isLoading }) })] }), jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270905
|
+
}, children: [jsx$1(Grid$1, { size: 10, children: jsx$1(ChannelSelectionDropdown$1, { handleChange: (v) => handlePropertyChange("selection", createSelection(v)), selectionIndex, channelOptions, disabled: isLoading, channelsSortOrder }) }), jsx$1(Grid$1, { size: 1, sx: { marginTop: "4px" }, children: jsx$1(ChannelOptions$1, { handlePropertyChange, handleChannelRemove, handleIQRUpdate, disabled: isLoading }) })] }), jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270801
270906
|
justifyContent: "space-between"
|
|
270802
270907
|
}, children: [jsx$1(Grid$1, { size: 2, children: jsx$1(ChannelVisibilityCheckbox$1, { color: rgbColor, checked: visibility, toggle: () => handlePropertyChange("visible", !visibility), disabled: isLoading }) }), jsx$1(Grid$1, { size: 9, children: jsx$1(ChannelSlider$1, { color: rgbColor, slider, domain: domain2 || DOMAINS[dtype], dtype, handleChange: (v) => handlePropertyChange("slider", v), disabled: isLoading }) })] })] });
|
|
270803
270908
|
}
|
|
270804
|
-
function BitmaskChannelController({ visibility = false, dimName, channelOptions, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions = false }) {
|
|
270909
|
+
function BitmaskChannelController({ visibility = false, dimName, channelOptions, channelsSortOrder, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions = false }) {
|
|
270805
270910
|
const createSelection = (index2) => ({ [dimName]: index2 });
|
|
270806
270911
|
return jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270807
270912
|
justifyContent: "space-between"
|
|
270808
|
-
}, children: [jsx$1(Grid$1, { size: 2, children: jsx$1(ChannelVisibilityCheckbox$1, { color: [220, 220, 220], checked: visibility, toggle: () => handlePropertyChange("visible", !visibility) }) }), jsx$1(Grid$1, { size: 9, children: jsx$1(ChannelSelectionDropdown$1, { handleChange: (v) => handlePropertyChange("selection", createSelection(v)), selectionIndex, disableOptions, channelOptions }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(IconButton$1, { onClick: handleChannelRemove, style: { padding: "6px 6px 6px 0px" }, "aria-label": "Remove channel", children: jsx$1(RemoveCircle, {}) }) })] });
|
|
270913
|
+
}, children: [jsx$1(Grid$1, { size: 2, children: jsx$1(ChannelVisibilityCheckbox$1, { color: [220, 220, 220], checked: visibility, toggle: () => handlePropertyChange("visible", !visibility) }) }), jsx$1(Grid$1, { size: 9, children: jsx$1(ChannelSelectionDropdown$1, { handleChange: (v) => handlePropertyChange("selection", createSelection(v)), selectionIndex, disableOptions, channelOptions, channelsSortOrder }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(IconButton$1, { onClick: handleChannelRemove, style: { padding: "6px 6px 6px 0px" }, "aria-label": "Remove channel", children: jsx$1(RemoveCircle, {}) }) })] });
|
|
270809
270914
|
}
|
|
270810
270915
|
function VectorLayerController(props) {
|
|
270811
270916
|
const { label: label2, layer, layerType, handleLayerChange } = props;
|
|
@@ -270926,6 +271031,10 @@ function OpacitySlider({ value: value2, inputId, handleChange }) {
|
|
|
270926
271031
|
const { classes: classes2 } = useChannelSliderStyles();
|
|
270927
271032
|
return jsx$1(Slider, { slotProps: { valueLabel: { className: classes2.sliderValueLabel } }, value: value2, onChange: (e3, v) => handleChange(v), valueLabelDisplay: "auto", "aria-label": "Layer opacity slider", id: inputId, min: 0, max: 1, step: 0.01, orientation: "horizontal" });
|
|
270928
271033
|
}
|
|
271034
|
+
function ChannelsSortOrderSelect({ value: value2, inputId, handleChange }) {
|
|
271035
|
+
const { classes: classes2 } = useSelectStyles();
|
|
271036
|
+
return jsx$1(NativeSelect, { onChange: (e3) => handleChange(e3.target.value), value: value2 || "original", id: inputId, inputProps: { "aria-label": "Channel sort order selector" }, style: { width: "100%" }, classes: { root: classes2.selectRoot }, children: CHANNELS_SORT_ORDER_OPTIONS.map(({ value: optValue, label: label2 }) => jsx$1("option", { value: optValue, children: label2 }, optValue)) });
|
|
271037
|
+
}
|
|
270929
271038
|
function SliderDomainSelector({ value: value2, inputId, handleChange }) {
|
|
270930
271039
|
const { classes: classes2 } = useSelectStyles();
|
|
270931
271040
|
return jsx$1(NativeSelect, { onChange: (e3) => handleChange(e3.target.value), value: value2, id: inputId, inputProps: { name: "domain-selector", "aria-label": "Domain type selector" }, style: { width: "100%" }, classes: { root: classes2.selectRoot }, children: DOMAIN_OPTIONS.map((name2) => jsx$1("option", { value: name2, children: name2 }, name2)) });
|
|
@@ -270959,7 +271068,7 @@ function LayerOption({ name: name2, inputId, children: children3 }) {
|
|
|
270959
271068
|
justifyContent: "center"
|
|
270960
271069
|
}, children: [jsx$1(Grid$1, { size: 6, children: jsxs(InputLabel, { htmlFor: inputId, children: [name2, ":"] }) }), jsx$1(Grid$1, { size: 6, children: children3 })] });
|
|
270961
271070
|
}
|
|
270962
|
-
function LayerOptions({ colormap, opacity: opacity2, handleColormapChange, handleOpacityChange, handleTransparentColorChange, globalControlLabels, globalLabelValues, handleGlobalChannelsSelectionChange, handleSliderChange, handleDomainChange, transparentColor, channels: channels2, domainType, disableChannelsIfRgbDetected, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, use3d, loader: loader2, handleMultiPropertyChange, resolution, disable3d, setRasterLayerCallback, setAreAllChannelsLoading, setViewState, spatialHeight, spatialWidth, modelMatrix: modelMatrix2 }) {
|
|
271071
|
+
function LayerOptions({ colormap, opacity: opacity2, handleColormapChange, handleOpacityChange, handleTransparentColorChange, globalControlLabels, globalLabelValues, handleGlobalChannelsSelectionChange, handleSliderChange, handleDomainChange, channelsSortOrder, handleChannelsSortOrderChange, transparentColor, channels: channels2, domainType, disableChannelsIfRgbDetected, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, use3d, loader: loader2, handleMultiPropertyChange, resolution, disable3d, setRasterLayerCallback, setAreAllChannelsLoading, setViewState, spatialHeight, spatialWidth, modelMatrix: modelMatrix2 }) {
|
|
270963
271072
|
const { labels: labels2, shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
|
|
270964
271073
|
const hasDimensionsAndChannels = labels2.length > 0 && channels2.length > 0;
|
|
270965
271074
|
const hasZStack = shape2[labels2.indexOf("z")] > 1;
|
|
@@ -270971,7 +271080,8 @@ function LayerOptions({ colormap, opacity: opacity2, handleColormapChange, handl
|
|
|
270971
271080
|
const domainSelectorId = $bdb11010cef70236$export$f680877a34711e37();
|
|
270972
271081
|
const opacitySliderId = $bdb11010cef70236$export$f680877a34711e37();
|
|
270973
271082
|
const zeroTransparentId = $bdb11010cef70236$export$f680877a34711e37();
|
|
270974
|
-
|
|
271083
|
+
const channelsSortOrderId = $bdb11010cef70236$export$f680877a34711e37();
|
|
271084
|
+
return jsxs(Grid$1, { container: true, sx: { flexDirection: "column", width: "100%" }, children: [hasZStack && !disable3d && hasViewableResolutions && jsx$1(VolumeDropdown, { loader: loader2, handleSliderChange, handleDomainChange, channels: channels2, handleMultiPropertyChange, resolution, disable3d, setRasterLayerCallback, setAreAllChannelsLoading, setViewState, spatialHeight, spatialWidth, use3d, modelMatrix: modelMatrix2 }), hasDimensionsAndChannels && !use3d && globalControlLabels.map((field2) => shape2[labels2.indexOf(field2)] > 1 && jsx$1(LayerOption, { name: field2, inputId: `${field2}-${globalSelectionSliderId}`, children: jsx$1(GlobalSelectionSlider, { field: field2, inputId: `${field2}-${globalSelectionSliderId}`, value: globalLabelValues[field2], handleChange: handleGlobalChannelsSelectionChange, possibleValues: range$d(shape2[labels2.indexOf(field2)]) }) }, field2)), !disableChannelsIfRgbDetected ? jsxs(Fragment, { children: [shouldShowColormap && jsx$1(Grid$1, { children: jsx$1(LayerOption, { name: "Colormap", inputId: colormapSelectId, children: jsx$1(ColormapSelect, { value: colormap || "", inputId: colormapSelectId, handleChange: handleColormapChange }) }) }), hasDimensionsAndChannels && handleChannelsSortOrderChange && jsx$1(Grid$1, { children: jsx$1(LayerOption, { name: "Channel Order", inputId: channelsSortOrderId, children: jsx$1(ChannelsSortOrderSelect, { value: channelsSortOrder, inputId: channelsSortOrderId, handleChange: handleChannelsSortOrderChange }) }) }), shouldShowDomain && jsx$1(Grid$1, { children: jsx$1(LayerOption, { name: "Domain", inputId: domainSelectorId, children: jsx$1(SliderDomainSelector, { value: domainType || DEFAULT_RASTER_DOMAIN_TYPE, inputId: domainSelectorId, handleChange: (value2) => {
|
|
270975
271085
|
handleDomainChange(value2);
|
|
270976
271086
|
} }) }) })] }) : null, !use3d && jsx$1(Grid$1, { children: jsx$1(LayerOption, { name: "Opacity", inputId: opacitySliderId, children: jsx$1(OpacitySlider, { value: opacity2, handleChange: handleOpacityChange, inputId: opacitySliderId }) }) }), shouldShowTransparentColor && !use3d && jsx$1(Grid$1, { children: jsx$1(LayerOption, { name: "Zero Transparent", inputId: zeroTransparentId, children: jsx$1(TransparentColorCheckbox, { value: transparentColor, handleChange: handleTransparentColorChange, inputId: zeroTransparentId }) }) })] });
|
|
270977
271087
|
}
|
|
@@ -271068,7 +271178,7 @@ const buttonStyles = {
|
|
|
271068
271178
|
fontWeight: 400
|
|
271069
271179
|
};
|
|
271070
271180
|
function LayerController$1(props) {
|
|
271071
|
-
const { layer, name: name2, loader: loader2, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth, photometricInterpretation, shouldShowRemoveLayerButton } = props;
|
|
271181
|
+
const { layer, name: name2, loader: loader2, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth, photometricInterpretation, shouldShowRemoveLayerButton, channelsSortOrder, setChannelsSortOrder } = props;
|
|
271072
271182
|
const { colormap, opacity: opacity2, channels: channels2, transparentColor, renderingMode, xSlice, ySlice, zSlice, resolution, use3d, modelMatrix: modelMatrix2 } = layer;
|
|
271073
271183
|
const channelRef = useRef(channels2);
|
|
271074
271184
|
useEffect(() => {
|
|
@@ -271252,7 +271362,7 @@ function LayerController$1(props) {
|
|
|
271252
271362
|
};
|
|
271253
271363
|
return jsx$1(
|
|
271254
271364
|
ChannelController,
|
|
271255
|
-
{ dimName: channelLabel, visibility: c2.visible, selectionIndex: c2.selection[channelLabel], slider: c2.slider, color: c2.color, channels: channels2, channelId, domainType, loader: loader2, globalLabelValues, theme, channelOptions, colormapOn: Boolean(colormap), handlePropertyChange: handleChannelPropertyChange, handleChannelRemove, handleIQRUpdate, setRasterLayerCallback: setImageLayerCallback, isLoading: areLayerChannelsLoading[channelId], use3d },
|
|
271365
|
+
{ dimName: channelLabel, visibility: c2.visible, selectionIndex: c2.selection[channelLabel], slider: c2.slider, color: c2.color, channels: channels2, channelId, domainType, loader: loader2, globalLabelValues, theme, channelOptions, colormapOn: Boolean(colormap), handlePropertyChange: handleChannelPropertyChange, handleChannelRemove, handleIQRUpdate, setRasterLayerCallback: setImageLayerCallback, isLoading: areLayerChannelsLoading[channelId], use3d, channelsSortOrder },
|
|
271256
271366
|
`channel-controller-${channelId}`
|
|
271257
271367
|
);
|
|
271258
271368
|
}
|
|
@@ -271298,7 +271408,9 @@ function LayerController$1(props) {
|
|
|
271298
271408
|
setViewState,
|
|
271299
271409
|
spatialHeight,
|
|
271300
271410
|
spatialWidth,
|
|
271301
|
-
modelMatrix: modelMatrix2
|
|
271411
|
+
modelMatrix: modelMatrix2,
|
|
271412
|
+
channelsSortOrder,
|
|
271413
|
+
handleChannelsSortOrderChange: setChannelsSortOrder
|
|
271302
271414
|
}), photometricInterpretation === "RGB" ? null : channelControllers, photometricInterpretation === "RGB" ? null : jsx$1(Button, { disabled: channels2.length === MAX_CHANNELS$1, onClick: handleChannelAdd, fullWidth: true, variant: "outlined", style: buttonStyles, startIcon: jsx$1(AddIcon, {}), size: "small", children: "Add Channel" })] });
|
|
271303
271415
|
return jsxs(Accordion, { slotProps: {
|
|
271304
271416
|
root: { elevation: 4, className: controllerSectionClasses.accordionRoot }
|
|
@@ -271328,7 +271440,7 @@ function LayerController$1(props) {
|
|
|
271328
271440
|
minWidth: "50%"
|
|
271329
271441
|
} })] }), jsx$1(TabPanel, { value: tab2, index: 0, children: FullController }), jsx$1(TabPanel, { value: tab2, index: 1, style: { marginTop: 4 }, children: jsx$1(VolumeOptions, { loader: loader2, handleSlicerSetting, handleRenderingModeChange: setRenderingMode, renderingMode, xSlice, ySlice, zSlice, use3d, setViewState, spatialHeight, spatialWidth, modelMatrix: modelMatrix2 }) })] }) : FullController, shouldShowRemoveLayerButton ? jsx$1(Button, { onClick: handleLayerRemove, fullWidth: true, variant: "outlined", style: buttonStyles, size: "small", children: "Remove Image Layer" }) : null] })] });
|
|
271330
271442
|
}
|
|
271331
|
-
const useStyles$
|
|
271443
|
+
const useStyles$j = makeStyles()(() => ({
|
|
271332
271444
|
addButton: {
|
|
271333
271445
|
marginTop: "10px",
|
|
271334
271446
|
marginBottom: "10px",
|
|
@@ -271340,7 +271452,7 @@ function ImageAddIcon() {
|
|
|
271340
271452
|
}
|
|
271341
271453
|
function ImageAddButton({ imageOptions, handleImageAdd }) {
|
|
271342
271454
|
const [open2, setOpen] = useState(false);
|
|
271343
|
-
const { classes: classes2 } = useStyles$
|
|
271455
|
+
const { classes: classes2 } = useStyles$j();
|
|
271344
271456
|
const handleAdd = (imgData) => {
|
|
271345
271457
|
setOpen((prev2) => !prev2);
|
|
271346
271458
|
handleImageAdd(imgData);
|
|
@@ -271399,6 +271511,8 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271399
271511
|
spatialLayout,
|
|
271400
271512
|
handleImageAdd,
|
|
271401
271513
|
enableLayerButtonsWithOneLayer,
|
|
271514
|
+
channelsSortOrder,
|
|
271515
|
+
setChannelsSortOrder,
|
|
271402
271516
|
helpText
|
|
271403
271517
|
} = props;
|
|
271404
271518
|
const shouldShowImageLayerButton = Boolean(enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1);
|
|
@@ -271454,7 +271568,9 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271454
271568
|
areLayerChannelsLoading,
|
|
271455
271569
|
spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
|
|
271456
271570
|
spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
|
|
271457
|
-
shouldShowRemoveLayerButton: shouldShowImageLayerButton
|
|
271571
|
+
shouldShowRemoveLayerButton: shouldShowImageLayerButton,
|
|
271572
|
+
channelsSortOrder,
|
|
271573
|
+
setChannelsSortOrder
|
|
271458
271574
|
}) },
|
|
271459
271575
|
`${dataset}-raster-${index2}-${i2}`
|
|
271460
271576
|
) : null;
|
|
@@ -271511,7 +271627,9 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271511
271627
|
areLayerChannelsLoading,
|
|
271512
271628
|
spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
|
|
271513
271629
|
spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
|
|
271514
|
-
shouldShowRemoveLayerButton: shouldShowImageLayerButton
|
|
271630
|
+
shouldShowRemoveLayerButton: shouldShowImageLayerButton,
|
|
271631
|
+
channelsSortOrder,
|
|
271632
|
+
setChannelsSortOrder
|
|
271515
271633
|
}) },
|
|
271516
271634
|
`${dataset}-raster-${index2}-${i2}`
|
|
271517
271635
|
) : null;
|
|
@@ -271520,7 +271638,7 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271520
271638
|
function LayerControllerSubscriber$1(props) {
|
|
271521
271639
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, helpText = ViewHelpMapping.LAYER_CONTROLLER } = props;
|
|
271522
271640
|
const loaders = useLoaders();
|
|
271523
|
-
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, photometricInterpretation: photometricInterpretationFromCoordination }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.LAYER_CONTROLLER], coordinationScopes);
|
|
271641
|
+
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, photometricInterpretation: photometricInterpretationFromCoordination, spatialChannelsSortOrder: channelsSortOrder }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, setSpatialChannelsSortOrder: setChannelsSortOrder }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.LAYER_CONTROLLER], coordinationScopes);
|
|
271524
271642
|
const [{ imageLayerCallbacks, areLoadingImageChannels, segmentationLayerCallbacks, areLoadingSegmentationChannels }, { setImageLayerCallbacks, setAreLoadingImageChannels, setSegmentationLayerCallbacks, setAreLoadingSegmentationChannels }] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
271525
271643
|
const [spatialLayout] = useComponentLayout("spatial", ["spatialImageLayer"], coordinationScopes);
|
|
271526
271644
|
const layerControllerRef = useRef();
|
|
@@ -271609,6 +271727,8 @@ function LayerControllerSubscriber$1(props) {
|
|
|
271609
271727
|
handleRasterLayerChange,
|
|
271610
271728
|
handleRasterLayerRemove,
|
|
271611
271729
|
photometricInterpretation,
|
|
271730
|
+
channelsSortOrder,
|
|
271731
|
+
setChannelsSortOrder,
|
|
271612
271732
|
obsSegmentationsType,
|
|
271613
271733
|
segmentationLayerLoaders,
|
|
271614
271734
|
segmentationLayerMeta,
|
|
@@ -271702,7 +271822,7 @@ const channelControlCellSx = {
|
|
|
271702
271822
|
}
|
|
271703
271823
|
};
|
|
271704
271824
|
const channelSpacerCellSx = { flexShrink: 0, minWidth: "44px" };
|
|
271705
|
-
const useStyles$
|
|
271825
|
+
const useStyles$i = makeStyles()(() => ({
|
|
271706
271826
|
colorPickerPaper: {
|
|
271707
271827
|
overflow: "hidden",
|
|
271708
271828
|
"& > ul": {
|
|
@@ -271760,7 +271880,7 @@ function ChannelColorPickerMenu(props) {
|
|
|
271760
271880
|
setColor2([rgb2.r, rgb2.g, rgb2.b]);
|
|
271761
271881
|
}
|
|
271762
271882
|
}
|
|
271763
|
-
const { classes: classes2 } = useStyles$
|
|
271883
|
+
const { classes: classes2 } = useStyles$i();
|
|
271764
271884
|
const currentColor = color2 ? colorArrayToString(color2) : colorArrayToString(getDefaultColor(theme));
|
|
271765
271885
|
const isWritable = typeof setColor2 === "function";
|
|
271766
271886
|
const derivedOpen = isWritable ? isStaticColor && visible ? open2 : false : false;
|
|
@@ -271768,7 +271888,7 @@ function ChannelColorPickerMenu(props) {
|
|
|
271768
271888
|
[classes2.colorIconOutline]: theme !== "dark" && isEqual$3(color2, [255, 255, 255])
|
|
271769
271889
|
}), style: { backgroundColor: currentColor } }) : isColormap && visible && featureValueColormap ? jsx$1("div", { className: classes2.colorIcon, children: jsx$1("svg", { width: "18", height: "18", children: jsx$1("image", { x: 0, y: 0, width: 18, height: 18, preserveAspectRatio: "none", href: getXlinkHref(featureValueColormap), clipPath: "inset(0% round 4px)" }) }) }) : jsx$1("div", { className: classes2.colorIcon }), buttonClassName: classes2.colorIconButton, withPaper: true, paperClassName: classes2.colorPickerPaper, "aria-label": "Open color picker menu", children: jsx$1(Twitter$1, { className: classes2.colorPicker, disableAlpha: true, width: 108, triangle: "hide", colors: defaultPalette, color: currentColor, onChangeComplete: handleColorChange }) });
|
|
271770
271890
|
}
|
|
271771
|
-
const useStyles$
|
|
271891
|
+
const useStyles$h = makeStyles()(() => ({
|
|
271772
271892
|
layerTypeSpotIcon: {
|
|
271773
271893
|
height: "100%",
|
|
271774
271894
|
marginLeft: "1px",
|
|
@@ -271781,7 +271901,7 @@ const useStyles$i = makeStyles()(() => ({
|
|
|
271781
271901
|
function SpotLayerEllipsisMenu(props) {
|
|
271782
271902
|
const { strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
271783
271903
|
const [open2, setOpen] = useState(false);
|
|
271784
|
-
const { classes: classes2 } = useStyles$
|
|
271904
|
+
const { classes: classes2 } = useStyles$h();
|
|
271785
271905
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
271786
271906
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271787
271907
|
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
@@ -271803,7 +271923,7 @@ function SpotLayerController(props) {
|
|
|
271803
271923
|
const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
|
|
271804
271924
|
const isStaticColor = obsColorEncoding === "spatialLayerColor";
|
|
271805
271925
|
const isColormap = obsColorEncoding === "geneSelection";
|
|
271806
|
-
const { classes: classes2 } = useStyles$
|
|
271926
|
+
const { classes: classes2 } = useStyles$h();
|
|
271807
271927
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
271808
271928
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271809
271929
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -271815,7 +271935,7 @@ function SpotLayerController(props) {
|
|
|
271815
271935
|
justifyContent: "space-between"
|
|
271816
271936
|
}, children: [jsx$1(Grid$1, { size: 1, children: jsx$1(Button, { onClick: handleVisibleChange, className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle spot layer visibility", children: jsx$1(Visibility$1, {}) }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(ChannelColorPickerMenu, { theme, color: color2, setColor: setColor2, palette, isStaticColor, isColormap, featureValueColormap, visible }) }), jsx$1(Grid$1, { size: 6, children: jsx$1(Typography, { className: menuClasses.imageLayerName, children: label2 }) }), jsx$1(Grid$1, { size: 2, children: jsx$1(Slider, { value: opacity2, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": `Adjust opacity for layer ${label2}` }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SpotLayerEllipsisMenu, { filled, setFilled, strokeWidth, setStrokeWidth, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SvgSpots, { className: classes2.layerTypeSpotIcon }) })] }) }) });
|
|
271817
271937
|
}
|
|
271818
|
-
const useStyles$
|
|
271938
|
+
const useStyles$g = makeStyles()(() => ({
|
|
271819
271939
|
layerFeatureControllerGrid: {
|
|
271820
271940
|
padding: "0",
|
|
271821
271941
|
flexWrap: "nowrap"
|
|
@@ -271876,7 +271996,7 @@ function LayerPerFeatureController(props) {
|
|
|
271876
271996
|
]);
|
|
271877
271997
|
}
|
|
271878
271998
|
}, [featureName, featureColor, setFeatureColor, featureColorIndex]);
|
|
271879
|
-
const { classes: classes2 } = useStyles$
|
|
271999
|
+
const { classes: classes2 } = useStyles$g();
|
|
271880
272000
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
271881
272001
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271882
272002
|
const [open2, setOpen] = useState(false);
|
|
@@ -271935,7 +272055,7 @@ function LayerPerFeatureController(props) {
|
|
|
271935
272055
|
justifyContent: "space-between"
|
|
271936
272056
|
}, children: jsx$1(LinearProgress, { variant: loadingDoneFraction === 0 ? "indeterminate" : "determinate", value: loadingDoneFraction * 100 }) }) : null] }) }, featureName);
|
|
271937
272057
|
}
|
|
271938
|
-
const useStyles$
|
|
272058
|
+
const useStyles$f = makeStyles()(() => ({
|
|
271939
272059
|
pointLayerButton: {
|
|
271940
272060
|
borderStyle: "dashed",
|
|
271941
272061
|
marginTop: "10px",
|
|
@@ -272007,7 +272127,7 @@ function PointLayerController(props) {
|
|
|
272007
272127
|
} else if (!usesLayerColor) {
|
|
272008
272128
|
colorTooltip = "The layer color is not used by the current Color Encoding mode.";
|
|
272009
272129
|
}
|
|
272010
|
-
const { classes: classes2 } = useStyles$
|
|
272130
|
+
const { classes: classes2 } = useStyles$f();
|
|
272011
272131
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
272012
272132
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272013
272133
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -272043,7 +272163,7 @@ function PointLayerController(props) {
|
|
|
272043
272163
|
justifyContent: "space-between"
|
|
272044
272164
|
}, children: [jsx$1(Grid$1, { size: 1, children: jsx$1(Button, { onClick: () => setFeatureFilterMode(featureFilterMode === "featureSelection" ? null : "featureSelection"), className: menuClasses.imageLayerVisibleButton, "aria-label": "Toggle visibility of unselected points", children: featureFilterMode === "featureSelection" ? jsx$1(VisibilityOff, {}) : jsx$1(Visibility, {}) }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(ChannelColorPickerMenu, { theme, color: getDefaultColor(theme), setColor: null, isStaticColor: true, isColormap: false, visible: true }) }), jsx$1(Grid$1, { size: 6, children: jsx$1(Typography, { className: menuClasses.imageLayerName, children: "Unselected" }) }), jsx$1(Grid$1, { size: 2, sx: { paddingRight: "12px", overflow: "visible" }, children: jsx$1(Slider, { value: spatialLayerOpacityUnselected ?? 0.25, min: 0, max: 1, step: 1e-3, onChange: handleUnselectedOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", "aria-label": "Adjust opacity for unselected layer" }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(SvgPoints, { className: classes2.layerTypePointIcon }) })] }) }) })] }) : null] });
|
|
272045
272165
|
}
|
|
272046
|
-
const useStyles$
|
|
272166
|
+
const useStyles$e = makeStyles()(() => ({
|
|
272047
272167
|
// Cap the channel name's width; imageLayerName ellipsizes the overflow.
|
|
272048
272168
|
channelName: {
|
|
272049
272169
|
overflow: "hidden",
|
|
@@ -272062,7 +272182,7 @@ const useStyles$f = makeStyles()(() => ({
|
|
|
272062
272182
|
function SegmentationChannelEllipsisMenu(props) {
|
|
272063
272183
|
const { obsType, featureType, featureValueType, strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
272064
272184
|
const [open2, setOpen] = useState(false);
|
|
272065
|
-
const { classes: classes2 } = useStyles$
|
|
272185
|
+
const { classes: classes2 } = useStyles$e();
|
|
272066
272186
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
272067
272187
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272068
272188
|
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
@@ -272081,7 +272201,7 @@ function SegmentationChannelController(props) {
|
|
|
272081
272201
|
const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
|
|
272082
272202
|
const isStaticColor = obsColorEncoding === "spatialChannelColor";
|
|
272083
272203
|
const isColormap = obsColorEncoding === "geneSelection";
|
|
272084
|
-
const { classes: classes2 } = useStyles$
|
|
272204
|
+
const { classes: classes2 } = useStyles$e();
|
|
272085
272205
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
272086
272206
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272087
272207
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -273324,7 +273444,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
273324
273444
|
function useQuery(options, queryClient) {
|
|
273325
273445
|
return useBaseQuery(options, QueryObserver);
|
|
273326
273446
|
}
|
|
273327
|
-
const useStyles$
|
|
273447
|
+
const useStyles$d = makeStyles()(() => ({
|
|
273328
273448
|
channelMenuButton: {
|
|
273329
273449
|
backgroundColor: "transparent",
|
|
273330
273450
|
padding: "3px 0",
|
|
@@ -273338,7 +273458,7 @@ const useStyles$e = makeStyles()(() => ({
|
|
|
273338
273458
|
function ChannelOptions(props) {
|
|
273339
273459
|
const { onRemove: onRemove2, onResetWindowUsingIQR, showValueExtent, setShowValueExtent, numResolutions, spatialMaxResolution, setSpatialMaxResolution } = props;
|
|
273340
273460
|
const [open2, setOpen] = useState(false);
|
|
273341
|
-
const { classes: classes2 } = useStyles$
|
|
273461
|
+
const { classes: classes2 } = useStyles$d();
|
|
273342
273462
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
273343
273463
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273344
273464
|
function handleRemove() {
|
|
@@ -273351,7 +273471,7 @@ function ChannelOptions(props) {
|
|
|
273351
273471
|
const domainTypeId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273352
273472
|
return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, { fontSize: "small" }), buttonClassName: classes2.channelMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, placement: "bottom-end", withPaper: true, "aria-label": "Open channel options menu", children: [jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: domainTypeId, children: "Best Resolution: " }), jsx$1(Slider, { value: spatialMaxResolution || 1, valueLabelDisplay: "auto", onChange: (e3, v) => setSpatialMaxResolution(v), min: 1, max: numResolutions - 1, step: 1, orientation: "horizontal" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: domainTypeId, children: "Slider Extent: " }), jsxs(NativeSelect, { onChange: handleDomainTypeChange, value: showValueExtent ? "Value Min/Max" : "Dtype Min/Max", inputProps: { id: domainTypeId, "aria-label": "Slider extent selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "Value Min/Max", children: "Value Min/Max" }), jsx$1("option", { value: "Dtype Min/Max", children: "Dtype Min/Max" })] })] }), jsx$1(MenuItem, { dense: true, disableGutters: true, component: "button", onClick: onResetWindowUsingIQR, className: classes2.menuItemButton, "aria-label": "Click to use IQR for channel", children: "Reset window using IQR" }), jsx$1(MenuItem, { dense: true, disableGutters: true, component: "button", onClick: handleRemove, className: classes2.menuItemButton, "aria-label": "Click to remove channel", children: "Remove channel" })] });
|
|
273353
273473
|
}
|
|
273354
|
-
const useStyles$
|
|
273474
|
+
const useStyles$c = makeStyles()(() => ({
|
|
273355
273475
|
channelSlider: {
|
|
273356
273476
|
marginTop: "7px"
|
|
273357
273477
|
}
|
|
@@ -273361,7 +273481,7 @@ function ChannelSlider(props) {
|
|
|
273361
273481
|
const rgbColor = toRgbUIString(colormapOn, color2, theme);
|
|
273362
273482
|
const dtype = image2?.getDtype();
|
|
273363
273483
|
const fullDomain = dtype ? DOMAINS[dtype] : [0, 0];
|
|
273364
|
-
const { classes: classes2 } = useStyles$
|
|
273484
|
+
const { classes: classes2 } = useStyles$c();
|
|
273365
273485
|
useEffect(() => {
|
|
273366
273486
|
if (!window2 && !disabled && Array.isArray(minMaxDomain?.upperThreeQuarters)) {
|
|
273367
273487
|
setWindow2(minMaxDomain?.upperThreeQuarters);
|
|
@@ -273376,7 +273496,7 @@ function ChannelSlider(props) {
|
|
|
273376
273496
|
return `${labelPrefix} for ${rgbColor} colormap channel`;
|
|
273377
273497
|
}, getAriaValueText: () => `Current colormap values: ${rgbColor}-${window2}`, min: min2, max: max2, step, orientation: "horizontal", className: classes2.channelSlider, style: { color: rgbColor }, disabled });
|
|
273378
273498
|
}
|
|
273379
|
-
const useStyles$
|
|
273499
|
+
const useStyles$b = makeStyles()(() => ({
|
|
273380
273500
|
visibilityCheckbox: {
|
|
273381
273501
|
padding: "10px 0"
|
|
273382
273502
|
}
|
|
@@ -273390,10 +273510,10 @@ function getCheckboxColor(colormapOn, color2, theme) {
|
|
|
273390
273510
|
function ChannelVisibilityCheckbox(props) {
|
|
273391
273511
|
const { color: color2, visible, setVisible, disabled, theme, colormapOn } = props;
|
|
273392
273512
|
const rgbColor = getCheckboxColor(colormapOn, color2, theme);
|
|
273393
|
-
const { classes: classes2 } = useStyles$
|
|
273513
|
+
const { classes: classes2 } = useStyles$b();
|
|
273394
273514
|
return jsx$1(Checkbox$1, { onChange: (e3, v) => setVisible(v), checked: visible, disabled, className: classes2.visibilityCheckbox, style: { color: rgbColor, "&$checked": { color: rgbColor } }, slotProps: { input: { "aria-label": "Toggle channel visibility" } } });
|
|
273395
273515
|
}
|
|
273396
|
-
const useStyles$
|
|
273516
|
+
const useStyles$a = makeStyles()(() => ({
|
|
273397
273517
|
oneLineChannelSelect: {
|
|
273398
273518
|
width: "90%",
|
|
273399
273519
|
marginLeft: "5%",
|
|
@@ -273402,21 +273522,13 @@ const useStyles$b = makeStyles()(() => ({
|
|
|
273402
273522
|
}));
|
|
273403
273523
|
function ChannelSelectionDropdown(props) {
|
|
273404
273524
|
const { featureIndex, channelsSortOrder, targetC, setTargetC, setWindow: setWindow2, disabled } = props;
|
|
273405
|
-
const { classes: classes2 } = useStyles$
|
|
273525
|
+
const { classes: classes2 } = useStyles$a();
|
|
273406
273526
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
273407
273527
|
function handleChange(event2) {
|
|
273408
273528
|
setTargetC(event2.target.value === "" ? null : Number(event2.target.value));
|
|
273409
273529
|
setWindow2(null);
|
|
273410
273530
|
}
|
|
273411
|
-
const sortedOptions = useMemo$1(() =>
|
|
273412
|
-
if (!Array.isArray(featureIndex))
|
|
273413
|
-
return [];
|
|
273414
|
-
const options = featureIndex.map((channelName, channelIndex) => ({ channelName, channelIndex }));
|
|
273415
|
-
if (channelsSortOrder === "alphabetical") {
|
|
273416
|
-
return options.sort((a2, b2) => a2.channelName.localeCompare(b2.channelName, void 0, { numeric: true, sensitivity: "base" }));
|
|
273417
|
-
}
|
|
273418
|
-
return options;
|
|
273419
|
-
}, [featureIndex, channelsSortOrder]);
|
|
273531
|
+
const sortedOptions = useMemo$1(() => getSortedChannelOptions(featureIndex, channelsSortOrder), [featureIndex, channelsSortOrder]);
|
|
273420
273532
|
return Array.isArray(featureIndex) ? jsx$1(NativeSelect, { classes: { root: selectClasses2.selectRoot }, className: classes2.oneLineChannelSelect, value: targetC === null ? "" : targetC, onChange: handleChange, inputProps: { "aria-label": "Channel selector" }, children: sortedOptions.map(({ channelName, channelIndex }) => jsx$1("option", { disabled, value: channelIndex, children: channelName }, `${channelName}-${channelIndex}`)) }) : null;
|
|
273421
273533
|
}
|
|
273422
273534
|
function ImageChannelController(props) {
|
|
@@ -273464,7 +273576,7 @@ function ImageChannelController(props) {
|
|
|
273464
273576
|
const selection = {
|
|
273465
273577
|
t: ctx.queryKey[2],
|
|
273466
273578
|
c: ctx.queryKey[3],
|
|
273467
|
-
z:
|
|
273579
|
+
z: ctx.meta.image?.getClampedZIndex(ctx.queryKey[4]) ?? 0
|
|
273468
273580
|
};
|
|
273469
273581
|
const stats = await getMultiSelectionStats({
|
|
273470
273582
|
loader: loader2,
|
|
@@ -273564,7 +273676,7 @@ function LoadingStatusIndicator(props) {
|
|
|
273564
273676
|
mb: 0.5
|
|
273565
273677
|
}, children: jsx$1(LinearProgress, { variant: "determinate", value: percentage }) })] });
|
|
273566
273678
|
}
|
|
273567
|
-
const useStyles$
|
|
273679
|
+
const useStyles$9 = makeStyles()(() => ({
|
|
273568
273680
|
imageLayerButton: {
|
|
273569
273681
|
borderStyle: "dashed",
|
|
273570
273682
|
marginTop: "10px",
|
|
@@ -273666,7 +273778,7 @@ function ImageLayerEllipsisMenu(props) {
|
|
|
273666
273778
|
...lodSliderRangeConfig,
|
|
273667
273779
|
inputMode: "numeric",
|
|
273668
273780
|
pattern: "[0-9]*"
|
|
273669
|
-
} })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapId, children: "Colormap: " }), jsxs(NativeSelect, { disabled: photometricInterpretation === "RGB", onChange: handleColormapChange, value: colormap === null ? "" : colormap, inputProps: { id: colormapId, "aria-label": "Colormap selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "None", value: "", children: "None" }), COLORMAP_OPTIONS.map((name2) => jsx$1("option", { value: name2, children: name2 }, name2))] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: interpretationId, children: "Photometric Interpretation: " }), jsxs(NativeSelect, { onChange: handleInterpretationChange, value: photometricInterpretation, inputProps: { id: interpretationId, "aria-label": "Photometric interpretation selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "RGB", value: "RGB", children: "RGB" }), channelScopes.length > 0 ? jsx$1("option", { "aria-label": "BlackIsZero", value: "BlackIsZero", children: "BlackIsZero" }) : null] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: transparentId, children: "Zero Transparent: " }), jsx$1(Checkbox$1, { color: "primary", checked: spatialLayerTransparentColor !== null, onChange: (e3, v) => setSpatialLayerTransparentColor(v ? [0, 0, 0] : null), slotProps: { input: { id: transparentId, "aria-label": "Render zero-value pixels as transparent" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: volumetricId, children: "Volumetric Rendering: " }), jsxs(NativeSelect, { onChange: handleVolumetricChange, value: volumetricRenderingAlgorithm, inputProps: { id: volumetricId, "aria-label": "Volumetric rendering algorithm selector" }, classes: { root: selectClasses2.selectRoot }, disabled: !is3dMode, children: [jsx$1("option", { "aria-label": "Additive", value: "additive", children: "Additive" }), jsx$1("option", { "aria-label": "Maximum Intensity Projection", value: "maximumIntensityProjection", children: "Maximum Intensity Projection" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: resolutionId, children: "Volume Resolution: " }), jsxs(NativeSelect, { disabled: !is3dMode || !isMultiResolution, onChange: handleResolutionChange, value: spatialTargetResolution === null ? "auto" : spatialTargetResolution, inputProps: { id: resolutionId, "aria-label": "Volumetric resolution selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "auto", children: "Auto" }), Array.isArray(multiResolutionStats) ? multiResolutionStats.map((stats, resolution) => stats.canLoad ? jsx$1("option", { value: resolution, children: `3D: ${resolution}x Downsampled, ~${formatBytes(stats.totalBytes)} per channel, (${stats.height}, ${stats.width}, ${stats.depthDownsampled})` }, `(${stats.height}, ${stats.width}, ${stats.depthDownsampled})`) : null) : null] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsx$1(Checkbox$1, { color: "primary", checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Render pixel value tooltips" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelsVisibleId, children: "Channel Labels Visible: " }), jsx$1(Checkbox$1, { disabled: photometricInterpretation === "RGB", color: "primary", checked: channelLabelsVisible, onChange: (e3, v) => setChannelLabelsVisible(v), slotProps: { input: { id: channelLabelsVisibleId, "aria-label": "Render channel labels" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelsOrientationId, children: "Channel Labels Orientation: " }), jsxs(NativeSelect, { disabled: photometricInterpretation === "RGB", onChange: handleChannelLabelsOrientationChange, value: channelLabelsOrientation, inputProps: { id: channelLabelsOrientationId, "aria-label": "Channel labels orientation selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "Vertical", value: "vertical", children: "Vertical" }), jsx$1("option", { "aria-label": "Horizontal", value: "horizontal", children: "Horizontal" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelSizeId, children: "Channel Labels Size: " }), jsx$1(Slider, { disabled: photometricInterpretation === "RGB", value: channelLabelSize, min: 8, max: 36, step: 1, onChange: (e3, v) => setChannelLabelSize(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: channelLabelSizeId, "aria-label": "Channel labels text size slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelsSortOrderId, children: "Channel Ordering: " }),
|
|
273781
|
+
} })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapId, children: "Colormap: " }), jsxs(NativeSelect, { disabled: photometricInterpretation === "RGB", onChange: handleColormapChange, value: colormap === null ? "" : colormap, inputProps: { id: colormapId, "aria-label": "Colormap selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "None", value: "", children: "None" }), COLORMAP_OPTIONS.map((name2) => jsx$1("option", { value: name2, children: name2 }, name2))] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: interpretationId, children: "Photometric Interpretation: " }), jsxs(NativeSelect, { onChange: handleInterpretationChange, value: photometricInterpretation, inputProps: { id: interpretationId, "aria-label": "Photometric interpretation selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "RGB", value: "RGB", children: "RGB" }), channelScopes.length > 0 ? jsx$1("option", { "aria-label": "BlackIsZero", value: "BlackIsZero", children: "BlackIsZero" }) : null] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: transparentId, children: "Zero Transparent: " }), jsx$1(Checkbox$1, { color: "primary", checked: spatialLayerTransparentColor !== null, onChange: (e3, v) => setSpatialLayerTransparentColor(v ? [0, 0, 0] : null), slotProps: { input: { id: transparentId, "aria-label": "Render zero-value pixels as transparent" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: volumetricId, children: "Volumetric Rendering: " }), jsxs(NativeSelect, { onChange: handleVolumetricChange, value: volumetricRenderingAlgorithm, inputProps: { id: volumetricId, "aria-label": "Volumetric rendering algorithm selector" }, classes: { root: selectClasses2.selectRoot }, disabled: !is3dMode, children: [jsx$1("option", { "aria-label": "Additive", value: "additive", children: "Additive" }), jsx$1("option", { "aria-label": "Maximum Intensity Projection", value: "maximumIntensityProjection", children: "Maximum Intensity Projection" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: resolutionId, children: "Volume Resolution: " }), jsxs(NativeSelect, { disabled: !is3dMode || !isMultiResolution, onChange: handleResolutionChange, value: spatialTargetResolution === null ? "auto" : spatialTargetResolution, inputProps: { id: resolutionId, "aria-label": "Volumetric resolution selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "auto", children: "Auto" }), Array.isArray(multiResolutionStats) ? multiResolutionStats.map((stats, resolution) => stats.canLoad ? jsx$1("option", { value: resolution, children: `3D: ${resolution}x Downsampled, ~${formatBytes(stats.totalBytes)} per channel, (${stats.height}, ${stats.width}, ${stats.depthDownsampled})` }, `(${stats.height}, ${stats.width}, ${stats.depthDownsampled})`) : null) : null] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsVisibleId, children: "Tooltips Visible: " }), jsx$1(Checkbox$1, { color: "primary", checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsVisibleId, "aria-label": "Render pixel value tooltips" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelsVisibleId, children: "Channel Labels Visible: " }), jsx$1(Checkbox$1, { disabled: photometricInterpretation === "RGB", color: "primary", checked: channelLabelsVisible, onChange: (e3, v) => setChannelLabelsVisible(v), slotProps: { input: { id: channelLabelsVisibleId, "aria-label": "Render channel labels" } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelsOrientationId, children: "Channel Labels Orientation: " }), jsxs(NativeSelect, { disabled: photometricInterpretation === "RGB", onChange: handleChannelLabelsOrientationChange, value: channelLabelsOrientation, inputProps: { id: channelLabelsOrientationId, "aria-label": "Channel labels orientation selector" }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { "aria-label": "Vertical", value: "vertical", children: "Vertical" }), jsx$1("option", { "aria-label": "Horizontal", value: "horizontal", children: "Horizontal" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelLabelSizeId, children: "Channel Labels Size: " }), jsx$1(Slider, { disabled: photometricInterpretation === "RGB", value: channelLabelSize, min: 8, max: 36, step: 1, onChange: (e3, v) => setChannelLabelSize(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: channelLabelSizeId, "aria-label": "Channel labels text size slider" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, classes: menuClasses.menuItem, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: channelsSortOrderId, children: "Channel Ordering: " }), jsx$1(NativeSelect, { onChange: handleChannelsSortOrderChange, value: channelsSortOrder, inputProps: { id: channelsSortOrderId, "aria-label": "Channel sort order selector" }, classes: { root: selectClasses2.selectRoot }, children: CHANNELS_SORT_ORDER_OPTIONS.map(({ value: value2, label: label2 }) => jsx$1("option", { "aria-label": label2, value: value2, children: label2 }, value2)) })] })] });
|
|
273670
273782
|
}
|
|
273671
273783
|
function ImageLayerController(props) {
|
|
273672
273784
|
const {
|
|
@@ -273709,7 +273821,7 @@ function ImageLayerController(props) {
|
|
|
273709
273821
|
}, [visible, setVisible]);
|
|
273710
273822
|
const handleOpacityChange = useCallback((e3, v) => setOpacity2(v), [setOpacity2]);
|
|
273711
273823
|
const handleOpenChange = useCallback(() => setOpen((prev2) => !prev2), []);
|
|
273712
|
-
const { classes: classes2 } = useStyles$
|
|
273824
|
+
const { classes: classes2 } = useStyles$9();
|
|
273713
273825
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273714
273826
|
const { classes: controllerSectionClasses } = useControllerSectionStyles();
|
|
273715
273827
|
const isMultiChannel = photometricInterpretation !== "RGB";
|
|
@@ -273729,7 +273841,7 @@ function ImageLayerController(props) {
|
|
|
273729
273841
|
justifyContent: "space-between"
|
|
273730
273842
|
}, children: [jsx$1(Typography, { className: classes2.clippingPanesLabel, children: "Clipping planes:" }), jsx$1(Grid$1, { size: 12, className: classes2.clippingSliders, children: jsx$1(ClippingSliders, { image: image2, spatialSliceX, spatialSliceY, spatialSliceZ, setSpatialSliceX, setSpatialSliceY, setSpatialSliceZ }) }), jsx$1(LoadingStatusIndicator, { loadingProgress: volumeLoadingProgress, onStopLoading: onStopVolumeLoading, onRestartLoading: onRestartVolumeLoading, stillRef: volumeStillRef, spatialRenderingMode })] }) : null] }) });
|
|
273731
273843
|
}
|
|
273732
|
-
const useStyles$
|
|
273844
|
+
const useStyles$8 = makeStyles()((theme) => ({
|
|
273733
273845
|
dimensionsIcon: {
|
|
273734
273846
|
height: "40px",
|
|
273735
273847
|
width: "40px",
|
|
@@ -273753,7 +273865,7 @@ const useStyles$9 = makeStyles()((theme) => ({
|
|
|
273753
273865
|
function GlobalDimensionSlider(props) {
|
|
273754
273866
|
const { label: label2, targetValue, setTargetValue, min: min2 = 0, max: max2 = 0, spatialRenderingMode = null, setSpatialRenderingMode = null, enable3d = true } = props;
|
|
273755
273867
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
273756
|
-
const { classes: classes2 } = useStyles$
|
|
273868
|
+
const { classes: classes2 } = useStyles$8();
|
|
273757
273869
|
const isForZ = spatialRenderingMode !== null;
|
|
273758
273870
|
const is3dMode = spatialRenderingMode === "3D";
|
|
273759
273871
|
function handleRenderingModeChange(event2) {
|
|
@@ -273766,117 +273878,17 @@ function GlobalDimensionSlider(props) {
|
|
|
273766
273878
|
justifyContent: "space-between"
|
|
273767
273879
|
}, channelRowContainerSx], children: [jsx$1(Grid$1, { size: 1, sx: channelControlCellSx, children: jsx$1(SvgDimensions, { className: classes2.dimensionsIcon }) }), jsx$1(Grid$1, { size: 1, sx: channelSelectorCellSx, children: jsx$1(Typography, { className: classes2.dimensionLabel, children: label2 }) }), jsx$1(Grid$1, { size: 8, sx: channelSliderCellSx, children: !is3dMode ? jsx$1(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` }) : null }), jsx$1(Grid$1, { size: 2, sx: channelControlCellSx, children: isForZ && enable3d ? jsx$1(FormGroup, { row: true, className: classes2.switchFormGroup, children: jsx$1(FormControlLabel$1, { control: jsx$1(Switch, { color: "primary", checked: spatialRenderingMode === "3D", onChange: handleRenderingModeChange, name: "is3dMode" }), label: "3D" }) }) : null })] }) }) });
|
|
273768
273880
|
}
|
|
273769
|
-
const useStyles$8 = makeStyles()(() => ({
|
|
273770
|
-
layerTypeCentroidSegmentationIcon: {
|
|
273771
|
-
height: "100%",
|
|
273772
|
-
marginLeft: "1px",
|
|
273773
|
-
fill: "currentColor",
|
|
273774
|
-
fontSize: "24px",
|
|
273775
|
-
width: "50%",
|
|
273776
|
-
maxWidth: "24px"
|
|
273777
|
-
},
|
|
273778
|
-
divider: {
|
|
273779
|
-
width: "1px",
|
|
273780
|
-
height: "20px",
|
|
273781
|
-
background: "currentColor",
|
|
273782
|
-
flexShrink: 0,
|
|
273783
|
-
margin: "0 10px"
|
|
273784
|
-
},
|
|
273785
|
-
inlineLabel: {
|
|
273786
|
-
margin: "0px !important",
|
|
273787
|
-
lineHeight: 1,
|
|
273788
|
-
alignSelf: "center"
|
|
273789
|
-
},
|
|
273790
|
-
iconCell: {
|
|
273791
|
-
display: "flex",
|
|
273792
|
-
alignItems: "center",
|
|
273793
|
-
justifyContent: "center"
|
|
273794
|
-
}
|
|
273795
|
-
}));
|
|
273796
|
-
function CombinedEllipsisMenu(props) {
|
|
273797
|
-
const { obsType, featureType, featureValueType, filled, setFilled, strokeWidth, setStrokeWidth, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, setPointObsColorEncoding, setPointFeatureValueColormap, setPointFeatureValueColormapRange, onColorEncodingChange } = props;
|
|
273798
|
-
const [open2, setOpen] = useState(false);
|
|
273799
|
-
const { classes: selectClasses2 } = useSelectStyles();
|
|
273800
|
-
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273801
|
-
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273802
|
-
const strokeWidthId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273803
|
-
const colorEncodingId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273804
|
-
const colormapId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273805
|
-
const colormapRangeId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273806
|
-
const tooltipsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273807
|
-
const crosshairsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273808
|
-
const legendId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273809
|
-
return jsxs(PopperMenu, { open: open2, setOpen, buttonIcon: jsx$1(MoreVertIcon, {}), buttonClassName: menuClasses.imageLayerMenuButton, containerClassName: menuClasses.imageLayerPopperContainer, withPaper: true, getAriaLabel: () => "Open combined centroid and segmentation layer options menu", children: [jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: filledId, children: "Filled: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: filled, onChange: (e3, v) => setFilled(v), slotProps: { input: { id: filledId } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: strokeWidthId, children: "Stroke width:" }), jsx$1(Slider, { disabled: filled, value: strokeWidth, min: 0.01, max: 5, step: 0.01, onChange: (e3, v) => setStrokeWidth(v), className: menuClasses.menuItemSlider, orientation: "horizontal", id: strokeWidthId, getAriaLabel: () => "Stroke width" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colorEncodingId, children: "Color encoding: " }), jsxs(NativeSelect, { onChange: onColorEncodingChange, value: obsColorEncoding, inputProps: { id: colorEncodingId }, classes: { root: selectClasses2.selectRoot }, children: [jsx$1("option", { value: "spatialChannelColor", children: "Static Color" }), jsx$1("option", { value: "geneSelection", children: "Feature Value" }), jsx$1("option", { value: "cellSetSelection", children: "Set Selection" })] })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapId, children: "Colormap: " }), jsx$1(NativeSelect, { onChange: (e3) => {
|
|
273810
|
-
setFeatureValueColormap(e3.target.value);
|
|
273811
|
-
setPointFeatureValueColormap?.(e3.target.value);
|
|
273812
|
-
}, value: featureValueColormap, inputProps: { id: colormapId }, classes: { root: selectClasses2.selectRoot }, children: GLSL_COLORMAPS.map((cmap) => jsx$1("option", { value: cmap, children: cmap }, cmap)) })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: colormapRangeId, children: "Colormap range: " }), jsx$1(Slider, { disabled: obsColorEncoding !== "geneSelection", value: featureValueColormapRange, min: 0, max: 1, step: 0.01, onChange: (e3, v) => {
|
|
273813
|
-
setFeatureValueColormapRange(v);
|
|
273814
|
-
setPointFeatureValueColormapRange?.(v);
|
|
273815
|
-
}, className: menuClasses.menuItemSlider, orientation: "horizontal", id: colormapRangeId, getAriaLabel: (i2) => i2 === 0 ? "Low colormap range" : "High colormap range" })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: tooltipsId, children: "Tooltips visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipsVisible, onChange: (e3, v) => setTooltipsVisible(v), slotProps: { input: { id: tooltipsId } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: crosshairsId, children: "Crosshairs visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: tooltipCrosshairsVisible, onChange: (e3, v) => setTooltipCrosshairsVisible(v), slotProps: { input: { id: crosshairsId } } })] }), jsxs(MenuItem, { dense: true, disableGutters: true, children: [jsx$1("label", { className: menuClasses.imageLayerMenuLabel, htmlFor: legendId, children: "Legend visible: " }), jsx$1(Checkbox$1, { color: "primary", className: menuClasses.menuItemCheckbox, checked: legendVisible, onChange: (e3, v) => setLegendVisible(v), slotProps: { input: { id: legendId } } })] })] });
|
|
273816
|
-
}
|
|
273817
|
-
function SegmentationCentroidsController(props) {
|
|
273818
|
-
const { theme, segScope, segLayerCoordination, segChannelScopesByLayer, segChannelCoordination, pointScope, pointLayerCoordination } = props;
|
|
273819
|
-
const { classes: classes2 } = useStyles$8();
|
|
273820
|
-
const { classes: lcClasses } = useControllerSectionStyles();
|
|
273821
|
-
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273822
|
-
const channelScopes = segChannelScopesByLayer?.[segScope] ?? [];
|
|
273823
|
-
const primaryChanScope = channelScopes[0];
|
|
273824
|
-
const chanValues = segChannelCoordination[0]?.[segScope]?.[primaryChanScope] ?? {};
|
|
273825
|
-
const chanSetters = segChannelCoordination[1]?.[segScope]?.[primaryChanScope] ?? {};
|
|
273826
|
-
const { obsType, featureType, featureValueType, spatialChannelVisible: segVisible, spatialChannelOpacity: segOpacity, spatialChannelColor: segColor, spatialSegmentationFilled: filled, spatialSegmentationStrokeWidth: strokeWidth, obsColorEncoding, featureSelection, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = chanValues;
|
|
273827
|
-
const { setSpatialChannelVisible: setSegVisible, setSpatialChannelOpacity: setSegOpacity, setSpatialChannelColor: setSegColor, setSpatialSegmentationFilled: setFilled, setSpatialSegmentationStrokeWidth: setStrokeWidth, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = chanSetters;
|
|
273828
|
-
const pointValues = pointLayerCoordination[0]?.[pointScope] ?? {};
|
|
273829
|
-
const pointSetters = pointLayerCoordination[1]?.[pointScope] ?? {};
|
|
273830
|
-
const { spatialLayerVisible: pointVisible, spatialLayerOpacity: pointOpacity, spatialLayerColor: pointColor, obsColorEncoding: pointObsColorEncoding, spatialLayerLabel: pointSpatialLayerLabel, featureValueColormap: pointFeatureValueColormap } = pointValues;
|
|
273831
|
-
const { setSpatialLayerVisible: setPointVisible, setSpatialLayerOpacity: setPointOpacity, setSpatialLayerColor: setPointColor, setObsColorEncoding: setPointObsColorEncoding, setFeatureValueColormap: setPointFeatureValueColormap, setFeatureValueColormapRange: setPointFeatureValueColormapRange } = pointSetters;
|
|
273832
|
-
const sharedOpacity = segOpacity ?? 1;
|
|
273833
|
-
const segValues = segLayerCoordination[0]?.[segScope] ?? {};
|
|
273834
|
-
const { spatialLayerLabel: segSpatialLayerLabel } = segValues;
|
|
273835
|
-
const handleOpacityChange = useCallback((e3, v) => {
|
|
273836
|
-
setSegOpacity?.(v);
|
|
273837
|
-
setPointOpacity?.(v);
|
|
273838
|
-
}, [setSegOpacity, setPointOpacity]);
|
|
273839
|
-
const handleSegVisibleChange = useCallback(() => {
|
|
273840
|
-
setSegVisible?.(typeof segVisible === "boolean" ? !segVisible : false);
|
|
273841
|
-
}, [segVisible, setSegVisible]);
|
|
273842
|
-
const handlePointVisibleChange = useCallback(() => {
|
|
273843
|
-
setPointVisible?.(typeof pointVisible === "boolean" ? !pointVisible : false);
|
|
273844
|
-
}, [pointVisible, setPointVisible]);
|
|
273845
|
-
const handleColorEncodingChange = useCallback((e3) => {
|
|
273846
|
-
const val = e3.target.value;
|
|
273847
|
-
setObsColorEncoding(val);
|
|
273848
|
-
if (val === "geneSelection") {
|
|
273849
|
-
setPointObsColorEncoding?.("geneSelection");
|
|
273850
|
-
} else if (val === "cellSetSelection") {
|
|
273851
|
-
setPointObsColorEncoding?.("cellSetSelection");
|
|
273852
|
-
} else {
|
|
273853
|
-
setPointObsColorEncoding?.("spatialChannelColor");
|
|
273854
|
-
}
|
|
273855
|
-
}, [setObsColorEncoding, setPointObsColorEncoding]);
|
|
273856
|
-
const segVisibleSetting = typeof segVisible === "boolean" ? segVisible : true;
|
|
273857
|
-
const pointVisibleSetting = typeof pointVisible === "boolean" ? pointVisible : true;
|
|
273858
|
-
const SegVisibility = segVisibleSetting ? Visibility : VisibilityOff;
|
|
273859
|
-
const PointVisibility = pointVisibleSetting ? Visibility : VisibilityOff;
|
|
273860
|
-
const isStaticColor = obsColorEncoding === "spatialChannelColor";
|
|
273861
|
-
const isColormap = obsColorEncoding === "geneSelection";
|
|
273862
|
-
const pointIsStaticColor = pointObsColorEncoding === "spatialChannelColor";
|
|
273863
|
-
const pointIsColormap = pointObsColorEncoding === "geneSelection";
|
|
273864
|
-
return jsx$1(Grid$1, { className: lcClasses.layerControllerGrid, children: jsx$1(Paper, { elevation: 4, className: lcClasses.layerControllerRoot, children: jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
273865
|
-
justifyContent: "space-between",
|
|
273866
|
-
alignItems: "center"
|
|
273867
|
-
}, children: [jsxs(Grid$1, { size: "grow", style: { display: "flex", alignItems: "center", minWidth: 0 }, children: [jsx$1(Button, { onClick: handleSegVisibleChange, className: menuClasses.imageLayerVisibleButton, getAriaLabel: () => "Toggle mesh visibility", children: jsx$1(SegVisibility, {}) }), jsx$1(ChannelColorPickerMenu, { theme, color: segColor, setColor: setSegColor, isStaticColor, isColormap, featureValueColormap, visible: segVisibleSetting }), jsx$1(Typography, { className: `${menuClasses.imageLayerName} ${classes2.inlineLabel}`, children: segSpatialLayerLabel ?? "Cell" }), jsx$1("div", { className: classes2.divider }), jsx$1(Button, { onClick: handlePointVisibleChange, className: menuClasses.imageLayerVisibleButton, getAriaLabel: () => "Toggle centroid visibility", children: jsx$1(PointVisibility, {}) }), jsx$1(ChannelColorPickerMenu, { theme, color: pointColor, setColor: setPointColor, isStaticColor: pointIsStaticColor, isColormap: pointIsColormap, featureValueColormap: pointFeatureValueColormap, visible: pointVisibleSetting }), jsx$1(Typography, { className: `${menuClasses.imageLayerName} ${classes2.inlineLabel}`, children: pointSpatialLayerLabel ?? "Point" })] }), jsx$1(Grid$1, { size: 2, children: jsx$1(Slider, { value: sharedOpacity, min: 0, max: 1, step: 1e-3, onChange: handleOpacityChange, className: menuClasses.imageLayerOpacitySlider, orientation: "horizontal", getAriaLabel: () => "Adjust shared opacity" }) }), jsx$1(Grid$1, { size: 1, children: jsx$1(CombinedEllipsisMenu, { obsType, featureType, featureValueType, filled, setFilled, strokeWidth, setStrokeWidth, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible, setPointObsColorEncoding, setPointFeatureValueColormap, setPointFeatureValueColormapRange, onColorEncodingChange: handleColorEncodingChange }) }), jsx$1(Grid$1, { size: 1, className: classes2.iconCell, children: jsx$1(SvgVector, { className: classes2.layerTypeCentroidSegmentationIcon }) })] }) }) });
|
|
273868
|
-
}
|
|
273869
273881
|
function LayerController(props) {
|
|
273870
|
-
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, layerPerFeatureForPoints, globalDisable3d
|
|
273882
|
+
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, layerPerFeatureForPoints, globalDisable3d } = props;
|
|
273871
273883
|
const anyLayerHasT = Object.values(images || {}).some((image2) => image2?.image?.instance.hasTStack());
|
|
273872
273884
|
const anyLayerHasZ = Object.values(images || {}).some((image2) => image2?.image?.instance.hasZStack());
|
|
273873
273885
|
const maxT = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumT()), 1) - 1;
|
|
273874
273886
|
const maxZ = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumZ()), 1) - 1;
|
|
273875
273887
|
const reversedImageLayerScopes = useMemo$1(() => [...imageLayerScopes || []].reverse(), [imageLayerScopes]);
|
|
273876
273888
|
const reversedSpotLayerScopes = useMemo$1(() => [...spotLayerScopes || []].reverse(), [spotLayerScopes]);
|
|
273877
|
-
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].
|
|
273878
|
-
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].
|
|
273879
|
-
return jsxs("div", { children: [anyLayerHasZ ? jsx$1(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode, enable3d: !globalDisable3d }) : null, anyLayerHasT ? jsx$1(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null,
|
|
273889
|
+
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].reverse(), [pointLayerScopes]);
|
|
273890
|
+
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].reverse(), [segmentationLayerScopes]);
|
|
273891
|
+
return jsxs("div", { children: [anyLayerHasZ ? jsx$1(GlobalDimensionSlider, { label: "Z", targetValue: targetZ, setTargetValue: setTargetZ, max: maxZ, spatialRenderingMode, setSpatialRenderingMode, enable3d: !globalDisable3d }) : null, anyLayerHasT ? jsx$1(GlobalDimensionSlider, { label: "T", targetValue: targetT, setTargetValue: setTargetT, max: maxT }) : null, pointLayerScopes && reversedPointLayerScopes.map((layerScope) => jsx$1(PointLayerController, { theme, layerScope, layerCoordination: pointLayerCoordination[0][layerScope], setLayerCoordination: pointLayerCoordination[1][layerScope], pointMatrixIndicesData: pointMultiIndicesData?.[layerScope], tiledPointsLoadingProgress, layerPerFeatureForPoints }, layerScope)), spotLayerScopes && reversedSpotLayerScopes.map((layerScope) => jsx$1(SpotLayerController, { theme, layerScope, layerCoordination: spotLayerCoordination[0][layerScope], setLayerCoordination: spotLayerCoordination[1][layerScope] }, layerScope)), segmentationLayerScopes && reversedSegmentationLayerScopes.map((layerScope) => jsx$1(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) => jsx$1(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))] });
|
|
273880
273892
|
}
|
|
273881
273893
|
function LayerControllerSubscriber(props) {
|
|
273882
273894
|
const { coordinationScopes: coordinationScopesRaw, coordinationScopesBy: coordinationScopesByRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", uuid: uuid2, layerPerFeatureForPoints = false, globalDisable3d = false, cameraPresets, helpText = ViewHelpMapping.LAYER_CONTROLLER_BETA } = props;
|
|
@@ -274014,40 +274026,6 @@ function LayerControllerSubscriber(props) {
|
|
|
274014
274026
|
CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
274015
274027
|
CoordinationType$1.LEGEND_VISIBLE
|
|
274016
274028
|
], coordinationScopes, coordinationScopesBy, CoordinationType$1.POINT_LAYER);
|
|
274017
|
-
const centroidSegmentationPairs = React__default.useMemo(() => {
|
|
274018
|
-
const pairs = [];
|
|
274019
|
-
const pairedSegScopes = /* @__PURE__ */ new Set();
|
|
274020
|
-
const pairedPointScopes = /* @__PURE__ */ new Set();
|
|
274021
|
-
pointLayerScopes.forEach((pointScope) => {
|
|
274022
|
-
const pointCoord = pointLayerCoordination[0][pointScope];
|
|
274023
|
-
if (!pointCoord)
|
|
274024
|
-
return;
|
|
274025
|
-
const pointObsType = pointCoord[CoordinationType$1.OBS_TYPE];
|
|
274026
|
-
if (!pointObsType)
|
|
274027
|
-
return;
|
|
274028
|
-
const matchingSegScope = segmentationLayerScopes.find((segScope) => {
|
|
274029
|
-
if (pairedSegScopes.has(segScope))
|
|
274030
|
-
return false;
|
|
274031
|
-
const channelScopes = segmentationChannelScopesByLayer[segScope] || [];
|
|
274032
|
-
return channelScopes.some((chanScope) => {
|
|
274033
|
-
const chanCoord = segmentationChannelCoordination[0]?.[segScope]?.[chanScope];
|
|
274034
|
-
return chanCoord?.[CoordinationType$1.OBS_TYPE] === pointObsType;
|
|
274035
|
-
});
|
|
274036
|
-
});
|
|
274037
|
-
if (matchingSegScope) {
|
|
274038
|
-
pairs.push({ pointScope, segScope: matchingSegScope });
|
|
274039
|
-
pairedSegScopes.add(matchingSegScope);
|
|
274040
|
-
pairedPointScopes.add(pointScope);
|
|
274041
|
-
}
|
|
274042
|
-
});
|
|
274043
|
-
return { pairs, pairedSegScopes, pairedPointScopes };
|
|
274044
|
-
}, [
|
|
274045
|
-
pointLayerScopes,
|
|
274046
|
-
pointLayerCoordination,
|
|
274047
|
-
segmentationLayerScopes,
|
|
274048
|
-
segmentationChannelScopesByLayer,
|
|
274049
|
-
segmentationChannelCoordination
|
|
274050
|
-
]);
|
|
274051
274029
|
const [{ volumeLoadingProgress: volumeLoadingStatus, tiledPointsLoadingProgress }] = useAuxiliaryCoordination([
|
|
274052
274030
|
"spatialAcceleratedVolumeLoadingProgress",
|
|
274053
274031
|
"spatialTiledPointsLoadingProgress"
|
|
@@ -274075,7 +274053,7 @@ function LayerControllerSubscriber(props) {
|
|
|
274075
274053
|
imageDataStatus,
|
|
274076
274054
|
pointMultiIndicesDataStatus
|
|
274077
274055
|
]);
|
|
274078
|
-
return jsx$1(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, helpText, children: jsx$1(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, layerPerFeatureForPoints, globalDisable3d, volumeLoadingStatus, tiledPointsLoadingProgress
|
|
274056
|
+
return jsx$1(TitleInfo, { title: title2, isScroll: true, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, errors, helpText, children: jsx$1(LayerController, { theme, coordinationScopesRaw, segmentationLayerScopes, segmentationLayerCoordination, segmentationChannelScopesByLayer, segmentationChannelCoordination, images: imageData, imageLayerScopes, imageLayerCoordination, targetT, targetZ, setTargetT, setTargetZ, spatialRenderingMode, setSpatialRenderingMode, imageChannelScopesByLayer, imageChannelCoordination, spotLayerScopes, spotLayerCoordination, pointLayerScopes, pointLayerCoordination, pointMultiIndicesData, layerPerFeatureForPoints, globalDisable3d, volumeLoadingStatus, tiledPointsLoadingProgress }) });
|
|
274079
274057
|
}
|
|
274080
274058
|
const isIterable$2 = (obj) => Symbol.iterator in obj;
|
|
274081
274059
|
const hasIterableEntries = (value2) => (
|
|
@@ -275234,7 +275212,7 @@ const GEOMETRY_FIELDS = {
|
|
|
275234
275212
|
["Radius", [["radiusX", "rx"], ["radiusY", "ry"]]]
|
|
275235
275213
|
]
|
|
275236
275214
|
};
|
|
275237
|
-
function rgbToHex$
|
|
275215
|
+
function rgbToHex$1(rgb2) {
|
|
275238
275216
|
return `#${rgb2.slice(0, 3).map((c2) => Math.max(0, Math.min(255, Math.round(c2))).toString(16).padStart(2, "0")).join("")}`;
|
|
275239
275217
|
}
|
|
275240
275218
|
function hexToRgb(hex2) {
|
|
@@ -275265,7 +275243,7 @@ function ShapeEditor(props) {
|
|
|
275265
275243
|
const strokeColor = shape2.strokeColor ?? DEFAULT_SHAPE_STROKE_COLOR;
|
|
275266
275244
|
const measurement = getMeasurementLabel(shape2, null, viewType);
|
|
275267
275245
|
const numDigits = String(frames.length).length;
|
|
275268
|
-
return jsxs("div", { className: classes2.shapeEditor, children: [jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Label" }), jsx$1(TextField, { value: shape2.text ?? "", onChange: (e3) => onUpdate2({ text: e3.target.value || void 0 }), size: "small", variant: "standard", placeholder: "Label text", fullWidth: true, slotProps: { htmlInput: { className: classes2.inputText, "aria-label": "Label text" } } })] }), shape2.type === "line" && shape2.text ? jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Position" }), jsx$1(OptionButtons, { options: TEXT_POSITION_OPTIONS.map((p) => ({ value: p, label: p })), value: shape2.textPosition ?? "start", onChange: (textPosition) => onUpdate2({ textPosition }) })] }) : null, jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Stroke" }), jsx$1("input", { type: "color", className: classes2.colorSwatch, value: rgbToHex$
|
|
275246
|
+
return jsxs("div", { className: classes2.shapeEditor, children: [jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Label" }), jsx$1(TextField, { value: shape2.text ?? "", onChange: (e3) => onUpdate2({ text: e3.target.value || void 0 }), size: "small", variant: "standard", placeholder: "Label text", fullWidth: true, slotProps: { htmlInput: { className: classes2.inputText, "aria-label": "Label text" } } })] }), shape2.type === "line" && shape2.text ? jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Position" }), jsx$1(OptionButtons, { options: TEXT_POSITION_OPTIONS.map((p) => ({ value: p, label: p })), value: shape2.textPosition ?? "start", onChange: (textPosition) => onUpdate2({ textPosition }) })] }) : null, jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Stroke" }), jsx$1("input", { type: "color", className: classes2.colorSwatch, value: rgbToHex$1(strokeColor), onChange: (e3) => onUpdate2({ strokeColor: hexToRgb(e3.target.value) }), "aria-label": "Stroke color" }), jsx$1(OptionButtons, { options: DASH_OPTIONS, value: shape2.strokeDashArray === "none" ? void 0 : shape2.strokeDashArray, onChange: (strokeDashArray) => onUpdate2({ strokeDashArray }) })] }), jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Width" }), jsx$1(Slider, { size: "small", min: 1, max: 10, step: 1, value: shape2.strokeWidth ?? DEFAULT_SHAPE_STROKE_WIDTH, onChange: (_, strokeWidth) => onUpdate2({ strokeWidth }), valueLabelDisplay: "auto", className: classes2.annotationSlider, "aria-label": "Stroke width" })] }), hasFill ? jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Fill" }), jsx$1("input", { type: "color", className: classes2.colorSwatch, value: rgbToHex$1(shape2.fillColor ?? strokeColor), onChange: (e3) => onUpdate2({ fillColor: hexToRgb(e3.target.value) }), "aria-label": "Fill color" }), jsx$1(Slider, { size: "small", min: 0, max: 1, step: 0.05, value: shape2.fillOpacity ?? 0, onChange: (_, fillOpacity) => onUpdate2({ fillOpacity }), valueLabelDisplay: "auto", valueLabelFormat: (v) => v.toFixed(2), className: classes2.annotationSlider, "aria-label": "Fill opacity" })] }) : null, hasMarkers ? jsxs(Fragment, { children: [jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "Start" }), jsx$1(OptionButtons, { options: MARKER_OPTIONS, value: shape2.markerStart ?? void 0, onChange: (markerStart) => onUpdate2({ markerStart }) })] }), jsxs("div", { className: classes2.shapeEditorRow, children: [jsx$1("span", { className: classes2.shapeEditorLabel, children: "End" }), jsx$1(OptionButtons, { options: MARKER_OPTIONS, value: shape2.markerEnd ?? void 0, onChange: (markerEnd) => onUpdate2({ markerEnd }) })] })] }) : null, jsxs("div", { className: classes2.shapeEditorRow, children: [jsxs("button", { type: "button", className: classes2.toggleTextButton, onClick: () => setIsGeometryOpen((prev2) => !prev2), "aria-expanded": isGeometryOpen, children: [isGeometryOpen ? "▾" : "▸", " Geometry"] }), jsx$1("span", { className: classes2.measurement, children: measurement }), frames.length > 1 ? jsxs(NativeSelect, { value: "", className: classes2.nativeSelect, onChange: (e3) => {
|
|
275269
275247
|
if (e3.target.value !== "") {
|
|
275270
275248
|
onCopyToFrame(Number(e3.target.value));
|
|
275271
275249
|
}
|
|
@@ -275579,6 +275557,10 @@ function getExistingScope(layout, coordinationType) {
|
|
|
275579
275557
|
const scope = layout.map((view) => view.coordinationScopes?.[coordinationType]).find((s2) => typeof s2 === "string");
|
|
275580
275558
|
return scope;
|
|
275581
275559
|
}
|
|
275560
|
+
function getMaxColumnHeight(layout) {
|
|
275561
|
+
const bottoms = layout.map((view) => view.y + view.h).filter((bottom2) => Number.isFinite(bottom2) && bottom2 >= 1);
|
|
275562
|
+
return bottoms.length > 0 ? Math.max(...bottoms) : NUM_GRID_ROWS;
|
|
275563
|
+
}
|
|
275582
275564
|
function addAnnotationControllerView(config3, options = {}) {
|
|
275583
275565
|
const { width: width2 = DEFAULT_ANNOTATION_CONTROLLER_WIDTH, uid: uid2 = DEFAULT_ANNOTATION_CONTROLLER_UID, closeButtonVisible } = options;
|
|
275584
275566
|
if (!Number.isInteger(width2) || width2 < 1 || width2 >= NUM_GRID_COLUMNS) {
|
|
@@ -275609,13 +275591,49 @@ function addAnnotationControllerView(config3, options = {}) {
|
|
|
275609
275591
|
x: remainingColumns,
|
|
275610
275592
|
y: 0,
|
|
275611
275593
|
w: width2,
|
|
275612
|
-
h:
|
|
275594
|
+
h: getMaxColumnHeight(layout)
|
|
275613
275595
|
});
|
|
275614
275596
|
return {
|
|
275615
275597
|
...config3,
|
|
275616
275598
|
layout: newLayout
|
|
275617
275599
|
};
|
|
275618
275600
|
}
|
|
275601
|
+
function removeAnnotationControllerView(config3) {
|
|
275602
|
+
const layout = (config3?.layout || []).filter((view) => view.component !== ViewType$1.ANNOTATION_CONTROLLER);
|
|
275603
|
+
const clampX = (value2) => Math.min(Math.max(value2, 0), NUM_GRID_COLUMNS);
|
|
275604
|
+
const isColumnOccupied = Array.from({ length: NUM_GRID_COLUMNS }, (_, col) => layout.some((view) => clampX(view.x) <= col && col < clampX(view.x + view.w)));
|
|
275605
|
+
const numOccupiedColumns = isColumnOccupied.filter(Boolean).length;
|
|
275606
|
+
if (numOccupiedColumns === 0) {
|
|
275607
|
+
return {
|
|
275608
|
+
...config3,
|
|
275609
|
+
layout
|
|
275610
|
+
};
|
|
275611
|
+
}
|
|
275612
|
+
const scaleX2 = (value2) => {
|
|
275613
|
+
const edge = clampX(value2);
|
|
275614
|
+
const numOccupiedBefore = isColumnOccupied.filter((isOccupied, col) => isOccupied && col < edge).length;
|
|
275615
|
+
return Math.round(numOccupiedBefore * NUM_GRID_COLUMNS / numOccupiedColumns);
|
|
275616
|
+
};
|
|
275617
|
+
const newLayout = layout.map((view) => {
|
|
275618
|
+
const x2 = Math.min(scaleX2(view.x), NUM_GRID_COLUMNS - 1);
|
|
275619
|
+
const right2 = Math.min(Math.max(scaleX2(view.x + view.w), x2 + 1), NUM_GRID_COLUMNS);
|
|
275620
|
+
return {
|
|
275621
|
+
...view,
|
|
275622
|
+
x: x2,
|
|
275623
|
+
w: right2 - x2
|
|
275624
|
+
};
|
|
275625
|
+
});
|
|
275626
|
+
return {
|
|
275627
|
+
...config3,
|
|
275628
|
+
layout: newLayout
|
|
275629
|
+
};
|
|
275630
|
+
}
|
|
275631
|
+
function hasAnyAnnotationStory(config3) {
|
|
275632
|
+
const type2 = CoordinationType$1.ANNOTATION_STORY;
|
|
275633
|
+
const scopeValues = Object.values(config3?.coordinationSpace?.[type2] || {});
|
|
275634
|
+
const viewValues = (config3?.layout || []).map((view) => view.coordinationValues?.[type2]);
|
|
275635
|
+
return [...scopeValues, ...viewValues].some((value2) => Array.isArray(value2?.frames) && value2.frames.length > 0);
|
|
275636
|
+
}
|
|
275619
275637
|
function isAnyAnnotationEditing(config3) {
|
|
275620
275638
|
const type2 = CoordinationType$1.ANNOTATION_EDITABLE;
|
|
275621
275639
|
const scopeValues = Object.values(config3?.coordinationSpace?.[type2] || {});
|
|
@@ -277495,7 +277513,7 @@ function HiglassGlobalStyles(props) {
|
|
|
277495
277513
|
}
|
|
277496
277514
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
277497
277515
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
277498
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
277516
|
+
const { HiGlassComponent } = await import("./higlass-CAqsuvzB.js");
|
|
277499
277517
|
return { default: HiGlassComponent };
|
|
277500
277518
|
});
|
|
277501
277519
|
const HG_SIZE = 800;
|
|
@@ -280450,12 +280468,27 @@ function NeuroglancerGlobalStyles(props) {
|
|
|
280450
280468
|
const { classes: classes2 } = props;
|
|
280451
280469
|
return jsxs(Fragment, { children: [jsx$1(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsx$1(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
|
|
280452
280470
|
}
|
|
280453
|
-
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-
|
|
280471
|
+
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-9V3VAS-Y.js"));
|
|
280454
280472
|
function createWorker() {
|
|
280455
280473
|
const worker = new WorkerFactory$1();
|
|
280456
280474
|
worker.AsyncComputationWorker = WorkerFactory;
|
|
280457
280475
|
return worker;
|
|
280458
280476
|
}
|
|
280477
|
+
function getPickedAnnotationLayerName(viewer, mouseState) {
|
|
280478
|
+
const { pickedAnnotationLayer, pickedRenderLayer } = mouseState;
|
|
280479
|
+
for (const managedLayer of viewer.layerManager.managedLayers) {
|
|
280480
|
+
const userLayer = managedLayer.layer;
|
|
280481
|
+
if (userLayer) {
|
|
280482
|
+
if (pickedAnnotationLayer && userLayer.annotationStates?.states?.includes(pickedAnnotationLayer)) {
|
|
280483
|
+
return managedLayer.name;
|
|
280484
|
+
}
|
|
280485
|
+
if (pickedRenderLayer && userLayer.renderLayers?.includes(pickedRenderLayer)) {
|
|
280486
|
+
return managedLayer.name;
|
|
280487
|
+
}
|
|
280488
|
+
}
|
|
280489
|
+
}
|
|
280490
|
+
return null;
|
|
280491
|
+
}
|
|
280459
280492
|
class NeuroglancerComp extends PureComponent {
|
|
280460
280493
|
constructor(props) {
|
|
280461
280494
|
super(props);
|
|
@@ -280495,16 +280528,27 @@ class NeuroglancerComp extends PureComponent {
|
|
|
280495
280528
|
}
|
|
280496
280529
|
};
|
|
280497
280530
|
remapWheelToZoom(viewer.inputEventBindings.perspectiveView);
|
|
280498
|
-
const {
|
|
280531
|
+
const { onViewerReady } = this.props;
|
|
280499
280532
|
this.prevHoverHandler = () => {
|
|
280500
280533
|
const ms = viewer.mouseState;
|
|
280534
|
+
const { getMeshIdToCellId, centroidAnnotationUrlsByLayerName, decodeCentroidById } = this.props;
|
|
280501
280535
|
if (ms.pickedAnnotationId != null) {
|
|
280536
|
+
const layerName = getPickedAnnotationLayerName(viewer, ms);
|
|
280537
|
+
const annotationUrl = layerName ? centroidAnnotationUrlsByLayerName?.[layerName] : null;
|
|
280538
|
+
if (!annotationUrl) {
|
|
280539
|
+
this.latestOnSelectHoveredCoords?.(null);
|
|
280540
|
+
return;
|
|
280541
|
+
}
|
|
280502
280542
|
const byIdKey = String(ms.pickedAnnotationId);
|
|
280503
|
-
fetch(`${
|
|
280504
|
-
const
|
|
280505
|
-
|
|
280543
|
+
fetch(`${annotationUrl}/by_id/${byIdKey}`).then((r3) => r3.arrayBuffer()).then((buf) => {
|
|
280544
|
+
const actualMeshId = decodeCentroidById?.(layerName, buf);
|
|
280545
|
+
if (!actualMeshId) {
|
|
280546
|
+
this.latestOnSelectHoveredCoords?.(null);
|
|
280547
|
+
return;
|
|
280548
|
+
}
|
|
280506
280549
|
const cellId = getMeshIdToCellId?.(actualMeshId) ?? actualMeshId;
|
|
280507
280550
|
this.latestOnSelectHoveredCoords?.(cellId);
|
|
280551
|
+
}).catch(() => {
|
|
280508
280552
|
});
|
|
280509
280553
|
return;
|
|
280510
280554
|
}
|
|
@@ -280548,9 +280592,9 @@ class NeuroglancerComp extends PureComponent {
|
|
|
280548
280592
|
this.bundleRoot = null;
|
|
280549
280593
|
}
|
|
280550
280594
|
render() {
|
|
280551
|
-
const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady,
|
|
280595
|
+
const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady, allowEmptySegments } = this.props;
|
|
280552
280596
|
const { bundleRootReady } = this.state;
|
|
280553
|
-
return jsxs(Fragment, { children: [jsx$1(NeuroglancerGlobalStyles, { classes: classes2 }), jsx$1("div", { className: classes2.neuroglancerWrapper, children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: bundleRootReady && jsx$1(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, onLayerLoadingChange, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef, onAnnotationSourceReady, onViewerReady,
|
|
280597
|
+
return jsxs(Fragment, { children: [jsx$1(NeuroglancerGlobalStyles, { classes: classes2 }), jsx$1("div", { className: classes2.neuroglancerWrapper, children: jsx$1(Suspense, { fallback: jsx$1("div", { children: "Loading..." }), children: bundleRootReady && jsx$1(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, onLayerLoadingChange, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef, onAnnotationSourceReady, onViewerReady, allowEmptySegments }) }) })] });
|
|
280554
280598
|
}
|
|
280555
280599
|
}
|
|
280556
280600
|
function customIsEqualForCellColors(prevDeps, nextDeps) {
|
|
@@ -280598,9 +280642,10 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
|
|
|
280598
280642
|
let forceUpdate = false;
|
|
280599
280643
|
const curriedShallowDiff = (depName) => shallowDiff(prevDeps, nextDeps, depName);
|
|
280600
280644
|
const curriedShallowDiffByLayer = (depName, scopeName) => shallowDiffByLayer(prevDeps, nextDeps, depName, scopeName);
|
|
280645
|
+
const curriedShallowDiffByChannel = (depName, firstName, secondName) => shallowDiffByChannel(prevDeps, nextDeps, depName, firstName, secondName);
|
|
280601
280646
|
const curriedShallowDiffByLayerCoordinationWithKeys = (depName, layerScope, keys2) => shallowDiffByLayerCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, keys2);
|
|
280602
280647
|
const curriedShallowDiffByChannelCoordinationWithKeys = (depName, layerScope, channelScope, keys2) => shallowDiffByChannelCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, channelScope, keys2);
|
|
280603
|
-
if (["theme", "showAxisLines"].some(curriedShallowDiff)) {
|
|
280648
|
+
if (["theme", "showAxisLines", "viewerDimensionsOverride"].some(curriedShallowDiff)) {
|
|
280604
280649
|
forceUpdate = true;
|
|
280605
280650
|
}
|
|
280606
280651
|
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(curriedShallowDiff)) {
|
|
@@ -280615,9 +280660,26 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
|
|
|
280615
280660
|
nextDeps.segmentationChannelScopesByLayer?.[layerScope]?.forEach((channelScope) => {
|
|
280616
280661
|
if (curriedShallowDiffByChannelCoordinationWithKeys("segmentationChannelCoordination", layerScope, channelScope, [
|
|
280617
280662
|
"spatialChannelVisible"
|
|
280618
|
-
])) {
|
|
280663
|
+
]) || curriedShallowDiffByChannel("obsSegmentationsLocationsData", layerScope, channelScope)) {
|
|
280619
280664
|
forceUpdate = true;
|
|
280620
280665
|
}
|
|
280666
|
+
const hasCentroids = nextDeps.obsSegmentationsLocationsData?.[layerScope]?.[channelScope]?.obsLocationsTilingType === "neuroglancer";
|
|
280667
|
+
if (hasCentroids) {
|
|
280668
|
+
const getOpacity2 = (deps) => (deps?.segmentationLayerCoordination?.[0]?.[layerScope]?.spatialLayerOpacity ?? 1) * (deps?.segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope]?.spatialChannelOpacity ?? 1);
|
|
280669
|
+
const keysChanged = curriedShallowDiffByChannelCoordinationWithKeys("segmentationChannelCoordination", layerScope, channelScope, [
|
|
280670
|
+
"spatialChannelColor",
|
|
280671
|
+
"obsColorEncoding",
|
|
280672
|
+
"featureValueColormap",
|
|
280673
|
+
"featureValueColormapRange",
|
|
280674
|
+
"obsSetColor",
|
|
280675
|
+
"obsSetSelection",
|
|
280676
|
+
"additionalObsSets"
|
|
280677
|
+
]);
|
|
280678
|
+
const opacityChanged = Math.abs(getOpacity2(prevDeps) - getOpacity2(nextDeps)) >= 0.05;
|
|
280679
|
+
if (keysChanged || opacityChanged) {
|
|
280680
|
+
forceUpdate = true;
|
|
280681
|
+
}
|
|
280682
|
+
}
|
|
280621
280683
|
});
|
|
280622
280684
|
});
|
|
280623
280685
|
}
|
|
@@ -281139,6 +281201,203 @@ function getPointsShader(layerCoordination) {
|
|
|
281139
281201
|
}
|
|
281140
281202
|
return getSpatialLayerColorShader(staticColor, opacity2, pointMarkerBorderWidth);
|
|
281141
281203
|
}
|
|
281204
|
+
const ANNOTATION_HEADER_OFFSET = 8;
|
|
281205
|
+
function ngMetersPerUnit(dimensions) {
|
|
281206
|
+
if (!dimensions?.x)
|
|
281207
|
+
return null;
|
|
281208
|
+
const [scale2, unit2] = dimensions.x;
|
|
281209
|
+
const factor = UNIT_TO_METERS[unit2];
|
|
281210
|
+
return factor ? scale2 * factor : null;
|
|
281211
|
+
}
|
|
281212
|
+
const GREY_HEX = "#323232";
|
|
281213
|
+
const EPSILON_KEYS_MAPPING_NG = {
|
|
281214
|
+
projectionScale: 5,
|
|
281215
|
+
projectionOrientation: 0.02,
|
|
281216
|
+
position: 1
|
|
281217
|
+
};
|
|
281218
|
+
const SOFT_POS_FACTOR = 0.15;
|
|
281219
|
+
const Q_Y_UP = [1, 0, 0, 0];
|
|
281220
|
+
const multiplyQuat = (a2, b2) => {
|
|
281221
|
+
const [ax, ay, az, aw] = a2;
|
|
281222
|
+
const [bx, by, bz, bw] = b2;
|
|
281223
|
+
return [
|
|
281224
|
+
aw * bx + ax * bw + ay * bz - az * by,
|
|
281225
|
+
aw * by - ax * bz + ay * bw + az * bx,
|
|
281226
|
+
aw * bz + ax * by - ay * bx + az * bw,
|
|
281227
|
+
aw * bw - ax * bx - ay * by - az * bz
|
|
281228
|
+
];
|
|
281229
|
+
};
|
|
281230
|
+
const deg2rad = (d) => d * Math.PI / 180;
|
|
281231
|
+
const isFiniteNumberArray = (value2, length2) => Array.isArray(value2) && value2.length === length2 && value2.every(Number.isFinite);
|
|
281232
|
+
function isValidNgPosition(position2) {
|
|
281233
|
+
return isFiniteNumberArray(position2, 3);
|
|
281234
|
+
}
|
|
281235
|
+
function isValidNgOrientation(orientation) {
|
|
281236
|
+
return isFiniteNumberArray(orientation, 4) && orientation.some((v) => v !== 0);
|
|
281237
|
+
}
|
|
281238
|
+
function isValidNgScale(scale2) {
|
|
281239
|
+
return Number.isFinite(scale2) && scale2 > 0;
|
|
281240
|
+
}
|
|
281241
|
+
const NG_CAMERA_VALIDATORS = {
|
|
281242
|
+
position: isValidNgPosition,
|
|
281243
|
+
projectionOrientation: isValidNgOrientation,
|
|
281244
|
+
projectionScale: isValidNgScale,
|
|
281245
|
+
crossSectionScale: isValidNgScale
|
|
281246
|
+
};
|
|
281247
|
+
function applyColormap(colormap, t4) {
|
|
281248
|
+
const tClamped = Math.max(0, Math.min(1, t4));
|
|
281249
|
+
const interpolators = {
|
|
281250
|
+
plasma: interpolatePlasma,
|
|
281251
|
+
viridis: interpolateViridis,
|
|
281252
|
+
jet: interpolateJet,
|
|
281253
|
+
greys: interpolateGreys
|
|
281254
|
+
};
|
|
281255
|
+
const fn2 = interpolators[colormap] ?? interpolateViridis;
|
|
281256
|
+
return fn2(tClamped);
|
|
281257
|
+
}
|
|
281258
|
+
function valueGreaterThanEpsilon(a2, b2, epsilon3) {
|
|
281259
|
+
if (Array.isArray(a2) && Array.isArray(b2) && a2.length === b2.length) {
|
|
281260
|
+
return a2.some((val, i2) => Math.abs(val - b2[i2]) > epsilon3);
|
|
281261
|
+
}
|
|
281262
|
+
if (typeof a2 === "number" && typeof b2 === "number") {
|
|
281263
|
+
return Math.abs(a2 - b2) > epsilon3;
|
|
281264
|
+
}
|
|
281265
|
+
return void 0;
|
|
281266
|
+
}
|
|
281267
|
+
const nearEq = (a2, b2, epsilon3) => Number.isFinite(a2) && Number.isFinite(b2) ? Math.abs(a2 - b2) <= epsilon3 : a2 === b2;
|
|
281268
|
+
function diffCameraState(prev2, next4) {
|
|
281269
|
+
const eps = EPSILON_KEYS_MAPPING_NG;
|
|
281270
|
+
const scale2 = valueGreaterThanEpsilon(prev2?.projectionScale, next4?.projectionScale, eps.projectionScale);
|
|
281271
|
+
const posHard = valueGreaterThanEpsilon(prev2?.position, next4?.position, eps.position);
|
|
281272
|
+
const rot2 = valueGreaterThanEpsilon(prev2?.projectionOrientation, next4?.projectionOrientation, eps.projectionOrientation);
|
|
281273
|
+
const posSoft = !posHard && scale2 && valueGreaterThanEpsilon(prev2?.position, next4?.position, SOFT_POS_FACTOR);
|
|
281274
|
+
const pos = posHard || posSoft;
|
|
281275
|
+
return { changed: scale2 || pos || rot2, scale: scale2, pos, rot: rot2 };
|
|
281276
|
+
}
|
|
281277
|
+
function eulerToQuaternion(pitch, yaw, roll = 0) {
|
|
281278
|
+
const c1 = Math.cos(pitch / 2);
|
|
281279
|
+
const c2 = Math.cos(yaw / 2);
|
|
281280
|
+
const c3 = Math.cos(roll / 2);
|
|
281281
|
+
const s1 = Math.sin(pitch / 2);
|
|
281282
|
+
const s2 = Math.sin(yaw / 2);
|
|
281283
|
+
const s3 = Math.sin(roll / 2);
|
|
281284
|
+
return [
|
|
281285
|
+
s1 * c2 * c3 + c1 * s2 * s3,
|
|
281286
|
+
c1 * s2 * c3 - s1 * c2 * s3,
|
|
281287
|
+
c1 * c2 * s3 - s1 * s2 * c3,
|
|
281288
|
+
c1 * c2 * c3 + s1 * s2 * s3
|
|
281289
|
+
];
|
|
281290
|
+
}
|
|
281291
|
+
function applyQuat(q, v) {
|
|
281292
|
+
const [qx, qy, qz, qw] = q;
|
|
281293
|
+
const [vx, vy, vz] = v;
|
|
281294
|
+
const tx2 = 2 * (qy * vz - qz * vy);
|
|
281295
|
+
const ty = 2 * (qz * vx - qx * vz);
|
|
281296
|
+
const tz = 2 * (qx * vy - qy * vx);
|
|
281297
|
+
return [
|
|
281298
|
+
vx + qw * tx2 + qy * tz - qz * ty,
|
|
281299
|
+
vy + qw * ty + qz * tx2 - qx * tz,
|
|
281300
|
+
vz + qw * tz + qx * ty - qy * tx2
|
|
281301
|
+
];
|
|
281302
|
+
}
|
|
281303
|
+
function getAnnotationPropertyIndices(info2, { segmentIdProp } = {}) {
|
|
281304
|
+
const propertyIds = (info2?.properties ?? []).map((p) => p.id);
|
|
281305
|
+
const resolvedSegmentIdProp = segmentIdProp ?? (propertyIds.includes("id") ? "id" : null);
|
|
281306
|
+
return {
|
|
281307
|
+
propertyIds,
|
|
281308
|
+
segmentIdProp: resolvedSegmentIdProp,
|
|
281309
|
+
segmentIdIndex: resolvedSegmentIdProp ? propertyIds.indexOf(resolvedSegmentIdProp) : -1
|
|
281310
|
+
};
|
|
281311
|
+
}
|
|
281312
|
+
function toNamedProperties(propertyIds, values3) {
|
|
281313
|
+
const named2 = {};
|
|
281314
|
+
propertyIds.forEach((name2, k) => {
|
|
281315
|
+
named2[name2] = values3[k];
|
|
281316
|
+
});
|
|
281317
|
+
return named2;
|
|
281318
|
+
}
|
|
281319
|
+
function parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2, layout) {
|
|
281320
|
+
const dv = new DataView(buffer2);
|
|
281321
|
+
if (buffer2.byteLength <= 8)
|
|
281322
|
+
return [];
|
|
281323
|
+
const { propertyIds = [], segmentIdIndex } = layout ?? {};
|
|
281324
|
+
if (!(segmentIdIndex >= 0))
|
|
281325
|
+
return [];
|
|
281326
|
+
const count2 = dv.getUint32(0, true);
|
|
281327
|
+
if (count2 === 0 || dv.getUint32(4, true) !== 0)
|
|
281328
|
+
return [];
|
|
281329
|
+
const geometryStride = serializer2.propertyGroupBytes?.[0] ?? serializer2.serializedBytes;
|
|
281330
|
+
const values3 = new Array(propertyIds.length).fill(null);
|
|
281331
|
+
const results = [];
|
|
281332
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
281333
|
+
serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true, values3);
|
|
281334
|
+
const segId = values3[segmentIdIndex];
|
|
281335
|
+
if (segId > 0) {
|
|
281336
|
+
const propBase = ANNOTATION_HEADER_OFFSET + i2 * geometryStride;
|
|
281337
|
+
const x2 = dv.getFloat32(propBase + 0, true);
|
|
281338
|
+
const y2 = dv.getFloat32(propBase + 4, true);
|
|
281339
|
+
const z2 = dv.getFloat32(propBase + 8, true);
|
|
281340
|
+
if (x2 !== 0 || y2 !== 0 || z2 !== 0) {
|
|
281341
|
+
results.push({
|
|
281342
|
+
id: String(segId),
|
|
281343
|
+
// value of segmentIdProp: used for the NG segments array
|
|
281344
|
+
x: x2,
|
|
281345
|
+
y: y2,
|
|
281346
|
+
z: z2,
|
|
281347
|
+
properties: toNamedProperties(propertyIds, values3)
|
|
281348
|
+
});
|
|
281349
|
+
}
|
|
281350
|
+
}
|
|
281351
|
+
}
|
|
281352
|
+
return results;
|
|
281353
|
+
}
|
|
281354
|
+
function parseAnnotationById(buffer2, serializer2, layout) {
|
|
281355
|
+
const { propertyIds = [], segmentIdIndex } = layout ?? {};
|
|
281356
|
+
if (!(segmentIdIndex >= 0) || !buffer2 || !serializer2 || buffer2.byteLength < serializer2.serializedBytes)
|
|
281357
|
+
return null;
|
|
281358
|
+
const values3 = new Array(propertyIds.length).fill(null);
|
|
281359
|
+
serializer2.deserialize(new DataView(buffer2), 0, 0, 1, true, values3);
|
|
281360
|
+
const segId = values3[segmentIdIndex];
|
|
281361
|
+
if (!(segId > 0))
|
|
281362
|
+
return null;
|
|
281363
|
+
return { id: String(segId), properties: toNamedProperties(propertyIds, values3) };
|
|
281364
|
+
}
|
|
281365
|
+
const remapCellColors = (ngCellColors, cellIdToMeshIdRef) => {
|
|
281366
|
+
const remapped = {};
|
|
281367
|
+
Object.entries(ngCellColors).forEach(([cellId, color2]) => {
|
|
281368
|
+
const meshId = cellIdToMeshIdRef.current[cellId] ?? cellId;
|
|
281369
|
+
remapped[meshId] = color2;
|
|
281370
|
+
});
|
|
281371
|
+
return remapped;
|
|
281372
|
+
};
|
|
281373
|
+
const autoColorCache = /* @__PURE__ */ new Map();
|
|
281374
|
+
function hashStringToIndex(str, mod2) {
|
|
281375
|
+
let hash2 = 0;
|
|
281376
|
+
for (let i2 = 0; i2 < str.length; i2 += 1) {
|
|
281377
|
+
hash2 = (hash2 * 31 + str.charCodeAt(i2)) % 2 ** 32;
|
|
281378
|
+
}
|
|
281379
|
+
return hash2 % mod2;
|
|
281380
|
+
}
|
|
281381
|
+
function autoColorForId(id2) {
|
|
281382
|
+
const key2 = String(id2);
|
|
281383
|
+
let color2 = autoColorCache.get(key2);
|
|
281384
|
+
if (!color2) {
|
|
281385
|
+
color2 = PALETTE[hashStringToIndex(key2, PALETTE.length)].map((c2) => c2.toString(16).padStart(2, "0")).join("");
|
|
281386
|
+
color2 = `#${color2}`;
|
|
281387
|
+
autoColorCache.set(key2, color2);
|
|
281388
|
+
}
|
|
281389
|
+
return color2;
|
|
281390
|
+
}
|
|
281391
|
+
function reuseIfShallowEqual(cacheRef, next4) {
|
|
281392
|
+
const prev2 = cacheRef.current;
|
|
281393
|
+
const prevKeys = Object.keys(prev2);
|
|
281394
|
+
const nextKeys = Object.keys(next4);
|
|
281395
|
+
if (prevKeys.length === nextKeys.length && nextKeys.every((k) => prev2[k] === next4[k])) {
|
|
281396
|
+
return prev2;
|
|
281397
|
+
}
|
|
281398
|
+
cacheRef.current = next4;
|
|
281399
|
+
return next4;
|
|
281400
|
+
}
|
|
281142
281401
|
const DEFAULT_NG_DIMENSIONS = {
|
|
281143
281402
|
x: [1, "nm"],
|
|
281144
281403
|
y: [1, "nm"],
|
|
@@ -281153,6 +281412,54 @@ const DEFAULT_NG_PROPS = {
|
|
|
281153
281412
|
dimensions: DEFAULT_NG_DIMENSIONS,
|
|
281154
281413
|
layers: []
|
|
281155
281414
|
};
|
|
281415
|
+
function sanitizeNgCameraState(cameraState, fallbacks = {}) {
|
|
281416
|
+
const defaults2 = {
|
|
281417
|
+
projectionOrientation: [0, 0, 0, 1],
|
|
281418
|
+
projectionScale: DEFAULT_NG_PROPS.projectionScale,
|
|
281419
|
+
crossSectionScale: DEFAULT_NG_PROPS.crossSectionScale,
|
|
281420
|
+
...fallbacks
|
|
281421
|
+
};
|
|
281422
|
+
const result = {};
|
|
281423
|
+
Object.entries(cameraState ?? {}).forEach(([key2, value2]) => {
|
|
281424
|
+
const validate2 = NG_CAMERA_VALIDATORS[key2];
|
|
281425
|
+
if (!validate2) {
|
|
281426
|
+
if (value2 !== void 0)
|
|
281427
|
+
result[key2] = value2;
|
|
281428
|
+
return;
|
|
281429
|
+
}
|
|
281430
|
+
if (validate2(value2)) {
|
|
281431
|
+
result[key2] = value2;
|
|
281432
|
+
} else if (key2 in defaults2) {
|
|
281433
|
+
console.warn(`Invalid initialNgCameraState.${key2}:`, value2, "— using default", defaults2[key2]);
|
|
281434
|
+
result[key2] = defaults2[key2];
|
|
281435
|
+
} else {
|
|
281436
|
+
console.warn(`Invalid initialNgCameraState.${key2}:`, value2, "— ignored");
|
|
281437
|
+
}
|
|
281438
|
+
});
|
|
281439
|
+
return result;
|
|
281440
|
+
}
|
|
281441
|
+
function isValidNgDimensions(dims) {
|
|
281442
|
+
return !!dims && typeof dims === "object" && ["x", "y", "z"].every((axis2) => Array.isArray(dims[axis2]) && dims[axis2].length === 2 && Number.isFinite(dims[axis2][0]) && dims[axis2][0] > 0 && typeof dims[axis2][1] === "string");
|
|
281443
|
+
}
|
|
281444
|
+
function resolveViewerDimensions(annotationSources, viewerDimensionsOverride = null) {
|
|
281445
|
+
if (viewerDimensionsOverride != null) {
|
|
281446
|
+
if (isValidNgDimensions(viewerDimensionsOverride))
|
|
281447
|
+
return viewerDimensionsOverride;
|
|
281448
|
+
console.warn("Ignoring invalid viewerDimensions prop; expected { x: [scale, unit], y: [scale, unit], z: [scale, unit] }.");
|
|
281449
|
+
}
|
|
281450
|
+
const declared = (annotationSources ?? []).map(({ name: scope, neuroglancerOptions }) => ({
|
|
281451
|
+
scope,
|
|
281452
|
+
dims: neuroglancerOptions?.transform?.outputDimensions
|
|
281453
|
+
})).filter(({ dims }) => dims);
|
|
281454
|
+
if (!declared.length)
|
|
281455
|
+
return DEFAULT_NG_DIMENSIONS;
|
|
281456
|
+
const [{ dims: viewerDims }] = declared;
|
|
281457
|
+
const mismatched = declared.filter(({ dims }) => !isEqual$3(dims, viewerDims));
|
|
281458
|
+
if (mismatched.length) {
|
|
281459
|
+
console.warn(`Point layers declare different outputDimensions; using those of "${declared[0].scope}" for the viewer. Layers ${mismatched.map(({ scope }) => `"${scope}"`).join(", ")} keep their own outputDimensions in their source transform.`);
|
|
281460
|
+
}
|
|
281461
|
+
return viewerDims;
|
|
281462
|
+
}
|
|
281156
281463
|
function toPrecomputedSource(url) {
|
|
281157
281464
|
if (!url) {
|
|
281158
281465
|
throw new Error("toPrecomputedSource: URL is required");
|
|
@@ -281166,20 +281473,92 @@ function toNgLayerName(dataType, layerScope, channelScope = null) {
|
|
|
281166
281473
|
if (dataType === DataType$3.OBS_POINTS) {
|
|
281167
281474
|
return `obsPoints-${layerScope}`;
|
|
281168
281475
|
}
|
|
281476
|
+
if (dataType === DataType$3.OBS_LOCATIONS) {
|
|
281477
|
+
return `obsLocations-${layerScope}-${channelScope}`;
|
|
281478
|
+
}
|
|
281169
281479
|
throw new Error(`Unsupported data type: ${dataType}`);
|
|
281170
281480
|
}
|
|
281171
|
-
function
|
|
281172
|
-
return segmentationLayerScopes.
|
|
281173
|
-
const
|
|
281174
|
-
|
|
281175
|
-
|
|
281176
|
-
|
|
281177
|
-
|
|
281178
|
-
|
|
281481
|
+
function getSegmentationCentroidSources({ segmentationLayerScopes, segmentationChannelScopesByLayer, obsSegmentationsLocationsData }) {
|
|
281482
|
+
return (segmentationLayerScopes ?? []).flatMap((layerScope) => (segmentationChannelScopesByLayer?.[layerScope] ?? []).map((channelScope) => {
|
|
281483
|
+
const locationsData = obsSegmentationsLocationsData?.[layerScope]?.[channelScope];
|
|
281484
|
+
if (locationsData?.obsLocationsTilingType !== "neuroglancer" || !locationsData.neuroglancerUrl) {
|
|
281485
|
+
return null;
|
|
281486
|
+
}
|
|
281487
|
+
return {
|
|
281488
|
+
layerScope,
|
|
281489
|
+
channelScope,
|
|
281490
|
+
name: toNgLayerName(DataType$3.OBS_LOCATIONS, layerScope, channelScope),
|
|
281491
|
+
url: locationsData.neuroglancerUrl,
|
|
281492
|
+
neuroglancerOptions: locationsData.neuroglancerOptions ?? {},
|
|
281493
|
+
neuroglancerInfo: locationsData.neuroglancerInfo ?? null
|
|
281494
|
+
};
|
|
281495
|
+
}).filter(Boolean));
|
|
281496
|
+
}
|
|
281497
|
+
const CENTROID_POINT_STROKE_WIDTH = 0.2;
|
|
281498
|
+
function getCentroidShaderParams(layerCoordination, channelCoordination) {
|
|
281499
|
+
const { spatialLayerOpacity } = layerCoordination || {};
|
|
281500
|
+
const { spatialChannelOpacity, spatialChannelColor, obsColorEncoding, featureValueColormap, featureValueColormapRange, obsSetColor, obsSetSelection, additionalObsSets } = channelCoordination || {};
|
|
281501
|
+
return {
|
|
281502
|
+
spatialLayerOpacity: (spatialLayerOpacity ?? 1) * (spatialChannelOpacity ?? 1),
|
|
281503
|
+
// Segmentation channels use 'spatialChannelColor' for a static color,
|
|
281504
|
+
// whereas the points shader uses 'spatialLayerColor'.
|
|
281505
|
+
obsColorEncoding: obsColorEncoding === "spatialChannelColor" ? "spatialLayerColor" : obsColorEncoding,
|
|
281506
|
+
spatialLayerColor: spatialChannelColor,
|
|
281507
|
+
featureValueColormap,
|
|
281508
|
+
featureValueColormapRange,
|
|
281509
|
+
obsSetColor,
|
|
281510
|
+
obsSetSelection,
|
|
281511
|
+
additionalObsSets,
|
|
281512
|
+
// Only show the centroids of the selected obsSets.
|
|
281513
|
+
featureFilterMode: "featureSelection",
|
|
281514
|
+
pointMarkerBorderWidth: CENTROID_POINT_STROKE_WIDTH,
|
|
281515
|
+
// The points represent the centroids of the segmentations.
|
|
281516
|
+
// We pass this down to the getPointsShader, to determine whether to interpret
|
|
281517
|
+
// `obsColorEncoding === 'geneSelection'` as a
|
|
281518
|
+
// quantitative color encoding or a categorical color encoding.
|
|
281519
|
+
pointsAreSegmentationCentroids: true
|
|
281520
|
+
};
|
|
281521
|
+
}
|
|
281522
|
+
function toAnnotationSource(url, ngOptions, viewerDimensions) {
|
|
281523
|
+
return {
|
|
281524
|
+
url: toPrecomputedSource(url),
|
|
281525
|
+
subsources: {
|
|
281526
|
+
default: true
|
|
281527
|
+
},
|
|
281528
|
+
enableDefaultSubsources: false,
|
|
281529
|
+
...ngOptions?.transform?.matrix ? {
|
|
281530
|
+
transform: {
|
|
281531
|
+
matrix: ngOptions.transform.matrix,
|
|
281532
|
+
// Layer-local output space; falls back to the viewer's
|
|
281533
|
+
// dimensions (order-independent), never another layer's.
|
|
281534
|
+
outputDimensions: ngOptions.transform?.outputDimensions ?? viewerDimensions
|
|
281535
|
+
}
|
|
281536
|
+
} : {}
|
|
281537
|
+
};
|
|
281179
281538
|
}
|
|
281180
|
-
function
|
|
281539
|
+
function getQuantitativeColorMax(ngOptions, obsColorEncoding) {
|
|
281540
|
+
const quantitativeColorMax = ngOptions?.quantitativeColorMax;
|
|
281541
|
+
if (!quantitativeColorMax && obsColorEncoding === "geneSelection") {
|
|
281542
|
+
console.warn("quantitativeColorMax not specified in options — defaulting to 1.0 (no normalization)");
|
|
281543
|
+
}
|
|
281544
|
+
return quantitativeColorMax ?? 1;
|
|
281545
|
+
}
|
|
281546
|
+
function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, obsSegmentationsLocationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData, viewerDimensionsOverride = null) {
|
|
281181
281547
|
const viewerState = useMemoCustomComparison(() => {
|
|
281182
281548
|
let result = cloneDeep$1(DEFAULT_NG_PROPS);
|
|
281549
|
+
const centroidSources = getSegmentationCentroidSources({
|
|
281550
|
+
segmentationLayerScopes,
|
|
281551
|
+
segmentationChannelScopesByLayer,
|
|
281552
|
+
obsSegmentationsLocationsData
|
|
281553
|
+
});
|
|
281554
|
+
const viewerDimensions = resolveViewerDimensions([
|
|
281555
|
+
...pointLayerScopes.map((layerScope) => ({
|
|
281556
|
+
name: toNgLayerName(DataType$3.OBS_POINTS, layerScope),
|
|
281557
|
+
neuroglancerOptions: obsPointsData?.[layerScope]?.neuroglancerOptions
|
|
281558
|
+
})),
|
|
281559
|
+
...centroidSources
|
|
281560
|
+
], viewerDimensionsOverride);
|
|
281561
|
+
result = { ...result, dimensions: viewerDimensions };
|
|
281183
281562
|
segmentationLayerScopes.forEach((layerScope) => {
|
|
281184
281563
|
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
281185
281564
|
const channelScopes = segmentationChannelScopesByLayer[layerScope] || [];
|
|
@@ -281221,31 +281600,45 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
|
|
|
281221
281600
|
});
|
|
281222
281601
|
}
|
|
281223
281602
|
});
|
|
281603
|
+
centroidSources.forEach(({ layerScope, channelScope, name: name2, url, neuroglancerOptions: ngOptions }) => {
|
|
281604
|
+
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
281605
|
+
const channelCoordination = segmentationChannelCoordination[0]?.[layerScope]?.[channelScope];
|
|
281606
|
+
const centroidShaderParams = getCentroidShaderParams(layerCoordination, channelCoordination);
|
|
281607
|
+
const shader = getPointsShader({
|
|
281608
|
+
theme,
|
|
281609
|
+
...centroidShaderParams,
|
|
281610
|
+
quantitativeColorProp: ngOptions.quantitativeColorProp,
|
|
281611
|
+
quantitativeColorMax: getQuantitativeColorMax(ngOptions, centroidShaderParams.obsColorEncoding)
|
|
281612
|
+
});
|
|
281613
|
+
result = {
|
|
281614
|
+
...result,
|
|
281615
|
+
layers: [
|
|
281616
|
+
...result.layers,
|
|
281617
|
+
{
|
|
281618
|
+
type: "annotation",
|
|
281619
|
+
source: toAnnotationSource(url, ngOptions, viewerDimensions),
|
|
281620
|
+
tab: "annotations",
|
|
281621
|
+
shader,
|
|
281622
|
+
name: name2,
|
|
281623
|
+
// Both layer and channel visibility must be true, as for the segmentation layer.
|
|
281624
|
+
visible: Boolean(layerCoordination?.spatialLayerVisible && channelCoordination?.spatialChannelVisible),
|
|
281625
|
+
projectionAnnotationSpacing: ngOptions.projectionAnnotationSpacing ?? 1
|
|
281626
|
+
}
|
|
281627
|
+
],
|
|
281628
|
+
selectedLayer: {
|
|
281629
|
+
layer: name2
|
|
281630
|
+
}
|
|
281631
|
+
};
|
|
281632
|
+
});
|
|
281224
281633
|
pointLayerScopes.forEach((layerScope) => {
|
|
281225
281634
|
const layerCoordination = pointLayerCoordination[0][layerScope];
|
|
281226
281635
|
const layerData = obsPointsData[layerScope];
|
|
281227
281636
|
const layerUrl = obsPointsUrls[layerScope]?.[0]?.url;
|
|
281228
281637
|
const ngOptions = layerData?.neuroglancerOptions;
|
|
281229
|
-
if (ngOptions?.transform?.matrix && ngOptions?.transform?.outputDimensions) {
|
|
281230
|
-
result = {
|
|
281231
|
-
...result,
|
|
281232
|
-
dimensions: ngOptions.transform.outputDimensions ?? DEFAULT_NG_DIMENSIONS
|
|
281233
|
-
};
|
|
281234
|
-
}
|
|
281235
|
-
const pointsAreSegmentationCentroids = pointsHaveMatchingSegmentation({
|
|
281236
|
-
pointObsType: layerCoordination?.obsType,
|
|
281237
|
-
segmentationLayerScopes,
|
|
281238
|
-
segmentationChannelScopesByLayer,
|
|
281239
|
-
segmentationChannelCoordination
|
|
281240
|
-
});
|
|
281241
281638
|
const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
|
|
281242
281639
|
if (layerUrl && layerData) {
|
|
281243
281640
|
const { spatialLayerVisible, spatialLayerOpacity, spatialLayerOpacityUnselected, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialPointStrokeWidth, featureValueColormap, featureValueColormapRange } = layerCoordination || {};
|
|
281244
|
-
const
|
|
281245
|
-
if (!quantitativeColorMax && obsColorEncoding === "geneSelection") {
|
|
281246
|
-
console.warn("quantitativeColorMax not specified in options — defaulting to 1.0 (no normalization)");
|
|
281247
|
-
}
|
|
281248
|
-
const quantitativeColorMaxSelected = quantitativeColorMax ?? 1;
|
|
281641
|
+
const quantitativeColorMaxSelected = getQuantitativeColorMax(ngOptions, obsColorEncoding);
|
|
281249
281642
|
const shader = getPointsShader({
|
|
281250
281643
|
theme,
|
|
281251
281644
|
featureIndex,
|
|
@@ -281266,8 +281659,7 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
|
|
|
281266
281659
|
obsSetColor: layerCoordination.obsSetColor,
|
|
281267
281660
|
obsSetSelection: layerCoordination.obsSetSelection,
|
|
281268
281661
|
additionalObsSets: layerCoordination.additionalObsSets,
|
|
281269
|
-
quantitativeColorMax: quantitativeColorMaxSelected
|
|
281270
|
-
pointsAreSegmentationCentroids
|
|
281662
|
+
quantitativeColorMax: quantitativeColorMaxSelected
|
|
281271
281663
|
});
|
|
281272
281664
|
result = {
|
|
281273
281665
|
...result,
|
|
@@ -281275,19 +281667,7 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
|
|
|
281275
281667
|
...result.layers,
|
|
281276
281668
|
{
|
|
281277
281669
|
type: "annotation",
|
|
281278
|
-
source:
|
|
281279
|
-
url: toPrecomputedSource(layerUrl),
|
|
281280
|
-
subsources: {
|
|
281281
|
-
default: true
|
|
281282
|
-
},
|
|
281283
|
-
enableDefaultSubsources: false,
|
|
281284
|
-
...ngOptions?.transform?.matrix ? {
|
|
281285
|
-
transform: {
|
|
281286
|
-
matrix: ngOptions.transform.matrix,
|
|
281287
|
-
outputDimensions: ngOptions.transform?.outputDimensions ?? result.dimensions
|
|
281288
|
-
}
|
|
281289
|
-
} : {}
|
|
281290
|
-
},
|
|
281670
|
+
source: toAnnotationSource(layerUrl, ngOptions, viewerDimensions),
|
|
281291
281671
|
tab: "annotations",
|
|
281292
281672
|
shader,
|
|
281293
281673
|
name: toNgLayerName(DataType$3.OBS_POINTS, layerScope),
|
|
@@ -281317,150 +281697,25 @@ function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScope
|
|
|
281317
281697
|
segmentationChannelCoordination,
|
|
281318
281698
|
obsSegmentationsUrls,
|
|
281319
281699
|
obsSegmentationsData,
|
|
281700
|
+
obsSegmentationsLocationsData,
|
|
281320
281701
|
pointLayerScopes,
|
|
281321
281702
|
pointLayerCoordination,
|
|
281322
281703
|
obsPointsUrls,
|
|
281323
281704
|
obsPointsData,
|
|
281324
|
-
pointMultiIndicesData
|
|
281705
|
+
pointMultiIndicesData,
|
|
281706
|
+
viewerDimensionsOverride
|
|
281325
281707
|
}, customIsEqualForInitialViewerState);
|
|
281326
281708
|
return viewerState;
|
|
281327
281709
|
}
|
|
281328
|
-
const ANNOTATION_HEADER_OFFSET = 8;
|
|
281329
|
-
const GREY_HEX = "#323232";
|
|
281330
|
-
const EPSILON_KEYS_MAPPING_NG = {
|
|
281331
|
-
projectionScale: 5,
|
|
281332
|
-
projectionOrientation: 0.02,
|
|
281333
|
-
position: 1
|
|
281334
|
-
};
|
|
281335
|
-
const SOFT_POS_FACTOR = 0.15;
|
|
281336
|
-
const Q_Y_UP = [1, 0, 0, 0];
|
|
281337
|
-
const multiplyQuat = (a2, b2) => {
|
|
281338
|
-
const [ax, ay, az, aw] = a2;
|
|
281339
|
-
const [bx, by, bz, bw] = b2;
|
|
281340
|
-
return [
|
|
281341
|
-
aw * bx + ax * bw + ay * bz - az * by,
|
|
281342
|
-
aw * by - ax * bz + ay * bw + az * bx,
|
|
281343
|
-
aw * bz + ax * by - ay * bx + az * bw,
|
|
281344
|
-
aw * bw - ax * bx - ay * by - az * bz
|
|
281345
|
-
];
|
|
281346
|
-
};
|
|
281347
|
-
const deg2rad = (d) => d * Math.PI / 180;
|
|
281348
|
-
function applyColormap(colormap, t4) {
|
|
281349
|
-
const tClamped = Math.max(0, Math.min(1, t4));
|
|
281350
|
-
const interpolators = {
|
|
281351
|
-
plasma: interpolatePlasma,
|
|
281352
|
-
viridis: interpolateViridis,
|
|
281353
|
-
jet: interpolateJet,
|
|
281354
|
-
greys: interpolateGreys
|
|
281355
|
-
};
|
|
281356
|
-
const fn2 = interpolators[colormap] ?? interpolateViridis;
|
|
281357
|
-
return fn2(tClamped);
|
|
281358
|
-
}
|
|
281359
|
-
function valueGreaterThanEpsilon(a2, b2, epsilon3) {
|
|
281360
|
-
if (Array.isArray(a2) && Array.isArray(b2) && a2.length === b2.length) {
|
|
281361
|
-
return a2.some((val, i2) => Math.abs(val - b2[i2]) > epsilon3);
|
|
281362
|
-
}
|
|
281363
|
-
if (typeof a2 === "number" && typeof b2 === "number") {
|
|
281364
|
-
return Math.abs(a2 - b2) > epsilon3;
|
|
281365
|
-
}
|
|
281366
|
-
return void 0;
|
|
281367
|
-
}
|
|
281368
|
-
const nearEq = (a2, b2, epsilon3) => Number.isFinite(a2) && Number.isFinite(b2) ? Math.abs(a2 - b2) <= epsilon3 : a2 === b2;
|
|
281369
|
-
function diffCameraState(prev2, next4) {
|
|
281370
|
-
const eps = EPSILON_KEYS_MAPPING_NG;
|
|
281371
|
-
const scale2 = valueGreaterThanEpsilon(prev2?.projectionScale, next4?.projectionScale, eps.projectionScale);
|
|
281372
|
-
const posHard = valueGreaterThanEpsilon(prev2?.position, next4?.position, eps.position);
|
|
281373
|
-
const rot2 = valueGreaterThanEpsilon(prev2?.projectionOrientation, next4?.projectionOrientation, eps.projectionOrientation);
|
|
281374
|
-
const posSoft = !posHard && scale2 && valueGreaterThanEpsilon(prev2?.position, next4?.position, SOFT_POS_FACTOR);
|
|
281375
|
-
const pos = posHard || posSoft;
|
|
281376
|
-
return { changed: scale2 || pos || rot2, scale: scale2, pos, rot: rot2 };
|
|
281377
|
-
}
|
|
281378
|
-
function eulerToQuaternion(pitch, yaw, roll = 0) {
|
|
281379
|
-
const c1 = Math.cos(pitch / 2);
|
|
281380
|
-
const c2 = Math.cos(yaw / 2);
|
|
281381
|
-
const c3 = Math.cos(roll / 2);
|
|
281382
|
-
const s1 = Math.sin(pitch / 2);
|
|
281383
|
-
const s2 = Math.sin(yaw / 2);
|
|
281384
|
-
const s3 = Math.sin(roll / 2);
|
|
281385
|
-
return [
|
|
281386
|
-
s1 * c2 * c3 + c1 * s2 * s3,
|
|
281387
|
-
c1 * s2 * c3 - s1 * c2 * s3,
|
|
281388
|
-
c1 * c2 * s3 - s1 * s2 * c3,
|
|
281389
|
-
c1 * c2 * c3 + s1 * s2 * s3
|
|
281390
|
-
];
|
|
281391
|
-
}
|
|
281392
|
-
function parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2) {
|
|
281393
|
-
const dv = new DataView(buffer2);
|
|
281394
|
-
if (buffer2.byteLength <= 8)
|
|
281395
|
-
return [];
|
|
281396
|
-
const count2 = dv.getUint32(0, true);
|
|
281397
|
-
if (count2 === 0)
|
|
281398
|
-
return [];
|
|
281399
|
-
const numBytes = serializer2.serializedBytes;
|
|
281400
|
-
const properties2 = [null, null, null, null, null];
|
|
281401
|
-
const results = [];
|
|
281402
|
-
for (let i2 = 0; i2 < count2; i2++) {
|
|
281403
|
-
serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true, properties2);
|
|
281404
|
-
const phenotype = properties2[0];
|
|
281405
|
-
const segId = properties2[1];
|
|
281406
|
-
if (segId > 0) {
|
|
281407
|
-
const propBase = ANNOTATION_HEADER_OFFSET + i2 * numBytes;
|
|
281408
|
-
const x2 = dv.getFloat32(propBase + 0, true);
|
|
281409
|
-
const y2 = dv.getFloat32(propBase + 4, true);
|
|
281410
|
-
const z2 = dv.getFloat32(propBase + 8, true);
|
|
281411
|
-
if (x2 !== 0 || y2 !== 0 || z2 !== 0) {
|
|
281412
|
-
results.push({
|
|
281413
|
-
id: String(segId),
|
|
281414
|
-
// mesh segment ID - use for segments array
|
|
281415
|
-
phenotype: Number(phenotype),
|
|
281416
|
-
x: x2,
|
|
281417
|
-
y: y2,
|
|
281418
|
-
z: z2
|
|
281419
|
-
});
|
|
281420
|
-
}
|
|
281421
|
-
}
|
|
281422
|
-
}
|
|
281423
|
-
return results;
|
|
281424
|
-
}
|
|
281425
|
-
const remapCellColors = (ngCellColors, cellIdToMeshIdRef) => {
|
|
281426
|
-
const remapped = {};
|
|
281427
|
-
Object.entries(ngCellColors).forEach(([cellId, color2]) => {
|
|
281428
|
-
const meshId = cellIdToMeshIdRef.current[cellId] ?? cellId;
|
|
281429
|
-
remapped[meshId] = color2;
|
|
281430
|
-
});
|
|
281431
|
-
return remapped;
|
|
281432
|
-
};
|
|
281433
|
-
const autoColorCache = /* @__PURE__ */ new Map();
|
|
281434
|
-
function hashStringToIndex(str, mod2) {
|
|
281435
|
-
let hash2 = 0;
|
|
281436
|
-
for (let i2 = 0; i2 < str.length; i2 += 1) {
|
|
281437
|
-
hash2 = (hash2 * 31 + str.charCodeAt(i2)) % 2 ** 32;
|
|
281438
|
-
}
|
|
281439
|
-
return hash2 % mod2;
|
|
281440
|
-
}
|
|
281441
|
-
function autoColorForId(id2) {
|
|
281442
|
-
const key2 = String(id2);
|
|
281443
|
-
let color2 = autoColorCache.get(key2);
|
|
281444
|
-
if (!color2) {
|
|
281445
|
-
color2 = PALETTE[hashStringToIndex(key2, PALETTE.length)].map((c2) => c2.toString(16).padStart(2, "0")).join("");
|
|
281446
|
-
color2 = `#${color2}`;
|
|
281447
|
-
autoColorCache.set(key2, color2);
|
|
281448
|
-
}
|
|
281449
|
-
return color2;
|
|
281450
|
-
}
|
|
281451
281710
|
const ROTATION_EPS = 1e-3;
|
|
281452
281711
|
const TARGET_EPS = 0.5;
|
|
281453
281712
|
const MESH_LOAD_THRESHOLD = 100;
|
|
281454
281713
|
const MESH_LOADING_OVERLAY_TIMEOUT = 1500;
|
|
281455
281714
|
const GUIDE_URL = "https://vitessce.io/docs/ng-guide/";
|
|
281456
|
-
const MESH_OPACITY = 0.6;
|
|
281457
281715
|
const LAST_INTERACTION_SOURCE = {
|
|
281458
281716
|
vitessce: "vitessce",
|
|
281459
281717
|
neuroglancer: "neuroglancer"
|
|
281460
281718
|
};
|
|
281461
|
-
function rgbToHex$1(rgb2) {
|
|
281462
|
-
return typeof rgb2 === "string" ? rgb2 : `#${rgb2.map((c2) => c2.toString(16).padStart(2, "0")).join("")}`;
|
|
281463
|
-
}
|
|
281464
281719
|
function NeuroglancerSubscriber(props) {
|
|
281465
281720
|
const {
|
|
281466
281721
|
uuid: uuid2,
|
|
@@ -281481,27 +281736,41 @@ function NeuroglancerSubscriber(props) {
|
|
|
281481
281736
|
// the existing spatialZoom, spatialTargetX, spatialRotationOrbit, etc,
|
|
281482
281737
|
// and then NeuroglancerSubscriber should internally convert
|
|
281483
281738
|
// to NG-compatible values, which would eliminate the need for this.
|
|
281484
|
-
initialNgCameraState
|
|
281739
|
+
initialNgCameraState,
|
|
281740
|
+
// Detail mode: render only the meshes selected (obsSets) or hovered
|
|
281741
|
+
// (obsHighlight) elsewhere, with an independent camera.
|
|
281742
|
+
detailMode = false,
|
|
281743
|
+
detailUseSelection = false,
|
|
281744
|
+
// >1: this view shows the shared camera N× more zoomed in.
|
|
281745
|
+
// Pan/rotation are shared via spatialCameraSnapshot; zoom keeps a fixed ratio.
|
|
281746
|
+
cameraZoomFactor = 1,
|
|
281747
|
+
// Optional global NG coordinate space, e.g.
|
|
281748
|
+
// { x: [1e-9, 'm'], y: [1e-9, 'm'], z: [1e-9, 'm'] }.
|
|
281749
|
+
// Overrides dimensions inferred from point layer transforms.
|
|
281750
|
+
viewerDimensions,
|
|
281751
|
+
// Column names in the obsSets CSV used to map mesh segment IDs <-> cell IDs.
|
|
281752
|
+
// If either column is missing from the CSV, IDs are assumed identical.
|
|
281753
|
+
meshIdColumn = "MeshID",
|
|
281754
|
+
cellIdColumn = "CellID"
|
|
281485
281755
|
} = props;
|
|
281486
281756
|
const loaders = useLoaders();
|
|
281487
281757
|
const mergeCoordination = useMergeCoordination();
|
|
281488
281758
|
const { classes: classes2 } = useStyles$4();
|
|
281489
281759
|
const initialRotationPushedRef = useRef(false);
|
|
281490
281760
|
const getViewProjectionMatRef = useRef(null);
|
|
281491
|
-
const obsIdToMeshIdRef = useRef({});
|
|
281492
281761
|
const meshIdToCellIdRef = useRef({});
|
|
281493
281762
|
const cellIdToMeshIdRef = useRef({});
|
|
281494
281763
|
const lastInteractionSource = useRef(null);
|
|
281495
281764
|
const initialRenderCalibratorRef = useRef(null);
|
|
281496
281765
|
const translationOffsetRef = useRef([0, 0, 0]);
|
|
281497
|
-
const
|
|
281498
|
-
const
|
|
281499
|
-
const
|
|
281766
|
+
const annotationInfoByScopeRef = useRef({});
|
|
281767
|
+
const annotationTransformByScopeRef = useRef({});
|
|
281768
|
+
const visibleSegmentIdsBySegLayerRef = useRef({});
|
|
281500
281769
|
const chunkCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
281501
281770
|
const resizeObserverRef = useRef(null);
|
|
281502
281771
|
const [isLayersLoaded, setIsLayersLoaded] = useState(false);
|
|
281503
281772
|
const [isMeshLoading, setIsMeshLoading] = useState(false);
|
|
281504
|
-
const [
|
|
281773
|
+
const [annotationReadyIteration, bumpAnnotationReady] = useReducer((x2) => x2 + 1, 0);
|
|
281505
281774
|
const [csvLoaded, setCsvLoaded] = useState(false);
|
|
281506
281775
|
const updateVisibleSegmentsThrottledRef = useRef(null);
|
|
281507
281776
|
const viewportSizeRef = useRef({ width: 0, height: 0 });
|
|
@@ -281524,7 +281793,8 @@ function NeuroglancerSubscriber(props) {
|
|
|
281524
281793
|
obsSetSelection: cellSetSelection,
|
|
281525
281794
|
additionalObsSets: additionalCellSets,
|
|
281526
281795
|
obsHighlight: cellHighlight,
|
|
281527
|
-
spatialCameraSnapshot
|
|
281796
|
+
spatialCameraSnapshot,
|
|
281797
|
+
spatialRenderingMode
|
|
281528
281798
|
}, { setSpatialCameraSnapshot, setAdditionalObsSets: setAdditionalCellSets, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$1.NEUROGLANCER], coordinationScopes);
|
|
281529
281799
|
const csvUrlRef = useRef(null);
|
|
281530
281800
|
const csvUrl = useMemo$1(() => {
|
|
@@ -281598,27 +281868,67 @@ function NeuroglancerSubscriber(props) {
|
|
|
281598
281868
|
const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls, obsSegmentationsDataErrors] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
281599
281869
|
const [obsSegmentationsSetsData, obsSegmentationsSetsDataStatus, obsSegmentationsSetsDataErrors] = useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281600
281870
|
const [obsSegmentationsColorsData, obsSegmentationsColorsDataStatus, obsSegmentationsColorsDataErrors] = useSegmentationMultiObsColors(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281871
|
+
const [obsSegmentationsLocationsData, obsSegmentationsLocationsDataStatus, obsSegmentationsLocationsDataErrors] = useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281601
281872
|
const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus, segmentationMultiFeatureSelectionErrors] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281602
281873
|
const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus, segmentationMultiIndicesDataErrors] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281603
|
-
const
|
|
281604
|
-
const
|
|
281874
|
+
const viewerDimensionsKey = viewerDimensions ? JSON.stringify(viewerDimensions) : null;
|
|
281875
|
+
const viewerDimensionsOverride = useMemo$1(() => viewerDimensions ?? null, [viewerDimensionsKey]);
|
|
281876
|
+
const initialViewerState = useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, obsSegmentationsLocationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData, viewerDimensionsOverride);
|
|
281877
|
+
const validInitialNgCamera = useMemo$1(() => sanitizeNgCameraState(initialNgCameraState, { projectionOrientation: Q_Y_UP }), []);
|
|
281878
|
+
const hasInitialNgPosition = "position" in validInitialNgCamera;
|
|
281879
|
+
const [hasResolvedInitialCamera, setHasResolvedInitialCamera] = useState(hasInitialNgPosition);
|
|
281605
281880
|
const latestViewerStateRef = useRef({
|
|
281606
281881
|
...initialViewerState,
|
|
281607
|
-
...
|
|
281882
|
+
...validInitialNgCamera
|
|
281608
281883
|
});
|
|
281609
281884
|
const segmentationUrl = useMemo$1(() => {
|
|
281610
281885
|
const firstScope = segmentationLayerScopes?.[0];
|
|
281611
281886
|
return obsSegmentationsUrls?.[firstScope]?.[0]?.url ?? null;
|
|
281612
281887
|
}, [segmentationLayerScopes, obsSegmentationsUrls]);
|
|
281613
|
-
const
|
|
281614
|
-
|
|
281615
|
-
|
|
281616
|
-
|
|
281888
|
+
const centroidSourcesCacheRef = useRef([]);
|
|
281889
|
+
const centroidSources = useMemo$1(() => {
|
|
281890
|
+
const next4 = getSegmentationCentroidSources({
|
|
281891
|
+
segmentationLayerScopes,
|
|
281892
|
+
segmentationChannelScopesByLayer,
|
|
281893
|
+
obsSegmentationsLocationsData
|
|
281894
|
+
});
|
|
281895
|
+
if (!isEqual$3(next4, centroidSourcesCacheRef.current)) {
|
|
281896
|
+
centroidSourcesCacheRef.current = next4;
|
|
281897
|
+
}
|
|
281898
|
+
return centroidSourcesCacheRef.current;
|
|
281899
|
+
}, [segmentationLayerScopes, segmentationChannelScopesByLayer, obsSegmentationsLocationsData]);
|
|
281900
|
+
const centroidLayerRoles = useMemo$1(() => {
|
|
281901
|
+
const centroidToSegLayers = Object.fromEntries(centroidSources.map(({ name: name2, layerScope }) => [name2, [layerScope]]));
|
|
281902
|
+
return {
|
|
281903
|
+
centroidScopes: centroidSources.map(({ name: name2 }) => name2),
|
|
281904
|
+
centroidToSegLayers,
|
|
281905
|
+
culledSegLayerScopes: new Set(Object.values(centroidToSegLayers).flat())
|
|
281906
|
+
};
|
|
281907
|
+
}, [centroidSources]);
|
|
281908
|
+
const centroidLayerUrls = useMemo$1(() => Object.fromEntries(centroidSources.map(({ name: name2, url }) => [name2, url])), [centroidSources]);
|
|
281909
|
+
const pointScopeByNgLayerName = useMemo$1(() => Object.fromEntries(centroidLayerRoles.centroidScopes.map((scope) => [scope, scope])), [centroidLayerRoles]);
|
|
281910
|
+
const centroidAnnotationUrlsByLayerName = useMemo$1(() => Object.fromEntries(centroidLayerRoles.centroidScopes.filter((scope) => centroidLayerUrls[scope]).map((scope) => [scope, centroidLayerUrls[scope]])), [centroidLayerRoles, centroidLayerUrls]);
|
|
281617
281911
|
const segmentationInfo = obsSegmentationsData?.[segmentationLayerScopes?.[0]]?.neuroglancerInfo ?? null;
|
|
281618
|
-
const
|
|
281912
|
+
const annotationInfoByScopeCacheRef = useRef({});
|
|
281913
|
+
const annotationInfoByScope = useMemo$1(() => {
|
|
281914
|
+
const next4 = Object.fromEntries([
|
|
281915
|
+
...(pointLayerScopes ?? []).map((scope) => [scope, obsPointsData?.[scope]?.neuroglancerInfo ?? null]),
|
|
281916
|
+
...centroidSources.map(({ name: name2, neuroglancerInfo }) => [name2, neuroglancerInfo])
|
|
281917
|
+
].filter(([, info2]) => info2));
|
|
281918
|
+
return reuseIfShallowEqual(annotationInfoByScopeCacheRef, next4);
|
|
281919
|
+
}, [pointLayerScopes, obsPointsData, centroidSources]);
|
|
281920
|
+
const segmentIdPropByScope = useMemo$1(() => Object.fromEntries(centroidSources.map(({ name: name2, neuroglancerOptions }) => [
|
|
281921
|
+
name2,
|
|
281922
|
+
neuroglancerOptions.segmentIdProp
|
|
281923
|
+
])), [centroidSources]);
|
|
281619
281924
|
const derivedCenter = useMemo$1(() => {
|
|
281620
|
-
const
|
|
281621
|
-
|
|
281925
|
+
const validBounds = (scopes) => scopes.map((scope) => annotationInfoByScope[scope]).map((info2) => [info2?.lower_bound, info2?.upper_bound]).filter(([lo, up]) => Array.isArray(lo) && Array.isArray(up) && lo.length === 3 && up.length === 3 && lo.every(Number.isFinite) && up.every(Number.isFinite));
|
|
281926
|
+
let bounds2 = validBounds(centroidLayerRoles.centroidScopes);
|
|
281927
|
+
if (!bounds2.length)
|
|
281928
|
+
bounds2 = validBounds(Object.keys(annotationInfoByScope));
|
|
281929
|
+
if (bounds2.length) {
|
|
281930
|
+
const lower2 = [0, 1, 2].map((i2) => Math.min(...bounds2.map(([lo]) => lo[i2])));
|
|
281931
|
+
const upper = [0, 1, 2].map((i2) => Math.max(...bounds2.map(([, up]) => up[i2])));
|
|
281622
281932
|
return lower2.map((lo, i2) => (lo + upper[i2]) / 2);
|
|
281623
281933
|
}
|
|
281624
281934
|
const scale2 = segmentationInfo?.scales?.[0];
|
|
@@ -281629,9 +281939,9 @@ function NeuroglancerSubscriber(props) {
|
|
|
281629
281939
|
return size2.map((s2, i2) => ((voxelOffset[i2] ?? 0) + s2 / 2) * (resolution[i2] ?? 1));
|
|
281630
281940
|
}
|
|
281631
281941
|
return null;
|
|
281632
|
-
}, [segmentationInfo,
|
|
281942
|
+
}, [segmentationInfo, annotationInfoByScope, centroidLayerRoles]);
|
|
281633
281943
|
useEffect(() => {
|
|
281634
|
-
if (
|
|
281944
|
+
if (hasInitialNgPosition || !segmentationUrl) {
|
|
281635
281945
|
setHasResolvedInitialCamera(true);
|
|
281636
281946
|
return;
|
|
281637
281947
|
}
|
|
@@ -281643,12 +281953,13 @@ function NeuroglancerSubscriber(props) {
|
|
|
281643
281953
|
incrementLatestViewerStateIteration();
|
|
281644
281954
|
}
|
|
281645
281955
|
setHasResolvedInitialCamera(true);
|
|
281646
|
-
}, [segmentationUrl, derivedCenter,
|
|
281956
|
+
}, [segmentationUrl, derivedCenter, hasInitialNgPosition]);
|
|
281647
281957
|
const errors = [
|
|
281648
281958
|
...obsPointsErrors,
|
|
281649
281959
|
...obsSegmentationsDataErrors,
|
|
281650
281960
|
...obsSegmentationsSetsDataErrors,
|
|
281651
281961
|
...obsSegmentationsColorsDataErrors,
|
|
281962
|
+
...obsSegmentationsLocationsDataErrors,
|
|
281652
281963
|
...pointMultiIndicesDataErrors,
|
|
281653
281964
|
...segmentationMultiFeatureSelectionErrors,
|
|
281654
281965
|
...segmentationMultiIndicesDataErrors
|
|
@@ -281661,6 +281972,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281661
281972
|
obsSegmentationsDataStatus,
|
|
281662
281973
|
obsSegmentationsSetsDataStatus,
|
|
281663
281974
|
obsSegmentationsColorsDataStatus,
|
|
281975
|
+
obsSegmentationsLocationsDataStatus,
|
|
281664
281976
|
segmentationMultiFeatureSelectionStatus,
|
|
281665
281977
|
segmentationMultiIndicesDataStatus
|
|
281666
281978
|
]);
|
|
@@ -281681,15 +281993,28 @@ function NeuroglancerSubscriber(props) {
|
|
|
281681
281993
|
});
|
|
281682
281994
|
const lastSeenCameraSnapshotRef = useRef(null);
|
|
281683
281995
|
const spatialBetaJustPushedRef = useRef(false);
|
|
281996
|
+
const is3dMode = spatialRenderingMode === "3D";
|
|
281997
|
+
const fromNeuroglancer = spatialCameraSnapshot?.source === "neuroglancer";
|
|
281998
|
+
const hasSpatialCameraSnapshot = Boolean(spatialCameraSnapshot) && (fromNeuroglancer || is3dMode);
|
|
281684
281999
|
useEffect(() => {
|
|
281685
|
-
if (
|
|
282000
|
+
if (detailMode)
|
|
282001
|
+
return;
|
|
282002
|
+
if (!hasSpatialCameraSnapshot)
|
|
281686
282003
|
return;
|
|
281687
282004
|
if (spatialCameraSnapshot === lastSeenCameraSnapshotRef.current)
|
|
281688
282005
|
return;
|
|
281689
282006
|
lastSeenCameraSnapshotRef.current = spatialCameraSnapshot;
|
|
281690
|
-
const {
|
|
282007
|
+
const { quaternion: quaternion2 } = spatialCameraSnapshot;
|
|
282008
|
+
let { position: position2, projectionScale } = spatialCameraSnapshot;
|
|
281691
282009
|
if (!Array.isArray(position2) || !Array.isArray(quaternion2))
|
|
281692
282010
|
return;
|
|
282011
|
+
const ownMpu = ngMetersPerUnit(latestViewerStateRef.current?.dimensions);
|
|
282012
|
+
const inMpu = spatialCameraSnapshot.metersPerUnit;
|
|
282013
|
+
if (ownMpu && inMpu && ownMpu !== inMpu) {
|
|
282014
|
+
const k = inMpu / ownMpu;
|
|
282015
|
+
position2 = position2.map((p) => p * k);
|
|
282016
|
+
projectionScale *= k;
|
|
282017
|
+
}
|
|
281693
282018
|
const unflipped = multiplyQuat(quaternion2, Q_Y_UP);
|
|
281694
282019
|
lastInteractionSource.current = LAST_INTERACTION_SOURCE.vitessce;
|
|
281695
282020
|
spatialBetaJustPushedRef.current = true;
|
|
@@ -281697,10 +282022,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
281697
282022
|
...latestViewerStateRef.current,
|
|
281698
282023
|
position: position2,
|
|
281699
282024
|
projectionOrientation: unflipped,
|
|
281700
|
-
projectionScale
|
|
282025
|
+
projectionScale: Number.isFinite(projectionScale) ? projectionScale / cameraZoomFactor : latestViewerStateRef.current.projectionScale
|
|
281701
282026
|
};
|
|
281702
282027
|
incrementLatestViewerStateIteration();
|
|
281703
|
-
}, [spatialCameraSnapshot]);
|
|
282028
|
+
}, [spatialCameraSnapshot, hasSpatialCameraSnapshot, detailMode, cameraZoomFactor]);
|
|
281704
282029
|
const segmentationColorMapping = useMemoCustomComparison(() => {
|
|
281705
282030
|
const result = {};
|
|
281706
282031
|
segmentationLayerScopes?.forEach((layerScope) => {
|
|
@@ -281729,7 +282054,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281729
282054
|
if (knownIdSet.has(String(id2))) {
|
|
281730
282055
|
const color2 = obsColorMap.get(id2);
|
|
281731
282056
|
if (color2) {
|
|
281732
|
-
ngCellColors[id2] =
|
|
282057
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281733
282058
|
} else {
|
|
281734
282059
|
ngCellColors[id2] = GREY_HEX;
|
|
281735
282060
|
}
|
|
@@ -281746,7 +282071,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281746
282071
|
finalizeChannelColors(ngCellColors, spatialChannelOpacity, GREY_HEX);
|
|
281747
282072
|
}
|
|
281748
282073
|
} else if (obsColorEncoding === "spatialChannelColor") {
|
|
281749
|
-
const hex2 = spatialChannelColor ?
|
|
282074
|
+
const hex2 = spatialChannelColor ? colorArrayToString(spatialChannelColor) : autoColorForId(layerScope + channelScope);
|
|
281750
282075
|
if (spatialChannelColor) {
|
|
281751
282076
|
const ngCellColors = {};
|
|
281752
282077
|
if (layerIndex) {
|
|
@@ -281791,11 +282116,11 @@ function NeuroglancerSubscriber(props) {
|
|
|
281791
282116
|
const tScaled = (t4 - low) / Math.max(high - low, 1e-4);
|
|
281792
282117
|
const tClamped = Math.max(0, Math.min(1, tScaled));
|
|
281793
282118
|
const color2 = applyColormap(featureValueColormap ?? "viridis", tClamped);
|
|
281794
|
-
ngCellColors[id2] =
|
|
282119
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281795
282120
|
});
|
|
281796
282121
|
finalizeChannelColors(ngCellColors, spatialChannelOpacity);
|
|
281797
282122
|
} else if (restrictedObsIndex) {
|
|
281798
|
-
const fallbackColor = spatialChannelColor ?
|
|
282123
|
+
const fallbackColor = spatialChannelColor ? colorArrayToString(spatialChannelColor) : GREY_HEX;
|
|
281799
282124
|
const ngCellColors = {};
|
|
281800
282125
|
restrictedObsIndex.forEach((id2) => {
|
|
281801
282126
|
ngCellColors[id2] = fallbackColor;
|
|
@@ -281816,7 +282141,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281816
282141
|
if (knownIdSet.has(String(id2))) {
|
|
281817
282142
|
const color2 = cellColors.get(String(id2));
|
|
281818
282143
|
if (color2) {
|
|
281819
|
-
ngCellColors[id2] =
|
|
282144
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281820
282145
|
} else {
|
|
281821
282146
|
ngCellColors[id2] = GREY_HEX;
|
|
281822
282147
|
}
|
|
@@ -281844,16 +282169,21 @@ function NeuroglancerSubscriber(props) {
|
|
|
281844
282169
|
if (!csvUrl)
|
|
281845
282170
|
return;
|
|
281846
282171
|
fetch(csvUrl).then((r3) => r3.text()).then((text2) => {
|
|
281847
|
-
const
|
|
281848
|
-
const
|
|
281849
|
-
const
|
|
281850
|
-
const
|
|
282172
|
+
const clean = (v) => v?.trim().replace(/^"(.*)"$/, "$1");
|
|
282173
|
+
const lines = text2.split(/\r?\n/);
|
|
282174
|
+
const header = lines[0].split(",").map(clean);
|
|
282175
|
+
const meshIdIdx = header.indexOf(meshIdColumn);
|
|
282176
|
+
const cellIdIdx = header.indexOf(cellIdColumn);
|
|
282177
|
+
if (meshIdIdx < 0 || cellIdIdx < 0) {
|
|
282178
|
+
setCsvLoaded(true);
|
|
282179
|
+
return;
|
|
282180
|
+
}
|
|
281851
282181
|
const meshMap = {};
|
|
281852
282182
|
const cellMap = {};
|
|
281853
282183
|
lines.slice(1).forEach((l2) => {
|
|
281854
282184
|
const cols = l2.split(",");
|
|
281855
|
-
const meshId = cols[meshIdIdx]
|
|
281856
|
-
const cellId = cols[cellIdIdx]
|
|
282185
|
+
const meshId = clean(cols[meshIdIdx]);
|
|
282186
|
+
const cellId = clean(cols[cellIdIdx]);
|
|
281857
282187
|
if (meshId && cellId) {
|
|
281858
282188
|
meshMap[meshId] = cellId;
|
|
281859
282189
|
cellMap[cellId] = meshId;
|
|
@@ -281863,10 +282193,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
281863
282193
|
cellIdToMeshIdRef.current = cellMap;
|
|
281864
282194
|
setCsvLoaded(true);
|
|
281865
282195
|
});
|
|
281866
|
-
}, [csvUrl]);
|
|
282196
|
+
}, [csvUrl, meshIdColumn, cellIdColumn]);
|
|
281867
282197
|
useEffect(() => {
|
|
281868
282198
|
chunkCacheRef.current.clear();
|
|
281869
|
-
}, [
|
|
282199
|
+
}, [centroidSources]);
|
|
281870
282200
|
useEffect(() => {
|
|
281871
282201
|
if (ngWidth && ngHeight) {
|
|
281872
282202
|
viewportSizeRef.current = { width: ngWidth, height: ngHeight };
|
|
@@ -281897,61 +282227,61 @@ function NeuroglancerSubscriber(props) {
|
|
|
281897
282227
|
}
|
|
281898
282228
|
}, []);
|
|
281899
282229
|
const updateVisibleSegments = useCallback(async () => {
|
|
281900
|
-
if (
|
|
281901
|
-
return;
|
|
281902
|
-
if (!annotationTransformRef.current)
|
|
282230
|
+
if (detailMode)
|
|
281903
282231
|
return;
|
|
281904
282232
|
if (!segmentationLayerScopes?.length)
|
|
281905
282233
|
return;
|
|
281906
|
-
|
|
282234
|
+
const { centroidToSegLayers } = centroidLayerRoles;
|
|
282235
|
+
const infoByScope = annotationInfoByScopeRef.current;
|
|
282236
|
+
const transformByScope = annotationTransformByScopeRef.current;
|
|
282237
|
+
const readyScopes = Object.keys(infoByScope).filter((scope) => centroidToSegLayers[scope] && transformByScope[scope]);
|
|
282238
|
+
if (!readyScopes.length)
|
|
281907
282239
|
return;
|
|
281908
282240
|
const { position: position2, projectionScale } = latestViewerStateRef.current;
|
|
281909
282241
|
if (!position2 || !projectionScale)
|
|
281910
282242
|
return;
|
|
281911
|
-
const
|
|
281912
|
-
|
|
281913
|
-
|
|
281914
|
-
|
|
282243
|
+
const commitVisibleIds = (nextBySegLayer) => {
|
|
282244
|
+
const prevBySegLayer = visibleSegmentIdsBySegLayerRef.current ?? {};
|
|
282245
|
+
const segLayers = /* @__PURE__ */ new Set([...Object.keys(prevBySegLayer), ...Object.keys(nextBySegLayer)]);
|
|
282246
|
+
let changed = false;
|
|
282247
|
+
let added = 0;
|
|
282248
|
+
segLayers.forEach((segLayer) => {
|
|
282249
|
+
const prevIds = prevBySegLayer[segLayer] ?? [];
|
|
282250
|
+
const nextIds = nextBySegLayer[segLayer] ?? [];
|
|
282251
|
+
const prevSet = new Set(prevIds);
|
|
282252
|
+
added += nextIds.filter((id2) => !prevSet.has(id2)).length;
|
|
282253
|
+
if ([...prevIds].sort().join(",") !== [...nextIds].sort().join(","))
|
|
282254
|
+
changed = true;
|
|
282255
|
+
});
|
|
282256
|
+
if (changed) {
|
|
282257
|
+
visibleSegmentIdsBySegLayerRef.current = nextBySegLayer;
|
|
281915
282258
|
incrementLatestViewerStateIteration();
|
|
281916
|
-
setIsMeshLoading(false);
|
|
281917
282259
|
}
|
|
282260
|
+
return added;
|
|
282261
|
+
};
|
|
282262
|
+
const maxProjectionScale = meshLoadProjectionScaleThreshold ?? MESH_LOAD_THRESHOLD;
|
|
282263
|
+
if (projectionScale > maxProjectionScale) {
|
|
282264
|
+
commitVisibleIds({});
|
|
282265
|
+
setIsMeshLoading(false);
|
|
281918
282266
|
return;
|
|
281919
282267
|
}
|
|
281920
282268
|
const { width: width2, height: height2 } = viewportSizeRef.current;
|
|
281921
282269
|
if (!width2 || !height2)
|
|
281922
282270
|
return;
|
|
281923
|
-
const
|
|
281924
|
-
|
|
281925
|
-
|
|
281926
|
-
const allLevelCoords = info2.spatial.flatMap((level) => {
|
|
281927
|
-
const [gx, gy, gz] = level.grid_shape;
|
|
281928
|
-
const coords = [];
|
|
281929
|
-
for (let cx = 0; cx < gx; cx++) {
|
|
281930
|
-
for (let cy = 0; cy < gy; cy++) {
|
|
281931
|
-
for (let cz = 0; cz < gz; cz++) {
|
|
281932
|
-
coords.push({ level: level.key, cx, cy, cz });
|
|
281933
|
-
}
|
|
281934
|
-
}
|
|
281935
|
-
}
|
|
281936
|
-
return coords;
|
|
281937
|
-
});
|
|
281938
|
-
const fetchChunkWithPositions = async ({ level, cx, cy, cz }) => {
|
|
281939
|
-
const { serializers, serializer: defaultSerializer } = annotationTransformRef.current;
|
|
281940
|
-
const serializer2 = serializers?.[0] ?? defaultSerializer;
|
|
281941
|
-
if (!serializer2)
|
|
281942
|
-
return [];
|
|
281943
|
-
const cacheKey = `${cellsInfoUrl}/${level}/${cx}_${cy}_${cz}`;
|
|
282271
|
+
const fetchChunkWithPositions = async (cellsInfoUrl, serializer2, layout, { level, cx, cy, cz }) => {
|
|
282272
|
+
const chunkUrl = `${cellsInfoUrl}/${level}/${cx}_${cy}_${cz}`;
|
|
282273
|
+
const cacheKey = `${chunkUrl}#${layout.segmentIdProp}`;
|
|
281944
282274
|
if (chunkCacheRef.current.has(cacheKey)) {
|
|
281945
282275
|
return chunkCacheRef.current.get(cacheKey);
|
|
281946
282276
|
}
|
|
281947
282277
|
try {
|
|
281948
|
-
const res = await fetch(
|
|
282278
|
+
const res = await fetch(chunkUrl);
|
|
281949
282279
|
if (!res.ok) {
|
|
281950
282280
|
chunkCacheRef.current.set(cacheKey, []);
|
|
281951
282281
|
return [];
|
|
281952
282282
|
}
|
|
281953
282283
|
const buffer2 = await res.arrayBuffer();
|
|
281954
|
-
const entries2 = parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2);
|
|
282284
|
+
const entries2 = parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2, layout);
|
|
281955
282285
|
chunkCacheRef.current.set(cacheKey, entries2);
|
|
281956
282286
|
return entries2;
|
|
281957
282287
|
} catch (e3) {
|
|
@@ -281959,28 +282289,54 @@ function NeuroglancerSubscriber(props) {
|
|
|
281959
282289
|
return [];
|
|
281960
282290
|
}
|
|
281961
282291
|
};
|
|
281962
|
-
|
|
281963
|
-
const
|
|
282292
|
+
const collectEntriesForScope = async (scope) => {
|
|
282293
|
+
const info2 = infoByScope[scope];
|
|
282294
|
+
const { serializers, serializer: defaultSerializer } = transformByScope[scope];
|
|
282295
|
+
const serializer2 = serializers?.[0] ?? defaultSerializer;
|
|
282296
|
+
if (!serializer2 || !Array.isArray(info2.spatial))
|
|
282297
|
+
return [];
|
|
282298
|
+
const layout = getAnnotationPropertyIndices(info2, { segmentIdProp: info2.segmentIdProp });
|
|
282299
|
+
if (layout.segmentIdIndex < 0) {
|
|
282300
|
+
console.warn(`[updateVisibleSegments] No segment ID property found for centroid layer "${scope}" (properties: ${layout.propertyIds.join(", ") || "none"}). Set options.segmentIdProp on the obsLocations.ng-annotations file.`);
|
|
282301
|
+
return [];
|
|
282302
|
+
}
|
|
282303
|
+
const allLevelCoords = info2.spatial.flatMap((level) => {
|
|
282304
|
+
const [gx, gy, gz] = level.grid_shape;
|
|
282305
|
+
const coords = [];
|
|
282306
|
+
for (let cx = 0; cx < gx; cx++) {
|
|
282307
|
+
for (let cy = 0; cy < gy; cy++) {
|
|
282308
|
+
for (let cz = 0; cz < gz; cz++) {
|
|
282309
|
+
coords.push({ level: level.key, cx, cy, cz });
|
|
282310
|
+
}
|
|
282311
|
+
}
|
|
282312
|
+
}
|
|
282313
|
+
return coords;
|
|
282314
|
+
});
|
|
282315
|
+
const results = await Promise.all(allLevelCoords.map((c2) => fetchChunkWithPositions(info2.url, serializer2, layout, c2)));
|
|
281964
282316
|
const seenIds = /* @__PURE__ */ new Set();
|
|
281965
|
-
|
|
282317
|
+
return results.flat().filter(({ id: id2 }) => {
|
|
281966
282318
|
if (seenIds.has(id2))
|
|
281967
282319
|
return false;
|
|
281968
282320
|
seenIds.add(id2);
|
|
281969
282321
|
return true;
|
|
281970
282322
|
});
|
|
281971
|
-
|
|
281972
|
-
|
|
281973
|
-
|
|
281974
|
-
});
|
|
281975
|
-
obsIdToMeshIdRef.current = obsIdToMeshId;
|
|
282323
|
+
};
|
|
282324
|
+
try {
|
|
282325
|
+
const entriesByScope = await Promise.all(readyScopes.map(collectEntriesForScope));
|
|
281976
282326
|
const mat = getViewProjectionMatRef.current?.();
|
|
281977
|
-
let visibleIds;
|
|
281978
282327
|
if (!mat) {
|
|
281979
282328
|
console.warn("No viewProjectionMatrix, loading all");
|
|
281980
|
-
|
|
281981
|
-
|
|
281982
|
-
|
|
281983
|
-
|
|
282329
|
+
}
|
|
282330
|
+
const margin2 = Math.max(width2, height2) * 0.5;
|
|
282331
|
+
const nextBySegLayer = {};
|
|
282332
|
+
readyScopes.forEach((scope, i2) => {
|
|
282333
|
+
const allEntries = entriesByScope[i2];
|
|
282334
|
+
const transform3 = transformByScope[scope];
|
|
282335
|
+
const obsIdToMeshId = {};
|
|
282336
|
+
allEntries.forEach(({ id: id2, obsId }) => {
|
|
282337
|
+
obsIdToMeshId[obsId] = id2;
|
|
282338
|
+
});
|
|
282339
|
+
const visibleEntries = !mat ? allEntries : allEntries.filter(({ x: x2, y: y2, z: z2 }) => {
|
|
281984
282340
|
const vx = x2 / transform3.x;
|
|
281985
282341
|
const vy = y2 / transform3.y;
|
|
281986
282342
|
const vz = (z2 || 0) / transform3.z;
|
|
@@ -281990,36 +282346,29 @@ function NeuroglancerSubscriber(props) {
|
|
|
281990
282346
|
const screenX = (cx / cw2 + 1) * 0.5 * width2;
|
|
281991
282347
|
const screenY = (1 - cy / cw2) * 0.5 * height2;
|
|
281992
282348
|
return screenX >= -margin2 && screenX <= width2 + margin2 && screenY >= -margin2 && screenY <= height2 + margin2;
|
|
281993
|
-
})
|
|
281994
|
-
|
|
281995
|
-
|
|
281996
|
-
|
|
281997
|
-
|
|
281998
|
-
|
|
281999
|
-
|
|
282349
|
+
});
|
|
282350
|
+
centroidToSegLayers[scope].forEach((segLayer) => {
|
|
282351
|
+
const merged = new Set(nextBySegLayer[segLayer] ?? []);
|
|
282352
|
+
visibleEntries.forEach(({ id: id2 }) => merged.add(id2));
|
|
282353
|
+
nextBySegLayer[segLayer] = Array.from(merged);
|
|
282354
|
+
});
|
|
282355
|
+
});
|
|
282356
|
+
const addedIdsCount = commitVisibleIds(nextBySegLayer);
|
|
282357
|
+
const totalVisible = Object.values(nextBySegLayer).reduce((acc, ids) => acc + ids.length, 0);
|
|
282358
|
+
if (totalVisible === 0) {
|
|
282000
282359
|
setIsMeshLoading(false);
|
|
282001
282360
|
return;
|
|
282002
282361
|
}
|
|
282003
|
-
const prevIds = new Set(visibleSegmentIdsRef.current ?? []);
|
|
282004
|
-
const addedIdsCount = visibleIds.filter((id2) => !prevIds.has(id2)).length;
|
|
282005
282362
|
const hasSignificantChange = addedIdsCount > 20;
|
|
282006
|
-
if (hasSignificantChange && visibleIds.length > 0) {
|
|
282007
|
-
setIsMeshLoading(true);
|
|
282008
|
-
}
|
|
282009
|
-
const prevSorted = [...visibleSegmentIdsRef.current ?? []].sort().join(",");
|
|
282010
|
-
const nextSorted = [...visibleIds].sort().join(",");
|
|
282011
|
-
if (prevSorted !== nextSorted) {
|
|
282012
|
-
visibleSegmentIdsRef.current = visibleIds;
|
|
282013
|
-
incrementLatestViewerStateIteration();
|
|
282014
|
-
}
|
|
282015
282363
|
if (hasSignificantChange) {
|
|
282364
|
+
setIsMeshLoading(true);
|
|
282016
282365
|
setTimeout(() => setIsMeshLoading(false), MESH_LOADING_OVERLAY_TIMEOUT);
|
|
282017
282366
|
}
|
|
282018
282367
|
} catch (e3) {
|
|
282019
282368
|
console.warn("[updateVisibleSegments] error:", e3);
|
|
282020
282369
|
setIsMeshLoading(false);
|
|
282021
282370
|
}
|
|
282022
|
-
}, [segmentationLayerScopes,
|
|
282371
|
+
}, [segmentationLayerScopes, centroidLayerRoles, meshLoadProjectionScaleThreshold, detailMode]);
|
|
282023
282372
|
useEffect(() => {
|
|
282024
282373
|
updateVisibleSegmentsThrottledRef.current = throttle$1(updateVisibleSegments, 500);
|
|
282025
282374
|
return () => updateVisibleSegmentsThrottledRef.current?.cancel();
|
|
@@ -282036,48 +282385,74 @@ function NeuroglancerSubscriber(props) {
|
|
|
282036
282385
|
};
|
|
282037
282386
|
incrementLatestViewerStateIteration();
|
|
282038
282387
|
}, [initialViewerState]);
|
|
282039
|
-
const
|
|
282040
|
-
|
|
282041
|
-
|
|
282042
|
-
|
|
282043
|
-
return pointsHaveMatchingSegmentation({
|
|
282044
|
-
pointObsType: pointLayerCoordination[0]?.[firstPointScope]?.obsType,
|
|
282045
|
-
segmentationLayerScopes,
|
|
282046
|
-
segmentationChannelScopesByLayer,
|
|
282047
|
-
segmentationChannelCoordination
|
|
282048
|
-
});
|
|
282049
|
-
}, [cellsUrl, pointLayerScopes, segmentationLayerScopes, segmentationChannelScopesByLayer]);
|
|
282050
|
-
useEffect(() => {
|
|
282051
|
-
if (!cellsUrl || !annotationInfo)
|
|
282388
|
+
const hasCentroidLayers = useMemo$1(() => centroidLayerRoles.centroidScopes.some((scope) => centroidLayerUrls[scope]), [centroidLayerRoles, centroidLayerUrls]);
|
|
282389
|
+
const readyCentroidScopesRef = useRef(/* @__PURE__ */ new Set());
|
|
282390
|
+
const markScopeReadyIfComplete = useCallback((scope) => {
|
|
282391
|
+
if (readyCentroidScopesRef.current.has(scope))
|
|
282052
282392
|
return;
|
|
282053
|
-
|
|
282054
|
-
|
|
282055
|
-
|
|
282056
|
-
}
|
|
282057
|
-
|
|
282058
|
-
|
|
282059
|
-
|
|
282393
|
+
if (annotationInfoByScopeRef.current[scope] && annotationTransformByScopeRef.current[scope]) {
|
|
282394
|
+
readyCentroidScopesRef.current.add(scope);
|
|
282395
|
+
bumpAnnotationReady();
|
|
282396
|
+
}
|
|
282397
|
+
}, []);
|
|
282398
|
+
useEffect(() => {
|
|
282399
|
+
const prev2 = annotationInfoByScopeRef.current;
|
|
282400
|
+
const next4 = {};
|
|
282401
|
+
centroidLayerRoles.centroidScopes.forEach((scope) => {
|
|
282402
|
+
const url = centroidLayerUrls[scope];
|
|
282403
|
+
const info2 = annotationInfoByScope[scope];
|
|
282404
|
+
if (url && info2) {
|
|
282405
|
+
next4[scope] = { ...info2, url, segmentIdProp: segmentIdPropByScope[scope] };
|
|
282406
|
+
}
|
|
282407
|
+
});
|
|
282408
|
+
Object.keys(prev2).forEach((scope) => {
|
|
282409
|
+
if (prev2[scope]?.url !== next4[scope]?.url || prev2[scope]?.segmentIdProp !== next4[scope]?.segmentIdProp) {
|
|
282410
|
+
readyCentroidScopesRef.current.delete(scope);
|
|
282411
|
+
}
|
|
282412
|
+
});
|
|
282413
|
+
annotationInfoByScopeRef.current = next4;
|
|
282414
|
+
Object.keys(next4).forEach(markScopeReadyIfComplete);
|
|
282415
|
+
}, [centroidLayerRoles, centroidLayerUrls, annotationInfoByScope, segmentIdPropByScope, markScopeReadyIfComplete]);
|
|
282416
|
+
const updateVisibleSegmentsRef = useRef(updateVisibleSegments);
|
|
282417
|
+
updateVisibleSegmentsRef.current = updateVisibleSegments;
|
|
282060
282418
|
useEffect(() => {
|
|
282061
|
-
if (
|
|
282419
|
+
if (annotationReadyIteration > 0) {
|
|
282062
282420
|
setIsLayersLoaded(true);
|
|
282063
|
-
|
|
282421
|
+
updateVisibleSegmentsRef.current();
|
|
282064
282422
|
}
|
|
282065
|
-
}, [
|
|
282066
|
-
const onAnnotationSourceReady = useCallback((transform3) => {
|
|
282067
|
-
|
|
282068
|
-
if (
|
|
282069
|
-
|
|
282070
|
-
|
|
282423
|
+
}, [annotationReadyIteration]);
|
|
282424
|
+
const onAnnotationSourceReady = useCallback(({ layerName, ...transform3 }) => {
|
|
282425
|
+
const scope = pointScopeByNgLayerName[layerName];
|
|
282426
|
+
if (!scope)
|
|
282427
|
+
return;
|
|
282428
|
+
annotationTransformByScopeRef.current = {
|
|
282429
|
+
...annotationTransformByScopeRef.current,
|
|
282430
|
+
[scope]: transform3
|
|
282431
|
+
};
|
|
282432
|
+
markScopeReadyIfComplete(scope);
|
|
282433
|
+
}, [pointScopeByNgLayerName, markScopeReadyIfComplete]);
|
|
282434
|
+
const decodeCentroidById = useCallback((layerName, buffer2) => {
|
|
282435
|
+
const scope = pointScopeByNgLayerName[layerName];
|
|
282436
|
+
const info2 = scope ? annotationInfoByScopeRef.current[scope] : null;
|
|
282437
|
+
const transform3 = scope ? annotationTransformByScopeRef.current[scope] : null;
|
|
282438
|
+
const serializer2 = transform3?.serializers?.[0] ?? transform3?.serializer;
|
|
282439
|
+
if (!info2 || !serializer2)
|
|
282440
|
+
return null;
|
|
282441
|
+
const layout = getAnnotationPropertyIndices(info2, { segmentIdProp: info2.segmentIdProp });
|
|
282442
|
+
return parseAnnotationById(buffer2, serializer2, layout)?.id ?? null;
|
|
282443
|
+
}, [pointScopeByNgLayerName]);
|
|
282071
282444
|
const handleStateUpdate = useCallback((newState) => {
|
|
282072
282445
|
lastInteractionSource.current = LAST_INTERACTION_SOURCE.neuroglancer;
|
|
282073
282446
|
const { projectionScale, projectionOrientation, position: position2 } = newState;
|
|
282074
|
-
if (Array.isArray(position2) && Array.isArray(projectionOrientation)) {
|
|
282447
|
+
if (!detailMode && Array.isArray(position2) && Array.isArray(projectionOrientation)) {
|
|
282075
282448
|
const flippedQuaternion = multiplyQuat(projectionOrientation, Q_Y_UP);
|
|
282076
282449
|
const snapshot = {
|
|
282077
282450
|
position: Array.from(position2),
|
|
282078
282451
|
quaternion: Array.from(flippedQuaternion),
|
|
282079
|
-
projectionScale,
|
|
282080
|
-
fovDegrees: 45
|
|
282452
|
+
projectionScale: Number.isFinite(projectionScale) ? projectionScale * cameraZoomFactor : latestViewerStateRef.current?.projectionScale,
|
|
282453
|
+
fovDegrees: 45,
|
|
282454
|
+
metersPerUnit: ngMetersPerUnit(latestViewerStateRef.current?.dimensions),
|
|
282455
|
+
source: "neuroglancer"
|
|
282081
282456
|
};
|
|
282082
282457
|
lastSeenCameraSnapshotRef.current = snapshot;
|
|
282083
282458
|
setSpatialCameraSnapshot(snapshot);
|
|
@@ -282088,8 +282463,9 @@ function NeuroglancerSubscriber(props) {
|
|
|
282088
282463
|
projectionScale,
|
|
282089
282464
|
position: position2
|
|
282090
282465
|
};
|
|
282091
|
-
|
|
282092
|
-
|
|
282466
|
+
if (!detailMode)
|
|
282467
|
+
updateVisibleSegmentsThrottledRef.current?.();
|
|
282468
|
+
}, [setSpatialCameraSnapshot, detailMode, cameraZoomFactor]);
|
|
282093
282469
|
const onSegmentClick = useCallback((value2) => {
|
|
282094
282470
|
if (value2) {
|
|
282095
282471
|
const id2 = String(value2);
|
|
@@ -282121,11 +282497,56 @@ function NeuroglancerSubscriber(props) {
|
|
|
282121
282497
|
return result;
|
|
282122
282498
|
}, [segmentationColorMapping, segmentationLayerScopes, segmentationChannelScopesByLayer]);
|
|
282123
282499
|
useEffect(() => {
|
|
282124
|
-
if (!
|
|
282500
|
+
if (!hasCentroidLayers && isReady && !segmentationLayerScopes?.length) {
|
|
282125
282501
|
setIsLayersLoaded(true);
|
|
282126
282502
|
}
|
|
282127
|
-
}, [
|
|
282128
|
-
const
|
|
282503
|
+
}, [hasCentroidLayers, isReady, segmentationLayerScopes]);
|
|
282504
|
+
const lastHoveredIdRef = useRef(null);
|
|
282505
|
+
if (detailMode && cellHighlight != null) {
|
|
282506
|
+
lastHoveredIdRef.current = String(cellHighlight);
|
|
282507
|
+
}
|
|
282508
|
+
const detailSegmentIds = useMemo$1(() => {
|
|
282509
|
+
if (!detailMode)
|
|
282510
|
+
return null;
|
|
282511
|
+
const layerScope = segmentationLayerScopes?.[0];
|
|
282512
|
+
const channelScope = segmentationChannelScopesByLayer?.[layerScope]?.[0];
|
|
282513
|
+
if (!layerScope || !channelScope)
|
|
282514
|
+
return [];
|
|
282515
|
+
const channel = segmentationChannelCoordination?.[0]?.[layerScope]?.[channelScope] ?? {};
|
|
282516
|
+
const selection = channel.obsSetSelection ?? cellSetSelection;
|
|
282517
|
+
const extraSets = channel.additionalObsSets ?? additionalCellSets;
|
|
282518
|
+
const layerSets = obsSegmentationsSetsData?.[layerScope]?.[channelScope]?.obsSets;
|
|
282519
|
+
const toMeshId = (id2) => {
|
|
282520
|
+
const stripped = String(id2).replace(/^.*_/, "");
|
|
282521
|
+
return String(cellIdToMeshIdRef.current?.[stripped] ?? stripped);
|
|
282522
|
+
};
|
|
282523
|
+
const ids = /* @__PURE__ */ new Set();
|
|
282524
|
+
if (detailUseSelection && selection?.length && (layerSets || extraSets)) {
|
|
282525
|
+
const merged = mergeObsSets(layerSets, extraSets);
|
|
282526
|
+
selection.forEach((setPath) => {
|
|
282527
|
+
let node2 = { children: merged?.tree };
|
|
282528
|
+
setPath.forEach((name2) => {
|
|
282529
|
+
node2 = node2?.children?.find((n3) => n3.name === name2);
|
|
282530
|
+
});
|
|
282531
|
+
node2?.set?.forEach(([id2]) => ids.add(toMeshId(id2)));
|
|
282532
|
+
});
|
|
282533
|
+
}
|
|
282534
|
+
if (lastHoveredIdRef.current != null) {
|
|
282535
|
+
ids.add(toMeshId(lastHoveredIdRef.current));
|
|
282536
|
+
}
|
|
282537
|
+
return [...ids].sort();
|
|
282538
|
+
}, [
|
|
282539
|
+
detailMode,
|
|
282540
|
+
detailUseSelection,
|
|
282541
|
+
segmentationLayerScopes,
|
|
282542
|
+
segmentationChannelScopesByLayer,
|
|
282543
|
+
segmentationChannelCoordination,
|
|
282544
|
+
cellSetSelection,
|
|
282545
|
+
additionalCellSets,
|
|
282546
|
+
obsSegmentationsSetsData,
|
|
282547
|
+
cellHighlight,
|
|
282548
|
+
csvLoaded
|
|
282549
|
+
]);
|
|
282129
282550
|
const derivedViewerState = useMemo$1(() => {
|
|
282130
282551
|
const { current: current2 } = latestViewerStateRef;
|
|
282131
282552
|
if (spatialBetaJustPushedRef.current) {
|
|
@@ -282147,10 +282568,31 @@ function NeuroglancerSubscriber(props) {
|
|
|
282147
282568
|
if (current2.layers.length <= 0) {
|
|
282148
282569
|
return current2;
|
|
282149
282570
|
}
|
|
282571
|
+
if (detailMode) {
|
|
282572
|
+
const ids = detailSegmentIds ?? [];
|
|
282573
|
+
const detailLayers = current2.layers.filter((layer) => layer.type === "segmentation").map((layer) => {
|
|
282574
|
+
const layerScope = segmentationLayerScopes?.find((scope) => layer.name?.includes(scope));
|
|
282575
|
+
const colors2 = cellColorMappingByLayer?.[layerScope]?.colors ?? {};
|
|
282576
|
+
const fallback2 = cellColorMappingByLayer?.[layerScope]?.defaultColor ?? GREY_HEX;
|
|
282577
|
+
const segmentColors = {};
|
|
282578
|
+
ids.forEach((id2) => {
|
|
282579
|
+
segmentColors[id2] = colors2[id2] || fallback2;
|
|
282580
|
+
});
|
|
282581
|
+
return {
|
|
282582
|
+
...layer,
|
|
282583
|
+
segments: ids,
|
|
282584
|
+
segmentColors,
|
|
282585
|
+
objectAlpha: 1
|
|
282586
|
+
};
|
|
282587
|
+
});
|
|
282588
|
+
const updated2 = isEqual$3(current2.layers, detailLayers) ? current2 : { ...current2, layers: detailLayers };
|
|
282589
|
+
latestViewerStateRef.current = updated2;
|
|
282590
|
+
return updated2;
|
|
282591
|
+
}
|
|
282150
282592
|
const { projectionScale, projectionOrientation, position: position2 } = current2;
|
|
282151
|
-
const rotChangedNow = !nearEq(spatialRotationX, prevCoordsRef.current.rx, ROTATION_EPS) || !nearEq(spatialRotationY, prevCoordsRef.current.ry, ROTATION_EPS) || !nearEq(spatialRotationZ, prevCoordsRef.current.rz, ROTATION_EPS) || !nearEq(spatialRotationOrbit, prevCoordsRef.current.orbit, ROTATION_EPS);
|
|
282152
|
-
const zoomChangedNow = !nearEq(spatialZoom, prevCoordsRef.current.zoom, ROTATION_EPS);
|
|
282153
|
-
const transChangedNow = !nearEq(spatialTargetX, prevCoordsRef.current.tx, ROTATION_EPS) || !nearEq(spatialTargetY, prevCoordsRef.current.ty, ROTATION_EPS);
|
|
282593
|
+
const rotChangedNow = is3dMode && (!nearEq(spatialRotationX, prevCoordsRef.current.rx, ROTATION_EPS) || !nearEq(spatialRotationY, prevCoordsRef.current.ry, ROTATION_EPS) || !nearEq(spatialRotationZ, prevCoordsRef.current.rz, ROTATION_EPS) || !nearEq(spatialRotationOrbit, prevCoordsRef.current.orbit, ROTATION_EPS));
|
|
282594
|
+
const zoomChangedNow = is3dMode && !nearEq(spatialZoom, prevCoordsRef.current.zoom, ROTATION_EPS);
|
|
282595
|
+
const transChangedNow = is3dMode && (!nearEq(spatialTargetX, prevCoordsRef.current.tx, ROTATION_EPS) || !nearEq(spatialTargetY, prevCoordsRef.current.ty, ROTATION_EPS));
|
|
282154
282596
|
let nextProjectionScale = projectionScale;
|
|
282155
282597
|
let nextPosition = position2;
|
|
282156
282598
|
if (typeof spatialZoom === "number" && initialRenderCalibratorRef.current && lastInteractionSource.current !== LAST_INTERACTION_SOURCE.neuroglancer && zoomChangedNow) {
|
|
@@ -282171,7 +282613,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
282171
282613
|
}
|
|
282172
282614
|
const vitessceRotationRaw = eulerToQuaternion(deg2rad(spatialRotationX ?? 0), deg2rad(spatialRotationOrbit ?? 0), deg2rad(spatialRotationZ ?? 0));
|
|
282173
282615
|
const vitessceRotation = multiplyQuat(Q_Y_UP, vitessceRotationRaw);
|
|
282174
|
-
const shouldForceInitialVitPush = !initialRotationPushedRef.current && valueGreaterThanEpsilon(vitessceRotation, projectionOrientation, ROTATION_EPS);
|
|
282616
|
+
const shouldForceInitialVitPush = is3dMode && !initialRotationPushedRef.current && valueGreaterThanEpsilon(vitessceRotation, projectionOrientation, ROTATION_EPS);
|
|
282175
282617
|
const changedNowOrIInitialVitPush = rotChangedNow || zoomChangedNow || transChangedNow || shouldForceInitialVitPush;
|
|
282176
282618
|
const src = lastInteractionSource.current ?? (changedNowOrIInitialVitPush ? LAST_INTERACTION_SOURCE.vitessce : null);
|
|
282177
282619
|
let nextOrientation = projectionOrientation;
|
|
@@ -282206,20 +282648,21 @@ function NeuroglancerSubscriber(props) {
|
|
|
282206
282648
|
return layer;
|
|
282207
282649
|
const layerColorMapping = cellColorMappingByLayer?.[layerScope]?.colors ?? {};
|
|
282208
282650
|
const defaultColor = cellColorMappingByLayer?.[layerScope]?.defaultColor;
|
|
282651
|
+
const isCulled = centroidLayerRoles.culledSegLayerScopes.has(layerScope);
|
|
282209
282652
|
let segments2 = [];
|
|
282210
|
-
if (
|
|
282211
|
-
segments2 =
|
|
282653
|
+
if (isCulled) {
|
|
282654
|
+
segments2 = visibleSegmentIdsBySegLayerRef.current?.[layerScope] ?? [];
|
|
282212
282655
|
} else if (Object.keys(layerColorMapping).length > 0) {
|
|
282213
282656
|
segments2 = Object.keys(layerColorMapping);
|
|
282214
282657
|
}
|
|
282215
282658
|
let derivedSegmentColors = {};
|
|
282216
|
-
if (
|
|
282659
|
+
if (isCulled && segments2.length > 0) {
|
|
282217
282660
|
segments2.forEach((meshId) => {
|
|
282218
282661
|
const color2 = layerColorMapping[meshId] || defaultColor;
|
|
282219
282662
|
if (color2)
|
|
282220
282663
|
derivedSegmentColors[meshId] = color2;
|
|
282221
282664
|
});
|
|
282222
|
-
} else if (!
|
|
282665
|
+
} else if (!isCulled) {
|
|
282223
282666
|
derivedSegmentColors = layerColorMapping;
|
|
282224
282667
|
}
|
|
282225
282668
|
return {
|
|
@@ -282258,7 +282701,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
282258
282701
|
spatialTargetY,
|
|
282259
282702
|
initialViewerState,
|
|
282260
282703
|
latestViewerStateIteration,
|
|
282261
|
-
|
|
282704
|
+
detailMode,
|
|
282705
|
+
detailSegmentIds,
|
|
282706
|
+
is3dMode,
|
|
282707
|
+
centroidLayerRoles
|
|
282262
282708
|
]);
|
|
282263
282709
|
const onSegmentHighlight = useCallback((obsId) => {
|
|
282264
282710
|
const next4 = obsId != null ? String(obsId) : null;
|
|
@@ -282272,7 +282718,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
282272
282718
|
}
|
|
282273
282719
|
}, [isLayersLoaded]);
|
|
282274
282720
|
const hasLayers = derivedViewerState?.layers?.length > 0;
|
|
282275
|
-
const
|
|
282721
|
+
const legendPointLayerScopes = pointLayerScopes?.length > 0 ? pointLayerScopes : void 0;
|
|
282276
282722
|
return jsx$1(TitleInfo, { title: title2, info: subtitle, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: isReady && isLayersLoaded, errors, withPadding: false, guideUrl: GUIDE_URL, children: hasLayers && hasResolvedInitialCamera ? jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, ref: setContainerNode, children: [jsx$1("div", { style: { position: "absolute", top: 0, right: 0, zIndex: 50 }, children: jsx$1(MultiLegend, {
|
|
282277
282723
|
theme: "dark",
|
|
282278
282724
|
maxHeight: ngHeight,
|
|
@@ -282282,12 +282728,12 @@ function NeuroglancerSubscriber(props) {
|
|
|
282282
282728
|
segmentationChannelScopesByLayer,
|
|
282283
282729
|
segmentationChannelCoordination,
|
|
282284
282730
|
// Points
|
|
282285
|
-
pointLayerScopes:
|
|
282731
|
+
pointLayerScopes: legendPointLayerScopes,
|
|
282286
282732
|
pointLayerCoordination,
|
|
282287
282733
|
pointMultiIndicesData
|
|
282288
|
-
}) }), isMeshLoading ? jsx$1(Chip, { label: "Loading meshes...", size: "small", color: "primary", className: classes2.meshLoadingIndicator }) : null, jsx$1(NeuroglancerComp, { classes: classes2, onSegmentClick, onSelectHoveredCoords: onSegmentHighlight, viewerState: derivedViewerState, cellColorMapping: cellColorMappingByLayer, setViewerState: handleStateUpdate, onLayerLoadingChange: handleLayerLoadingChange, onAnnotationSourceReady, onViewerReady: (getFn) => {
|
|
282734
|
+
}) }), isMeshLoading ? jsx$1(Chip, { label: "Loading meshes...", size: "small", color: "primary", className: classes2.meshLoadingIndicator }) : null, jsx$1(NeuroglancerComp, { classes: classes2, onSegmentClick, onSelectHoveredCoords: detailMode ? void 0 : onSegmentHighlight, viewerState: derivedViewerState, cellColorMapping: cellColorMappingByLayer, setViewerState: handleStateUpdate, onLayerLoadingChange: handleLayerLoadingChange, onAnnotationSourceReady, onViewerReady: (getFn) => {
|
|
282289
282735
|
getViewProjectionMatRef.current = getFn;
|
|
282290
|
-
}, getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId],
|
|
282736
|
+
}, getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId], centroidAnnotationUrlsByLayerName, decodeCentroidById, allowEmptySegments: detailMode })] }) : null });
|
|
282291
282737
|
}
|
|
282292
282738
|
const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
|
|
282293
282739
|
function CellSetExpressionPlotOptions(props) {
|
|
@@ -334800,7 +335246,7 @@ const VEGA_THEMES = {
|
|
|
334800
335246
|
};
|
|
334801
335247
|
const DATASET_NAME = "table";
|
|
334802
335248
|
function VegaGlobalStyles() {
|
|
334803
|
-
const { theme } = useStyles$
|
|
335249
|
+
const { theme } = useStyles$z();
|
|
334804
335250
|
return jsx$1(GlobalStyles$3, { styles: {
|
|
334805
335251
|
"#vg-tooltip-element.vg-tooltip.custom-theme": {
|
|
334806
335252
|
boxShadow: "0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)",
|
|
@@ -334834,7 +335280,7 @@ function renderTooltipContents(tooltipText) {
|
|
|
334834
335280
|
}
|
|
334835
335281
|
function VegaPlot(props) {
|
|
334836
335282
|
const { spec: partialSpec, data: data2, getTooltipText, signalListeners, renderer = "svg", onNewView } = props;
|
|
334837
|
-
const { classes: tooltipClasses2 } = useStyles$
|
|
335283
|
+
const { classes: tooltipClasses2 } = useStyles$u();
|
|
334838
335284
|
const tooltipHandler = useMemo$1(() => {
|
|
334839
335285
|
if (typeof getTooltipText === "function") {
|
|
334840
335286
|
const tooltipConfig = {
|
|
@@ -340451,6 +340897,17 @@ class ImageWrapper {
|
|
|
340451
340897
|
const { labels: labels2, shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
|
|
340452
340898
|
return shape2[labels2.indexOf("z")];
|
|
340453
340899
|
}
|
|
340900
|
+
/**
|
|
340901
|
+
* Clamp a z target to a valid plane index.
|
|
340902
|
+
* spatialTargetZ can hold a 3D camera target in scene units, which may
|
|
340903
|
+
* exceed the number of planes; geotiff throws on out-of-range indices.
|
|
340904
|
+
*/
|
|
340905
|
+
getClampedZIndex(targetZ) {
|
|
340906
|
+
const numZ = this.getNumZ();
|
|
340907
|
+
if (!Number.isFinite(numZ) || !Number.isFinite(targetZ))
|
|
340908
|
+
return 0;
|
|
340909
|
+
return Math.min(Math.max(Math.floor(targetZ), 0), numZ - 1);
|
|
340910
|
+
}
|
|
340454
340911
|
getNumT() {
|
|
340455
340912
|
const loader2 = this.vivLoader;
|
|
340456
340913
|
const { labels: labels2, shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
|
|
@@ -340551,6 +341008,27 @@ class ImageWrapper {
|
|
|
340551
341008
|
}
|
|
340552
341009
|
return "BlackIsZero";
|
|
340553
341010
|
}
|
|
341011
|
+
/**
|
|
341012
|
+
* Meters per 3D scene unit, i.e. the unit of getModelMatrix().
|
|
341013
|
+
* OME-TIFF: physicalSizeToMatrix divides by 1 um, so the scene is in µm
|
|
341014
|
+
* (only when physical sizes exist; otherwise pixels, unit unknown → null).
|
|
341015
|
+
* OME-Zarr: the model matrix is in the units of the NGFF axes.
|
|
341016
|
+
*/
|
|
341017
|
+
getSceneMetersPerUnit() {
|
|
341018
|
+
const { metadata: metadata2 } = this.vivLoader;
|
|
341019
|
+
if (!metadata2)
|
|
341020
|
+
return null;
|
|
341021
|
+
if ("Pixels" in metadata2) {
|
|
341022
|
+
return this.hasPhysicalSize() ? 1e-6 : null;
|
|
341023
|
+
}
|
|
341024
|
+
if ("multiscales" in metadata2) {
|
|
341025
|
+
const axes = metadata2.multiscales?.[0]?.axes ?? [];
|
|
341026
|
+
const xAxis = axes.find((a2) => (typeof a2 === "string" ? a2 : a2?.name) === "x");
|
|
341027
|
+
const unit2 = typeof xAxis === "object" ? xAxis?.unit : null;
|
|
341028
|
+
return unit2 ? UNIT_TO_METERS[unit2.normalize("NFKC")] ?? null : null;
|
|
341029
|
+
}
|
|
341030
|
+
return null;
|
|
341031
|
+
}
|
|
340554
341032
|
}
|
|
340555
341033
|
class OmeZarrLoader extends AbstractTwoStepLoader {
|
|
340556
341034
|
constructor(dataSource, params2) {
|
|
@@ -341235,6 +341713,27 @@ class NgAnnotationPointsDataLoader extends AbstractTwoStepLoader {
|
|
|
341235
341713
|
}, url);
|
|
341236
341714
|
}
|
|
341237
341715
|
}
|
|
341716
|
+
class NgAnnotationLocationsDataLoader extends AbstractTwoStepLoader {
|
|
341717
|
+
async load() {
|
|
341718
|
+
const { url, requestInit: requestInit2, options } = this;
|
|
341719
|
+
if (!this.neuroglancerInfo) {
|
|
341720
|
+
this.neuroglancerInfo = fetchNeuroglancerInfo(url, requestInit2);
|
|
341721
|
+
}
|
|
341722
|
+
const neuroglancerInfo = await this.neuroglancerInfo;
|
|
341723
|
+
return new LoaderResult({
|
|
341724
|
+
obsIndex: null,
|
|
341725
|
+
obsLocations: null,
|
|
341726
|
+
obsLocationsTilingType: "neuroglancer",
|
|
341727
|
+
neuroglancerOptions: options,
|
|
341728
|
+
// Contents of the annotation source's `info` JSON file
|
|
341729
|
+
// (e.g., lower_bound, upper_bound, spatial, properties).
|
|
341730
|
+
neuroglancerInfo,
|
|
341731
|
+
// The multi-level data hooks only return the `data` part of the
|
|
341732
|
+
// LoaderResult, so the source URL is also included here.
|
|
341733
|
+
neuroglancerUrl: url
|
|
341734
|
+
}, url);
|
|
341735
|
+
}
|
|
341736
|
+
}
|
|
341238
341737
|
const decoder = new TextDecoder("utf-8");
|
|
341239
341738
|
const decodeUtf8 = (buffer2) => decoder.decode(buffer2);
|
|
341240
341739
|
const encoder = new TextEncoder();
|
|
@@ -360466,6 +360965,7 @@ const baseFileTypes = [
|
|
|
360466
360965
|
makeFileType(FileType$1.OBS_SEGMENTATIONS_GLB, DataType$3.OBS_SEGMENTATIONS, GlbDataLoader, GlbSource, meshGlbSchema),
|
|
360467
360966
|
makeFileType(FileType$1.OBS_SEGMENTATIONS_NG_PRECOMPUTED, DataType$3.OBS_SEGMENTATIONS, PrecomputedMeshDataLoader, PrecomputedMeshSource, ngPrecomputedMeshSchema),
|
|
360468
360967
|
makeFileType(FileType$1.OBS_POINTS_NG_ANNOTATIONS, DataType$3.OBS_POINTS, NgAnnotationPointsDataLoader, PrecomputedMeshSource, ngPointAnnotationSchema),
|
|
360968
|
+
makeFileType(FileType$1.OBS_LOCATIONS_NG_ANNOTATIONS, DataType$3.OBS_LOCATIONS, NgAnnotationLocationsDataLoader, PrecomputedMeshSource, ngLocationsAnnotationSchema),
|
|
360469
360969
|
// All legacy file types
|
|
360470
360970
|
makeFileType(FileType$1.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR, DataType$3.OBS_FEATURE_MATRIX, MatrixZarrAsObsFeatureMatrixLoader, ZarrDataSource, z.null()),
|
|
360471
360971
|
makeFileType(FileType$1.IMAGE_RASTER_JSON, DataType$3.IMAGE, RasterJsonAsImageLoader, JsonSource, rasterJsonSchema),
|
|
@@ -360756,6 +361256,7 @@ const baseCoordinationTypes = [
|
|
|
360756
361256
|
new PluginCoordinationType(CoordinationType$1.SPATIAL_LAYER_COLOR, null, z.array(z.number()).length(3).nullable()),
|
|
360757
361257
|
new PluginCoordinationType(CoordinationType$1.PIXEL_HIGHLIGHT, null, z.array(z.number()).length(3).nullable()),
|
|
360758
361258
|
new PluginCoordinationType(CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE, true, z.boolean()),
|
|
361259
|
+
new PluginCoordinationType(CoordinationType$1.TOOLTIP_OBS_SETS_MODE, "all", z.enum(["all", "selected"])),
|
|
360759
361260
|
new PluginCoordinationType(CoordinationType$1.LEGEND_VISIBLE, true, z.boolean()),
|
|
360760
361261
|
new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_LABELS_VISIBLE, true, z.boolean()),
|
|
360761
361262
|
new PluginCoordinationType(CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION, "vertical", z.enum(["vertical", "horizontal"])),
|
|
@@ -360899,18 +361400,21 @@ export {
|
|
|
360899
361400
|
require_objectAssign as _,
|
|
360900
361401
|
LercAddCompression as a,
|
|
360901
361402
|
diffCameraState as a0,
|
|
360902
|
-
|
|
360903
|
-
|
|
360904
|
-
|
|
360905
|
-
|
|
360906
|
-
|
|
360907
|
-
|
|
360908
|
-
|
|
360909
|
-
|
|
360910
|
-
|
|
360911
|
-
|
|
360912
|
-
|
|
360913
|
-
|
|
361403
|
+
applyQuat as a1,
|
|
361404
|
+
Vitessce as a2,
|
|
361405
|
+
PluginFileType as a3,
|
|
361406
|
+
PluginViewType as a4,
|
|
361407
|
+
PluginCoordinationType as a5,
|
|
361408
|
+
PluginJointFileType as a6,
|
|
361409
|
+
PluginAsyncFunction as a7,
|
|
361410
|
+
z as a8,
|
|
361411
|
+
hasAnnotationControllerView as a9,
|
|
361412
|
+
addAnnotationControllerView as aa,
|
|
361413
|
+
removeAnnotationControllerView as ab,
|
|
361414
|
+
hasAnyAnnotationStory as ac,
|
|
361415
|
+
isAnyAnnotationEditing as ad,
|
|
361416
|
+
enableAnnotationEditing as ae,
|
|
361417
|
+
disableAnnotationEditing as af,
|
|
360914
361418
|
getImageSize as b,
|
|
360915
361419
|
commonjsGlobal$1 as c,
|
|
360916
361420
|
requireAssign as d,
|