Add test coverage for multi-channel writing and fix bounding box bug#57
Add test coverage for multi-channel writing and fix bounding box bug#57rhoadesScholar merged 8 commits intomulti_channel_writingfrom
Conversation
…ling Co-authored-by: rhoadesScholar <37990507+rhoadesScholar@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds test coverage for multi-channel writing features and fixes two critical bugs in ImageWriter: incorrect bounding_box handling for channel dimensions and incorrect scale assignment for channel axes. The changes improve code coverage from 33% to 57% for dataset_writer.py, 47% to 75% for image_writer.py, and 29% to 76% for dataset.py.
Changes:
- Added tests for automatic channel axis detection and deduplication in
ImageWriterandCellMapDatasetWriter - Added tests for
CellMapDataset.empty()method initialization - Fixed
ImageWriterto correctly add channel dimension to bounding_box when channel axis is detected - Fixed scale assignment to use 1.0 (unitless) for channel axis instead of copying first spatial scale
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tests/test_empty_image_writer.py | Added three tests for channel axis detection scenarios: automatic detection, explicit specification, and no-op when dimensions match |
| tests/test_dataset_writer.py | Added two tests for n_channels parameter: automatic channel axis addition and deduplication when axis already exists |
| tests/test_cellmap_dataset.py | Added two tests verifying CellMapDataset.empty() correctly initializes has_data and _sampling_box_shape |
| src/cellmap_data/image_writer.py | Fixed bounding_box to include channel dimension and scale to use 1.0 for channel axis; added tracking variable for channel axis addition |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## multi_channel_writing #57 +/- ##
=========================================================
+ Coverage 60.48% 68.77% +8.29%
=========================================================
Files 27 27
Lines 2528 2527 -1
=========================================================
+ Hits 1529 1738 +209
+ Misses 999 789 -210 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov reported 33% patch coverage with 6 uncovered lines in the multi-channel writing feature (
n_channelsparameter and channel axis handling).Changes
n_channelsparameter inCellMapDatasetWritercovering automatic channel axis addition and deduplication when axis already existsImageWritercovering automatic detection from shape, explicit specification, and no-op when unnecessaryCellMapDataset.empty()verifyinghas_dataand_sampling_box_shapeinitializationImageWriter.__init__: bounding_box now correctly includes channel dimension{"c": [0, n_channels]}when channel axis is detected or specifiedExample
Coverage Impact
dataset_writer.py: 33% → 57%image_writer.py: 47% → 75%dataset.py: 29% → 76%✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.