Skip to content

Commit c5f1b8e

Browse files
authored
Merge pull request #47 from mikemcka/feat/whole-cell-default-hide-advanced
Default use_whole_cell_only to true; hide mask smoothing and Cellpose preprocessing params
2 parents 025e926 + fe0d9ee commit c5f1b8e

5 files changed

Lines changed: 37 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## Unreleased
7+
8+
### Changed
9+
10+
- **:warning: `use_whole_cell_only` now defaults to `true`.** Nuclei are no
11+
longer segmented or measured unless `--use_whole_cell_only false` is set.
12+
Runs that relied on nuclear masks or nuclear measurements must set it
13+
explicitly.
14+
15+
- The **Mask smoothing options** and **Cellpose preprocessing options**
16+
parameters are hidden in the Seqera Platform launch form and in `--help`.
17+
They are shown with `--show_hidden` and can still be set on the command line
18+
or in a params file. Their defaults are unchanged.
19+
620
## v0.5.0 - 2026-09-07
721

822
### Changed

‎docs/usage.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ You can also generate such `YAML`/`JSON` files via [nf-core/launch](https://nf-c
122122

123123
### Cell processing parameters
124124

125-
| Parameter Name | Description |
126-
| ------------------- | ---------------------------------------------------------------------------------- |
127-
| use_whole_cell_only | Use only the whole-cell segmentation to process cells (skip nuclear segmentation). |
125+
| Parameter Name | Description |
126+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
127+
| use_whole_cell_only | Use only the whole-cell segmentation to process cells (skip nuclear segmentation). Default: `true`. Set to `false` to also segment and measure nuclei. |
128128

129129
### Combine channel parameters
130130

@@ -304,7 +304,7 @@ were trained on:
304304
| `equalize_adapthist(clip_limit, kernel)` | sopa | **off** (`0`) |
305305
| percentile (1, 99) rescale | Cellpose | on (unchanged) |
306306

307-
These four parameters form the **Cellpose preprocessing options** group:
307+
These four parameters form the **Cellpose preprocessing options** group. They are hidden in the Seqera Platform launch form and in `--help` (shown with `--show_hidden`). They can still be set on the command line or in a params file:
308308

309309
| Parameter Name | Default | Description |
310310
| ---------------------------- | ------- | -------------------------------------------------------------------------------------- |
@@ -725,6 +725,8 @@ Two things to watch:
725725

726726
### Mask smoothing options
727727

728+
These parameters are hidden in the Seqera Platform launch form and in `--help` (shown with `--show_hidden`). They can still be set on the command line or in a params file.
729+
728730
| Parameter Name | Description |
729731
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
730732
| smooth_masks | Enable mask smoothing before cell measurement to reduce polygon complexity (default: `false`). Prevents StackOverflowError in QuPath's GeoJSON export for images with complex cell boundaries. |

‎modules/local/cellmeasurement/tests/main.nf.test‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ nextflow_process {
1111
test("cellmeasurement - basic functionality") {
1212

1313
when {
14+
params {
15+
use_whole_cell_only = false
16+
}
1417
process {
1518
"""
1619
input[0] = [

‎nextflow.config‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ params {
3030
remove_markers = 'TRITC,Cy5'
3131

3232
// cell processing options
33-
use_whole_cell_only = false
33+
use_whole_cell_only = true
3434

3535
// combine channels options
3636
combine_method = 'max'

‎nextflow_schema.json‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@
5959
"properties": {
6060
"use_whole_cell_only": {
6161
"type": "boolean",
62+
"default": true,
6263
"description": "Use only the whole-cell segmentation to process cells (skip nuclear segmentation).",
6364
"fa_icon": "fas fa-stopwatch",
64-
"help_text": "Set this to `true` to use only the whole-cell segmentation to process cells. This will skip segmentation of nuclei and associated measurements but retains cell, erosion, and expansion measurements."
65+
"help_text": "Defaults to `true`: only the whole-cell segmentation is used to process cells. Nuclei are not segmented and nuclear measurements are not produced; cell, erosion, and expansion measurements are kept. Set to `false` to also segment nuclei and measure them."
6566
}
6667
}
6768
},
@@ -164,27 +165,31 @@
164165
"properties": {
165166
"cellpose_tile_norm_blocksize": {
166167
"type": "integer",
168+
"hidden": true,
167169
"minimum": 0,
168170
"description": "Block size in pixels for Cellpose's tile-local intensity normalisation. 0 uses Cellpose's whole-patch default.",
169171
"help_text": "Segmentation always runs on patches, and normalisation is computed from the patch, so without this a cell's segmentation depends on what else landed in its patch and changing `--patch_width_pixel` changes results. Patch overlap does not help: it resolves cells straddling a boundary, not differing normalisation.\n\nThis is forwarded as `--method-kwargs '{\"normalize\": {\"tile_norm_blocksize\": N, \"percentile\": [1.0, 99.0]}}'`, which sopa passes into `model.eval`, making the percentile statistics local to each block rather than global to the patch.\n\nChoose a block that comfortably contains many nuclei. At COMET's 0.28 um/px with `--cellpose_diameter 30` (8.4 um cells), 512 px is 143 um, about 17 nuclear diameters. Small blocks are actively harmful: a 128 px (36 um) block spans roughly 4 cell diameters, so in sparse tissue it can contain no nuclei at all and its noise is stretched to the full range. Cellpose only guards a flat block when its 1-99 percentile range falls below 1e-3, which such blocks exceed.\n\nNote this does not normalise across the whole image -- nothing in the patch-parallel design ever sees it.",
170172
"fa_icon": "fas fa-th"
171173
},
172174
"cellpose_clip_limit": {
173175
"type": "number",
176+
"hidden": true,
174177
"minimum": 0,
175178
"description": "sopa's CLAHE clip limit, applied before Cellpose. Defaults to 0 in this pipeline, disabling CLAHE; null restores sopa's default of 0.2.",
176179
"help_text": "sopa runs `skimage.exposure.equalize_adapthist` on each patch before Cellpose sees it. This is sopa's addition, not part of Cellpose -- Cellpose contains no CLAHE code, and its released weights were trained on percentile-normalised input, so this preprocessing is off that contract.\n\nSetting 0 disables CLAHE. Worth testing: CLAHE is the largest single source of patch-dependence in this stack, and on an all-zero patch it expands the image to the full range, which defeats Cellpose's own empty-patch guard.",
177180
"fa_icon": "fas fa-adjust"
178181
},
179182
"cellpose_clahe_kernel_size": {
180183
"type": "integer",
184+
"hidden": true,
181185
"minimum": 1,
182186
"description": "Kernel size in pixels for sopa's CLAHE. Unset uses skimage's default of patch.shape // 8, which scales with patch_width_pixel.",
183187
"help_text": "Left unset, skimage derives the kernel from the patch: 1/8 of its height and width. The contrast-enhancement length scale therefore moves with `--patch_width_pixel` -- 187 px (52 um) at 1500, 375 px (105 um) at 3000, 750 px (210 um) at 6000 -- so the same tissue is enhanced differently purely because of a patching knob.\n\nPinning an absolute value removes that coupling. cellSAM, which also CLAHEs each block, fixes its kernel at 128 px rather than deriving it from the block size.\n\nHas no effect while `--cellpose_clip_limit` is 0.",
184188
"fa_icon": "fas fa-ruler-combined"
185189
},
186190
"cellpose_gaussian_sigma": {
187191
"type": "number",
192+
"hidden": true,
188193
"minimum": 0,
189194
"description": "Sigma for sopa's gaussian smoothing, applied before Cellpose. Defaults to 0 in this pipeline, disabling it; null restores sopa's default of 1.",
190195
"help_text": "Like CLAHE, this is sopa's addition rather than Cellpose's: Cellpose's own smoothing and sharpening parameters (`smooth_radius`, `sharpen_radius`) both default to 0, and it applies neither unless asked.\n\nUnlike CLAHE this is not a source of patch dependence, since a small-sigma convolution is local and only edge reflection differs between patch layouts. Disabling it is therefore about matching Cellpose's preprocessing contract, not about stability. Raise it if your data is noisy enough to need denoising before segmentation.",
@@ -556,12 +561,14 @@
556561
"properties": {
557562
"smooth_masks": {
558563
"type": "boolean",
564+
"hidden": true,
559565
"description": "Enable mask smoothing before cell measurement.",
560566
"fa_icon": "fas fa-wave-square",
561567
"help_text": "When enabled, segmentation masks are smoothed to reduce polygon complexity before being passed to cellmeasurement. Choose the method with smooth_method."
562568
},
563569
"smooth_method": {
564570
"type": "string",
571+
"hidden": true,
565572
"default": "morphological",
566573
"description": "Smoothing algorithm: 'morphological' (disk close+open) or 'shapely' (Douglas-Peucker polygon simplification).",
567574
"fa_icon": "fas fa-cogs",
@@ -570,6 +577,7 @@
570577
},
571578
"smooth_kernel_size": {
572579
"type": "integer",
580+
"hidden": true,
573581
"default": 2,
574582
"minimum": 1,
575583
"maximum": 10,
@@ -579,6 +587,7 @@
579587
},
580588
"smooth_n_workers": {
581589
"type": "integer",
590+
"hidden": true,
582591
"default": 8,
583592
"minimum": 1,
584593
"maximum": 64,
@@ -588,6 +597,7 @@
588597
},
589598
"smooth_chunksize": {
590599
"type": "integer",
600+
"hidden": true,
591601
"default": 200,
592602
"minimum": 1,
593603
"maximum": 10000,
@@ -597,6 +607,7 @@
597607
},
598608
"smooth_tolerance": {
599609
"type": "number",
610+
"hidden": true,
600611
"default": 1,
601612
"minimum": 0.01,
602613
"description": "[shapely] Douglas-Peucker simplification tolerance in pixels.",
@@ -605,6 +616,7 @@
605616
},
606617
"smooth_min_area": {
607618
"type": "number",
619+
"hidden": true,
608620
"default": 0,
609621
"minimum": 0,
610622
"description": "[shapely] Minimum polygon area in pixels\u00b2 to retain after simplification.",

0 commit comments

Comments
 (0)