Repository navigation
Conversation
|
Even with sopa's CLAHE and gaussian disabled, cellpose still rescales
every patch to that patch's own 1-99 percentile, so an identical cell
lands on a different scale in a dense versus a sparse patch -- the
residual tile grid at patch seams. Measured on one identical synthetic
cell across patches of differing content, its post-normalisation peak
varied by 284% under per-patch percentile and 1.8% under a shared
global scale.
Add opt-in `cellpose_normalize_global`: compute one [low, high] pair
per channel from the whole image (at `cellpose_normalize_percentiles`,
default 1,99) and pass it to cellpose as
`--method-kwargs '{"normalize": {"lowhigh": ...}}'`, so every patch
shares one scale. Bounds are ordered to match the channels cellpose
receives (membrane then nucleus for whole-cell).
The cellpose normalize dict is now single-sourced in the
SOPA_SEGMENTATIONCELLPOSE module rather than conf/modules.config,
because the global bounds are computed per sample at run time and sopa
would choke on --method-kwargs appearing twice. Precedence: global >
tile-local (cellpose_tile_norm_blocksize) > cellpose's stock
whole-patch percentile.
Off by default (preserves cellpose's stock contract); assumes
cellpose_clip_limit=0, since bounds are computed on raw intensities.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mikemcka
force-pushed
the
feat/cellpose-global-normalization
branch
from
August 20, 2026 01:56
08e972c to
1dee280
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in param
cellpose_normalize_global(defaultfalse) to fix the residual tiling grid.Why
Even with sopa's CLAHE/gaussian off, Cellpose still normalises each patch to its own 1–99 percentile, so the same cell gets a different scale in a dense vs. a sparse patch — a faint grid at patch seams. When enabled, the pipeline computes one
[low, high]per channel from the whole image and reuses it for every patch, so the scale is identical everywhere.Notes
cellpose_clip_limit = 0; supersedescellpose_tile_norm_blocksize.cellpose_normalize_percentiles(default1,99).🤖 Generated with Claude Code