scverse / scverse/spatialdata

[Suggestion] Allow strings for method when constructing multiscale Image2DModel

Open
#995 1 comment 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

When constructing an Image2DModel, the following code will work:

from multiscale_spatial_image.to_multiscale.to_multiscale import Methods

sdata.images['my_image'] = sd.models.Image2DModel.parse(
        imarr,
        dims=['c','y','x'],
        c_coords=['DAPI','ATP1A1/CD45/E-Cadherin','18S','alphaSMA/Vimentin'],
        scale_factors=[2,2,2,2,2,2,2,2],
        method=Methods.XARRAY_COARSEN, chunks=(1,256,256),
)

However, the following code will work (as of v0.4.0), but not produce a multiscale image:

sdata.images['my_image'] = sd.models.Image2DModel.parse(
        imarr,
        dims=['c','y','x'],
        c_coords=['DAPI','ATP1A1/CD45/E-Cadherin','18S','alphaSMA/Vimentin'],
        scale_factors=[2,2,2,2,2,2,2,2],
        method='xarray_coarsen', chunks=(1,256,256),
)

Based on the documentation, it would be nice if the second method worked. Thanks!

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 Image2DModel.parse and inspect how the documented Methods.XARRAY_COARSEN value is handled compared with the string "xarray_coarsen". Confirm that passing the string selects the same multiscale method and produces a multiscale image, then add or update coverage if the repository provides a relevant test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.