scverse / scverse/spatialdata-io

CosMx Reader Incorrectly Assumes Image Dimension Order

Open
#403 2 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

The CosMx reader implements some pretty rigid expectations about image dimension order in input images here:
https://github.com/scverse/spatialdata-io/blob/main/src/spatialdata_io/readers/cosmx.py#L197

In the course of testing a pipeline for processing data for the SenNet and HuBMAP consortia, I've encountered data where dask_image.imread.imread() returns data with dimensions ordered like this:

>>> img = imread.imread('FOV0046.tiff')
>>> img
dask.array<_map_read_frame, shape=(5, 4256, 4256), dtype=uint16, chunksize=(1, 4256, 4256), chunktype=numpy.ndarray>

The transposition of C and Y dimensions relative to the reader's expectations results in some issues visualizing data downstream. I understand that there's a new CosMx reader in development, and am wondering if it will have more flexible expectations about image dimension ordering, and if there's a timeline for the release of the new reader.

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

Start at src/spatialdata_io/readers/cosmx.py around line 197 and reproduce the reported shape from dask_image.imread.imread() using FOV0046.tiff. Trace how the reader interprets image dimensions and verify that the reported ordering is handled correctly for downstream visualization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.