scverse / scverse/napari-spatialdata

Fix default size for points elements

Open
#214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
90
Forks
25
Avg merge
22m
Merged PRs (30d)
1

Description

When points elements are being shown, an optimal size for the points is guessed based on a heuristic implemented in _calc_default_radii().

There are three fixes that we need to make here:

  • get_extent(), even when using exact=False, is too slow when there is a large number of points. We should add a parameter fast: bool = False which computes a very rough approximation of the extent based on some "Montecarlo" sampling.
  • The value in unit we return is wrong when we are in a scaled coordinate system; I think that we need to divide by the average module of the eigenvalues of the affine transformation, as we do in _adjust_radii_of_points_layer()
  • There is a strange bug in get_extent() where the single-dispatch doesn't recognize SpatialData objects. This is tracked here: https://github.com/scverse/spatialdata/issues/500

For the moment, I am disabling the use of _calc_default_radii() in https://github.com/scverse/napari-spatialdata/pull/215.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with _calc_default_radii() and get_extent(), then compare the unit handling in _adjust_radii_of_points_layer(). Check the linked SpatialData issue and napari-spatialdata PR 215 for context on the single-dispatch problem and the temporary disabling change. Done means the fast extent path, scaled-coordinate sizing, and SpatialData dispatch behavior are corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.