Skip to content

[3/3] cp_measure features + coordinate alignment for calculate_image_features#1216

Open
timtreis wants to merge 1 commit into
scverse:mainfrom
timtreis:feature/image-features-alignment-cpmeasure
Open

[3/3] cp_measure features + coordinate alignment for calculate_image_features#1216
timtreis wants to merge 1 commit into
scverse:mainfrom
timtreis:feature/image-features-alignment-cpmeasure

Conversation

@timtreis

@timtreis timtreis commented Jun 15, 2026

Copy link
Copy Markdown
Member

Final piece of #982 (split from #1189, #1190). Adds cp_measure features and image/labels coordinate alignment.

New deps (hard)

cp-measure>=0.1.19,<0.2, centrosome>=1.2.3.

Usage

sq.experimental.im.calculate_image_features(
    sdata, image_key="img", labels_key="cells",
    features=["cpmeasure:sizeshape", "skimage:morphology", "squidpy:summary"],
)
  • features=None -> all features, all backends (needs an image).
  • align_mode="strict" (default) raises on non-pixel-aligned image/labels; "rasterize" resamples onto the image grid.

Notes

  • Boundary cells outside the image/labels overlap are dropped + reported.
  • Multiscale labels: alignment works for identity/integer-translation; rasterize raises (pre-align instead).
  • cp_measure columns keep raw CellProfiler names.

@timtreis timtreis force-pushed the feature/image-features-alignment-cpmeasure branch 3 times, most recently from 7bc0f28 to ef48286 Compare June 15, 2026 19:14
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.26638% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.72%. Comparing base (55572c4) to head (8bed3e7).

Files with missing lines Patch % Lines
...uidpy/experimental/im/_calculate_image_features.py 89.72% 10 Missing and 9 partials ⚠️
src/squidpy/gr/_ppatterns.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1216      +/-   ##
==========================================
+ Coverage   76.55%   76.72%   +0.17%     
==========================================
  Files          63       63              
  Lines        9067     9148      +81     
  Branches     1521     1527       +6     
==========================================
+ Hits         6941     7019      +78     
- Misses       1541     1543       +2     
- Partials      585      586       +1     
Files with missing lines Coverage Δ
src/squidpy/experimental/im/_tiling.py 88.28% <100.00%> (+2.22%) ⬆️
src/squidpy/experimental/tl/_tiling_qc.py 71.33% <ø> (ø)
src/squidpy/gr/_ppatterns.py 80.43% <0.00%> (ø)
...uidpy/experimental/im/_calculate_image_features.py 89.17% <89.72%> (+0.57%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis force-pushed the feature/image-features-alignment-cpmeasure branch 9 times, most recently from 25df4eb to 0bc0c1f Compare June 15, 2026 20:13
Final piece of scverse#982 (split from scverse#1189, scverse#1190): wires cp_measure into
calculate_image_features and adds image/labels coordinate-system alignment
(align_mode strict/rasterize), with boundary-cell drop accounting.

- deps: cp-measure>=0.1.19,<0.2, centrosome>=1.2.3 (hard)
- features=None now runs all features across all backends
- _tiling: bbox_y0/bbox_x0 on CellInfo; _Accum accumulator; shared yx_size
- key_added (was adata_key_added); keyword-only params
- skimage backend: single regionprops_table pass for morphology+intensity
- dedupe skimage morphology vs cp_measure:sizeshape when both requested
  (cp wins, computed identically; skimage-only props kept)
- purge non-ASCII em/en-dashes from text files repo-wide (ASCII-only policy)
@timtreis timtreis force-pushed the feature/image-features-alignment-cpmeasure branch from 0bc0c1f to 8bed3e7 Compare June 15, 2026 20:35
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