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

added dims paramter to xenium_aligned_image() #196

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

LucaMarconato
Copy link
Member

@LucaMarconato LucaMarconato commented Aug 12, 2024

Closes #168

Added the dims parameter to give control on the axis names of the additional images. Useful when the default heuristic used to infer the dims fails, as in #168.

Here is an example on how to use the new functionality; please notice that you need to pass aligned_images=False to xenium().

##
from pathlib import Path

# data from here https://github.com/giovp/spatialdata-sandbox/tree/main/xenium_2.0.0_io
f = Path("spatialdata-sandbox/xenium_2.0.0_io/data")

from spatialdata_io import xenium, xenium_aligned_image

sdata = xenium(path=f, aligned_images=False)

image_path = f / "Xenium_V1_humanLung_Cancer_FFPE_he_image.ome.tif"
alignment_file_path = f / "Xenium_V1_humanLung_Cancer_FFPE_he_imagealignment.csv"
sdata["my_if_image"] = xenium_aligned_image(
    image_path=image_path,
    alignment_file=alignment_file_path,
    image_models_kwargs={"scale_factors": [2, 2, 2]},
    dims=("k", "y", "x", "c"),
)

# you need to save the data and re-read it to take advantage of the Zarr optimization
# sdata.write('data.zarr')
# import spatialdata as sd
# sdata = sd.read_zarr('data.zarr')

@LucaMarconato LucaMarconato merged commit 248c7f0 into main Aug 12, 2024
5 checks passed
@LucaMarconato LucaMarconato deleted the fix/xenium_aligned_image branch August 12, 2024 16:06
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

Successfully merging this pull request may close these issues.

Alignment image with xenium
1 participant