Skip to content
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

visium_hd: no global coordinate system for image #202

Closed
fbnrst opened this issue Sep 6, 2024 · 4 comments
Closed

visium_hd: no global coordinate system for image #202

fbnrst opened this issue Sep 6, 2024 · 4 comments

Comments

@fbnrst
Copy link

fbnrst commented Sep 6, 2024

I am reading spaceranger outputs like this:

spatialdata_io.visium_hd(
    '../../raw_data/240905_VisiumHD_Periportal_Assembloid/spaceranger/Slide1_phh2_normal1/outs/',
    dataset_id='Slide1_phh2_normal1',
    load_all_images=False,
)

output:

SpatialData object
├── Images
│     ├── 'Slide1_phh2_normal1_cytassist_image': DataArray[cyx] (3, 3000, 3200)
│     ├── 'Slide1_phh2_normal1_hires_image': DataArray[cyx] (3, 4997, 6000)
│     └── 'Slide1_phh2_normal1_lowres_image': DataArray[cyx] (3, 500, 600)
├── Shapes
│     ├── 'Slide1_phh2_normal1_square_002um': GeoDataFrame shape: (326064, 1) (2D shapes)
│     ├── 'Slide1_phh2_normal1_square_008um': GeoDataFrame shape: (20379, 1) (2D shapes)
│     └── 'Slide1_phh2_normal1_square_016um': GeoDataFrame shape: (5279, 1) (2D shapes)
└── Tables
      ├── 'square_002um': AnnData (326064, 18094)
      ├── 'square_008um': AnnData (20379, 18094)
      └── 'square_016um': AnnData (5279, 18094)
with coordinate systems:
    ▸ 'downscaled_hires', with elements:
        Slide1_phh2_normal1_hires_image (Images), Slide1_phh2_normal1_square_002um (Shapes), Slide1_phh2_normal1_square_008um (Shapes), Slide1_phh2_normal1_square_016um (Shapes)
    ▸ 'downscaled_lowres', with elements:
        Slide1_phh2_normal1_lowres_image (Images), Slide1_phh2_normal1_square_002um (Shapes), Slide1_phh2_normal1_square_008um (Shapes), Slide1_phh2_normal1_square_016um (Shapes)
    ▸ 'global', with elements:
        Slide1_phh2_normal1_cytassist_image (Images), Slide1_phh2_normal1_square_002um (Shapes), Slide1_phh2_normal1_square_008um (Shapes), Slide1_phh2_normal1_square_016um (Shapes)

I noticed that the "hires" and "lowres" images do not have a global coordinate system. I manually registered these images before to the CytAssist image using landmarks in the loupe browser, also, when I open the cloupe files in loupe browser the hires image is registered.

This is not what I expected from the tutorial https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/technology_visium_hd.html, there, all images are part of the global coordinate system

@LucaMarconato
Copy link
Member

LucaMarconato commented Oct 2, 2024

Hi, thanks for reaching out. What you get is expected and is consistent in what is shown in the tutorial (copy-pasting the first print below):

SpatialData object, with associated Zarr store: /Users/macbook/embl/projects/basel/spatialdata-sandbox/visium_hd_3.0.0_io/data.zarr
├── Images
│     ├── 'Visium_HD_Mouse_Small_Intestine_cytassist_image': DataArray[cyx] (3, 3000, 3200)
│     ├── 'Visium_HD_Mouse_Small_Intestine_full_image': DataTree[cyx] (3, 21943, 23618), (3, 10971, 11809), (3, 5485, 5904), (3, 2742, 2952), (3, 1371, 1476)
│     ├── 'Visium_HD_Mouse_Small_Intestine_hires_image': DataArray[cyx] (3, 5575, 6000)
│     └── 'Visium_HD_Mouse_Small_Intestine_lowres_image': DataArray[cyx] (3, 558, 600)
├── Shapes
│     ├── 'Visium_HD_Mouse_Small_Intestine_square_002um': GeoDataFrame shape: (5479660, 1) (2D shapes)
│     ├── 'Visium_HD_Mouse_Small_Intestine_square_008um': GeoDataFrame shape: (351817, 1) (2D shapes)
│     └── 'Visium_HD_Mouse_Small_Intestine_square_016um': GeoDataFrame shape: (91033, 1) (2D shapes)
└── Tables
      ├── 'square_002um': AnnData (5479660, 19059)
      ├── 'square_008um': AnnData (351817, 19059)
      └── 'square_016um': AnnData (91033, 19059)
with coordinate systems:
    ▸ 'downscaled_hires', with elements:
        Visium_HD_Mouse_Small_Intestine_hires_image (Images), Visium_HD_Mouse_Small_Intestine_square_002um (Shapes), Visium_HD_Mouse_Small_Intestine_square_008um (Shapes), Visium_HD_Mouse_Small_Intestine_square_016um (Shapes)
    ▸ 'downscaled_lowres', with elements:
        Visium_HD_Mouse_Small_Intestine_lowres_image (Images), Visium_HD_Mouse_Small_Intestine_square_002um (Shapes), Visium_HD_Mouse_Small_Intestine_square_008um (Shapes), Visium_HD_Mouse_Small_Intestine_square_016um (Shapes)
    ▸ 'global', with elements:
        Visium_HD_Mouse_Small_Intestine_cytassist_image (Images), Visium_HD_Mouse_Small_Intestine_full_image (Images), Visium_HD_Mouse_Small_Intestine_square_002um (Shapes), Visium_HD_Mouse_Small_Intestine_square_008um (Shapes), Visium_HD_Mouse_Small_Intestine_square_016um (Shapes)

As you can see Visium_HD_Mouse_Small_Intestine_hires_image and Visium_HD_Mouse_Small_Intestine_lowres_image are indeed not listed in the global coordinate system.

The difference is that in the tutorial the global coordinate system has the image Visium_HD_Mouse_Small_Intestine_full_image. In your case it seems that the reader could not locate the image, probably because of a naming issue, or because the image is located in a different folder than what the reader expects (we saw this in some datasets in a recent SpaceRanger run).

I would suggest the following:

Let me know if it this helps!

@LucaMarconato
Copy link
Member

LucaMarconato commented Oct 2, 2024

(I closed the issue by accident pressing the wrong key, reopened)

@fbnrst
Copy link
Author

fbnrst commented Oct 4, 2024

Thanks! You are right, not sure why I thought hires and lowres would be part of global. I will try with the fullres image as you suggested. I won't have time to do so soon, so will close this issue for now, and I would only reopen if I cannot make it run. Thanks for looking into this!

@fbnrst fbnrst closed this as completed Oct 4, 2024
@LucaMarconato
Copy link
Member

Sounds great! Please be aware of this other bug that has been reported: #216. We are working on it and it does affect only some datasets, so hopefully you will not encounter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants