google / google/neuroglancer

Viewer scale values are overwritten and huge if a state is created without dimensions

Open
#635 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
389
Avg merge
3d 21h
Merged PRs (30d)
3

Description

When loading a new state into Neuroglancer, it can either get the coordinate dimensions directly from the `state.dimensions` or infer them the base dimension set in the layer info. Sometimes this inference is useful, as there is no generic way to infer correct dimensions without navigating auth and looking up an info file which could easily vary by source type.

However, if you load a neuroglancer state without explicit dimensions, the viewer scales (`crossSectionScale` and `projectionScale`) get set to huge values (124999999.99999999 and 624999999999.9999, respectively) even if these values were already explicitly set in the state.

For example, if I paste the following state with explicit scales into Neuroglancer:

```json
{
"showSlices": false,
"layout": "xy-3d",
"crossSectionScale": 1.0,
"projectionScale": 5000.0,
"layers": [
{"type": "image", "source": [{"url": "precomputed://https://bossdb-open-data.s3.amazonaws.com/iarpa_microns/minnie/minnie65/em"}], "name": "img"},
{"type": "segmentation", "source": [{"url": "precomputed://gs://iarpa_microns/minnie/minnie65/seg"}], "name": "seg"}]
}
```

on loading, the state becomes the following, with a correct set of dimensions and default position but a non-useful pair of scale values.

```
{
"dimensions": {
"x": [
8e-9,
"m"
],
"y": [
8e-9,
"m"
],
"z": [
4e-8,
"m"
]
},
"position": [
120320.5,
103936.5,
21360.5
],
"crossSectionScale": 124999999.99999999,
"projectionScale": 624999999999.9999,
"layers": [
{
"type": "image",
"source": "precomputed://https://bossdb-open-data.s3.amazonaws.com/iarpa_microns/minnie/minnie65/em",
"tab": "source",
"name": "img"
},
{
"type": "segmentation",
"source": "precomputed://gs://iarpa_microns/minnie/minnie65/seg",
"tab": "source",
"segments": [],
"name": "seg"
}
],
"showSlices": false,
"layout": "xy-3d"
}
```

Since scales are relative to the layer dimensions anyway, I don't see why they should be adjusted by dimensions being set.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.