Skip to content

Document the segmentation pipeline - #10

Merged
rushin682 merged 2 commits into
mainfrom
docs/segmentation-tutorial
Aug 31, 2026
Merged

Document the segmentation pipeline#10
rushin682 merged 2 commits into
mainfrom
docs/segmentation-tutorial

Conversation

@rushin682

Copy link
Copy Markdown
Collaborator

Documentation and tutorial update for the segmentation pipeline added in #9, which shipped without docs.

Tutorial

docs/notebooks/segment_nuclei.ipynb picks up where convert_to_ometiff.ipynb leaves off: it takes an OME-TIFF through segment_wsi and geojson_to_spatialdata to a written SpatialData zarr, then reads the store back and plots the nuclei over the H&E.

Executed end-to-end on a kidney H&E (867 MB, 1239 tiles, 83,554 nuclei), so the committed outputs are real.

Registered in tutorials.md, index.md, api.md (new Segmenting section) and installation.md (the segmentation extra). convert_to_ometiff.ipynb now links forward to it.

Zarr store naming

The store is now named for the slide's stem rather than its full filename:

before:  Xenium_..._he_image.ome.tif.zarr
after:   Xenium_..._he_image.zarr

Path.stem alone does not do this (slide.ome.tifslide.ome), so this adds a slide_stem helper in core/utils.py and a default_zarr_path in segmentation/to_spatialdata.py. The .zarr.zip sibling and the skip-existing check follow automatically.

Stores written under the old convention are no longer recognised by the skip-existing check, so a re-run would rebuild them. A rename snippet is in the geojson_to_spatialdata.py module docstring.

Also

The SLURM scripts are untracked — they are cluster-specific scratch, not part of the package surface.

Checks

  • pytest — 100 passed
  • sphinx-build -W — build succeeded
  • ruff check / ruff format --check — clean

Add a tutorial notebook that carries an OME-TIFF through InstanSeg nucleus
segmentation to a SpatialData zarr, and register it in the docs.

Name the zarr store for the slide's stem (`slide.ome.tif` -> `slide.zarr`)
instead of the full filename, via a new `slide_stem` helper.

Untrack the SLURM scripts; they are cluster-specific scratch.
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.90%. Comparing base (f346302) to head (1927779).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
+ Coverage   65.62%   65.90%   +0.28%     
==========================================
  Files          13       13              
  Lines        1338     1349      +11     
==========================================
+ Hits          878      889      +11     
  Misses        460      460              
Files with missing lines Coverage Δ
src/spatialrefinery/core/utils.py 82.72% <100.00%> (+0.47%) ⬆️
src/spatialrefinery/segmentation/instanseg.py 53.62% <ø> (ø)
src/spatialrefinery/segmentation/to_spatialdata.py 85.71% <100.00%> (+0.42%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add the segmentation steps to Getting started and both optional extras
to Installation.

Restore the trailing newline in .gitignore, which end-of-file-fixer
rejected in CI.
@rushin682
rushin682 merged commit af204cb into main Aug 31, 2026
9 checks passed
@rushin682
rushin682 deleted the docs/segmentation-tutorial branch August 31, 2026 18:54
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