Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ceesem opened this issue Aug 13, 2024 · 0 comments

Comments

@ceesem
Copy link

ceesem commented Aug 13, 2024

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:

{
    "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant