-
Notifications
You must be signed in to change notification settings - Fork 17
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
API for programmatically loading single elements into Napari #189
Comments
Thank you @aeisenbarth for reaching out and for the feature request. I agree that it's an important use case and it would facilitate the interaction between our and other napari plugins. We also needed similar functions, to be able to instantiate specific elements to the viewer programmatically (to be used during testing) https://github.com/scverse/napari-spatialdata/pull/170/files and in a headless mode https://github.com/scverse/napari-spatialdata/pull/140/files or to fire an instance with already a coordinate system selected https://github.com/scverse/napari-spatialdata/pull/151/files. Nevertheless, the mentioned PRs don't cover your use case, so it would need to be addressed in a separate PR. I am currently focusing on merging old PRs in |
Hey @aeisenbarth! Does what @LucaMarconato stated in his comment suit your needs? If so we can close this issue. |
I should have a look again into the I have the impression,
The original API proposed in this was to convert SpatialData elements directly to Napari layers without GUI, so that me as user would add the layers to Napari. In contrast to that, I would also be fine with a different API for GUI automation:
|
Use case
Workarounds
Currently, I have these options:
napari-spatialdata
, double-click on (the only) coordinate system, double-click on the image name.**kwargs
are passed to Napari'sadd_layer
method, so there is no way to extend this. Also,napari-spatialdata
returns layer data[(None,)]
which is a sentinal that tells Napari that the plugin successfully read the path, but loaded no layer.Use
spatialdata.read_zarr(sdata_path).images[image_name]
and pass the array and transformation to Napari. However, I have to handle both SpatialImage/MultiscaleSpatialImage, extract the scale levels to a plain list, order the axes, convert the transformation to a plain matrix… basically rebuilding the private function_adjust_channels_order
(which I cannot savely import) andadd_sdata_image
.It remains for discussion whether such an API should:
viewer.add_image(…)
so that the user/developer has further control over passing them to the viewer.Requirements:
Tuple[DataType, Metadata, LayerName]
.The text was updated successfully, but these errors were encountered: