Skip to content

Raw stats#54

Merged
davidackerman merged 3 commits intomainfrom
raw_stats
Mar 16, 2026
Merged

Raw stats#54
davidackerman merged 3 commits intomainfrom
raw_stats

Conversation

@davidackerman
Copy link
Copy Markdown
Collaborator

This pull request introduces support for measuring raw intensity statistics for segmented objects, including their mean and standard deviation, and integrates these statistics throughout the measurement pipeline. The changes add new functionality for handling raw intensity data, updating object information, and outputting these statistics, as well as comprehensive tests to ensure correctness.

Raw intensity support and integration:

  • Added handling of raw_path in the Measure class, loading raw intensity data and propagating it through blockwise measurement processing (src/cellmap_analyze/analyze/measure.py). [1] [2]
  • Extended the measurement output to include columns for mean and standard deviation of raw intensity when available, and updated row generation logic to include these values (src/cellmap_analyze/analyze/measure.py). [1] [2]

Object information enhancements:

  • Added fields and computation logic for raw intensity statistics (raw_sum, raw_sum_sq, raw_count, mean_intensity, std_intensity, has_raw_intensity) in ObjectInformation, including validation and aggregation in addition and equality operations (src/cellmap_analyze/util/information_holders.py). [1] [2] [3]

Measurement utilities:

  • Implemented get_raw_intensity_stats to efficiently compute per-label raw intensity statistics, and integrated it into get_object_information for both whole and blockwise measurements (src/cellmap_analyze/util/measure_util.py). [1] [2] [3] [4]

Testing improvements:

  • Added fixtures and tests for raw intensity data, including validation of computed statistics and aggregation logic (tests/conftest.py, tests/operations/test_measure.py). [1] [2] [3] [4]

Expanded test coverage:

  • Introduced tests for raw intensity statistics computation, addition of ObjectInformation objects with raw intensity, and end-to-end measurement with raw intensity input (tests/operations/test_measure.py).

Support optional raw_sum, raw_sum_sq, raw_count kwargs for tracking
per-label intensity statistics. Derived mean_intensity and std_intensity
are computed from accumulators. Updated __add__ to merge and __eq__ to
compare raw intensity fields.
…rmation

New function computes per-label sum, sum of squares, and count using
fastremap and bincount. get_object_information now accepts an optional
raw_data kwarg and passes intensity accumulators to ObjectInformation.
Measure now accepts optional raw_path kwarg to compute per-label mean
and std intensity from a raw zarr dataset. Resolution differences are
handled via ImageDataInterface output_voxel_size. CSV output includes
Mean Intensity and Std Intensity columns when raw_path is provided.
@davidackerman davidackerman merged commit e09a692 into main Mar 16, 2026
2 checks passed
@davidackerman davidackerman deleted the raw_stats branch March 16, 2026 20:49
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.92%. Comparing base (99fe4e8) to head (eed3065).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/cellmap_analyze/util/information_holders.py 74.07% 7 Missing ⚠️
src/cellmap_analyze/analyze/measure.py 84.61% 2 Missing ⚠️
src/cellmap_analyze/util/measure_util.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
+ Coverage   81.89%   81.92%   +0.02%     
==========================================
  Files          24       24              
  Lines        3016     3076      +60     
==========================================
+ Hits         2470     2520      +50     
- Misses        546      556      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

1 participant