squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

read image from Vizgen data (for Napari)

Open anidj opened this issue 2 years ago • 4 comments

Hi,

Thank you for developping this amazing tool! I am currently working on breast Vizgen data (available online) and I was wondering what should be the input for the image on napari.

I thought it would be the file micron_to_mosaic_pixel_transform.csv, but when I do that:

img = sq.im.ImageContainer("micron_to_mosaic_pixel_transform.csv") I got the message: "ValueError: Unable to handle path"

When I do that: import imageio image = imageio.imread("micron_to_mosaic_pixel_transform.csv") img = sq.im.ImageContainer(image) I got: "ValueError: Could not find a backend to open micron_to_mosaic_pixel_transform.csv`` with iomode ri`."

Do you think you can help me with that ?

Thanks a lot,

anidj avatar Feb 08 '23 15:02 anidj

@anidj What I know imageContainer from the napari libarray only accepts image data in the form of numpy arrays/image formate etc. You need to first read the date into a pandas dataframes and then use below codes:

`import pandas as pd
import napari

data = pd.read_csv("micron_to_mosaic_pixel_transform.csv")

with napari.gui_qt():
    viewer = napari.Viewer()
    # display the data as a table layer
    viewer.add_table(data)` 

This should able to display the date in the pixel transform formate (table layer in the napari viewer). Please keep in mind that I have not tested the code above

DRSEI avatar Feb 09 '23 00:02 DRSEI

Any developments on this? Have been trying to interactively visualize some VizGen data using SquidPy, with no success so far. Seems like the developers didn't anticipate that users might want to do that with VizGen data?

davisidarta avatar Jul 25 '23 17:07 davisidarta

No, I wasn't able to do it yet

anidj avatar Jul 25 '23 18:07 anidj

hey all! apologies for late reply! We don't support such functionality with squidpy but we do with spatialdata!

see IO for vizgen: https://spatialdata.scverse.org/projects/io/en/latest/generated/spatialdata_io.merscope.html you might have to install from main as a bug was fixed recently

visualize with napari. you can take a look at this nanostring tutorial but vizgen data is relatively similar in terms of what can be visualized: https://spatialdata.scverse.org/projects/napari/en/latest/notebooks/nanostring_analysis.html

HTH!

giovp avatar Jul 25 '23 19:07 giovp