interface with NAPARI
Description
hello again :) I am trying to add a point layer to napari in interactive mode. I follow these indications to add cells positions that I got with tangram: https://forum.image.sc/t/napari-plugin-to-display-csv-as-image/37399/3 ) when I type :
data = sq.datasets.visium_hne_adata()
img = sq.datasets.visium_hne_image()
viewer = img.interactive(adata)
the viewer does not accept the .add_points method viewer.add_points give this error message: 'Interactive' object has no attribute 'add_points'
Could you help me with that ?
The other solution would be : viewer = napari.Viewer(); points_layer = viewer.add_points( data) but I dont know how to add all my squidpy results (clusters, genes, ...) Many many thanks sophie ...
hi @sophieRAIBAUD ,
thanks for the interesting in squidpy. Actually we just released a napari plugin that should allow you to do that (add points directly to viewer), you can check it out here: https://github.com/scverse/napari-spatialdata
and the examples here: https://github.com/scverse/napari-spatialdata/tree/main/examples
let me know if this helps!
@giovp many thanks, I'll try it asap
the first example is working properly thanks !
_import napari import squidpy as sq
adata = sq.datasets.visium_hne_adata() img1 = adata.uns["spatial"]["V1_Adult_Mouse_Brain"]["images"]["hires"].copy()
viewer = napari.Viewer() viewer.add_image( img1, rgb=True, name="image1", metadata={"adata": adata, "library_id": "V1_Adult_Mouse_Brain"}, )_
for the raster_points_regions I am not really sure what is the fov parameter in adata.obs ....
adata1 = adata[adata.obs.fov == "1"].copy()
hi @sophieRAIBAUD , the fov is the single slide of the mibitof dataset. It's just an example to extract a single image (and related annotation) from anndata).
does it help?
@giovp , OK thanks I am very happy with the spatial transcriptomic data, except minor comments can I continue to comment on this channel ?
hi @sophieRAIBAUD , for sure! I'd say github is more for bug report and feature requests, whereas discourse is more for usage discussion
I'll close this, feel free to reopen if not addressed