Skip to content

Multi-slide pooled fit_stain_reference#1209

Open
timtreis wants to merge 2 commits into
mainfrom
stain/pr4-pooled-fit
Open

Multi-slide pooled fit_stain_reference#1209
timtreis wants to merge 2 commits into
mainfrom
stain/pr4-pooled-fit

Conversation

@timtreis

Copy link
Copy Markdown
Member

fit_stain_reference now accepts image_key: str | list[str] — a list pools several images' tissue pixels into one fit (one reference for a cohort in one SpatialData).

ref = sq.experimental.im.fit_stain_reference(sdata, ["s1", "s2"], method="macenko")

tissue_mask_key takes an order-matched list (or None for the {key}_tissue convention). Single-image fit unchanged.

`fit_stain_reference` now accepts `image_key: str | list[str]`. A list pools
the tissue pixels of several same-dtype images into one fit (decomposition
pools tissue OD, Reinhard pools tissue Lab pixels) - one reference for a cohort
held in a single SpatialData. `tissue_mask_key` accepts an order-matched list
(or None for the `{key}_tissue` convention). A blank slide raises, named; no
silent skip. Single-image fit is unchanged.

KISS replacement for the old cohort-aggregation + persistence design: no new
module, no provenance fields, no serialization format (references are plain
Python objects users serialize themselves).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.67%. Comparing base (55572c4) to head (587c013).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1209      +/-   ##
==========================================
+ Coverage   76.55%   76.67%   +0.12%     
==========================================
  Files          63       63              
  Lines        9067     9115      +48     
  Branches     1521     1533      +12     
==========================================
+ Hits         6941     6989      +48     
  Misses       1541     1541              
  Partials      585      585              
Files with missing lines Coverage Δ
...c/squidpy/experimental/im/_stain/_decomposition.py 92.18% <100.00%> (+0.31%) ⬆️
src/squidpy/experimental/im/_stain/_normalize.py 94.96% <100.00%> (+1.21%) ⬆️
src/squidpy/experimental/im/_stain/_reinhard.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis marked this pull request as ready for review June 15, 2026 14: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.

1 participant