Skip to content

Commit 16ca914

Browse files
authored
Merge pull request #81 from kbestak/stardist
Stardist
2 parents 12d9c3f + 10d9f59 commit 16ca914

File tree

20 files changed

+332
-9
lines changed

20 files changed

+332
-9
lines changed

CITATIONS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535

3636
> Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. doi: 10.1093/bioinformatics/btw354. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924.
3737
38+
- [Stardist](https://github.com/stardist/stardist)
39+
40+
> Schmidt, U., Weigert, M., Broaddus, C., Myers, G. (2018). Cell Detection with Star-Convex Polygons. In: Frangi, A., Schnabel, J., Davatzikos, C., Alberola-López, C., Fichtinger, G. (eds) Medical Image Computing and Computer Assisted Intervention – MICCAI 2018. MICCAI 2018. Lecture Notes in Computer Science(), vol 11071. Springer, Cham. https://doi.org/10.1007/978-3-030-00934-2_30
41+
3842
## Software packaging/containerisation tools
3943

4044
- [Anaconda](https://anaconda.com)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Image preprocessing
3232

3333
Cell segmentation
3434

35-
- Apply cell segmentation based on provided images, available options are: - [`Cellpose`](https://www.cellpose.org/) - [`Mesmer`](https://deepcell.readthedocs.io/en/master/API/deepcell.applications.html#mesmer) - [`ilastik`](https://www.ilastik.org/)
35+
- Apply cell segmentation based on provided images, available options are: - [`Cellpose`](https://www.cellpose.org/) - [`Mesmer`](https://deepcell.readthedocs.io/en/master/API/deepcell.applications.html#mesmer) - [`ilastik`](https://www.ilastik.org/) - [`Stardist`](https://github.com/stardist/stardist)
3636
- Filter cells based on cell size to remove artifacts
3737

3838
Spot processing

conf/modules.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ process {
173173
].join(" ").trim()
174174
}
175175

176+
177+
withName: STARDIST {
178+
ext.when = { params.segmentation_method.split(',').contains('stardist') }
179+
ext.args = [ "",
180+
params.stardist_model ? "--model ${params.stardist_model}" : "",
181+
(params.stardist_n_tiles_x && params.stardist_n_tiles_y) ? "--n_tiles ${params.stardist_n_tiles_x} ${params.stardist_n_tiles_y}" : "",
182+
].join(" ").trim()
183+
ext.prefix = { "${meta.id}_stardist_mask" }
184+
publishDir = [
185+
path: "${params.outdir}/segmentation/stardist",
186+
pattern: "*.tif",
187+
saveAs: { filename -> "${meta.id}_stardist_mask.tif" }
188+
]
189+
}
190+
176191
withName: "DEEPCELL_MESMER" {
177192
ext.when = { params.segmentation_method.split(',').contains('mesmer') }
178193
ext.args = [ "",

conf/test.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ params {
2828
mindagap_boxsize = 7
2929
mindagap_loopnum = 100
3030
clahe_pyramid_tile = 368
31-
segmentation_method = "mesmer,cellpose"
31+
segmentation_method = "mesmer,cellpose,stardist"
3232

3333
// Only used if additionally params.create_training_subset is used
3434
crop_size_x = 30

conf/test_full.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ params {
1616

1717
input = params.pipelines_testdata_base_path + 'molkart/test_data/samplesheets/samplesheet_full_test.csv'
1818

19-
segmentation_method = "mesmer,cellpose"
19+
segmentation_method = "mesmer,cellpose,stardist"
2020
mindagap_boxsize = 3
2121
mindagap_loopnum = 40
2222
cellpose_pretrained_model = "nuclei"
23+
stardist_n_tiles_x = 20
24+
stardist_n_tiles_y = 20
2325
}

docs/output.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Create stack is a local module used to merge images into a stack as preparation
7373
- `*_ilastik_mask.tif`: Segmentation masks created by ilastik's Boundary prediction with Multicut workflow.
7474
- `mesmer/`:
7575
- `*_mesmer_mask.tif`: Segmentation masks created by Mesmer.
76+
- `stardist/`:
77+
- `*_stardist_mask.tif`: Nuclear segmentation masks created by Stardist.
7678
- `filtered_masks/` - `*_method_filtered.tif`: Segmentation masks filtered based on provided area limits.
7779
</details>
7880

@@ -82,6 +84,8 @@ Create stack is a local module used to merge images into a stack as preparation
8284

8385
[Mesmer](https://deepcell.readthedocs.io/en/master/API/deepcell.applications.html#mesmer) is a segmentation tool that provides pretrained models for whole-cell and nuclear segmentation.
8486

87+
[Stardist](https://github.com/stardist/stardist) is an object detection tool using star-convex shapes.
88+
8589
### Spot2cell
8690

8791
<details markdown="1">

docs/usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ cellpose_pretrained_model: "cyto"
9292
cellpose_custom_model: null
9393
cellpose_flow_threshold: 0.4
9494
cellpose_edge_exclude: true
95+
stardist_model: "2D_versatile_fluo"
96+
stardist_n_tiles_x: 3
97+
stardist_n_tiles_y: 3
9598
mesmer_image_mpp: 0.138
9699
mesmer_compartment: "whole-cell"
97100
ilastik_pixel_project: null
@@ -121,6 +124,10 @@ To run the pipeline so that the training subset is created with default values,
121124
nextflow run nf-core/molkart --input ./samplesheet.csv --outdir ./results -profile docker --create_training_subset
122125
```
123126

127+
:::note
128+
Stardist segmentation currently only support nuclear segmentation and the additional marker will not be used.
129+
:::
130+
124131
After training a Cellpose 2.0 model, or creating ilastik Pixel Classification and Multicut projects, make sure you match the parameters (e.g cell diameter, flow threshold) in the run to your training and continue the default pipeline run with:
125132

126133
```bash

modules.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
"branch": "master",
4040
"git_sha": "81880787133db07d9b4c1febd152c090eb8325dc",
4141
"installed_by": ["modules"]
42+
},
43+
"stardist": {
44+
"branch": "master",
45+
"git_sha": "666652151335353eef2fcd58880bcef5bc2928e1",
46+
"installed_by": ["modules"]
4247
}
4348
}
4449
},

modules/nf-core/stardist/environment.yml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/stardist/main.nf

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/stardist/meta.yml

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/stardist/tests/main.nf.test

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/stardist/tests/main.nf.test.snap

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/nf-core/stardist/tests/nextflow.config

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nextflow.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ params {
1616
segmentation_method = 'mesmer'
1717
segmentation_min_area = null
1818
segmentation_max_area = null
19+
// cellpose
1920
cellpose_save_flows = false
2021
cellpose_diameter = 30
2122
cellpose_chan = 0
@@ -24,10 +25,16 @@ params {
2425
cellpose_custom_model = null
2526
cellpose_flow_threshold = 0.4
2627
cellpose_edge_exclude = true
28+
// mesmer
2729
mesmer_image_mpp = 0.138
2830
mesmer_compartment = 'whole-cell'
31+
// ilastik
2932
ilastik_pixel_project = null
3033
ilastik_multicut_project = null
34+
// stardist
35+
stardist_model = '2D_versatile_fluo'
36+
stardist_n_tiles_x = 3
37+
stardist_n_tiles_y = 3
3138

3239
// Preprocessing command line flags
3340
skip_mindagap = false

0 commit comments

Comments
 (0)