scverse / scverse/spatialdata-io

Alignment image with xenium

Open
#168 24 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
103
Forks
65
Avg merge
1h 8m
Merged PRs (30d)
3

Description

Sorry for the continuous questions, and I'm really at the beginning stage of spatial transcriptomics.
I aligned my confocal image (Z-stack OME TIFF file) with the Xenium dataset in Xenium Explorer. I downloaded the matrix.csv from Xenium Explorer.

Please let me know if I need provide more information

I use this tutorial for alignment. https://github.com/quentinblampey/spatialdata_xenium_explorer/blob/master/docs/10x_tutorials/xenium/xenium_tuto.ipynb
However, I got the issue at this step.
alignment_matrix_path = "../C1-blank-section1-ant2-SOAR40x_alignment_files/matrix.csv"
confocal_path = "../C1-blank-section1-ant2-SORA40x.ome.tif"
image = xenium_aligned_image(confocal_path, alignment_matrix_path)


AssertionError Traceback (most recent call last)
Cell In[14], line 6
3 alignment_matrix_path = "../C1-blank-section1-ant2-SOAR40x_alignment_files/matrix.csv"
4 confocal_path = "../C1-blank-section1-ant2-SORA40x.ome.tif"
----> 6 image = xenium_aligned_image(confocal_path, alignment_matrix_path)
7 sdata.add_image(image_name, image)
8 sdata

File d:\Yifan_Wang\Software\envs\SP\lib\site-packages\spatialdata_io\readers\xenium.py:595, in xenium_aligned_image(image_path, alignment_file, imread_kwargs, image_models_kwargs)
593 else:
594 assert len(image.shape) == 3
--> 595 assert image.shape[0] in [3, 4]
596 if image.shape[0] == 4:
597 # as explained before in _get_images(), we need to add a dummy channel until we support 4-channel images as
598 # non-RGBA images in napari
599 image = da.concatenate([image, da.zeros_like(image[0:1])], axis=0)

AssertionError:---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[14], line 6
3 alignment_matrix_path = "../C1-blank-section1-ant2-SOAR40x_alignment_files/matrix.csv"
4 confocal_path = "../C1-blank-section1-ant2-SORA40x.ome.tif"
----> 6 image = xenium_aligned_image(confocal_path, alignment_matrix_path)
7 sdata.add_image(image_name, image)
8 sdata

File d:\Yifan_Wang\Software\envs\SP\lib\site-packages\spatialdata_io\readers\xenium.py:595, in xenium_aligned_image(image_path, alignment_file, imread_kwargs, image_models_kwargs)
593 else:
594 assert len(image.shape) == 3
--> 595 assert image.shape[0] in [3, 4]
596 if image.shape[0] == 4:
597 # as explained before in _get_images(), we need to add a dummy channel until we support 4-channel images as
598 # non-RGBA images in napari
599 image = da.concatenate([image, da.zeros_like(image[0:1])], axis=0)

AssertionError:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using docs/10x_tutorials/xenium/xenium_tuto.ipynb and the xenium_aligned_image entry point shown in spatialdata_io/readers/xenium.py. Inspect the loaded OME TIFF shape and channel layout at the assertion, then compare it with the alignment matrix input and existing image-reader assumptions; done requires a documented or tested resolution for this reported input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.