Skip to content

fix: write OME channel labels as strings#1168

Open
stanbot8 wants to merge 1 commit into
scverse:mainfrom
stanbot8:staging/1136-omero-channel-labels
Open

fix: write OME channel labels as strings#1168
stanbot8 wants to merge 1 commit into
scverse:mainfrom
stanbot8:staging/1136-omero-channel-labels

Conversation

@stanbot8

Copy link
Copy Markdown

Change

The OME-NGFF 0.5 channel model requires each channel label to be a string. SpatialData wrote numeric channel coordinates without conversion. This produced the invalid metadata reported in issue 1136.

This change writes OME channel labels as strings. It stores the SpatialData channel coordinates separately. This preserves integer coordinates and numeric-looking string coordinates without a type guess. It publishes both metadata representations with 1 atomic attribute update. Old stores continue to use their OME labels.

Closes #1136.

Commands

uvx pre-commit run --files src/spatialdata/_io/_utils.py src/spatialdata/_io/io_raster.py tests/io/test_metadata.py

pytest tests/io/test_metadata.py -q

pytest --cov --color=no -n auto --dist worksteal -q

All commands pass. The full suite reports 1366 passed, 7 skipped, and 1 expected failure.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.45%. Comparing base (eb4fb3d) to head (0257c80).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1168   +/-   ##
=======================================
  Coverage   92.44%   92.45%           
=======================================
  Files          51       51           
  Lines        7820     7828    +8     
=======================================
+ Hits         7229     7237    +8     
  Misses        591      591           
Files with missing lines Coverage Δ
src/spatialdata/_io/_utils.py 86.92% <100.00%> (+0.25%) ⬆️
src/spatialdata/_io/io_raster.py 89.20% <100.00%> (+0.15%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

attributes/ome/omero/channels/label gets incorrectly coerced to integer

1 participant