scverse / scverse/spatialdata

Channel Equivalent For `Labels2DModel`

Open
#338 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

Thanks for developing SpatialData! It's been a very ergonomic experience so far trying to convert a small subset of our lab's current multiplexed imaging pipeline as a MVP for testing.

One particular wishlist item would be an $N$-dimensional implementation of Labels2D, as for each SpatialImage a user may want to have several types of labels, such as:

  • Cell membrane segmentation masks
  • Nuclear membrane segmentation masks
  • Cluster Masks from various algorithms
  • etc...

Here is what I have currently:

Current `sdata` setup
SpatialData object with:
├── Images
│     ├── 'fov0': SpatialImage[cyx] (22, 512, 512)
│     ├── 'fov1': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov2': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov3': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov4': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov5': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov6': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov7': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov8': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov9': SpatialImage[cyx] (22, 1024, 1024)
│     └── 'fov10': SpatialImage[cyx] (22, 1024, 1024)
└── Labels
     ├── 'fov0_nuclear': SpatialImage[yx] (512, 512)
     ├── 'fov0_whole_cell': SpatialImage[yx] (512, 512)
     ├── 'fov1_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov1_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov2_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov2_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov3_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov3_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov4_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov4_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov5_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov5_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov6_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov6_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov7_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov7_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov8_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov8_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov9_nuclear': SpatialImage[yx] (1024, 1024)
     ├── 'fov9_whole_cell': SpatialImage[yx] (1024, 1024)
     ├── 'fov10_nuclear': SpatialImage[yx] (1024, 1024)
     └── 'fov10_whole_cell': SpatialImage[yx] (1024, 1024)

Ideally something like this would be great:

`sdata` with `C` equivalent
SpatialData object with:
├── Images
│     ├── 'fov0': SpatialImage[cyx] (22, 512, 512)
│     ├── 'fov1': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov2': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov3': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov4': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov5': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov6': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov7': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov8': SpatialImage[cyx] (22, 1024, 1024)
│     ├── 'fov9': SpatialImage[cyx] (22, 1024, 1024)
│     └── 'fov10': SpatialImage[cyx] (22, 1024, 1024)
└── Labels
     ├── 'fov0': SpatialImage[cyx] (2, 512, 512)
     ├── 'fov1': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov2': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov3': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov4': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov5': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov6': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov7': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov8': SpatialImage[cyx] (2, 1024, 1024)
     ├── 'fov9': SpatialImage[cyx] (2, 1024, 1024)
     └── 'fov10': SpatialImage[cyx] (2, 1024, 1024)

This would be pretty convenient when, say indexing a particular Spatial Image with along with 1,2, or $n$ potential label masks.

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 by reviewing the existing Labels2D and SpatialImage concepts described in the issue, then determine how a channel dimension would fit the Labels representation and indexing behavior. Define what the C-equivalent labels should contain and how users access each mask; the work is done when multiple label masks can be associated with each spatial image in the proposed structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.