Skip to content

Skeletonization updates#53

Merged
davidackerman merged 6 commits intomainfrom
skeletonization_updates
Mar 16, 2026
Merged

Skeletonization updates#53
davidackerman merged 6 commits intomainfrom
skeletonization_updates

Conversation

@davidackerman
Copy link
Copy Markdown
Collaborator

This pull request introduces a comprehensive update to the skeletonization process in src/cellmap_analyze/process/skeletonize.py, adding the computation and export of quantitative skeleton metrics for each segmented object. The changes include new metric calculations (such as branch count, path length, and radii), integration with parallel processing, and CSV output, along with corresponding updates to the test suite and test data. These improvements provide richer analysis and facilitate downstream evaluation of skeleton structures.

Skeleton Metrics Calculation and Export:

  • Added computation of skeleton metrics (longest_shortest_path_nm, num_branches, radius_mean_nm, radius_std_nm) for each segmented object, using EDT for radii and NetworkX for graph-based path analysis. Metrics are returned for each object and exported to a CSV file alongside the original segmentation table. (src/cellmap_analyze/process/skeletonize.py, [1] [2] [3] [4] [5] [6] [7] [8]
  • Introduced error handling and default metric values for cases where skeletonization fails or produces empty results, ensuring robust output. (src/cellmap_analyze/process/skeletonize.py, [1] [2] [3] [4] [5]
  • Integrated metrics computation with Dask parallelization, including a merge step and CSV writing after processing all IDs. (src/cellmap_analyze/process/skeletonize.py, src/cellmap_analyze/process/skeletonize.pyR371-R412)

Test Suite Enhancements:

  • Updated test_skeletonize_without_erosion to verify the new skeleton metrics CSV, including checks for branch count, path length, and radius values for a cross-shaped object. (tests/operations/test_skeletonize.py, tests/operations/test_skeletonize.pyR292-R316)
  • Improved test segmentation data for ID 5 to ensure the cross shape produces meaningful branches and metrics. (tests/conftest.py, tests/conftest.pyL649-R656)

Minor Improvements and Cleanups:

  • Fixed argument passing in morphological operation tests and removed commented-out code. (tests/operations/test_morphological_operations.py, [1] [2]

These changes significantly enhance the skeletonization pipeline, providing quantitative metrics for each object and improving test coverage and robustness.

Compute EDT-based radii, longest shortest path distance, and branch
count for each skeleton. Write results to a _with_skeletons.csv
alongside the input CSV. Add a note that Lee's algorithm has known
limitations.
…etrics

The 2x2 cross-section was too thin for skimage.skeletonize to produce
branch points. Use 4x4 arms with distinct lengths and add assertions
for branch count, longest shortest path, and radii on ID 5.
… test

Assert ID 5 has exactly 3 branches and longest shortest path ~160 nm.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.89%. Comparing base (8e9f313) to head (95afeb7).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/cellmap_analyze/process/skeletonize.py 90.74% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
+ Coverage   81.17%   81.89%   +0.72%     
==========================================
  Files          24       24              
  Lines        2969     3016      +47     
==========================================
+ Hits         2410     2470      +60     
+ Misses        559      546      -13     

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

@davidackerman davidackerman merged commit 99fe4e8 into main Mar 16, 2026
3 checks passed
@davidackerman davidackerman deleted the skeletonization_updates branch March 16, 2026 17: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