@vitessce/all 4.1.1 → 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-BSJ2rBtK.js → GeometryAndMeshXR-Bjs1Ruhx.js} +1 -1
- package/dist/{ReactNeuroglancer-Db7O0CnI.js → ReactNeuroglancer-9V3VAS-Y.js} +86 -25
- package/dist/{XREnterButton-D-MyjNiM.js → XREnterButton-CSkdz0V0.js} +1 -1
- package/dist/{XRSceneComponents-KvBqtraG.js → XRSceneComponents-D8sYIzX0.js} +1 -1
- package/dist/{XRWrapper-BNdj_qnt.js → XRWrapper-op8Avjd6.js} +2 -2
- package/dist/{deflate-B9RQRiyy.js → deflate-fHER2jFf.js} +1 -1
- package/dist/{higlass-CJExboBo.js → higlass-CAqsuvzB.js} +1 -1
- package/dist/{index-Vg2it-xm.js → index-B_ToVxzC.js} +5 -5
- package/dist/{index-CZ9S9EsT.js → index-CO-QVcb0.js} +1 -1
- package/dist/{index-uF7T9QQ9.js → index-zwNOYbwy.js} +862 -612
- package/dist/index.js +15 -15
- package/dist/{jpeg-D1J1ZLjO.js → jpeg-DmU-OL1-.js} +1 -1
- package/dist/{lerc-BYUvdCVc.js → lerc-BVAXzWm2.js} +1 -1
- package/dist/{lzw-BnX_a9ES.js → lzw-DBPKnFIn.js} +1 -1
- package/dist/{packbits-DxNVm_vW.js → packbits-hvcFV7pJ.js} +1 -1
- package/dist/{raw-D529ykG0.js → raw-CEMGBBAD.js} +1 -1
- package/dist/{webimage-D6fsjgI6.js → webimage-Bgcea_jr.js} +1 -1
- package/dist/{xrStore-2FzrFs3o.js → xrStore-Cg8RL1U5.js} +1 -1
- package/dist-tsc/base-plugins.d.ts.map +1 -1
- package/dist-tsc/base-plugins.js +3 -2
- package/dist-tsc/base-plugins.js.map +1 -1
- package/package.json +34 -34
- package/src/base-plugins.ts +3 -0
|
@@ -9469,6 +9469,7 @@ const FileType$1 = {
|
|
|
9469
9469
|
// Precomputed (mesh) format
|
|
9470
9470
|
OBS_SEGMENTATIONS_NG_PRECOMPUTED: "obsSegmentations.ng-precomputed",
|
|
9471
9471
|
OBS_POINTS_NG_ANNOTATIONS: "obsPoints.ng-annotations",
|
|
9472
|
+
OBS_LOCATIONS_NG_ANNOTATIONS: "obsLocations.ng-annotations",
|
|
9472
9473
|
// New file types to support old file types:
|
|
9473
9474
|
// - cells.json
|
|
9474
9475
|
OBS_EMBEDDING_CELLS_JSON: "obsEmbedding.cells.json",
|
|
@@ -9747,6 +9748,7 @@ const ViewHelpMapping = {
|
|
|
9747
9748
|
[FileType$1.OBS_SEGMENTATIONS_GLB]: DataType$3.OBS_SEGMENTATIONS,
|
|
9748
9749
|
[FileType$1.OBS_SEGMENTATIONS_NG_PRECOMPUTED]: DataType$3.OBS_SEGMENTATIONS,
|
|
9749
9750
|
[FileType$1.OBS_POINTS_NG_ANNOTATIONS]: DataType$3.OBS_POINTS,
|
|
9751
|
+
[FileType$1.OBS_LOCATIONS_NG_ANNOTATIONS]: DataType$3.OBS_LOCATIONS,
|
|
9750
9752
|
[FileType$1.IMAGE_SPATIALDATA_ZARR]: DataType$3.IMAGE,
|
|
9751
9753
|
[FileType$1.LABELS_SPATIALDATA_ZARR]: DataType$3.OBS_SEGMENTATIONS,
|
|
9752
9754
|
[FileType$1.SHAPES_SPATIALDATA_ZARR]: DataType$3.OBS_SEGMENTATIONS,
|
|
@@ -10201,7 +10203,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10201
10203
|
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
10202
10204
|
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
10203
10205
|
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
10204
|
-
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
10206
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM,
|
|
10207
|
+
CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER
|
|
10205
10208
|
],
|
|
10206
10209
|
[ViewType$1.SPATIAL_BETA]: [
|
|
10207
10210
|
CoordinationType$1.META_COORDINATION_SCOPES,
|
|
@@ -10419,7 +10422,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10419
10422
|
CoordinationType$1.SPATIAL_ROTATION_Z,
|
|
10420
10423
|
CoordinationType$1.SPATIAL_ROTATION_ORBIT,
|
|
10421
10424
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
10422
|
-
CoordinationType$1.PHOTOMETRIC_INTERPRETATION
|
|
10425
|
+
CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
|
|
10426
|
+
CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER
|
|
10423
10427
|
],
|
|
10424
10428
|
[ViewType$1.LAYER_CONTROLLER_BETA]: [
|
|
10425
10429
|
CoordinationType$1.META_COORDINATION_SCOPES,
|
|
@@ -11200,14 +11204,15 @@ const ngPrecomputedMeshSchema = z.object({
|
|
|
11200
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(),
|
|
11201
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()
|
|
11202
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.");
|
|
11203
11211
|
const ngPointAnnotationSchema = z.object({
|
|
11204
11212
|
projectionAnnotationSpacing: z.number(),
|
|
11205
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."),
|
|
11206
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."),
|
|
11207
|
-
transform:
|
|
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."),
|
|
11215
|
+
transform: ngAnnotationTransformSchema,
|
|
11211
11216
|
// Note: See comments in neuroglancer-sorger.js
|
|
11212
11217
|
// We may remove these in the future, pending clarification
|
|
11213
11218
|
// to questions in the tissue-map-tools repo
|
|
@@ -11216,6 +11221,14 @@ const ngPointAnnotationSchema = z.object({
|
|
|
11216
11221
|
quantitativeColorProp: z.string().optional(),
|
|
11217
11222
|
quantitativeColorMax: z.number().optional()
|
|
11218
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();
|
|
11219
11232
|
const obsEmbeddingAnndataSchema = annDataObsEmbedding;
|
|
11220
11233
|
const obsSpotsAnndataSchema = annDataObsLocations;
|
|
11221
11234
|
const obsPointsAnndataSchema = annDataObsLocations;
|
|
@@ -20336,7 +20349,7 @@ const { tss } = createTss({
|
|
|
20336
20349
|
},
|
|
20337
20350
|
"usePlugin": useMuiThemeStyleOverridesPlugin
|
|
20338
20351
|
});
|
|
20339
|
-
const useStyles$
|
|
20352
|
+
const useStyles$z = tss.create({});
|
|
20340
20353
|
function createChainedFunction$1(...funcs) {
|
|
20341
20354
|
return funcs.reduce((acc, func) => {
|
|
20342
20355
|
if (func == null) {
|
|
@@ -79933,7 +79946,7 @@ const Popper = React.forwardRef((props, ref2) => {
|
|
|
79933
79946
|
}, [handlePopperRef]);
|
|
79934
79947
|
React.useImperativeHandle(popperRefProp, () => popperRef.current, []);
|
|
79935
79948
|
const [exited, setExited] = React.useState(true);
|
|
79936
|
-
const { theme } = useStyles$
|
|
79949
|
+
const { theme } = useStyles$z();
|
|
79937
79950
|
const rtlPlacement = flipPlacement(initialPlacement, theme);
|
|
79938
79951
|
const [placement, setPlacement] = React.useState(rtlPlacement);
|
|
79939
79952
|
React.useEffect(() => {
|
|
@@ -80688,7 +80701,7 @@ var VariableSizeList$1 = /* @__PURE__ */ createListComponent({
|
|
|
80688
80701
|
});
|
|
80689
80702
|
const VariableSizeList = VariableSizeList$1;
|
|
80690
80703
|
const LIST_ROW_HEIGHT$1 = 48;
|
|
80691
|
-
const useStyles$
|
|
80704
|
+
const useStyles$y = makeStyles()(() => ({
|
|
80692
80705
|
searchInput: {
|
|
80693
80706
|
lineHeight: "initial",
|
|
80694
80707
|
height: "auto !important"
|
|
@@ -80728,7 +80741,7 @@ const ListboxComponent$1 = React__default.forwardRef((props, ref2) => {
|
|
|
80728
80741
|
});
|
|
80729
80742
|
function SimpleAutocomplete(props) {
|
|
80730
80743
|
const { getMatches, onChange, textInputLabel = "Enter a gene", getItemLabel = (option) => option.label } = props;
|
|
80731
|
-
const { classes: classes2 } = useStyles$
|
|
80744
|
+
const { classes: classes2 } = useStyles$y();
|
|
80732
80745
|
const [potentialItems, setPotentialItems] = useState([]);
|
|
80733
80746
|
const handleInputChange = async (_event, value2) => {
|
|
80734
80747
|
if (!value2) {
|
|
@@ -90278,7 +90291,7 @@ function defaultUrlTransform(value2) {
|
|
|
90278
90291
|
}
|
|
90279
90292
|
return "";
|
|
90280
90293
|
}
|
|
90281
|
-
const useStyles$
|
|
90294
|
+
const useStyles$x = makeStyles()((theme) => ({
|
|
90282
90295
|
description: {
|
|
90283
90296
|
"& p, details, table": {
|
|
90284
90297
|
fontSize: "80%",
|
|
@@ -90315,7 +90328,7 @@ const useStyles$y = makeStyles()((theme) => ({
|
|
|
90315
90328
|
}));
|
|
90316
90329
|
function Description(props) {
|
|
90317
90330
|
const { description: description2, metadata: metadata2, descriptionType } = props;
|
|
90318
|
-
const { classes: classes2 } = useStyles$
|
|
90331
|
+
const { classes: classes2 } = useStyles$x();
|
|
90319
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)] });
|
|
90320
90333
|
}
|
|
90321
90334
|
function DescriptionSubscriber(props) {
|
|
@@ -100880,7 +100893,7 @@ const Tooltip$2 = /* @__PURE__ */ React.forwardRef((props, ref2) => {
|
|
|
100880
100893
|
}, extraProps), getChildren());
|
|
100881
100894
|
});
|
|
100882
100895
|
const nodeHeight = 32;
|
|
100883
|
-
const useStyles$
|
|
100896
|
+
const useStyles$w = makeStyles()((theme) => ({
|
|
100884
100897
|
setsManager: {
|
|
100885
100898
|
position: "relative",
|
|
100886
100899
|
width: "100%",
|
|
@@ -101047,7 +101060,7 @@ const useStyles$x = makeStyles()((theme) => ({
|
|
|
101047
101060
|
}));
|
|
101048
101061
|
function SetsManagerTreeGlobalStyles(props) {
|
|
101049
101062
|
const { classes: classes2 } = props;
|
|
101050
|
-
const { theme } = useStyles$
|
|
101063
|
+
const { theme } = useStyles$z();
|
|
101051
101064
|
return jsx$1(ScopedGlobalStyles, { parentClassName: classes2.setsManagerTree, styles: {
|
|
101052
101065
|
".rc-tree": {
|
|
101053
101066
|
paddingLeft: "0",
|
|
@@ -101388,7 +101401,7 @@ function HelpTooltipGlobalStyles(props) {
|
|
|
101388
101401
|
}
|
|
101389
101402
|
function PopoverGlobalStyles(props) {
|
|
101390
101403
|
const { classes: classes2 } = props;
|
|
101391
|
-
const { theme } = useStyles$
|
|
101404
|
+
const { theme } = useStyles$z();
|
|
101392
101405
|
return jsx$1(ScopedGlobalStyles, { parentClassName: classes2.popover, styles: {
|
|
101393
101406
|
".rc-tooltip-inner": {
|
|
101394
101407
|
boxSizing: "border-box",
|
|
@@ -106072,7 +106085,7 @@ function NamedSetNodeStatic(props) {
|
|
|
106072
106085
|
const onClick = level === 0 && !expanded ? () => onCheckLevel(nodeKey, nextLevelToCheck) : () => onNodeView(path2);
|
|
106073
106086
|
const tooltipProps = disableTooltip ? { visible: false } : {};
|
|
106074
106087
|
const popoverMenuConfig = makeNodeViewMenuConfig(props);
|
|
106075
|
-
const { classes: classes2 } = useStyles$
|
|
106088
|
+
const { classes: classes2 } = useStyles$w();
|
|
106076
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 })] });
|
|
106077
106090
|
}
|
|
106078
106091
|
function NamedSetNodeEditing(props) {
|
|
@@ -106084,7 +106097,7 @@ function NamedSetNodeEditing(props) {
|
|
|
106084
106097
|
onNodeSetName(path2, currentTitle, true);
|
|
106085
106098
|
}
|
|
106086
106099
|
}
|
|
106087
|
-
const { classes: classes2 } = useStyles$
|
|
106100
|
+
const { classes: classes2 } = useStyles$w();
|
|
106088
106101
|
return jsxs("span", { className: classes2.titleButtonWithInput, children: [jsx$1("input", {
|
|
106089
106102
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
106090
106103
|
autoFocus: true,
|
|
@@ -106110,7 +106123,7 @@ function LevelsButtons(props) {
|
|
|
106110
106123
|
onCheckLevel(nodeKey, newLevel);
|
|
106111
106124
|
}
|
|
106112
106125
|
}
|
|
106113
|
-
const { classes: classes2 } = useStyles$
|
|
106126
|
+
const { classes: classes2 } = useStyles$w();
|
|
106114
106127
|
return jsx$1("div", { className: classes2.levelButtonsContainer, children: range$d(1, height2 + 1).map((i2) => {
|
|
106115
106128
|
const isChecked = isEqual$3(path2, checkedLevelPath) && i2 === checkedLevelIndex;
|
|
106116
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);
|
|
@@ -106194,7 +106207,7 @@ let TreeNode$1 = class TreeNode extends TreeNode$2 {
|
|
|
106194
106207
|
};
|
|
106195
106208
|
function PlusButton(props) {
|
|
106196
106209
|
const { datatype, onError, onImportTree, onCreateLevelZeroNode, importable, editable } = props;
|
|
106197
|
-
const { classes: classes2 } = useStyles$
|
|
106210
|
+
const { classes: classes2 } = useStyles$w();
|
|
106198
106211
|
const onImport = useCallback((importHandler, mimeType) => () => {
|
|
106199
106212
|
const uploadInputNode = document.createElement("input");
|
|
106200
106213
|
uploadInputNode.setAttribute("type", "file");
|
|
@@ -106311,7 +106324,7 @@ function SetsManager(props) {
|
|
|
106311
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));
|
|
106312
106325
|
});
|
|
106313
106326
|
}
|
|
106314
|
-
const { classes: classes2 } = useStyles$
|
|
106327
|
+
const { classes: classes2 } = useStyles$w();
|
|
106315
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) => {
|
|
106316
106329
|
const { eventKey: dropKey } = info2.node.props;
|
|
106317
106330
|
const { eventKey: dragKey } = info2.dragNode.props;
|
|
@@ -210912,22 +210925,22 @@ async function getDecoder(fileDirectory) {
|
|
|
210912
210925
|
const Decoder = await importFn();
|
|
210913
210926
|
return new Decoder(fileDirectory);
|
|
210914
210927
|
}
|
|
210915
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
210916
|
-
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));
|
|
210917
210930
|
addDecoder(6, () => {
|
|
210918
210931
|
throw new Error("old style JPEG compression is not supported.");
|
|
210919
210932
|
});
|
|
210920
|
-
addDecoder(7, () => import("./jpeg-
|
|
210921
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
210922
|
-
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));
|
|
210923
210936
|
addDecoder(
|
|
210924
210937
|
34887,
|
|
210925
|
-
() => import("./lerc-
|
|
210938
|
+
() => import("./lerc-BVAXzWm2.js").then(async (m2) => {
|
|
210926
210939
|
await m2.zstd.init();
|
|
210927
210940
|
return m2;
|
|
210928
210941
|
}).then((m2) => m2.default)
|
|
210929
210942
|
);
|
|
210930
|
-
addDecoder(50001, () => import("./webimage-
|
|
210943
|
+
addDecoder(50001, () => import("./webimage-Bgcea_jr.js").then((m2) => m2.default));
|
|
210931
210944
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
210932
210945
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
210933
210946
|
}
|
|
@@ -233230,7 +233243,7 @@ class RawView extends View$2 {
|
|
|
233230
233243
|
return OrbitController2;
|
|
233231
233244
|
}
|
|
233232
233245
|
}
|
|
233233
|
-
const useStyles$
|
|
233246
|
+
const useStyles$v = makeStyles()(() => ({
|
|
233234
233247
|
toolButton: {
|
|
233235
233248
|
display: "inline-flex",
|
|
233236
233249
|
"&:active": {
|
|
@@ -233292,12 +233305,12 @@ const useStyles$w = makeStyles()(() => ({
|
|
|
233292
233305
|
}));
|
|
233293
233306
|
function IconTool(props) {
|
|
233294
233307
|
const { alt, onClick, isActive: isActive2, children: children3 } = props;
|
|
233295
|
-
const { classes: classes2 } = useStyles$
|
|
233308
|
+
const { classes: classes2 } = useStyles$v();
|
|
233296
233309
|
return jsx$1("button", { className: clsx(classes2.toolIcon, { [classes2.toolActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
|
|
233297
233310
|
}
|
|
233298
233311
|
function IconButton(props) {
|
|
233299
233312
|
const { alt, onClick, children: children3 } = props;
|
|
233300
|
-
const { classes: classes2 } = useStyles$
|
|
233313
|
+
const { classes: classes2 } = useStyles$v();
|
|
233301
233314
|
return jsx$1("button", { className: clsx(classes2.toolIcon, classes2.toolButton), onClick, type: "button", title: alt, children: children3 });
|
|
233302
233315
|
}
|
|
233303
233316
|
function ToolMenu(props) {
|
|
@@ -233305,7 +233318,7 @@ function ToolMenu(props) {
|
|
|
233305
233318
|
const lassoIconAltText = "Select lasso";
|
|
233306
233319
|
const { setActiveTool, activeTool, visibleTools = { pan: true, selectLasso: true, recenter: true }, recenterOnClick = () => {
|
|
233307
233320
|
} } = props;
|
|
233308
|
-
const { classes: classes2 } = useStyles$
|
|
233321
|
+
const { classes: classes2 } = useStyles$v();
|
|
233309
233322
|
const onRecenterButtonCLick = () => {
|
|
233310
233323
|
recenterOnClick();
|
|
233311
233324
|
};
|
|
@@ -234795,7 +234808,7 @@ function ScatterplotOptions(props) {
|
|
|
234795
234808
|
id: `feature-aggregation-strategy-${scatterplotOptionsId}`
|
|
234796
234809
|
}, children: FEATURE_AGGREGATION_STRATEGIES$2.map((opt) => jsx$1("option", { value: opt, children: capitalize$3(opt) }, opt)) }) })] }) : null] });
|
|
234797
234810
|
}
|
|
234798
|
-
const useStyles$
|
|
234811
|
+
const useStyles$u = makeStyles()((theme) => ({
|
|
234799
234812
|
tooltipAnchor: {
|
|
234800
234813
|
position: "relative",
|
|
234801
234814
|
width: "0px",
|
|
@@ -234826,7 +234839,7 @@ const useStyles$v = makeStyles()((theme) => ({
|
|
|
234826
234839
|
function Tooltip3(props) {
|
|
234827
234840
|
const { x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props;
|
|
234828
234841
|
const ref2 = useRef();
|
|
234829
|
-
const { classes: classes2 } = useStyles$
|
|
234842
|
+
const { classes: classes2 } = useStyles$u();
|
|
234830
234843
|
const [placementX, setPlacementX] = useState("start");
|
|
234831
234844
|
const [placementY, setPlacementY] = useState("bottom");
|
|
234832
234845
|
const getTooltipContainer = useVitessceContainer(ref2);
|
|
@@ -234842,7 +234855,7 @@ function Tooltip3(props) {
|
|
|
234842
234855
|
}, [x2, y2, parentWidth, parentHeight]);
|
|
234843
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 });
|
|
234844
234857
|
}
|
|
234845
|
-
const useStyles$
|
|
234858
|
+
const useStyles$t = makeStyles()((theme) => ({
|
|
234846
234859
|
cellEmphasisCrosshair: {
|
|
234847
234860
|
zIndex: 50,
|
|
234848
234861
|
position: "absolute",
|
|
@@ -234853,7 +234866,7 @@ const useStyles$u = makeStyles()((theme) => ({
|
|
|
234853
234866
|
}));
|
|
234854
234867
|
function Tooltip2D(props) {
|
|
234855
234868
|
const { parentUuid, sourceUuid, x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props;
|
|
234856
|
-
const { classes: classes2 } = useStyles$
|
|
234869
|
+
const { classes: classes2 } = useStyles$t();
|
|
234857
234870
|
if (x2 < 0 || x2 > parentWidth || y2 < 0 || y2 > parentHeight) {
|
|
234858
234871
|
return null;
|
|
234859
234872
|
}
|
|
@@ -238765,7 +238778,7 @@ function getXlinkHref(cmap) {
|
|
|
238765
238778
|
const xlinkHref = ramp(color2.copy().domain(quantize$3(interpolate$1$1(0, 1), n3))).toDataURL();
|
|
238766
238779
|
return xlinkHref;
|
|
238767
238780
|
}
|
|
238768
|
-
const useStyles$
|
|
238781
|
+
const useStyles$s = makeStyles()(() => ({
|
|
238769
238782
|
legend: {
|
|
238770
238783
|
position: "relative",
|
|
238771
238784
|
// Needed for absolute positioning of slider overlay
|
|
@@ -238962,7 +238975,7 @@ function Legend(props) {
|
|
|
238962
238975
|
contourThresholds
|
|
238963
238976
|
} = props;
|
|
238964
238977
|
const svgRef = useRef(null);
|
|
238965
|
-
const { classes: classes2 } = useStyles$
|
|
238978
|
+
const { classes: classes2 } = useStyles$s();
|
|
238966
238979
|
const [localRange, setLocalRange] = useState(featureValueColormapRange);
|
|
238967
238980
|
useEffect(() => {
|
|
238968
238981
|
setLocalRange(featureValueColormapRange);
|
|
@@ -239296,7 +239309,7 @@ function Legend(props) {
|
|
|
239296
239309
|
}
|
|
239297
239310
|
} })] })] });
|
|
239298
239311
|
}
|
|
239299
|
-
const useStyles$
|
|
239312
|
+
const useStyles$r = makeStyles()(() => ({
|
|
239300
239313
|
multiLegend: {
|
|
239301
239314
|
position: "absolute",
|
|
239302
239315
|
top: "0px",
|
|
@@ -239323,7 +239336,7 @@ function MultiLegend(props) {
|
|
|
239323
239336
|
pointLayerCoordination,
|
|
239324
239337
|
pointMultiIndicesData
|
|
239325
239338
|
} = props;
|
|
239326
|
-
const { classes: classes2 } = useStyles$
|
|
239339
|
+
const { classes: classes2 } = useStyles$r();
|
|
239327
239340
|
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].reverse(), [segmentationLayerScopes]);
|
|
239328
239341
|
const reversedSpotLayerScopes = useMemo$1(() => [...spotLayerScopes || []].reverse(), [spotLayerScopes]);
|
|
239329
239342
|
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].reverse(), [pointLayerScopes]);
|
|
@@ -239416,7 +239429,7 @@ function MultiLegend(props) {
|
|
|
239416
239429
|
}) : null;
|
|
239417
239430
|
}) : null] });
|
|
239418
239431
|
}
|
|
239419
|
-
const useStyles$
|
|
239432
|
+
const useStyles$q = makeStyles()(() => ({
|
|
239420
239433
|
channelNamesLegendContainer: {
|
|
239421
239434
|
position: "absolute",
|
|
239422
239435
|
bottom: "0px",
|
|
@@ -239442,7 +239455,7 @@ const useStyles$r = makeStyles()(() => ({
|
|
|
239442
239455
|
}));
|
|
239443
239456
|
function ChannelNamesLegend(props) {
|
|
239444
239457
|
const { images, imageLayerScopes, imageLayerCoordination, imageChannelScopesByLayer, imageChannelCoordination } = props;
|
|
239445
|
-
const { classes: classes2 } = useStyles$
|
|
239458
|
+
const { classes: classes2 } = useStyles$q();
|
|
239446
239459
|
const reversedImageLayerScopes = useMemo$1(() => [...imageLayerScopes || []].reverse(), [imageLayerScopes]);
|
|
239447
239460
|
return jsx$1("div", { className: classes2.channelNamesLegendContainer, children: imageLayerScopes ? reversedImageLayerScopes.map((layerScope) => {
|
|
239448
239461
|
const layerCoordination = imageLayerCoordination[0][layerScope];
|
|
@@ -262143,16 +262156,16 @@ class ErrorBoundary extends React__default.Component {
|
|
|
262143
262156
|
}
|
|
262144
262157
|
}
|
|
262145
262158
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
262146
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
262159
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-B_ToVxzC.js").then((n3) => n3.a);
|
|
262147
262160
|
return { default: SpatialWrapper2 };
|
|
262148
262161
|
});
|
|
262149
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 }) }) }) }));
|
|
262150
262163
|
const LazySpatialAccelerated = React__default.lazy(async () => {
|
|
262151
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
262164
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-CO-QVcb0.js");
|
|
262152
262165
|
return { default: SpatialWrapper2 };
|
|
262153
262166
|
});
|
|
262154
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 }) }) }) }));
|
|
262155
|
-
const useStyles$
|
|
262168
|
+
const useStyles$p = makeStyles()(() => ({
|
|
262156
262169
|
spatialBetaCameraLabel: {
|
|
262157
262170
|
padding: "0px 0px 0px 16px"
|
|
262158
262171
|
},
|
|
@@ -262163,7 +262176,7 @@ const useStyles$q = makeStyles()(() => ({
|
|
|
262163
262176
|
function SpatialOptions(props) {
|
|
262164
262177
|
const { spatialAxisFixed, setSpatialAxisFixed, use3d } = props;
|
|
262165
262178
|
const toggleAxisId = $bdb11010cef70236$export$f680877a34711e37();
|
|
262166
|
-
const { classes: classes2 } = useStyles$
|
|
262179
|
+
const { classes: classes2 } = useStyles$p();
|
|
262167
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: {
|
|
262168
262181
|
"aria-label": "Fix or not fix spatial camera axis",
|
|
262169
262182
|
id: `spatial-camera-axis-${toggleAxisId}`
|
|
@@ -270308,7 +270321,7 @@ _defineProperty$3(WindowScroller, "defaultProps", {
|
|
|
270308
270321
|
serverHeight: 0,
|
|
270309
270322
|
serverWidth: 0
|
|
270310
270323
|
});
|
|
270311
|
-
const useStyles$
|
|
270324
|
+
const useStyles$o = makeStyles()((theme) => ({
|
|
270312
270325
|
selectableTable: {
|
|
270313
270326
|
flex: "1 1 auto",
|
|
270314
270327
|
outline: "none"
|
|
@@ -270458,7 +270471,7 @@ function SelectableTable(props) {
|
|
|
270458
270471
|
onChange(null);
|
|
270459
270472
|
}
|
|
270460
270473
|
}, [selectedRows, allowMultiple]);
|
|
270461
|
-
const { classes: classes2 } = useStyles$
|
|
270474
|
+
const { classes: classes2 } = useStyles$o();
|
|
270462
270475
|
const inputUuid = v4$1();
|
|
270463
270476
|
const rowRenderer = ({ index: index2, style: style2 }) => (
|
|
270464
270477
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
@@ -270487,7 +270500,7 @@ const FEATURELIST_SORT_OPTIONS = [
|
|
|
270487
270500
|
"original"
|
|
270488
270501
|
];
|
|
270489
270502
|
const ALT_COLNAME = "Alternate ID";
|
|
270490
|
-
const useStyles$
|
|
270503
|
+
const useStyles$n = makeStyles()(() => ({
|
|
270491
270504
|
searchBar: {
|
|
270492
270505
|
marginTop: "10px",
|
|
270493
270506
|
marginLeft: "10px",
|
|
@@ -270500,7 +270513,7 @@ const useStyles$o = makeStyles()(() => ({
|
|
|
270500
270513
|
}));
|
|
270501
270514
|
function FeatureList(props) {
|
|
270502
270515
|
const { width: width2, height: height2, hasColorEncoding, geneList = [], featureLabelsMap, geneSelection = [], geneFilter = null, setGeneSelection, enableMultiSelect, requireShiftForMultiSelect, showFeatureTable, featureListSort, featureListSortKey, hasFeatureLabels, primaryColumnName } = props;
|
|
270503
|
-
const { classes: classes2 } = useStyles$
|
|
270516
|
+
const { classes: classes2 } = useStyles$n();
|
|
270504
270517
|
const [searchTerm, setSearchTerm] = useState("");
|
|
270505
270518
|
const selectableTableSortKey = featureListSortKey === "featureIndex" ? "key" : "name";
|
|
270506
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]);
|
|
@@ -270573,7 +270586,7 @@ function FeatureListOptions(props) {
|
|
|
270573
270586
|
id: `feature-list-show-alternative-ids-${featureListId}`
|
|
270574
270587
|
} } }) })] })] }) : null] });
|
|
270575
270588
|
}
|
|
270576
|
-
const useStyles$
|
|
270589
|
+
const useStyles$m = makeStyles()((theme) => ({
|
|
270577
270590
|
featureListContainer: {
|
|
270578
270591
|
width: "100%",
|
|
270579
270592
|
height: "100%",
|
|
@@ -270588,7 +270601,7 @@ function FeatureListSubscriber(props) {
|
|
|
270588
270601
|
const loaders = useLoaders();
|
|
270589
270602
|
const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
|
|
270590
270603
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
270591
|
-
const { classes: classes2 } = useStyles$
|
|
270604
|
+
const { classes: classes2 } = useStyles$m();
|
|
270592
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);
|
|
270593
270606
|
const variablesLabel = variablesLabelOverride || featureType;
|
|
270594
270607
|
const title2 = titleOverride || `${capitalize$3(variablesLabel)} List`;
|
|
@@ -270723,7 +270736,7 @@ const useSelectionSliderStyles = makeStyles()(() => ({
|
|
|
270723
270736
|
backgroundColor: "rgba(128, 128, 128, 0.7)"
|
|
270724
270737
|
}
|
|
270725
270738
|
}));
|
|
270726
|
-
const useStyles$
|
|
270739
|
+
const useStyles$l = makeStyles()((theme) => ({
|
|
270727
270740
|
paletteContainer: {
|
|
270728
270741
|
width: "70px",
|
|
270729
270742
|
height: "40px",
|
|
@@ -270744,10 +270757,10 @@ const useStyles$m = makeStyles()((theme) => ({
|
|
|
270744
270757
|
}
|
|
270745
270758
|
}));
|
|
270746
270759
|
const ColorPalette = ({ handleChange }) => {
|
|
270747
|
-
const { classes: classes2 } = useStyles$
|
|
270760
|
+
const { classes: classes2 } = useStyles$l();
|
|
270748
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)) });
|
|
270749
270762
|
};
|
|
270750
|
-
const useStyles$
|
|
270763
|
+
const useStyles$k = makeStyles()(() => ({
|
|
270751
270764
|
menuButton: {
|
|
270752
270765
|
backgroundColor: "transparent"
|
|
270753
270766
|
},
|
|
@@ -270766,7 +270779,7 @@ function MuiSpan(props) {
|
|
|
270766
270779
|
}
|
|
270767
270780
|
function ChannelOptions$1({ handlePropertyChange, handleChannelRemove, handleIQRUpdate }) {
|
|
270768
270781
|
const [open2, setOpen] = useState(false);
|
|
270769
|
-
const { classes: classes2 } = useStyles$
|
|
270782
|
+
const { classes: classes2 } = useStyles$k();
|
|
270770
270783
|
const handleColorSelect = (color2) => {
|
|
270771
270784
|
handlePropertyChange("color", color2);
|
|
270772
270785
|
};
|
|
@@ -270776,9 +270789,23 @@ function ChannelOptions$1({ handlePropertyChange, handleChannelRemove, handleIQR
|
|
|
270776
270789
|
};
|
|
270777
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 }) })] });
|
|
270778
270791
|
}
|
|
270779
|
-
|
|
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 }) {
|
|
270780
270806
|
const { classes: classes2 } = useSelectStyles();
|
|
270781
|
-
|
|
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}`)) });
|
|
270782
270809
|
}
|
|
270783
270810
|
function ChannelVisibilityCheckbox$1({ color: color2, checked, toggle: toggle2, disabled }) {
|
|
270784
270811
|
return jsx$1(Checkbox$1, { onChange: toggle2, checked, disabled, sx: { paddingLeft: 0 }, style: { color: color2, "&$checked": { color: color2 } }, slotProps: {
|
|
@@ -270802,7 +270829,7 @@ function ChannelSlider$1({ color: color2, slider = [0, 0], handleChange, domain:
|
|
|
270802
270829
|
return `${labelPrefix} for ${color2} colormap channel`;
|
|
270803
270830
|
}, getAriaValueText: () => `Current colormap values: ${color2}-${slider}`, min: min2, max: max2, step, orientation: "horizontal", style: { color: color2, marginTop: "7px" }, disabled });
|
|
270804
270831
|
}
|
|
270805
|
-
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 }) {
|
|
270806
270833
|
const { dtype } = getSourceFromLoader(loader2);
|
|
270807
270834
|
const [domain2, setDomain] = useState(null);
|
|
270808
270835
|
const [domainType, setDomainType] = useState(null);
|
|
@@ -270875,15 +270902,15 @@ function RasterChannelController({ visibility = false, slider, color: color2, ch
|
|
|
270875
270902
|
justifyContent: "center"
|
|
270876
270903
|
}, children: [jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270877
270904
|
justifyContent: "space-between"
|
|
270878
|
-
}, 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: {
|
|
270879
270906
|
justifyContent: "space-between"
|
|
270880
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 }) })] })] });
|
|
270881
270908
|
}
|
|
270882
|
-
function BitmaskChannelController({ visibility = false, dimName, channelOptions, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions = false }) {
|
|
270909
|
+
function BitmaskChannelController({ visibility = false, dimName, channelOptions, channelsSortOrder, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions = false }) {
|
|
270883
270910
|
const createSelection = (index2) => ({ [dimName]: index2 });
|
|
270884
270911
|
return jsxs(Grid$1, { container: true, direction: "row", sx: {
|
|
270885
270912
|
justifyContent: "space-between"
|
|
270886
|
-
}, 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, {}) }) })] });
|
|
270887
270914
|
}
|
|
270888
270915
|
function VectorLayerController(props) {
|
|
270889
270916
|
const { label: label2, layer, layerType, handleLayerChange } = props;
|
|
@@ -271004,6 +271031,10 @@ function OpacitySlider({ value: value2, inputId, handleChange }) {
|
|
|
271004
271031
|
const { classes: classes2 } = useChannelSliderStyles();
|
|
271005
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" });
|
|
271006
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
|
+
}
|
|
271007
271038
|
function SliderDomainSelector({ value: value2, inputId, handleChange }) {
|
|
271008
271039
|
const { classes: classes2 } = useSelectStyles();
|
|
271009
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)) });
|
|
@@ -271037,7 +271068,7 @@ function LayerOption({ name: name2, inputId, children: children3 }) {
|
|
|
271037
271068
|
justifyContent: "center"
|
|
271038
271069
|
}, children: [jsx$1(Grid$1, { size: 6, children: jsxs(InputLabel, { htmlFor: inputId, children: [name2, ":"] }) }), jsx$1(Grid$1, { size: 6, children: children3 })] });
|
|
271039
271070
|
}
|
|
271040
|
-
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 }) {
|
|
271041
271072
|
const { labels: labels2, shape: shape2 } = Array.isArray(loader2.data) ? loader2.data[0] : loader2.data;
|
|
271042
271073
|
const hasDimensionsAndChannels = labels2.length > 0 && channels2.length > 0;
|
|
271043
271074
|
const hasZStack = shape2[labels2.indexOf("z")] > 1;
|
|
@@ -271049,7 +271080,8 @@ function LayerOptions({ colormap, opacity: opacity2, handleColormapChange, handl
|
|
|
271049
271080
|
const domainSelectorId = $bdb11010cef70236$export$f680877a34711e37();
|
|
271050
271081
|
const opacitySliderId = $bdb11010cef70236$export$f680877a34711e37();
|
|
271051
271082
|
const zeroTransparentId = $bdb11010cef70236$export$f680877a34711e37();
|
|
271052
|
-
|
|
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) => {
|
|
271053
271085
|
handleDomainChange(value2);
|
|
271054
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 }) }) })] });
|
|
271055
271087
|
}
|
|
@@ -271146,7 +271178,7 @@ const buttonStyles = {
|
|
|
271146
271178
|
fontWeight: 400
|
|
271147
271179
|
};
|
|
271148
271180
|
function LayerController$1(props) {
|
|
271149
|
-
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;
|
|
271150
271182
|
const { colormap, opacity: opacity2, channels: channels2, transparentColor, renderingMode, xSlice, ySlice, zSlice, resolution, use3d, modelMatrix: modelMatrix2 } = layer;
|
|
271151
271183
|
const channelRef = useRef(channels2);
|
|
271152
271184
|
useEffect(() => {
|
|
@@ -271330,7 +271362,7 @@ function LayerController$1(props) {
|
|
|
271330
271362
|
};
|
|
271331
271363
|
return jsx$1(
|
|
271332
271364
|
ChannelController,
|
|
271333
|
-
{ 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 },
|
|
271334
271366
|
`channel-controller-${channelId}`
|
|
271335
271367
|
);
|
|
271336
271368
|
}
|
|
@@ -271376,7 +271408,9 @@ function LayerController$1(props) {
|
|
|
271376
271408
|
setViewState,
|
|
271377
271409
|
spatialHeight,
|
|
271378
271410
|
spatialWidth,
|
|
271379
|
-
modelMatrix: modelMatrix2
|
|
271411
|
+
modelMatrix: modelMatrix2,
|
|
271412
|
+
channelsSortOrder,
|
|
271413
|
+
handleChannelsSortOrderChange: setChannelsSortOrder
|
|
271380
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" })] });
|
|
271381
271415
|
return jsxs(Accordion, { slotProps: {
|
|
271382
271416
|
root: { elevation: 4, className: controllerSectionClasses.accordionRoot }
|
|
@@ -271406,7 +271440,7 @@ function LayerController$1(props) {
|
|
|
271406
271440
|
minWidth: "50%"
|
|
271407
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] })] });
|
|
271408
271442
|
}
|
|
271409
|
-
const useStyles$
|
|
271443
|
+
const useStyles$j = makeStyles()(() => ({
|
|
271410
271444
|
addButton: {
|
|
271411
271445
|
marginTop: "10px",
|
|
271412
271446
|
marginBottom: "10px",
|
|
@@ -271418,7 +271452,7 @@ function ImageAddIcon() {
|
|
|
271418
271452
|
}
|
|
271419
271453
|
function ImageAddButton({ imageOptions, handleImageAdd }) {
|
|
271420
271454
|
const [open2, setOpen] = useState(false);
|
|
271421
|
-
const { classes: classes2 } = useStyles$
|
|
271455
|
+
const { classes: classes2 } = useStyles$j();
|
|
271422
271456
|
const handleAdd = (imgData) => {
|
|
271423
271457
|
setOpen((prev2) => !prev2);
|
|
271424
271458
|
handleImageAdd(imgData);
|
|
@@ -271477,6 +271511,8 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271477
271511
|
spatialLayout,
|
|
271478
271512
|
handleImageAdd,
|
|
271479
271513
|
enableLayerButtonsWithOneLayer,
|
|
271514
|
+
channelsSortOrder,
|
|
271515
|
+
setChannelsSortOrder,
|
|
271480
271516
|
helpText
|
|
271481
271517
|
} = props;
|
|
271482
271518
|
const shouldShowImageLayerButton = Boolean(enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1);
|
|
@@ -271532,7 +271568,9 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271532
271568
|
areLayerChannelsLoading,
|
|
271533
271569
|
spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
|
|
271534
271570
|
spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
|
|
271535
|
-
shouldShowRemoveLayerButton: shouldShowImageLayerButton
|
|
271571
|
+
shouldShowRemoveLayerButton: shouldShowImageLayerButton,
|
|
271572
|
+
channelsSortOrder,
|
|
271573
|
+
setChannelsSortOrder
|
|
271536
271574
|
}) },
|
|
271537
271575
|
`${dataset}-raster-${index2}-${i2}`
|
|
271538
271576
|
) : null;
|
|
@@ -271589,7 +271627,9 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271589
271627
|
areLayerChannelsLoading,
|
|
271590
271628
|
spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
|
|
271591
271629
|
spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
|
|
271592
|
-
shouldShowRemoveLayerButton: shouldShowImageLayerButton
|
|
271630
|
+
shouldShowRemoveLayerButton: shouldShowImageLayerButton,
|
|
271631
|
+
channelsSortOrder,
|
|
271632
|
+
setChannelsSortOrder
|
|
271593
271633
|
}) },
|
|
271594
271634
|
`${dataset}-raster-${index2}-${i2}`
|
|
271595
271635
|
) : null;
|
|
@@ -271598,7 +271638,7 @@ const LayerControllerMemoized = React__default.memo(forwardRef$1((props, ref2) =
|
|
|
271598
271638
|
function LayerControllerSubscriber$1(props) {
|
|
271599
271639
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, helpText = ViewHelpMapping.LAYER_CONTROLLER } = props;
|
|
271600
271640
|
const loaders = useLoaders();
|
|
271601
|
-
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);
|
|
271602
271642
|
const [{ imageLayerCallbacks, areLoadingImageChannels, segmentationLayerCallbacks, areLoadingSegmentationChannels }, { setImageLayerCallbacks, setAreLoadingImageChannels, setSegmentationLayerCallbacks, setAreLoadingSegmentationChannels }] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
271603
271643
|
const [spatialLayout] = useComponentLayout("spatial", ["spatialImageLayer"], coordinationScopes);
|
|
271604
271644
|
const layerControllerRef = useRef();
|
|
@@ -271687,6 +271727,8 @@ function LayerControllerSubscriber$1(props) {
|
|
|
271687
271727
|
handleRasterLayerChange,
|
|
271688
271728
|
handleRasterLayerRemove,
|
|
271689
271729
|
photometricInterpretation,
|
|
271730
|
+
channelsSortOrder,
|
|
271731
|
+
setChannelsSortOrder,
|
|
271690
271732
|
obsSegmentationsType,
|
|
271691
271733
|
segmentationLayerLoaders,
|
|
271692
271734
|
segmentationLayerMeta,
|
|
@@ -271780,7 +271822,7 @@ const channelControlCellSx = {
|
|
|
271780
271822
|
}
|
|
271781
271823
|
};
|
|
271782
271824
|
const channelSpacerCellSx = { flexShrink: 0, minWidth: "44px" };
|
|
271783
|
-
const useStyles$
|
|
271825
|
+
const useStyles$i = makeStyles()(() => ({
|
|
271784
271826
|
colorPickerPaper: {
|
|
271785
271827
|
overflow: "hidden",
|
|
271786
271828
|
"& > ul": {
|
|
@@ -271838,7 +271880,7 @@ function ChannelColorPickerMenu(props) {
|
|
|
271838
271880
|
setColor2([rgb2.r, rgb2.g, rgb2.b]);
|
|
271839
271881
|
}
|
|
271840
271882
|
}
|
|
271841
|
-
const { classes: classes2 } = useStyles$
|
|
271883
|
+
const { classes: classes2 } = useStyles$i();
|
|
271842
271884
|
const currentColor = color2 ? colorArrayToString(color2) : colorArrayToString(getDefaultColor(theme));
|
|
271843
271885
|
const isWritable = typeof setColor2 === "function";
|
|
271844
271886
|
const derivedOpen = isWritable ? isStaticColor && visible ? open2 : false : false;
|
|
@@ -271846,7 +271888,7 @@ function ChannelColorPickerMenu(props) {
|
|
|
271846
271888
|
[classes2.colorIconOutline]: theme !== "dark" && isEqual$3(color2, [255, 255, 255])
|
|
271847
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 }) });
|
|
271848
271890
|
}
|
|
271849
|
-
const useStyles$
|
|
271891
|
+
const useStyles$h = makeStyles()(() => ({
|
|
271850
271892
|
layerTypeSpotIcon: {
|
|
271851
271893
|
height: "100%",
|
|
271852
271894
|
marginLeft: "1px",
|
|
@@ -271859,7 +271901,7 @@ const useStyles$i = makeStyles()(() => ({
|
|
|
271859
271901
|
function SpotLayerEllipsisMenu(props) {
|
|
271860
271902
|
const { strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
271861
271903
|
const [open2, setOpen] = useState(false);
|
|
271862
|
-
const { classes: classes2 } = useStyles$
|
|
271904
|
+
const { classes: classes2 } = useStyles$h();
|
|
271863
271905
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
271864
271906
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271865
271907
|
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
@@ -271881,7 +271923,7 @@ function SpotLayerController(props) {
|
|
|
271881
271923
|
const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
|
|
271882
271924
|
const isStaticColor = obsColorEncoding === "spatialLayerColor";
|
|
271883
271925
|
const isColormap = obsColorEncoding === "geneSelection";
|
|
271884
|
-
const { classes: classes2 } = useStyles$
|
|
271926
|
+
const { classes: classes2 } = useStyles$h();
|
|
271885
271927
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
271886
271928
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271887
271929
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -271893,7 +271935,7 @@ function SpotLayerController(props) {
|
|
|
271893
271935
|
justifyContent: "space-between"
|
|
271894
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 }) })] }) }) });
|
|
271895
271937
|
}
|
|
271896
|
-
const useStyles$
|
|
271938
|
+
const useStyles$g = makeStyles()(() => ({
|
|
271897
271939
|
layerFeatureControllerGrid: {
|
|
271898
271940
|
padding: "0",
|
|
271899
271941
|
flexWrap: "nowrap"
|
|
@@ -271954,7 +271996,7 @@ function LayerPerFeatureController(props) {
|
|
|
271954
271996
|
]);
|
|
271955
271997
|
}
|
|
271956
271998
|
}, [featureName, featureColor, setFeatureColor, featureColorIndex]);
|
|
271957
|
-
const { classes: classes2 } = useStyles$
|
|
271999
|
+
const { classes: classes2 } = useStyles$g();
|
|
271958
272000
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
271959
272001
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
271960
272002
|
const [open2, setOpen] = useState(false);
|
|
@@ -272013,7 +272055,7 @@ function LayerPerFeatureController(props) {
|
|
|
272013
272055
|
justifyContent: "space-between"
|
|
272014
272056
|
}, children: jsx$1(LinearProgress, { variant: loadingDoneFraction === 0 ? "indeterminate" : "determinate", value: loadingDoneFraction * 100 }) }) : null] }) }, featureName);
|
|
272015
272057
|
}
|
|
272016
|
-
const useStyles$
|
|
272058
|
+
const useStyles$f = makeStyles()(() => ({
|
|
272017
272059
|
pointLayerButton: {
|
|
272018
272060
|
borderStyle: "dashed",
|
|
272019
272061
|
marginTop: "10px",
|
|
@@ -272085,7 +272127,7 @@ function PointLayerController(props) {
|
|
|
272085
272127
|
} else if (!usesLayerColor) {
|
|
272086
272128
|
colorTooltip = "The layer color is not used by the current Color Encoding mode.";
|
|
272087
272129
|
}
|
|
272088
|
-
const { classes: classes2 } = useStyles$
|
|
272130
|
+
const { classes: classes2 } = useStyles$f();
|
|
272089
272131
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
272090
272132
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272091
272133
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -272121,7 +272163,7 @@ function PointLayerController(props) {
|
|
|
272121
272163
|
justifyContent: "space-between"
|
|
272122
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] });
|
|
272123
272165
|
}
|
|
272124
|
-
const useStyles$
|
|
272166
|
+
const useStyles$e = makeStyles()(() => ({
|
|
272125
272167
|
// Cap the channel name's width; imageLayerName ellipsizes the overflow.
|
|
272126
272168
|
channelName: {
|
|
272127
272169
|
overflow: "hidden",
|
|
@@ -272140,7 +272182,7 @@ const useStyles$f = makeStyles()(() => ({
|
|
|
272140
272182
|
function SegmentationChannelEllipsisMenu(props) {
|
|
272141
272183
|
const { obsType, featureType, featureValueType, strokeWidth, setStrokeWidth, filled, setFilled, featureSelection, obsColorEncoding, setObsColorEncoding, featureValueColormap, setFeatureValueColormap, featureValueColormapRange, setFeatureValueColormapRange, tooltipsVisible, setTooltipsVisible, tooltipCrosshairsVisible, setTooltipCrosshairsVisible, legendVisible, setLegendVisible } = props;
|
|
272142
272184
|
const [open2, setOpen] = useState(false);
|
|
272143
|
-
const { classes: classes2 } = useStyles$
|
|
272185
|
+
const { classes: classes2 } = useStyles$e();
|
|
272144
272186
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
272145
272187
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272146
272188
|
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
@@ -272159,7 +272201,7 @@ function SegmentationChannelController(props) {
|
|
|
272159
272201
|
const Visibility$1 = useMemo$1(() => visibleSetting ? Visibility : VisibilityOff, [visibleSetting]);
|
|
272160
272202
|
const isStaticColor = obsColorEncoding === "spatialChannelColor";
|
|
272161
272203
|
const isColormap = obsColorEncoding === "geneSelection";
|
|
272162
|
-
const { classes: classes2 } = useStyles$
|
|
272204
|
+
const { classes: classes2 } = useStyles$e();
|
|
272163
272205
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
272164
272206
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
272165
272207
|
const handleVisibleChange = useCallback(() => {
|
|
@@ -273402,7 +273444,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
273402
273444
|
function useQuery(options, queryClient) {
|
|
273403
273445
|
return useBaseQuery(options, QueryObserver);
|
|
273404
273446
|
}
|
|
273405
|
-
const useStyles$
|
|
273447
|
+
const useStyles$d = makeStyles()(() => ({
|
|
273406
273448
|
channelMenuButton: {
|
|
273407
273449
|
backgroundColor: "transparent",
|
|
273408
273450
|
padding: "3px 0",
|
|
@@ -273416,7 +273458,7 @@ const useStyles$e = makeStyles()(() => ({
|
|
|
273416
273458
|
function ChannelOptions(props) {
|
|
273417
273459
|
const { onRemove: onRemove2, onResetWindowUsingIQR, showValueExtent, setShowValueExtent, numResolutions, spatialMaxResolution, setSpatialMaxResolution } = props;
|
|
273418
273460
|
const [open2, setOpen] = useState(false);
|
|
273419
|
-
const { classes: classes2 } = useStyles$
|
|
273461
|
+
const { classes: classes2 } = useStyles$d();
|
|
273420
273462
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
273421
273463
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273422
273464
|
function handleRemove() {
|
|
@@ -273429,7 +273471,7 @@ function ChannelOptions(props) {
|
|
|
273429
273471
|
const domainTypeId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273430
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" })] });
|
|
273431
273473
|
}
|
|
273432
|
-
const useStyles$
|
|
273474
|
+
const useStyles$c = makeStyles()(() => ({
|
|
273433
273475
|
channelSlider: {
|
|
273434
273476
|
marginTop: "7px"
|
|
273435
273477
|
}
|
|
@@ -273439,7 +273481,7 @@ function ChannelSlider(props) {
|
|
|
273439
273481
|
const rgbColor = toRgbUIString(colormapOn, color2, theme);
|
|
273440
273482
|
const dtype = image2?.getDtype();
|
|
273441
273483
|
const fullDomain = dtype ? DOMAINS[dtype] : [0, 0];
|
|
273442
|
-
const { classes: classes2 } = useStyles$
|
|
273484
|
+
const { classes: classes2 } = useStyles$c();
|
|
273443
273485
|
useEffect(() => {
|
|
273444
273486
|
if (!window2 && !disabled && Array.isArray(minMaxDomain?.upperThreeQuarters)) {
|
|
273445
273487
|
setWindow2(minMaxDomain?.upperThreeQuarters);
|
|
@@ -273454,7 +273496,7 @@ function ChannelSlider(props) {
|
|
|
273454
273496
|
return `${labelPrefix} for ${rgbColor} colormap channel`;
|
|
273455
273497
|
}, getAriaValueText: () => `Current colormap values: ${rgbColor}-${window2}`, min: min2, max: max2, step, orientation: "horizontal", className: classes2.channelSlider, style: { color: rgbColor }, disabled });
|
|
273456
273498
|
}
|
|
273457
|
-
const useStyles$
|
|
273499
|
+
const useStyles$b = makeStyles()(() => ({
|
|
273458
273500
|
visibilityCheckbox: {
|
|
273459
273501
|
padding: "10px 0"
|
|
273460
273502
|
}
|
|
@@ -273468,10 +273510,10 @@ function getCheckboxColor(colormapOn, color2, theme) {
|
|
|
273468
273510
|
function ChannelVisibilityCheckbox(props) {
|
|
273469
273511
|
const { color: color2, visible, setVisible, disabled, theme, colormapOn } = props;
|
|
273470
273512
|
const rgbColor = getCheckboxColor(colormapOn, color2, theme);
|
|
273471
|
-
const { classes: classes2 } = useStyles$
|
|
273513
|
+
const { classes: classes2 } = useStyles$b();
|
|
273472
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" } } });
|
|
273473
273515
|
}
|
|
273474
|
-
const useStyles$
|
|
273516
|
+
const useStyles$a = makeStyles()(() => ({
|
|
273475
273517
|
oneLineChannelSelect: {
|
|
273476
273518
|
width: "90%",
|
|
273477
273519
|
marginLeft: "5%",
|
|
@@ -273480,21 +273522,13 @@ const useStyles$b = makeStyles()(() => ({
|
|
|
273480
273522
|
}));
|
|
273481
273523
|
function ChannelSelectionDropdown(props) {
|
|
273482
273524
|
const { featureIndex, channelsSortOrder, targetC, setTargetC, setWindow: setWindow2, disabled } = props;
|
|
273483
|
-
const { classes: classes2 } = useStyles$
|
|
273525
|
+
const { classes: classes2 } = useStyles$a();
|
|
273484
273526
|
const { classes: selectClasses2 } = useSelectStyles();
|
|
273485
273527
|
function handleChange(event2) {
|
|
273486
273528
|
setTargetC(event2.target.value === "" ? null : Number(event2.target.value));
|
|
273487
273529
|
setWindow2(null);
|
|
273488
273530
|
}
|
|
273489
|
-
const sortedOptions = useMemo$1(() =>
|
|
273490
|
-
if (!Array.isArray(featureIndex))
|
|
273491
|
-
return [];
|
|
273492
|
-
const options = featureIndex.map((channelName, channelIndex) => ({ channelName, channelIndex }));
|
|
273493
|
-
if (channelsSortOrder === "alphabetical") {
|
|
273494
|
-
return options.sort((a2, b2) => a2.channelName.localeCompare(b2.channelName, void 0, { numeric: true, sensitivity: "base" }));
|
|
273495
|
-
}
|
|
273496
|
-
return options;
|
|
273497
|
-
}, [featureIndex, channelsSortOrder]);
|
|
273531
|
+
const sortedOptions = useMemo$1(() => getSortedChannelOptions(featureIndex, channelsSortOrder), [featureIndex, channelsSortOrder]);
|
|
273498
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;
|
|
273499
273533
|
}
|
|
273500
273534
|
function ImageChannelController(props) {
|
|
@@ -273642,7 +273676,7 @@ function LoadingStatusIndicator(props) {
|
|
|
273642
273676
|
mb: 0.5
|
|
273643
273677
|
}, children: jsx$1(LinearProgress, { variant: "determinate", value: percentage }) })] });
|
|
273644
273678
|
}
|
|
273645
|
-
const useStyles$
|
|
273679
|
+
const useStyles$9 = makeStyles()(() => ({
|
|
273646
273680
|
imageLayerButton: {
|
|
273647
273681
|
borderStyle: "dashed",
|
|
273648
273682
|
marginTop: "10px",
|
|
@@ -273744,7 +273778,7 @@ function ImageLayerEllipsisMenu(props) {
|
|
|
273744
273778
|
...lodSliderRangeConfig,
|
|
273745
273779
|
inputMode: "numeric",
|
|
273746
273780
|
pattern: "[0-9]*"
|
|
273747
|
-
} })] }), 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)) })] })] });
|
|
273748
273782
|
}
|
|
273749
273783
|
function ImageLayerController(props) {
|
|
273750
273784
|
const {
|
|
@@ -273787,7 +273821,7 @@ function ImageLayerController(props) {
|
|
|
273787
273821
|
}, [visible, setVisible]);
|
|
273788
273822
|
const handleOpacityChange = useCallback((e3, v) => setOpacity2(v), [setOpacity2]);
|
|
273789
273823
|
const handleOpenChange = useCallback(() => setOpen((prev2) => !prev2), []);
|
|
273790
|
-
const { classes: classes2 } = useStyles$
|
|
273824
|
+
const { classes: classes2 } = useStyles$9();
|
|
273791
273825
|
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273792
273826
|
const { classes: controllerSectionClasses } = useControllerSectionStyles();
|
|
273793
273827
|
const isMultiChannel = photometricInterpretation !== "RGB";
|
|
@@ -273807,7 +273841,7 @@ function ImageLayerController(props) {
|
|
|
273807
273841
|
justifyContent: "space-between"
|
|
273808
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] }) });
|
|
273809
273843
|
}
|
|
273810
|
-
const useStyles$
|
|
273844
|
+
const useStyles$8 = makeStyles()((theme) => ({
|
|
273811
273845
|
dimensionsIcon: {
|
|
273812
273846
|
height: "40px",
|
|
273813
273847
|
width: "40px",
|
|
@@ -273831,7 +273865,7 @@ const useStyles$9 = makeStyles()((theme) => ({
|
|
|
273831
273865
|
function GlobalDimensionSlider(props) {
|
|
273832
273866
|
const { label: label2, targetValue, setTargetValue, min: min2 = 0, max: max2 = 0, spatialRenderingMode = null, setSpatialRenderingMode = null, enable3d = true } = props;
|
|
273833
273867
|
const { classes: lcClasses } = useControllerSectionStyles();
|
|
273834
|
-
const { classes: classes2 } = useStyles$
|
|
273868
|
+
const { classes: classes2 } = useStyles$8();
|
|
273835
273869
|
const isForZ = spatialRenderingMode !== null;
|
|
273836
273870
|
const is3dMode = spatialRenderingMode === "3D";
|
|
273837
273871
|
function handleRenderingModeChange(event2) {
|
|
@@ -273844,117 +273878,17 @@ function GlobalDimensionSlider(props) {
|
|
|
273844
273878
|
justifyContent: "space-between"
|
|
273845
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 })] }) }) });
|
|
273846
273880
|
}
|
|
273847
|
-
const useStyles$8 = makeStyles()(() => ({
|
|
273848
|
-
layerTypeCentroidSegmentationIcon: {
|
|
273849
|
-
height: "100%",
|
|
273850
|
-
marginLeft: "1px",
|
|
273851
|
-
fill: "currentColor",
|
|
273852
|
-
fontSize: "24px",
|
|
273853
|
-
width: "50%",
|
|
273854
|
-
maxWidth: "24px"
|
|
273855
|
-
},
|
|
273856
|
-
divider: {
|
|
273857
|
-
width: "1px",
|
|
273858
|
-
height: "20px",
|
|
273859
|
-
background: "currentColor",
|
|
273860
|
-
flexShrink: 0,
|
|
273861
|
-
margin: "0 10px"
|
|
273862
|
-
},
|
|
273863
|
-
inlineLabel: {
|
|
273864
|
-
margin: "0px !important",
|
|
273865
|
-
lineHeight: 1,
|
|
273866
|
-
alignSelf: "center"
|
|
273867
|
-
},
|
|
273868
|
-
iconCell: {
|
|
273869
|
-
display: "flex",
|
|
273870
|
-
alignItems: "center",
|
|
273871
|
-
justifyContent: "center"
|
|
273872
|
-
}
|
|
273873
|
-
}));
|
|
273874
|
-
function CombinedEllipsisMenu(props) {
|
|
273875
|
-
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;
|
|
273876
|
-
const [open2, setOpen] = useState(false);
|
|
273877
|
-
const { classes: selectClasses2 } = useSelectStyles();
|
|
273878
|
-
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273879
|
-
const filledId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273880
|
-
const strokeWidthId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273881
|
-
const colorEncodingId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273882
|
-
const colormapId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273883
|
-
const colormapRangeId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273884
|
-
const tooltipsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273885
|
-
const crosshairsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273886
|
-
const legendId = $bdb11010cef70236$export$f680877a34711e37();
|
|
273887
|
-
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) => {
|
|
273888
|
-
setFeatureValueColormap(e3.target.value);
|
|
273889
|
-
setPointFeatureValueColormap?.(e3.target.value);
|
|
273890
|
-
}, 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) => {
|
|
273891
|
-
setFeatureValueColormapRange(v);
|
|
273892
|
-
setPointFeatureValueColormapRange?.(v);
|
|
273893
|
-
}, 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 } } })] })] });
|
|
273894
|
-
}
|
|
273895
|
-
function SegmentationCentroidsController(props) {
|
|
273896
|
-
const { theme, segScope, segLayerCoordination, segChannelScopesByLayer, segChannelCoordination, pointScope, pointLayerCoordination } = props;
|
|
273897
|
-
const { classes: classes2 } = useStyles$8();
|
|
273898
|
-
const { classes: lcClasses } = useControllerSectionStyles();
|
|
273899
|
-
const { classes: menuClasses } = useEllipsisMenuStyles();
|
|
273900
|
-
const channelScopes = segChannelScopesByLayer?.[segScope] ?? [];
|
|
273901
|
-
const primaryChanScope = channelScopes[0];
|
|
273902
|
-
const chanValues = segChannelCoordination[0]?.[segScope]?.[primaryChanScope] ?? {};
|
|
273903
|
-
const chanSetters = segChannelCoordination[1]?.[segScope]?.[primaryChanScope] ?? {};
|
|
273904
|
-
const { obsType, featureType, featureValueType, spatialChannelVisible: segVisible, spatialChannelOpacity: segOpacity, spatialChannelColor: segColor, spatialSegmentationFilled: filled, spatialSegmentationStrokeWidth: strokeWidth, obsColorEncoding, featureSelection, featureValueColormap, featureValueColormapRange, tooltipsVisible, tooltipCrosshairsVisible, legendVisible } = chanValues;
|
|
273905
|
-
const { setSpatialChannelVisible: setSegVisible, setSpatialChannelOpacity: setSegOpacity, setSpatialChannelColor: setSegColor, setSpatialSegmentationFilled: setFilled, setSpatialSegmentationStrokeWidth: setStrokeWidth, setObsColorEncoding, setFeatureValueColormap, setFeatureValueColormapRange, setTooltipsVisible, setTooltipCrosshairsVisible, setLegendVisible } = chanSetters;
|
|
273906
|
-
const pointValues = pointLayerCoordination[0]?.[pointScope] ?? {};
|
|
273907
|
-
const pointSetters = pointLayerCoordination[1]?.[pointScope] ?? {};
|
|
273908
|
-
const { spatialLayerVisible: pointVisible, spatialLayerOpacity: pointOpacity, spatialLayerColor: pointColor, obsColorEncoding: pointObsColorEncoding, spatialLayerLabel: pointSpatialLayerLabel, featureValueColormap: pointFeatureValueColormap } = pointValues;
|
|
273909
|
-
const { setSpatialLayerVisible: setPointVisible, setSpatialLayerOpacity: setPointOpacity, setSpatialLayerColor: setPointColor, setObsColorEncoding: setPointObsColorEncoding, setFeatureValueColormap: setPointFeatureValueColormap, setFeatureValueColormapRange: setPointFeatureValueColormapRange } = pointSetters;
|
|
273910
|
-
const sharedOpacity = segOpacity ?? 1;
|
|
273911
|
-
const segValues = segLayerCoordination[0]?.[segScope] ?? {};
|
|
273912
|
-
const { spatialLayerLabel: segSpatialLayerLabel } = segValues;
|
|
273913
|
-
const handleOpacityChange = useCallback((e3, v) => {
|
|
273914
|
-
setSegOpacity?.(v);
|
|
273915
|
-
setPointOpacity?.(v);
|
|
273916
|
-
}, [setSegOpacity, setPointOpacity]);
|
|
273917
|
-
const handleSegVisibleChange = useCallback(() => {
|
|
273918
|
-
setSegVisible?.(typeof segVisible === "boolean" ? !segVisible : false);
|
|
273919
|
-
}, [segVisible, setSegVisible]);
|
|
273920
|
-
const handlePointVisibleChange = useCallback(() => {
|
|
273921
|
-
setPointVisible?.(typeof pointVisible === "boolean" ? !pointVisible : false);
|
|
273922
|
-
}, [pointVisible, setPointVisible]);
|
|
273923
|
-
const handleColorEncodingChange = useCallback((e3) => {
|
|
273924
|
-
const val = e3.target.value;
|
|
273925
|
-
setObsColorEncoding(val);
|
|
273926
|
-
if (val === "geneSelection") {
|
|
273927
|
-
setPointObsColorEncoding?.("geneSelection");
|
|
273928
|
-
} else if (val === "cellSetSelection") {
|
|
273929
|
-
setPointObsColorEncoding?.("cellSetSelection");
|
|
273930
|
-
} else {
|
|
273931
|
-
setPointObsColorEncoding?.("spatialChannelColor");
|
|
273932
|
-
}
|
|
273933
|
-
}, [setObsColorEncoding, setPointObsColorEncoding]);
|
|
273934
|
-
const segVisibleSetting = typeof segVisible === "boolean" ? segVisible : true;
|
|
273935
|
-
const pointVisibleSetting = typeof pointVisible === "boolean" ? pointVisible : true;
|
|
273936
|
-
const SegVisibility = segVisibleSetting ? Visibility : VisibilityOff;
|
|
273937
|
-
const PointVisibility = pointVisibleSetting ? Visibility : VisibilityOff;
|
|
273938
|
-
const isStaticColor = obsColorEncoding === "spatialChannelColor";
|
|
273939
|
-
const isColormap = obsColorEncoding === "geneSelection";
|
|
273940
|
-
const pointIsStaticColor = pointObsColorEncoding === "spatialChannelColor";
|
|
273941
|
-
const pointIsColormap = pointObsColorEncoding === "geneSelection";
|
|
273942
|
-
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: {
|
|
273943
|
-
justifyContent: "space-between",
|
|
273944
|
-
alignItems: "center"
|
|
273945
|
-
}, 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 }) })] }) }) });
|
|
273946
|
-
}
|
|
273947
273881
|
function LayerController(props) {
|
|
273948
|
-
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;
|
|
273949
273883
|
const anyLayerHasT = Object.values(images || {}).some((image2) => image2?.image?.instance.hasTStack());
|
|
273950
273884
|
const anyLayerHasZ = Object.values(images || {}).some((image2) => image2?.image?.instance.hasZStack());
|
|
273951
273885
|
const maxT = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumT()), 1) - 1;
|
|
273952
273886
|
const maxZ = Object.values(images || {}).reduce((a2, h2) => Math.max(a2, h2?.image?.instance.getNumZ()), 1) - 1;
|
|
273953
273887
|
const reversedImageLayerScopes = useMemo$1(() => [...imageLayerScopes || []].reverse(), [imageLayerScopes]);
|
|
273954
273888
|
const reversedSpotLayerScopes = useMemo$1(() => [...spotLayerScopes || []].reverse(), [spotLayerScopes]);
|
|
273955
|
-
const reversedPointLayerScopes = useMemo$1(() => [...pointLayerScopes || []].
|
|
273956
|
-
const reversedSegmentationLayerScopes = useMemo$1(() => [...segmentationLayerScopes || []].
|
|
273957
|
-
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))] });
|
|
273958
273892
|
}
|
|
273959
273893
|
function LayerControllerSubscriber(props) {
|
|
273960
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;
|
|
@@ -274092,40 +274026,6 @@ function LayerControllerSubscriber(props) {
|
|
|
274092
274026
|
CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
274093
274027
|
CoordinationType$1.LEGEND_VISIBLE
|
|
274094
274028
|
], coordinationScopes, coordinationScopesBy, CoordinationType$1.POINT_LAYER);
|
|
274095
|
-
const centroidSegmentationPairs = React__default.useMemo(() => {
|
|
274096
|
-
const pairs = [];
|
|
274097
|
-
const pairedSegScopes = /* @__PURE__ */ new Set();
|
|
274098
|
-
const pairedPointScopes = /* @__PURE__ */ new Set();
|
|
274099
|
-
pointLayerScopes.forEach((pointScope) => {
|
|
274100
|
-
const pointCoord = pointLayerCoordination[0][pointScope];
|
|
274101
|
-
if (!pointCoord)
|
|
274102
|
-
return;
|
|
274103
|
-
const pointObsType = pointCoord[CoordinationType$1.OBS_TYPE];
|
|
274104
|
-
if (!pointObsType)
|
|
274105
|
-
return;
|
|
274106
|
-
const matchingSegScope = segmentationLayerScopes.find((segScope) => {
|
|
274107
|
-
if (pairedSegScopes.has(segScope))
|
|
274108
|
-
return false;
|
|
274109
|
-
const channelScopes = segmentationChannelScopesByLayer[segScope] || [];
|
|
274110
|
-
return channelScopes.some((chanScope) => {
|
|
274111
|
-
const chanCoord = segmentationChannelCoordination[0]?.[segScope]?.[chanScope];
|
|
274112
|
-
return chanCoord?.[CoordinationType$1.OBS_TYPE] === pointObsType;
|
|
274113
|
-
});
|
|
274114
|
-
});
|
|
274115
|
-
if (matchingSegScope) {
|
|
274116
|
-
pairs.push({ pointScope, segScope: matchingSegScope });
|
|
274117
|
-
pairedSegScopes.add(matchingSegScope);
|
|
274118
|
-
pairedPointScopes.add(pointScope);
|
|
274119
|
-
}
|
|
274120
|
-
});
|
|
274121
|
-
return { pairs, pairedSegScopes, pairedPointScopes };
|
|
274122
|
-
}, [
|
|
274123
|
-
pointLayerScopes,
|
|
274124
|
-
pointLayerCoordination,
|
|
274125
|
-
segmentationLayerScopes,
|
|
274126
|
-
segmentationChannelScopesByLayer,
|
|
274127
|
-
segmentationChannelCoordination
|
|
274128
|
-
]);
|
|
274129
274029
|
const [{ volumeLoadingProgress: volumeLoadingStatus, tiledPointsLoadingProgress }] = useAuxiliaryCoordination([
|
|
274130
274030
|
"spatialAcceleratedVolumeLoadingProgress",
|
|
274131
274031
|
"spatialTiledPointsLoadingProgress"
|
|
@@ -274153,7 +274053,7 @@ function LayerControllerSubscriber(props) {
|
|
|
274153
274053
|
imageDataStatus,
|
|
274154
274054
|
pointMultiIndicesDataStatus
|
|
274155
274055
|
]);
|
|
274156
|
-
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 }) });
|
|
274157
274057
|
}
|
|
274158
274058
|
const isIterable$2 = (obj) => Symbol.iterator in obj;
|
|
274159
274059
|
const hasIterableEntries = (value2) => (
|
|
@@ -275312,7 +275212,7 @@ const GEOMETRY_FIELDS = {
|
|
|
275312
275212
|
["Radius", [["radiusX", "rx"], ["radiusY", "ry"]]]
|
|
275313
275213
|
]
|
|
275314
275214
|
};
|
|
275315
|
-
function rgbToHex$
|
|
275215
|
+
function rgbToHex$1(rgb2) {
|
|
275316
275216
|
return `#${rgb2.slice(0, 3).map((c2) => Math.max(0, Math.min(255, Math.round(c2))).toString(16).padStart(2, "0")).join("")}`;
|
|
275317
275217
|
}
|
|
275318
275218
|
function hexToRgb(hex2) {
|
|
@@ -275343,7 +275243,7 @@ function ShapeEditor(props) {
|
|
|
275343
275243
|
const strokeColor = shape2.strokeColor ?? DEFAULT_SHAPE_STROKE_COLOR;
|
|
275344
275244
|
const measurement = getMeasurementLabel(shape2, null, viewType);
|
|
275345
275245
|
const numDigits = String(frames.length).length;
|
|
275346
|
-
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) => {
|
|
275347
275247
|
if (e3.target.value !== "") {
|
|
275348
275248
|
onCopyToFrame(Number(e3.target.value));
|
|
275349
275249
|
}
|
|
@@ -277613,7 +277513,7 @@ function HiglassGlobalStyles(props) {
|
|
|
277613
277513
|
}
|
|
277614
277514
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
277615
277515
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
277616
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
277516
|
+
const { HiGlassComponent } = await import("./higlass-CAqsuvzB.js");
|
|
277617
277517
|
return { default: HiGlassComponent };
|
|
277618
277518
|
});
|
|
277619
277519
|
const HG_SIZE = 800;
|
|
@@ -280568,12 +280468,27 @@ function NeuroglancerGlobalStyles(props) {
|
|
|
280568
280468
|
const { classes: classes2 } = props;
|
|
280569
280469
|
return jsxs(Fragment, { children: [jsx$1(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsx$1(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
|
|
280570
280470
|
}
|
|
280571
|
-
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-
|
|
280471
|
+
const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-9V3VAS-Y.js"));
|
|
280572
280472
|
function createWorker() {
|
|
280573
280473
|
const worker = new WorkerFactory$1();
|
|
280574
280474
|
worker.AsyncComputationWorker = WorkerFactory;
|
|
280575
280475
|
return worker;
|
|
280576
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
|
+
}
|
|
280577
280492
|
class NeuroglancerComp extends PureComponent {
|
|
280578
280493
|
constructor(props) {
|
|
280579
280494
|
super(props);
|
|
@@ -280613,16 +280528,27 @@ class NeuroglancerComp extends PureComponent {
|
|
|
280613
280528
|
}
|
|
280614
280529
|
};
|
|
280615
280530
|
remapWheelToZoom(viewer.inputEventBindings.perspectiveView);
|
|
280616
|
-
const {
|
|
280531
|
+
const { onViewerReady } = this.props;
|
|
280617
280532
|
this.prevHoverHandler = () => {
|
|
280618
280533
|
const ms = viewer.mouseState;
|
|
280534
|
+
const { getMeshIdToCellId, centroidAnnotationUrlsByLayerName, decodeCentroidById } = this.props;
|
|
280619
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
|
+
}
|
|
280620
280542
|
const byIdKey = String(ms.pickedAnnotationId);
|
|
280621
|
-
fetch(`${
|
|
280622
|
-
const
|
|
280623
|
-
|
|
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
|
+
}
|
|
280624
280549
|
const cellId = getMeshIdToCellId?.(actualMeshId) ?? actualMeshId;
|
|
280625
280550
|
this.latestOnSelectHoveredCoords?.(cellId);
|
|
280551
|
+
}).catch(() => {
|
|
280626
280552
|
});
|
|
280627
280553
|
return;
|
|
280628
280554
|
}
|
|
@@ -280666,9 +280592,9 @@ class NeuroglancerComp extends PureComponent {
|
|
|
280666
280592
|
this.bundleRoot = null;
|
|
280667
280593
|
}
|
|
280668
280594
|
render() {
|
|
280669
|
-
const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady,
|
|
280595
|
+
const { classes: classes2, viewerState, cellColorMapping, onLayerLoadingChange, onAnnotationSourceReady, onViewerReady, allowEmptySegments } = this.props;
|
|
280670
280596
|
const { bundleRootReady } = this.state;
|
|
280671
|
-
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 }) }) })] });
|
|
280672
280598
|
}
|
|
280673
280599
|
}
|
|
280674
280600
|
function customIsEqualForCellColors(prevDeps, nextDeps) {
|
|
@@ -280716,9 +280642,10 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
|
|
|
280716
280642
|
let forceUpdate = false;
|
|
280717
280643
|
const curriedShallowDiff = (depName) => shallowDiff(prevDeps, nextDeps, depName);
|
|
280718
280644
|
const curriedShallowDiffByLayer = (depName, scopeName) => shallowDiffByLayer(prevDeps, nextDeps, depName, scopeName);
|
|
280645
|
+
const curriedShallowDiffByChannel = (depName, firstName, secondName) => shallowDiffByChannel(prevDeps, nextDeps, depName, firstName, secondName);
|
|
280719
280646
|
const curriedShallowDiffByLayerCoordinationWithKeys = (depName, layerScope, keys2) => shallowDiffByLayerCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, keys2);
|
|
280720
280647
|
const curriedShallowDiffByChannelCoordinationWithKeys = (depName, layerScope, channelScope, keys2) => shallowDiffByChannelCoordinationWithKeys(prevDeps, nextDeps, depName, layerScope, channelScope, keys2);
|
|
280721
|
-
if (["theme", "showAxisLines"].some(curriedShallowDiff)) {
|
|
280648
|
+
if (["theme", "showAxisLines", "viewerDimensionsOverride"].some(curriedShallowDiff)) {
|
|
280722
280649
|
forceUpdate = true;
|
|
280723
280650
|
}
|
|
280724
280651
|
if (["segmentationLayerScopes", "segmentationChannelScopesByLayer"].some(curriedShallowDiff)) {
|
|
@@ -280733,9 +280660,26 @@ function customIsEqualForInitialViewerState(prevDeps, nextDeps) {
|
|
|
280733
280660
|
nextDeps.segmentationChannelScopesByLayer?.[layerScope]?.forEach((channelScope) => {
|
|
280734
280661
|
if (curriedShallowDiffByChannelCoordinationWithKeys("segmentationChannelCoordination", layerScope, channelScope, [
|
|
280735
280662
|
"spatialChannelVisible"
|
|
280736
|
-
])) {
|
|
280663
|
+
]) || curriedShallowDiffByChannel("obsSegmentationsLocationsData", layerScope, channelScope)) {
|
|
280737
280664
|
forceUpdate = true;
|
|
280738
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
|
+
}
|
|
280739
280683
|
});
|
|
280740
280684
|
});
|
|
280741
280685
|
}
|
|
@@ -281257,192 +281201,6 @@ function getPointsShader(layerCoordination) {
|
|
|
281257
281201
|
}
|
|
281258
281202
|
return getSpatialLayerColorShader(staticColor, opacity2, pointMarkerBorderWidth);
|
|
281259
281203
|
}
|
|
281260
|
-
const DEFAULT_NG_DIMENSIONS = {
|
|
281261
|
-
x: [1, "nm"],
|
|
281262
|
-
y: [1, "nm"],
|
|
281263
|
-
z: [1, "nm"]
|
|
281264
|
-
};
|
|
281265
|
-
const DEFAULT_NG_PROPS = {
|
|
281266
|
-
layout: "3d",
|
|
281267
|
-
position: [0, 0, 0],
|
|
281268
|
-
projectionOrientation: [0, 0, 0, 1],
|
|
281269
|
-
projectionScale: 1024,
|
|
281270
|
-
crossSectionScale: 1,
|
|
281271
|
-
dimensions: DEFAULT_NG_DIMENSIONS,
|
|
281272
|
-
layers: []
|
|
281273
|
-
};
|
|
281274
|
-
function toPrecomputedSource(url) {
|
|
281275
|
-
if (!url) {
|
|
281276
|
-
throw new Error("toPrecomputedSource: URL is required");
|
|
281277
|
-
}
|
|
281278
|
-
return `precomputed://${url}`;
|
|
281279
|
-
}
|
|
281280
|
-
function toNgLayerName(dataType, layerScope, channelScope = null) {
|
|
281281
|
-
if (dataType === DataType$3.OBS_SEGMENTATIONS) {
|
|
281282
|
-
return `obsSegmentations-${layerScope}-${channelScope}`;
|
|
281283
|
-
}
|
|
281284
|
-
if (dataType === DataType$3.OBS_POINTS) {
|
|
281285
|
-
return `obsPoints-${layerScope}`;
|
|
281286
|
-
}
|
|
281287
|
-
throw new Error(`Unsupported data type: ${dataType}`);
|
|
281288
|
-
}
|
|
281289
|
-
function pointsHaveMatchingSegmentation({ pointObsType, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationChannelCoordination }) {
|
|
281290
|
-
return segmentationLayerScopes.some((segmentationLayerScope) => {
|
|
281291
|
-
const segmentationChannelScopes = segmentationChannelScopesByLayer?.[segmentationLayerScope] || [];
|
|
281292
|
-
return segmentationChannelScopes.some((segmentationChannelScope) => {
|
|
281293
|
-
const segmentationObsType = segmentationChannelCoordination?.[0]?.[segmentationLayerScope]?.[segmentationChannelScope]?.obsType;
|
|
281294
|
-
return segmentationObsType && pointObsType && segmentationObsType === pointObsType;
|
|
281295
|
-
});
|
|
281296
|
-
});
|
|
281297
|
-
}
|
|
281298
|
-
function useNeuroglancerViewerState(theme, showAxisLines, segmentationLayerScopes, segmentationChannelScopesByLayer, segmentationLayerCoordination, segmentationChannelCoordination, obsSegmentationsUrls, obsSegmentationsData, pointLayerScopes, pointLayerCoordination, obsPointsUrls, obsPointsData, pointMultiIndicesData) {
|
|
281299
|
-
const viewerState = useMemoCustomComparison(() => {
|
|
281300
|
-
let result = cloneDeep$1(DEFAULT_NG_PROPS);
|
|
281301
|
-
segmentationLayerScopes.forEach((layerScope) => {
|
|
281302
|
-
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
281303
|
-
const channelScopes = segmentationChannelScopesByLayer[layerScope] || [];
|
|
281304
|
-
const layerData = obsSegmentationsData[layerScope];
|
|
281305
|
-
const layerUrl = obsSegmentationsUrls[layerScope]?.[0]?.url;
|
|
281306
|
-
if (layerUrl && layerData) {
|
|
281307
|
-
const { spatialLayerVisible } = layerCoordination || {};
|
|
281308
|
-
channelScopes.forEach((channelScope) => {
|
|
281309
|
-
const channelCoordination = segmentationChannelCoordination[0]?.[layerScope]?.[channelScope];
|
|
281310
|
-
const { spatialChannelVisible } = channelCoordination || {};
|
|
281311
|
-
const { source: ngSource, ...otherNgOptions } = layerData.neuroglancerOptions ?? {};
|
|
281312
|
-
const hasNgSourceOptions = layerData.neuroglancerOptions?.subsources || layerData.neuroglancerOptions?.enableDefaultSubsources !== void 0;
|
|
281313
|
-
const source2 = hasNgSourceOptions ? {
|
|
281314
|
-
url: toPrecomputedSource(layerUrl),
|
|
281315
|
-
subsources: layerData.neuroglancerOptions.subsources,
|
|
281316
|
-
enableDefaultSubsources: layerData.neuroglancerOptions.enableDefaultSubsources ?? false
|
|
281317
|
-
} : toPrecomputedSource(layerUrl);
|
|
281318
|
-
result = {
|
|
281319
|
-
...result,
|
|
281320
|
-
showAxisLines,
|
|
281321
|
-
showDefaultAnnotations: false,
|
|
281322
|
-
// this removes the yellow box around pointsLayer
|
|
281323
|
-
layers: [
|
|
281324
|
-
...result.layers,
|
|
281325
|
-
{
|
|
281326
|
-
type: "segmentation",
|
|
281327
|
-
source: source2,
|
|
281328
|
-
segments: [],
|
|
281329
|
-
name: toNgLayerName(DataType$3.OBS_SEGMENTATIONS, layerScope, channelScope),
|
|
281330
|
-
visible: spatialLayerVisible && spatialChannelVisible,
|
|
281331
|
-
// Both layer and channel
|
|
281332
|
-
// visibility must be true for the layer to be visible.
|
|
281333
|
-
// TODO: update this to extract specific properties from
|
|
281334
|
-
// neuroglancerOptions as needed.
|
|
281335
|
-
...otherNgOptions
|
|
281336
|
-
}
|
|
281337
|
-
]
|
|
281338
|
-
};
|
|
281339
|
-
});
|
|
281340
|
-
}
|
|
281341
|
-
});
|
|
281342
|
-
pointLayerScopes.forEach((layerScope) => {
|
|
281343
|
-
const layerCoordination = pointLayerCoordination[0][layerScope];
|
|
281344
|
-
const layerData = obsPointsData[layerScope];
|
|
281345
|
-
const layerUrl = obsPointsUrls[layerScope]?.[0]?.url;
|
|
281346
|
-
const ngOptions = layerData?.neuroglancerOptions;
|
|
281347
|
-
if (ngOptions?.transform?.matrix && ngOptions?.transform?.outputDimensions) {
|
|
281348
|
-
result = {
|
|
281349
|
-
...result,
|
|
281350
|
-
dimensions: ngOptions.transform.outputDimensions ?? DEFAULT_NG_DIMENSIONS
|
|
281351
|
-
};
|
|
281352
|
-
}
|
|
281353
|
-
const pointsAreSegmentationCentroids = pointsHaveMatchingSegmentation({
|
|
281354
|
-
pointObsType: layerCoordination?.obsType,
|
|
281355
|
-
segmentationLayerScopes,
|
|
281356
|
-
segmentationChannelScopesByLayer,
|
|
281357
|
-
segmentationChannelCoordination
|
|
281358
|
-
});
|
|
281359
|
-
const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
|
|
281360
|
-
if (layerUrl && layerData) {
|
|
281361
|
-
const { spatialLayerVisible, spatialLayerOpacity, spatialLayerOpacityUnselected, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialPointStrokeWidth, featureValueColormap, featureValueColormapRange } = layerCoordination || {};
|
|
281362
|
-
const quantitativeColorMax = layerData.neuroglancerOptions?.quantitativeColorMax;
|
|
281363
|
-
if (!quantitativeColorMax && obsColorEncoding === "geneSelection") {
|
|
281364
|
-
console.warn("quantitativeColorMax not specified in options — defaulting to 1.0 (no normalization)");
|
|
281365
|
-
}
|
|
281366
|
-
const quantitativeColorMaxSelected = quantitativeColorMax ?? 1;
|
|
281367
|
-
const shader = getPointsShader({
|
|
281368
|
-
theme,
|
|
281369
|
-
featureIndex,
|
|
281370
|
-
spatialLayerOpacity,
|
|
281371
|
-
spatialLayerOpacityUnselected,
|
|
281372
|
-
obsColorEncoding,
|
|
281373
|
-
spatialLayerColor,
|
|
281374
|
-
featureSelection,
|
|
281375
|
-
featureFilterMode,
|
|
281376
|
-
featureColor,
|
|
281377
|
-
featureValueColormap,
|
|
281378
|
-
featureValueColormapRange,
|
|
281379
|
-
featureIndexProp: layerData.neuroglancerOptions?.featureIndexProp,
|
|
281380
|
-
pointIndexProp: layerData.neuroglancerOptions?.pointIndexProp,
|
|
281381
|
-
quantitativeColorProp: layerData.neuroglancerOptions?.quantitativeColorProp,
|
|
281382
|
-
pointMarkerBorderWidth: spatialPointStrokeWidth ?? 0,
|
|
281383
|
-
obsSets: layerCoordination.obsSets,
|
|
281384
|
-
obsSetColor: layerCoordination.obsSetColor,
|
|
281385
|
-
obsSetSelection: layerCoordination.obsSetSelection,
|
|
281386
|
-
additionalObsSets: layerCoordination.additionalObsSets,
|
|
281387
|
-
quantitativeColorMax: quantitativeColorMaxSelected,
|
|
281388
|
-
pointsAreSegmentationCentroids
|
|
281389
|
-
});
|
|
281390
|
-
result = {
|
|
281391
|
-
...result,
|
|
281392
|
-
layers: [
|
|
281393
|
-
...result.layers,
|
|
281394
|
-
{
|
|
281395
|
-
type: "annotation",
|
|
281396
|
-
source: {
|
|
281397
|
-
url: toPrecomputedSource(layerUrl),
|
|
281398
|
-
subsources: {
|
|
281399
|
-
default: true
|
|
281400
|
-
},
|
|
281401
|
-
enableDefaultSubsources: false,
|
|
281402
|
-
...ngOptions?.transform?.matrix ? {
|
|
281403
|
-
transform: {
|
|
281404
|
-
matrix: ngOptions.transform.matrix,
|
|
281405
|
-
outputDimensions: ngOptions.transform?.outputDimensions ?? result.dimensions
|
|
281406
|
-
}
|
|
281407
|
-
} : {}
|
|
281408
|
-
},
|
|
281409
|
-
tab: "annotations",
|
|
281410
|
-
shader,
|
|
281411
|
-
name: toNgLayerName(DataType$3.OBS_POINTS, layerScope),
|
|
281412
|
-
visible: spatialLayerVisible,
|
|
281413
|
-
// Options from layerData.neuroglancerOptions
|
|
281414
|
-
// like projectionAnnotationSpacing:
|
|
281415
|
-
projectionAnnotationSpacing: ngOptions?.projectionAnnotationSpacing ?? 1
|
|
281416
|
-
}
|
|
281417
|
-
],
|
|
281418
|
-
// TODO: is this needed?
|
|
281419
|
-
// The selected layer here will overwrite anything
|
|
281420
|
-
// that was previously specified.
|
|
281421
|
-
selectedLayer: {
|
|
281422
|
-
// size: ? // TODO: is this needed?
|
|
281423
|
-
layer: toNgLayerName(DataType$3.OBS_POINTS, layerScope)
|
|
281424
|
-
}
|
|
281425
|
-
};
|
|
281426
|
-
}
|
|
281427
|
-
});
|
|
281428
|
-
return result;
|
|
281429
|
-
}, {
|
|
281430
|
-
theme,
|
|
281431
|
-
showAxisLines,
|
|
281432
|
-
segmentationLayerScopes,
|
|
281433
|
-
segmentationChannelScopesByLayer,
|
|
281434
|
-
segmentationLayerCoordination,
|
|
281435
|
-
segmentationChannelCoordination,
|
|
281436
|
-
obsSegmentationsUrls,
|
|
281437
|
-
obsSegmentationsData,
|
|
281438
|
-
pointLayerScopes,
|
|
281439
|
-
pointLayerCoordination,
|
|
281440
|
-
obsPointsUrls,
|
|
281441
|
-
obsPointsData,
|
|
281442
|
-
pointMultiIndicesData
|
|
281443
|
-
}, customIsEqualForInitialViewerState);
|
|
281444
|
-
return viewerState;
|
|
281445
|
-
}
|
|
281446
281204
|
const ANNOTATION_HEADER_OFFSET = 8;
|
|
281447
281205
|
function ngMetersPerUnit(dimensions) {
|
|
281448
281206
|
if (!dimensions?.x)
|
|
@@ -281470,6 +281228,22 @@ const multiplyQuat = (a2, b2) => {
|
|
|
281470
281228
|
];
|
|
281471
281229
|
};
|
|
281472
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
|
+
};
|
|
281473
281247
|
function applyColormap(colormap, t4) {
|
|
281474
281248
|
const tClamped = Math.max(0, Math.min(1, t4));
|
|
281475
281249
|
const interpolators = {
|
|
@@ -281514,39 +281288,80 @@ function eulerToQuaternion(pitch, yaw, roll = 0) {
|
|
|
281514
281288
|
c1 * c2 * c3 + s1 * s2 * s3
|
|
281515
281289
|
];
|
|
281516
281290
|
}
|
|
281517
|
-
function
|
|
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) {
|
|
281518
281320
|
const dv = new DataView(buffer2);
|
|
281519
281321
|
if (buffer2.byteLength <= 8)
|
|
281520
281322
|
return [];
|
|
281323
|
+
const { propertyIds = [], segmentIdIndex } = layout ?? {};
|
|
281324
|
+
if (!(segmentIdIndex >= 0))
|
|
281325
|
+
return [];
|
|
281521
281326
|
const count2 = dv.getUint32(0, true);
|
|
281522
|
-
if (count2 === 0)
|
|
281327
|
+
if (count2 === 0 || dv.getUint32(4, true) !== 0)
|
|
281523
281328
|
return [];
|
|
281524
|
-
const
|
|
281525
|
-
const
|
|
281329
|
+
const geometryStride = serializer2.propertyGroupBytes?.[0] ?? serializer2.serializedBytes;
|
|
281330
|
+
const values3 = new Array(propertyIds.length).fill(null);
|
|
281526
281331
|
const results = [];
|
|
281527
281332
|
for (let i2 = 0; i2 < count2; i2++) {
|
|
281528
|
-
serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true,
|
|
281529
|
-
const
|
|
281530
|
-
const segId = properties2[1];
|
|
281333
|
+
serializer2.deserialize(dv, ANNOTATION_HEADER_OFFSET, i2, count2, true, values3);
|
|
281334
|
+
const segId = values3[segmentIdIndex];
|
|
281531
281335
|
if (segId > 0) {
|
|
281532
|
-
const propBase = ANNOTATION_HEADER_OFFSET + i2 *
|
|
281336
|
+
const propBase = ANNOTATION_HEADER_OFFSET + i2 * geometryStride;
|
|
281533
281337
|
const x2 = dv.getFloat32(propBase + 0, true);
|
|
281534
281338
|
const y2 = dv.getFloat32(propBase + 4, true);
|
|
281535
281339
|
const z2 = dv.getFloat32(propBase + 8, true);
|
|
281536
281340
|
if (x2 !== 0 || y2 !== 0 || z2 !== 0) {
|
|
281537
281341
|
results.push({
|
|
281538
281342
|
id: String(segId),
|
|
281539
|
-
//
|
|
281540
|
-
phenotype: Number(phenotype),
|
|
281343
|
+
// value of segmentIdProp: used for the NG segments array
|
|
281541
281344
|
x: x2,
|
|
281542
281345
|
y: y2,
|
|
281543
|
-
z: z2
|
|
281346
|
+
z: z2,
|
|
281347
|
+
properties: toNamedProperties(propertyIds, values3)
|
|
281544
281348
|
});
|
|
281545
281349
|
}
|
|
281546
281350
|
}
|
|
281547
281351
|
}
|
|
281548
281352
|
return results;
|
|
281549
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
|
+
}
|
|
281550
281365
|
const remapCellColors = (ngCellColors, cellIdToMeshIdRef) => {
|
|
281551
281366
|
const remapped = {};
|
|
281552
281367
|
Object.entries(ngCellColors).forEach(([cellId, color2]) => {
|
|
@@ -281573,19 +281388,334 @@ function autoColorForId(id2) {
|
|
|
281573
281388
|
}
|
|
281574
281389
|
return color2;
|
|
281575
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
|
+
}
|
|
281401
|
+
const DEFAULT_NG_DIMENSIONS = {
|
|
281402
|
+
x: [1, "nm"],
|
|
281403
|
+
y: [1, "nm"],
|
|
281404
|
+
z: [1, "nm"]
|
|
281405
|
+
};
|
|
281406
|
+
const DEFAULT_NG_PROPS = {
|
|
281407
|
+
layout: "3d",
|
|
281408
|
+
position: [0, 0, 0],
|
|
281409
|
+
projectionOrientation: [0, 0, 0, 1],
|
|
281410
|
+
projectionScale: 1024,
|
|
281411
|
+
crossSectionScale: 1,
|
|
281412
|
+
dimensions: DEFAULT_NG_DIMENSIONS,
|
|
281413
|
+
layers: []
|
|
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
|
+
}
|
|
281463
|
+
function toPrecomputedSource(url) {
|
|
281464
|
+
if (!url) {
|
|
281465
|
+
throw new Error("toPrecomputedSource: URL is required");
|
|
281466
|
+
}
|
|
281467
|
+
return `precomputed://${url}`;
|
|
281468
|
+
}
|
|
281469
|
+
function toNgLayerName(dataType, layerScope, channelScope = null) {
|
|
281470
|
+
if (dataType === DataType$3.OBS_SEGMENTATIONS) {
|
|
281471
|
+
return `obsSegmentations-${layerScope}-${channelScope}`;
|
|
281472
|
+
}
|
|
281473
|
+
if (dataType === DataType$3.OBS_POINTS) {
|
|
281474
|
+
return `obsPoints-${layerScope}`;
|
|
281475
|
+
}
|
|
281476
|
+
if (dataType === DataType$3.OBS_LOCATIONS) {
|
|
281477
|
+
return `obsLocations-${layerScope}-${channelScope}`;
|
|
281478
|
+
}
|
|
281479
|
+
throw new Error(`Unsupported data type: ${dataType}`);
|
|
281480
|
+
}
|
|
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
|
+
};
|
|
281538
|
+
}
|
|
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) {
|
|
281547
|
+
const viewerState = useMemoCustomComparison(() => {
|
|
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 };
|
|
281562
|
+
segmentationLayerScopes.forEach((layerScope) => {
|
|
281563
|
+
const layerCoordination = segmentationLayerCoordination[0][layerScope];
|
|
281564
|
+
const channelScopes = segmentationChannelScopesByLayer[layerScope] || [];
|
|
281565
|
+
const layerData = obsSegmentationsData[layerScope];
|
|
281566
|
+
const layerUrl = obsSegmentationsUrls[layerScope]?.[0]?.url;
|
|
281567
|
+
if (layerUrl && layerData) {
|
|
281568
|
+
const { spatialLayerVisible } = layerCoordination || {};
|
|
281569
|
+
channelScopes.forEach((channelScope) => {
|
|
281570
|
+
const channelCoordination = segmentationChannelCoordination[0]?.[layerScope]?.[channelScope];
|
|
281571
|
+
const { spatialChannelVisible } = channelCoordination || {};
|
|
281572
|
+
const { source: ngSource, ...otherNgOptions } = layerData.neuroglancerOptions ?? {};
|
|
281573
|
+
const hasNgSourceOptions = layerData.neuroglancerOptions?.subsources || layerData.neuroglancerOptions?.enableDefaultSubsources !== void 0;
|
|
281574
|
+
const source2 = hasNgSourceOptions ? {
|
|
281575
|
+
url: toPrecomputedSource(layerUrl),
|
|
281576
|
+
subsources: layerData.neuroglancerOptions.subsources,
|
|
281577
|
+
enableDefaultSubsources: layerData.neuroglancerOptions.enableDefaultSubsources ?? false
|
|
281578
|
+
} : toPrecomputedSource(layerUrl);
|
|
281579
|
+
result = {
|
|
281580
|
+
...result,
|
|
281581
|
+
showAxisLines,
|
|
281582
|
+
showDefaultAnnotations: false,
|
|
281583
|
+
// this removes the yellow box around pointsLayer
|
|
281584
|
+
layers: [
|
|
281585
|
+
...result.layers,
|
|
281586
|
+
{
|
|
281587
|
+
type: "segmentation",
|
|
281588
|
+
source: source2,
|
|
281589
|
+
segments: [],
|
|
281590
|
+
name: toNgLayerName(DataType$3.OBS_SEGMENTATIONS, layerScope, channelScope),
|
|
281591
|
+
visible: spatialLayerVisible && spatialChannelVisible,
|
|
281592
|
+
// Both layer and channel
|
|
281593
|
+
// visibility must be true for the layer to be visible.
|
|
281594
|
+
// TODO: update this to extract specific properties from
|
|
281595
|
+
// neuroglancerOptions as needed.
|
|
281596
|
+
...otherNgOptions
|
|
281597
|
+
}
|
|
281598
|
+
]
|
|
281599
|
+
};
|
|
281600
|
+
});
|
|
281601
|
+
}
|
|
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
|
+
});
|
|
281633
|
+
pointLayerScopes.forEach((layerScope) => {
|
|
281634
|
+
const layerCoordination = pointLayerCoordination[0][layerScope];
|
|
281635
|
+
const layerData = obsPointsData[layerScope];
|
|
281636
|
+
const layerUrl = obsPointsUrls[layerScope]?.[0]?.url;
|
|
281637
|
+
const ngOptions = layerData?.neuroglancerOptions;
|
|
281638
|
+
const featureIndex = pointMultiIndicesData[layerScope]?.featureIndex;
|
|
281639
|
+
if (layerUrl && layerData) {
|
|
281640
|
+
const { spatialLayerVisible, spatialLayerOpacity, spatialLayerOpacityUnselected, obsColorEncoding, spatialLayerColor, featureSelection, featureFilterMode, featureColor, spatialPointStrokeWidth, featureValueColormap, featureValueColormapRange } = layerCoordination || {};
|
|
281641
|
+
const quantitativeColorMaxSelected = getQuantitativeColorMax(ngOptions, obsColorEncoding);
|
|
281642
|
+
const shader = getPointsShader({
|
|
281643
|
+
theme,
|
|
281644
|
+
featureIndex,
|
|
281645
|
+
spatialLayerOpacity,
|
|
281646
|
+
spatialLayerOpacityUnselected,
|
|
281647
|
+
obsColorEncoding,
|
|
281648
|
+
spatialLayerColor,
|
|
281649
|
+
featureSelection,
|
|
281650
|
+
featureFilterMode,
|
|
281651
|
+
featureColor,
|
|
281652
|
+
featureValueColormap,
|
|
281653
|
+
featureValueColormapRange,
|
|
281654
|
+
featureIndexProp: layerData.neuroglancerOptions?.featureIndexProp,
|
|
281655
|
+
pointIndexProp: layerData.neuroglancerOptions?.pointIndexProp,
|
|
281656
|
+
quantitativeColorProp: layerData.neuroglancerOptions?.quantitativeColorProp,
|
|
281657
|
+
pointMarkerBorderWidth: spatialPointStrokeWidth ?? 0,
|
|
281658
|
+
obsSets: layerCoordination.obsSets,
|
|
281659
|
+
obsSetColor: layerCoordination.obsSetColor,
|
|
281660
|
+
obsSetSelection: layerCoordination.obsSetSelection,
|
|
281661
|
+
additionalObsSets: layerCoordination.additionalObsSets,
|
|
281662
|
+
quantitativeColorMax: quantitativeColorMaxSelected
|
|
281663
|
+
});
|
|
281664
|
+
result = {
|
|
281665
|
+
...result,
|
|
281666
|
+
layers: [
|
|
281667
|
+
...result.layers,
|
|
281668
|
+
{
|
|
281669
|
+
type: "annotation",
|
|
281670
|
+
source: toAnnotationSource(layerUrl, ngOptions, viewerDimensions),
|
|
281671
|
+
tab: "annotations",
|
|
281672
|
+
shader,
|
|
281673
|
+
name: toNgLayerName(DataType$3.OBS_POINTS, layerScope),
|
|
281674
|
+
visible: spatialLayerVisible,
|
|
281675
|
+
// Options from layerData.neuroglancerOptions
|
|
281676
|
+
// like projectionAnnotationSpacing:
|
|
281677
|
+
projectionAnnotationSpacing: ngOptions?.projectionAnnotationSpacing ?? 1
|
|
281678
|
+
}
|
|
281679
|
+
],
|
|
281680
|
+
// TODO: is this needed?
|
|
281681
|
+
// The selected layer here will overwrite anything
|
|
281682
|
+
// that was previously specified.
|
|
281683
|
+
selectedLayer: {
|
|
281684
|
+
// size: ? // TODO: is this needed?
|
|
281685
|
+
layer: toNgLayerName(DataType$3.OBS_POINTS, layerScope)
|
|
281686
|
+
}
|
|
281687
|
+
};
|
|
281688
|
+
}
|
|
281689
|
+
});
|
|
281690
|
+
return result;
|
|
281691
|
+
}, {
|
|
281692
|
+
theme,
|
|
281693
|
+
showAxisLines,
|
|
281694
|
+
segmentationLayerScopes,
|
|
281695
|
+
segmentationChannelScopesByLayer,
|
|
281696
|
+
segmentationLayerCoordination,
|
|
281697
|
+
segmentationChannelCoordination,
|
|
281698
|
+
obsSegmentationsUrls,
|
|
281699
|
+
obsSegmentationsData,
|
|
281700
|
+
obsSegmentationsLocationsData,
|
|
281701
|
+
pointLayerScopes,
|
|
281702
|
+
pointLayerCoordination,
|
|
281703
|
+
obsPointsUrls,
|
|
281704
|
+
obsPointsData,
|
|
281705
|
+
pointMultiIndicesData,
|
|
281706
|
+
viewerDimensionsOverride
|
|
281707
|
+
}, customIsEqualForInitialViewerState);
|
|
281708
|
+
return viewerState;
|
|
281709
|
+
}
|
|
281576
281710
|
const ROTATION_EPS = 1e-3;
|
|
281577
281711
|
const TARGET_EPS = 0.5;
|
|
281578
281712
|
const MESH_LOAD_THRESHOLD = 100;
|
|
281579
281713
|
const MESH_LOADING_OVERLAY_TIMEOUT = 1500;
|
|
281580
281714
|
const GUIDE_URL = "https://vitessce.io/docs/ng-guide/";
|
|
281581
|
-
const MESH_OPACITY = 0.6;
|
|
281582
281715
|
const LAST_INTERACTION_SOURCE = {
|
|
281583
281716
|
vitessce: "vitessce",
|
|
281584
281717
|
neuroglancer: "neuroglancer"
|
|
281585
281718
|
};
|
|
281586
|
-
function rgbToHex$1(rgb2) {
|
|
281587
|
-
return typeof rgb2 === "string" ? rgb2 : `#${rgb2.map((c2) => c2.toString(16).padStart(2, "0")).join("")}`;
|
|
281588
|
-
}
|
|
281589
281719
|
function NeuroglancerSubscriber(props) {
|
|
281590
281720
|
const {
|
|
281591
281721
|
uuid: uuid2,
|
|
@@ -281613,27 +281743,34 @@ function NeuroglancerSubscriber(props) {
|
|
|
281613
281743
|
detailUseSelection = false,
|
|
281614
281744
|
// >1: this view shows the shared camera N× more zoomed in.
|
|
281615
281745
|
// Pan/rotation are shared via spatialCameraSnapshot; zoom keeps a fixed ratio.
|
|
281616
|
-
cameraZoomFactor = 1
|
|
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"
|
|
281617
281755
|
} = props;
|
|
281618
281756
|
const loaders = useLoaders();
|
|
281619
281757
|
const mergeCoordination = useMergeCoordination();
|
|
281620
281758
|
const { classes: classes2 } = useStyles$4();
|
|
281621
281759
|
const initialRotationPushedRef = useRef(false);
|
|
281622
281760
|
const getViewProjectionMatRef = useRef(null);
|
|
281623
|
-
const obsIdToMeshIdRef = useRef({});
|
|
281624
281761
|
const meshIdToCellIdRef = useRef({});
|
|
281625
281762
|
const cellIdToMeshIdRef = useRef({});
|
|
281626
281763
|
const lastInteractionSource = useRef(null);
|
|
281627
281764
|
const initialRenderCalibratorRef = useRef(null);
|
|
281628
281765
|
const translationOffsetRef = useRef([0, 0, 0]);
|
|
281629
|
-
const
|
|
281630
|
-
const
|
|
281631
|
-
const
|
|
281766
|
+
const annotationInfoByScopeRef = useRef({});
|
|
281767
|
+
const annotationTransformByScopeRef = useRef({});
|
|
281768
|
+
const visibleSegmentIdsBySegLayerRef = useRef({});
|
|
281632
281769
|
const chunkCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
281633
281770
|
const resizeObserverRef = useRef(null);
|
|
281634
281771
|
const [isLayersLoaded, setIsLayersLoaded] = useState(false);
|
|
281635
281772
|
const [isMeshLoading, setIsMeshLoading] = useState(false);
|
|
281636
|
-
const [
|
|
281773
|
+
const [annotationReadyIteration, bumpAnnotationReady] = useReducer((x2) => x2 + 1, 0);
|
|
281637
281774
|
const [csvLoaded, setCsvLoaded] = useState(false);
|
|
281638
281775
|
const updateVisibleSegmentsThrottledRef = useRef(null);
|
|
281639
281776
|
const viewportSizeRef = useRef({ width: 0, height: 0 });
|
|
@@ -281731,27 +281868,67 @@ function NeuroglancerSubscriber(props) {
|
|
|
281731
281868
|
const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls, obsSegmentationsDataErrors] = useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, uuid2);
|
|
281732
281869
|
const [obsSegmentationsSetsData, obsSegmentationsSetsDataStatus, obsSegmentationsSetsDataErrors] = useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281733
281870
|
const [obsSegmentationsColorsData, obsSegmentationsColorsDataStatus, obsSegmentationsColorsDataErrors] = useSegmentationMultiObsColors(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281871
|
+
const [obsSegmentationsLocationsData, obsSegmentationsLocationsDataStatus, obsSegmentationsLocationsDataErrors] = useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281734
281872
|
const [segmentationMultiExpressionData, segmentationMultiLoadedFeatureSelection, segmentationMultiExpressionExtents, segmentationMultiExpressionNormData, segmentationMultiFeatureSelectionStatus, segmentationMultiFeatureSelectionErrors] = useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281735
281873
|
const [segmentationMultiIndicesData, segmentationMultiIndicesDataStatus, segmentationMultiIndicesDataErrors] = useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset);
|
|
281736
|
-
const
|
|
281737
|
-
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);
|
|
281738
281880
|
const latestViewerStateRef = useRef({
|
|
281739
281881
|
...initialViewerState,
|
|
281740
|
-
...
|
|
281882
|
+
...validInitialNgCamera
|
|
281741
281883
|
});
|
|
281742
281884
|
const segmentationUrl = useMemo$1(() => {
|
|
281743
281885
|
const firstScope = segmentationLayerScopes?.[0];
|
|
281744
281886
|
return obsSegmentationsUrls?.[firstScope]?.[0]?.url ?? null;
|
|
281745
281887
|
}, [segmentationLayerScopes, obsSegmentationsUrls]);
|
|
281746
|
-
const
|
|
281747
|
-
|
|
281748
|
-
|
|
281749
|
-
|
|
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]);
|
|
281750
281911
|
const segmentationInfo = obsSegmentationsData?.[segmentationLayerScopes?.[0]]?.neuroglancerInfo ?? null;
|
|
281751
|
-
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]);
|
|
281752
281924
|
const derivedCenter = useMemo$1(() => {
|
|
281753
|
-
const
|
|
281754
|
-
|
|
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])));
|
|
281755
281932
|
return lower2.map((lo, i2) => (lo + upper[i2]) / 2);
|
|
281756
281933
|
}
|
|
281757
281934
|
const scale2 = segmentationInfo?.scales?.[0];
|
|
@@ -281762,9 +281939,9 @@ function NeuroglancerSubscriber(props) {
|
|
|
281762
281939
|
return size2.map((s2, i2) => ((voxelOffset[i2] ?? 0) + s2 / 2) * (resolution[i2] ?? 1));
|
|
281763
281940
|
}
|
|
281764
281941
|
return null;
|
|
281765
|
-
}, [segmentationInfo,
|
|
281942
|
+
}, [segmentationInfo, annotationInfoByScope, centroidLayerRoles]);
|
|
281766
281943
|
useEffect(() => {
|
|
281767
|
-
if (
|
|
281944
|
+
if (hasInitialNgPosition || !segmentationUrl) {
|
|
281768
281945
|
setHasResolvedInitialCamera(true);
|
|
281769
281946
|
return;
|
|
281770
281947
|
}
|
|
@@ -281776,12 +281953,13 @@ function NeuroglancerSubscriber(props) {
|
|
|
281776
281953
|
incrementLatestViewerStateIteration();
|
|
281777
281954
|
}
|
|
281778
281955
|
setHasResolvedInitialCamera(true);
|
|
281779
|
-
}, [segmentationUrl, derivedCenter,
|
|
281956
|
+
}, [segmentationUrl, derivedCenter, hasInitialNgPosition]);
|
|
281780
281957
|
const errors = [
|
|
281781
281958
|
...obsPointsErrors,
|
|
281782
281959
|
...obsSegmentationsDataErrors,
|
|
281783
281960
|
...obsSegmentationsSetsDataErrors,
|
|
281784
281961
|
...obsSegmentationsColorsDataErrors,
|
|
281962
|
+
...obsSegmentationsLocationsDataErrors,
|
|
281785
281963
|
...pointMultiIndicesDataErrors,
|
|
281786
281964
|
...segmentationMultiFeatureSelectionErrors,
|
|
281787
281965
|
...segmentationMultiIndicesDataErrors
|
|
@@ -281794,6 +281972,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281794
281972
|
obsSegmentationsDataStatus,
|
|
281795
281973
|
obsSegmentationsSetsDataStatus,
|
|
281796
281974
|
obsSegmentationsColorsDataStatus,
|
|
281975
|
+
obsSegmentationsLocationsDataStatus,
|
|
281797
281976
|
segmentationMultiFeatureSelectionStatus,
|
|
281798
281977
|
segmentationMultiIndicesDataStatus
|
|
281799
281978
|
]);
|
|
@@ -281815,7 +281994,8 @@ function NeuroglancerSubscriber(props) {
|
|
|
281815
281994
|
const lastSeenCameraSnapshotRef = useRef(null);
|
|
281816
281995
|
const spatialBetaJustPushedRef = useRef(false);
|
|
281817
281996
|
const is3dMode = spatialRenderingMode === "3D";
|
|
281818
|
-
const
|
|
281997
|
+
const fromNeuroglancer = spatialCameraSnapshot?.source === "neuroglancer";
|
|
281998
|
+
const hasSpatialCameraSnapshot = Boolean(spatialCameraSnapshot) && (fromNeuroglancer || is3dMode);
|
|
281819
281999
|
useEffect(() => {
|
|
281820
282000
|
if (detailMode)
|
|
281821
282001
|
return;
|
|
@@ -281874,7 +282054,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281874
282054
|
if (knownIdSet.has(String(id2))) {
|
|
281875
282055
|
const color2 = obsColorMap.get(id2);
|
|
281876
282056
|
if (color2) {
|
|
281877
|
-
ngCellColors[id2] =
|
|
282057
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281878
282058
|
} else {
|
|
281879
282059
|
ngCellColors[id2] = GREY_HEX;
|
|
281880
282060
|
}
|
|
@@ -281891,7 +282071,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281891
282071
|
finalizeChannelColors(ngCellColors, spatialChannelOpacity, GREY_HEX);
|
|
281892
282072
|
}
|
|
281893
282073
|
} else if (obsColorEncoding === "spatialChannelColor") {
|
|
281894
|
-
const hex2 = spatialChannelColor ?
|
|
282074
|
+
const hex2 = spatialChannelColor ? colorArrayToString(spatialChannelColor) : autoColorForId(layerScope + channelScope);
|
|
281895
282075
|
if (spatialChannelColor) {
|
|
281896
282076
|
const ngCellColors = {};
|
|
281897
282077
|
if (layerIndex) {
|
|
@@ -281936,11 +282116,11 @@ function NeuroglancerSubscriber(props) {
|
|
|
281936
282116
|
const tScaled = (t4 - low) / Math.max(high - low, 1e-4);
|
|
281937
282117
|
const tClamped = Math.max(0, Math.min(1, tScaled));
|
|
281938
282118
|
const color2 = applyColormap(featureValueColormap ?? "viridis", tClamped);
|
|
281939
|
-
ngCellColors[id2] =
|
|
282119
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281940
282120
|
});
|
|
281941
282121
|
finalizeChannelColors(ngCellColors, spatialChannelOpacity);
|
|
281942
282122
|
} else if (restrictedObsIndex) {
|
|
281943
|
-
const fallbackColor = spatialChannelColor ?
|
|
282123
|
+
const fallbackColor = spatialChannelColor ? colorArrayToString(spatialChannelColor) : GREY_HEX;
|
|
281944
282124
|
const ngCellColors = {};
|
|
281945
282125
|
restrictedObsIndex.forEach((id2) => {
|
|
281946
282126
|
ngCellColors[id2] = fallbackColor;
|
|
@@ -281961,7 +282141,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
281961
282141
|
if (knownIdSet.has(String(id2))) {
|
|
281962
282142
|
const color2 = cellColors.get(String(id2));
|
|
281963
282143
|
if (color2) {
|
|
281964
|
-
ngCellColors[id2] =
|
|
282144
|
+
ngCellColors[id2] = colorArrayToString(color2);
|
|
281965
282145
|
} else {
|
|
281966
282146
|
ngCellColors[id2] = GREY_HEX;
|
|
281967
282147
|
}
|
|
@@ -281989,16 +282169,21 @@ function NeuroglancerSubscriber(props) {
|
|
|
281989
282169
|
if (!csvUrl)
|
|
281990
282170
|
return;
|
|
281991
282171
|
fetch(csvUrl).then((r3) => r3.text()).then((text2) => {
|
|
281992
|
-
const
|
|
281993
|
-
const
|
|
281994
|
-
const
|
|
281995
|
-
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
|
+
}
|
|
281996
282181
|
const meshMap = {};
|
|
281997
282182
|
const cellMap = {};
|
|
281998
282183
|
lines.slice(1).forEach((l2) => {
|
|
281999
282184
|
const cols = l2.split(",");
|
|
282000
|
-
const meshId = cols[meshIdIdx]
|
|
282001
|
-
const cellId = cols[cellIdIdx]
|
|
282185
|
+
const meshId = clean(cols[meshIdIdx]);
|
|
282186
|
+
const cellId = clean(cols[cellIdIdx]);
|
|
282002
282187
|
if (meshId && cellId) {
|
|
282003
282188
|
meshMap[meshId] = cellId;
|
|
282004
282189
|
cellMap[cellId] = meshId;
|
|
@@ -282008,10 +282193,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
282008
282193
|
cellIdToMeshIdRef.current = cellMap;
|
|
282009
282194
|
setCsvLoaded(true);
|
|
282010
282195
|
});
|
|
282011
|
-
}, [csvUrl]);
|
|
282196
|
+
}, [csvUrl, meshIdColumn, cellIdColumn]);
|
|
282012
282197
|
useEffect(() => {
|
|
282013
282198
|
chunkCacheRef.current.clear();
|
|
282014
|
-
}, [
|
|
282199
|
+
}, [centroidSources]);
|
|
282015
282200
|
useEffect(() => {
|
|
282016
282201
|
if (ngWidth && ngHeight) {
|
|
282017
282202
|
viewportSizeRef.current = { width: ngWidth, height: ngHeight };
|
|
@@ -282044,61 +282229,59 @@ function NeuroglancerSubscriber(props) {
|
|
|
282044
282229
|
const updateVisibleSegments = useCallback(async () => {
|
|
282045
282230
|
if (detailMode)
|
|
282046
282231
|
return;
|
|
282047
|
-
if (!annotationInfoRef.current)
|
|
282048
|
-
return;
|
|
282049
|
-
if (!annotationTransformRef.current)
|
|
282050
|
-
return;
|
|
282051
282232
|
if (!segmentationLayerScopes?.length)
|
|
282052
282233
|
return;
|
|
282053
|
-
|
|
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)
|
|
282054
282239
|
return;
|
|
282055
282240
|
const { position: position2, projectionScale } = latestViewerStateRef.current;
|
|
282056
282241
|
if (!position2 || !projectionScale)
|
|
282057
282242
|
return;
|
|
282058
|
-
const
|
|
282059
|
-
|
|
282060
|
-
|
|
282061
|
-
|
|
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;
|
|
282062
282258
|
incrementLatestViewerStateIteration();
|
|
282063
|
-
setIsMeshLoading(false);
|
|
282064
282259
|
}
|
|
282260
|
+
return added;
|
|
282261
|
+
};
|
|
282262
|
+
const maxProjectionScale = meshLoadProjectionScaleThreshold ?? MESH_LOAD_THRESHOLD;
|
|
282263
|
+
if (projectionScale > maxProjectionScale) {
|
|
282264
|
+
commitVisibleIds({});
|
|
282265
|
+
setIsMeshLoading(false);
|
|
282065
282266
|
return;
|
|
282066
282267
|
}
|
|
282067
282268
|
const { width: width2, height: height2 } = viewportSizeRef.current;
|
|
282068
282269
|
if (!width2 || !height2)
|
|
282069
282270
|
return;
|
|
282070
|
-
const
|
|
282071
|
-
|
|
282072
|
-
|
|
282073
|
-
const allLevelCoords = info2.spatial.flatMap((level) => {
|
|
282074
|
-
const [gx, gy, gz] = level.grid_shape;
|
|
282075
|
-
const coords = [];
|
|
282076
|
-
for (let cx = 0; cx < gx; cx++) {
|
|
282077
|
-
for (let cy = 0; cy < gy; cy++) {
|
|
282078
|
-
for (let cz = 0; cz < gz; cz++) {
|
|
282079
|
-
coords.push({ level: level.key, cx, cy, cz });
|
|
282080
|
-
}
|
|
282081
|
-
}
|
|
282082
|
-
}
|
|
282083
|
-
return coords;
|
|
282084
|
-
});
|
|
282085
|
-
const fetchChunkWithPositions = async ({ level, cx, cy, cz }) => {
|
|
282086
|
-
const { serializers, serializer: defaultSerializer } = annotationTransformRef.current;
|
|
282087
|
-
const serializer2 = serializers?.[0] ?? defaultSerializer;
|
|
282088
|
-
if (!serializer2)
|
|
282089
|
-
return [];
|
|
282090
|
-
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}`;
|
|
282091
282274
|
if (chunkCacheRef.current.has(cacheKey)) {
|
|
282092
282275
|
return chunkCacheRef.current.get(cacheKey);
|
|
282093
282276
|
}
|
|
282094
282277
|
try {
|
|
282095
|
-
const res = await fetch(
|
|
282278
|
+
const res = await fetch(chunkUrl);
|
|
282096
282279
|
if (!res.ok) {
|
|
282097
282280
|
chunkCacheRef.current.set(cacheKey, []);
|
|
282098
282281
|
return [];
|
|
282099
282282
|
}
|
|
282100
282283
|
const buffer2 = await res.arrayBuffer();
|
|
282101
|
-
const entries2 = parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2);
|
|
282284
|
+
const entries2 = parseAnnotationChunkSegmentsWithPositions(buffer2, serializer2, layout);
|
|
282102
282285
|
chunkCacheRef.current.set(cacheKey, entries2);
|
|
282103
282286
|
return entries2;
|
|
282104
282287
|
} catch (e3) {
|
|
@@ -282106,28 +282289,54 @@ function NeuroglancerSubscriber(props) {
|
|
|
282106
282289
|
return [];
|
|
282107
282290
|
}
|
|
282108
282291
|
};
|
|
282109
|
-
|
|
282110
|
-
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)));
|
|
282111
282316
|
const seenIds = /* @__PURE__ */ new Set();
|
|
282112
|
-
|
|
282317
|
+
return results.flat().filter(({ id: id2 }) => {
|
|
282113
282318
|
if (seenIds.has(id2))
|
|
282114
282319
|
return false;
|
|
282115
282320
|
seenIds.add(id2);
|
|
282116
282321
|
return true;
|
|
282117
282322
|
});
|
|
282118
|
-
|
|
282119
|
-
|
|
282120
|
-
|
|
282121
|
-
});
|
|
282122
|
-
obsIdToMeshIdRef.current = obsIdToMeshId;
|
|
282323
|
+
};
|
|
282324
|
+
try {
|
|
282325
|
+
const entriesByScope = await Promise.all(readyScopes.map(collectEntriesForScope));
|
|
282123
282326
|
const mat = getViewProjectionMatRef.current?.();
|
|
282124
|
-
let visibleIds;
|
|
282125
282327
|
if (!mat) {
|
|
282126
282328
|
console.warn("No viewProjectionMatrix, loading all");
|
|
282127
|
-
|
|
282128
|
-
|
|
282129
|
-
|
|
282130
|
-
|
|
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 }) => {
|
|
282131
282340
|
const vx = x2 / transform3.x;
|
|
282132
282341
|
const vy = y2 / transform3.y;
|
|
282133
282342
|
const vz = (z2 || 0) / transform3.z;
|
|
@@ -282137,36 +282346,29 @@ function NeuroglancerSubscriber(props) {
|
|
|
282137
282346
|
const screenX = (cx / cw2 + 1) * 0.5 * width2;
|
|
282138
282347
|
const screenY = (1 - cy / cw2) * 0.5 * height2;
|
|
282139
282348
|
return screenX >= -margin2 && screenX <= width2 + margin2 && screenY >= -margin2 && screenY <= height2 + margin2;
|
|
282140
|
-
})
|
|
282141
|
-
|
|
282142
|
-
|
|
282143
|
-
|
|
282144
|
-
|
|
282145
|
-
|
|
282146
|
-
|
|
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) {
|
|
282147
282359
|
setIsMeshLoading(false);
|
|
282148
282360
|
return;
|
|
282149
282361
|
}
|
|
282150
|
-
const prevIds = new Set(visibleSegmentIdsRef.current ?? []);
|
|
282151
|
-
const addedIdsCount = visibleIds.filter((id2) => !prevIds.has(id2)).length;
|
|
282152
282362
|
const hasSignificantChange = addedIdsCount > 20;
|
|
282153
|
-
if (hasSignificantChange && visibleIds.length > 0) {
|
|
282154
|
-
setIsMeshLoading(true);
|
|
282155
|
-
}
|
|
282156
|
-
const prevSorted = [...visibleSegmentIdsRef.current ?? []].sort().join(",");
|
|
282157
|
-
const nextSorted = [...visibleIds].sort().join(",");
|
|
282158
|
-
if (prevSorted !== nextSorted) {
|
|
282159
|
-
visibleSegmentIdsRef.current = visibleIds;
|
|
282160
|
-
incrementLatestViewerStateIteration();
|
|
282161
|
-
}
|
|
282162
282363
|
if (hasSignificantChange) {
|
|
282364
|
+
setIsMeshLoading(true);
|
|
282163
282365
|
setTimeout(() => setIsMeshLoading(false), MESH_LOADING_OVERLAY_TIMEOUT);
|
|
282164
282366
|
}
|
|
282165
282367
|
} catch (e3) {
|
|
282166
282368
|
console.warn("[updateVisibleSegments] error:", e3);
|
|
282167
282369
|
setIsMeshLoading(false);
|
|
282168
282370
|
}
|
|
282169
|
-
}, [segmentationLayerScopes,
|
|
282371
|
+
}, [segmentationLayerScopes, centroidLayerRoles, meshLoadProjectionScaleThreshold, detailMode]);
|
|
282170
282372
|
useEffect(() => {
|
|
282171
282373
|
updateVisibleSegmentsThrottledRef.current = throttle$1(updateVisibleSegments, 500);
|
|
282172
282374
|
return () => updateVisibleSegmentsThrottledRef.current?.cancel();
|
|
@@ -282183,38 +282385,62 @@ function NeuroglancerSubscriber(props) {
|
|
|
282183
282385
|
};
|
|
282184
282386
|
incrementLatestViewerStateIteration();
|
|
282185
282387
|
}, [initialViewerState]);
|
|
282186
|
-
const
|
|
282187
|
-
|
|
282188
|
-
|
|
282189
|
-
|
|
282190
|
-
return pointsHaveMatchingSegmentation({
|
|
282191
|
-
pointObsType: pointLayerCoordination[0]?.[firstPointScope]?.obsType,
|
|
282192
|
-
segmentationLayerScopes,
|
|
282193
|
-
segmentationChannelScopesByLayer,
|
|
282194
|
-
segmentationChannelCoordination
|
|
282195
|
-
});
|
|
282196
|
-
}, [cellsUrl, pointLayerScopes, segmentationLayerScopes, segmentationChannelScopesByLayer, detailMode]);
|
|
282197
|
-
useEffect(() => {
|
|
282198
|
-
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))
|
|
282199
282392
|
return;
|
|
282200
|
-
|
|
282201
|
-
|
|
282202
|
-
|
|
282203
|
-
}
|
|
282204
|
-
|
|
282205
|
-
setAnnotationReady(true);
|
|
282206
|
-
}, [cellsUrl, annotationInfo]);
|
|
282393
|
+
if (annotationInfoByScopeRef.current[scope] && annotationTransformByScopeRef.current[scope]) {
|
|
282394
|
+
readyCentroidScopesRef.current.add(scope);
|
|
282395
|
+
bumpAnnotationReady();
|
|
282396
|
+
}
|
|
282397
|
+
}, []);
|
|
282207
282398
|
useEffect(() => {
|
|
282208
|
-
|
|
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;
|
|
282418
|
+
useEffect(() => {
|
|
282419
|
+
if (annotationReadyIteration > 0) {
|
|
282209
282420
|
setIsLayersLoaded(true);
|
|
282210
|
-
|
|
282421
|
+
updateVisibleSegmentsRef.current();
|
|
282211
282422
|
}
|
|
282212
|
-
}, [
|
|
282213
|
-
const onAnnotationSourceReady = useCallback((transform3) => {
|
|
282214
|
-
|
|
282215
|
-
if (
|
|
282216
|
-
|
|
282217
|
-
|
|
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]);
|
|
282218
282444
|
const handleStateUpdate = useCallback((newState) => {
|
|
282219
282445
|
lastInteractionSource.current = LAST_INTERACTION_SOURCE.neuroglancer;
|
|
282220
282446
|
const { projectionScale, projectionOrientation, position: position2 } = newState;
|
|
@@ -282225,7 +282451,8 @@ function NeuroglancerSubscriber(props) {
|
|
|
282225
282451
|
quaternion: Array.from(flippedQuaternion),
|
|
282226
282452
|
projectionScale: Number.isFinite(projectionScale) ? projectionScale * cameraZoomFactor : latestViewerStateRef.current?.projectionScale,
|
|
282227
282453
|
fovDegrees: 45,
|
|
282228
|
-
metersPerUnit: ngMetersPerUnit(latestViewerStateRef.current?.dimensions)
|
|
282454
|
+
metersPerUnit: ngMetersPerUnit(latestViewerStateRef.current?.dimensions),
|
|
282455
|
+
source: "neuroglancer"
|
|
282229
282456
|
};
|
|
282230
282457
|
lastSeenCameraSnapshotRef.current = snapshot;
|
|
282231
282458
|
setSpatialCameraSnapshot(snapshot);
|
|
@@ -282270,10 +282497,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
282270
282497
|
return result;
|
|
282271
282498
|
}, [segmentationColorMapping, segmentationLayerScopes, segmentationChannelScopesByLayer]);
|
|
282272
282499
|
useEffect(() => {
|
|
282273
|
-
if (!
|
|
282500
|
+
if (!hasCentroidLayers && isReady && !segmentationLayerScopes?.length) {
|
|
282274
282501
|
setIsLayersLoaded(true);
|
|
282275
282502
|
}
|
|
282276
|
-
}, [
|
|
282503
|
+
}, [hasCentroidLayers, isReady, segmentationLayerScopes]);
|
|
282277
282504
|
const lastHoveredIdRef = useRef(null);
|
|
282278
282505
|
if (detailMode && cellHighlight != null) {
|
|
282279
282506
|
lastHoveredIdRef.current = String(cellHighlight);
|
|
@@ -282320,7 +282547,6 @@ function NeuroglancerSubscriber(props) {
|
|
|
282320
282547
|
cellHighlight,
|
|
282321
282548
|
csvLoaded
|
|
282322
282549
|
]);
|
|
282323
|
-
const meshOpacity = hasMatchingAnnotationSource ? MESH_OPACITY : void 0;
|
|
282324
282550
|
const derivedViewerState = useMemo$1(() => {
|
|
282325
282551
|
const { current: current2 } = latestViewerStateRef;
|
|
282326
282552
|
if (spatialBetaJustPushedRef.current) {
|
|
@@ -282422,20 +282648,21 @@ function NeuroglancerSubscriber(props) {
|
|
|
282422
282648
|
return layer;
|
|
282423
282649
|
const layerColorMapping = cellColorMappingByLayer?.[layerScope]?.colors ?? {};
|
|
282424
282650
|
const defaultColor = cellColorMappingByLayer?.[layerScope]?.defaultColor;
|
|
282651
|
+
const isCulled = centroidLayerRoles.culledSegLayerScopes.has(layerScope);
|
|
282425
282652
|
let segments2 = [];
|
|
282426
|
-
if (
|
|
282427
|
-
segments2 =
|
|
282653
|
+
if (isCulled) {
|
|
282654
|
+
segments2 = visibleSegmentIdsBySegLayerRef.current?.[layerScope] ?? [];
|
|
282428
282655
|
} else if (Object.keys(layerColorMapping).length > 0) {
|
|
282429
282656
|
segments2 = Object.keys(layerColorMapping);
|
|
282430
282657
|
}
|
|
282431
282658
|
let derivedSegmentColors = {};
|
|
282432
|
-
if (
|
|
282659
|
+
if (isCulled && segments2.length > 0) {
|
|
282433
282660
|
segments2.forEach((meshId) => {
|
|
282434
282661
|
const color2 = layerColorMapping[meshId] || defaultColor;
|
|
282435
282662
|
if (color2)
|
|
282436
282663
|
derivedSegmentColors[meshId] = color2;
|
|
282437
282664
|
});
|
|
282438
|
-
} else if (!
|
|
282665
|
+
} else if (!isCulled) {
|
|
282439
282666
|
derivedSegmentColors = layerColorMapping;
|
|
282440
282667
|
}
|
|
282441
282668
|
return {
|
|
@@ -282474,10 +282701,10 @@ function NeuroglancerSubscriber(props) {
|
|
|
282474
282701
|
spatialTargetY,
|
|
282475
282702
|
initialViewerState,
|
|
282476
282703
|
latestViewerStateIteration,
|
|
282477
|
-
hasMatchingAnnotationSource,
|
|
282478
282704
|
detailMode,
|
|
282479
282705
|
detailSegmentIds,
|
|
282480
|
-
is3dMode
|
|
282706
|
+
is3dMode,
|
|
282707
|
+
centroidLayerRoles
|
|
282481
282708
|
]);
|
|
282482
282709
|
const onSegmentHighlight = useCallback((obsId) => {
|
|
282483
282710
|
const next4 = obsId != null ? String(obsId) : null;
|
|
@@ -282491,7 +282718,7 @@ function NeuroglancerSubscriber(props) {
|
|
|
282491
282718
|
}
|
|
282492
282719
|
}, [isLayersLoaded]);
|
|
282493
282720
|
const hasLayers = derivedViewerState?.layers?.length > 0;
|
|
282494
|
-
const
|
|
282721
|
+
const legendPointLayerScopes = pointLayerScopes?.length > 0 ? pointLayerScopes : void 0;
|
|
282495
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, {
|
|
282496
282723
|
theme: "dark",
|
|
282497
282724
|
maxHeight: ngHeight,
|
|
@@ -282501,12 +282728,12 @@ function NeuroglancerSubscriber(props) {
|
|
|
282501
282728
|
segmentationChannelScopesByLayer,
|
|
282502
282729
|
segmentationChannelCoordination,
|
|
282503
282730
|
// Points
|
|
282504
|
-
pointLayerScopes:
|
|
282731
|
+
pointLayerScopes: legendPointLayerScopes,
|
|
282505
282732
|
pointLayerCoordination,
|
|
282506
282733
|
pointMultiIndicesData
|
|
282507
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) => {
|
|
282508
282735
|
getViewProjectionMatRef.current = getFn;
|
|
282509
|
-
}, getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId],
|
|
282736
|
+
}, getMeshIdToCellId: (meshId) => meshIdToCellIdRef.current[meshId], centroidAnnotationUrlsByLayerName, decodeCentroidById, allowEmptySegments: detailMode })] }) : null });
|
|
282510
282737
|
}
|
|
282511
282738
|
const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
|
|
282512
282739
|
function CellSetExpressionPlotOptions(props) {
|
|
@@ -335019,7 +335246,7 @@ const VEGA_THEMES = {
|
|
|
335019
335246
|
};
|
|
335020
335247
|
const DATASET_NAME = "table";
|
|
335021
335248
|
function VegaGlobalStyles() {
|
|
335022
|
-
const { theme } = useStyles$
|
|
335249
|
+
const { theme } = useStyles$z();
|
|
335023
335250
|
return jsx$1(GlobalStyles$3, { styles: {
|
|
335024
335251
|
"#vg-tooltip-element.vg-tooltip.custom-theme": {
|
|
335025
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)",
|
|
@@ -335053,7 +335280,7 @@ function renderTooltipContents(tooltipText) {
|
|
|
335053
335280
|
}
|
|
335054
335281
|
function VegaPlot(props) {
|
|
335055
335282
|
const { spec: partialSpec, data: data2, getTooltipText, signalListeners, renderer = "svg", onNewView } = props;
|
|
335056
|
-
const { classes: tooltipClasses2 } = useStyles$
|
|
335283
|
+
const { classes: tooltipClasses2 } = useStyles$u();
|
|
335057
335284
|
const tooltipHandler = useMemo$1(() => {
|
|
335058
335285
|
if (typeof getTooltipText === "function") {
|
|
335059
335286
|
const tooltipConfig = {
|
|
@@ -341486,6 +341713,27 @@ class NgAnnotationPointsDataLoader extends AbstractTwoStepLoader {
|
|
|
341486
341713
|
}, url);
|
|
341487
341714
|
}
|
|
341488
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
|
+
}
|
|
341489
341737
|
const decoder = new TextDecoder("utf-8");
|
|
341490
341738
|
const decodeUtf8 = (buffer2) => decoder.decode(buffer2);
|
|
341491
341739
|
const encoder = new TextEncoder();
|
|
@@ -360717,6 +360965,7 @@ const baseFileTypes = [
|
|
|
360717
360965
|
makeFileType(FileType$1.OBS_SEGMENTATIONS_GLB, DataType$3.OBS_SEGMENTATIONS, GlbDataLoader, GlbSource, meshGlbSchema),
|
|
360718
360966
|
makeFileType(FileType$1.OBS_SEGMENTATIONS_NG_PRECOMPUTED, DataType$3.OBS_SEGMENTATIONS, PrecomputedMeshDataLoader, PrecomputedMeshSource, ngPrecomputedMeshSchema),
|
|
360719
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),
|
|
360720
360969
|
// All legacy file types
|
|
360721
360970
|
makeFileType(FileType$1.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR, DataType$3.OBS_FEATURE_MATRIX, MatrixZarrAsObsFeatureMatrixLoader, ZarrDataSource, z.null()),
|
|
360722
360971
|
makeFileType(FileType$1.IMAGE_RASTER_JSON, DataType$3.IMAGE, RasterJsonAsImageLoader, JsonSource, rasterJsonSchema),
|
|
@@ -361151,20 +361400,21 @@ export {
|
|
|
361151
361400
|
require_objectAssign as _,
|
|
361152
361401
|
LercAddCompression as a,
|
|
361153
361402
|
diffCameraState as a0,
|
|
361154
|
-
|
|
361155
|
-
|
|
361156
|
-
|
|
361157
|
-
|
|
361158
|
-
|
|
361159
|
-
|
|
361160
|
-
|
|
361161
|
-
|
|
361162
|
-
|
|
361163
|
-
|
|
361164
|
-
|
|
361165
|
-
|
|
361166
|
-
|
|
361167
|
-
|
|
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,
|
|
361168
361418
|
getImageSize as b,
|
|
361169
361419
|
commonjsGlobal$1 as c,
|
|
361170
361420
|
requireAssign as d,
|