scverse / scverse/napari-spatialdata

`add_elements` not adding elements using Interactive

Open
#362 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

Hi,

I'm trying to use this package to show my sopa results but can't get my elements to be shown in napari through code.

Here is my code :

image_key = list(sdata.images.keys())[0]
points_key = list(sdata.points.keys())[0] 

interactive = Interactive(sdata, headless=True)
interactive.add_element(image_key, "global", True)
interactive.add_element(points_key, "global", True)
interactive.add_element("cellpose_boundaries", "global", True)
interactive.run()

This loads the image but then nothing else.
The notebook shows

INFO: Please wait for the current operation to finish.
INFO: Please wait for the current operation to finish.
2025-05-13 15:56:57.577 | DEBUG    | napari_spatialdata._view:_on_layer_update:569 - Updating layer.
2025-05-13 15:56:57.578 | DEBUG    | napari_spatialdata._view:_on_layer_update:569 - Updating layer.

but it never finishes. Clicking on it through the GUI is super fast though. Any ideas why ?

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 the Interactive.add_element and Interactive.run entry points and reproduce the supplied Python snippet. Then inspect napari_spatialdata._view:_on_layer_update, which is named in the debug output, to determine why adding multiple elements does not finish. Done means the image, points, and cellpose_boundaries layers all load through code and the operation completes.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.