Skip to content

Port task_ist_preprocessing segmentation methods to spatial proteomics - #4

Open
danielStrobl wants to merge 2 commits into
mainfrom
port-ist-segmentation-methods
Open

danielStrobl wants to merge 2 commits into
mainfrom
port-ist-segmentation-methods

Conversation

@danielStrobl

Copy link
Copy Markdown

Add five segmentation components adapted from
openproblems-bio/task_ist_preprocessing, rewritten to this task's .npy contract (gapless int32 labels plus a metadata JSON):

  • cellpose_segmentation (Cellpose 3: cyto, cyto2, cyto3, nuclei)
  • cellposev4_segmentation (Cellpose-SAM / cpsam)
  • stardist_segmentation (2D_versatile_fluo, IST big-image strategy)
  • watershed_txsim_segmentation (txsim segment_watershed, inlined)
  • binning_segmentation (txsim segment_binning, inlined)

custom_segmentation is not ported; reference_segmentation covers it.

Channels are selected by marker name (--input_markers with --nuclear_markers / --membrane_markers) instead of IST's hard-coded image[0], with --nuclei_channel as the fallback. Both Cellpose components run in two-channel [membrane, nuclear] mode when membrane markers are given; the Cellpose nuclei model ignores them.

The txsim watershed is inlined so the component needs no txsim, squidpy or rasterio. Integer-valued images take txsim's exact code path; masks were pixel-identical to txsim on 36 synthetic image/option combinations.

The segmentation API now holds only shared arguments; the threshold and watershed arguments moved into basic_threshold_segmentation and watershed_expand_segmentation, whose outputs are unchanged. The remove_small_* calls go through a scikit-image-version-agnostic helper.

run_benchmark runs all seven image-derived segmenters by default, forwards the marker sidecar, and gains --segmentation_nuclear_markers and --membrane_markers. GPU directive labels match IST.

Describe your changes

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

Daniel Strobl and others added 2 commits November 27, 2026 14:58
Add five segmentation components adapted from
openproblems-bio/task_ist_preprocessing, rewritten to this task's .npy
contract (gapless int32 labels plus a metadata JSON):

- cellpose_segmentation (Cellpose 3: cyto, cyto2, cyto3, nuclei)
- cellposev4_segmentation (Cellpose-SAM / cpsam)
- stardist_segmentation (2D_versatile_fluo, IST big-image strategy)
- watershed_txsim_segmentation (txsim segment_watershed, inlined)
- binning_segmentation (txsim segment_binning, inlined)

custom_segmentation is not ported; reference_segmentation covers it.

Channels are selected by marker name (--input_markers with
--nuclear_markers / --membrane_markers) instead of IST's hard-coded
image[0], with --nuclei_channel as the fallback. Both Cellpose components
run in two-channel [membrane, nuclear] mode when membrane markers are
given; the Cellpose nuclei model ignores them.

The txsim watershed is inlined so the component needs no txsim, squidpy
or rasterio. Integer-valued images take txsim's exact code path; masks
were pixel-identical to txsim on 36 synthetic image/option combinations.

The segmentation API now holds only shared arguments; the threshold and
watershed arguments moved into basic_threshold_segmentation and
watershed_expand_segmentation, whose outputs are unchanged. The
remove_small_* calls go through a scikit-image-version-agnostic helper.

run_benchmark runs all seven image-derived segmenters by default,
forwards the marker sidecar, and gains --segmentation_nuclear_markers and
--membrane_markers. GPU directive labels match IST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
viash 0.9.7 rejects single quotes in a python setup '.script' field,
which made 'viash ns list' fail on stardist_segmentation and stopped CI
before any component test ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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