Skip to content

Commit 1cfd0e8

Browse files
committed
docs(dog): 📝 document deconvolution + DoG segmentation on SLURM
Add a cluster-specific section for running cilia segmentation with deconvolution enabled, and confirm estimate_empty_tiles() is used for custom-method (DoG) runs the same as Cellpose runs.
1 parent 241ca58 commit 1cfd0e8

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

docs/examples/dog.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,68 @@ custom:
101101
See `workflow/config/config_cilia.yaml` for a full example, including
102102
deconvolution.
103103

104+
### With deconvolution, on SLURM
105+
106+
Add `decon_kwargs` under `custom.kwargs` — same keys as the plain-Python
107+
example above — and the segment job deconvolves each tile with
108+
`pycudadecon` before running the DoG detector:
109+
110+
```yaml
111+
# config/config_cilia.yaml (excerpt)
112+
channel: 2
113+
tile_shape: [16, 1024, 1024]
114+
overlap: 30 # cover the PSF support (decon) + the DoG's high_sigma
115+
skip_empty: true
116+
117+
method: "custom"
118+
label_name: "cilia_labels"
119+
custom:
120+
module: "patchworks.plugins.dog"
121+
function: "segment"
122+
kwargs:
123+
low_sigma: 1.0
124+
high_sigma: 3.0
125+
threshold: 0.02
126+
decon_kwargs:
127+
psf: "/path/to/psf.tif"
128+
dxpsf: 0.1
129+
dxdata: 0.1
130+
dzpsf: 0.2
131+
dzdata: 0.2
132+
wavelength: 525
133+
na: 1.4
134+
nimm: 1.515
135+
```
136+
137+
Run it exactly like a Cellpose config:
138+
139+
```bash
140+
python -m snakemake --workflow-profile profile/slurm \
141+
--configfile config/config_cilia.yaml
142+
```
143+
144+
Checklist specific to this config:
145+
146+
- **Env:** the segment job's environment needs `patchworks[dog]`
147+
(`pip install "patchworks[dog]"`) on top of whatever else it uses — plain
148+
`dog_label_fn` only needs scipy, but `decon_kwargs` pulls in
149+
`pycudadecon`.
150+
- **GPU always required:** `pycudadecon` is CUDA-only regardless of the
151+
detector's own `use_gpu` flag, so `set-resources: segment:` in
152+
`profile/slurm/config.yaml` must request a GPU (`slurm_extra:
153+
"'--gres=gpu:1'"`) the same as for Cellpose.
154+
- **`overlap`:** widen it past the PSF support, not just past `high_sigma` —
155+
a thin intensity/threshold halo isn't enough once deconvolution is in the
156+
loop.
157+
- **`skip_empty`:** the `prepare` rule (`workflow/scripts/prepare_tiles.py`)
158+
calls `estimate_empty_tiles()` before submitting any `segment` jobs,
159+
regardless of `method`, so cilia/DoG runs skip background tiles exactly
160+
like Cellpose runs — no extra config needed beyond `skip_empty: true`
161+
(the default).
162+
- Run alongside `config_cyto.yaml`/`config_nuclei.yaml` via `config/multi.yaml`
163+
to also get the cilia→cell/nucleus relation — see *Relating cilia to their
164+
cell*, below.
165+
104166
## Relating cilia to their cell
105167

106168
Segment the cell body with Cellpose and the cilia with `dog_label_fn` as two

0 commit comments

Comments
 (0)