Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #218

Open
wants to merge 134 commits into
base: develop_2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
938398a
Unifying how panel column datatypes are ahndeled.
Feb 24, 2023
7a53648
Unifying how panel column datatypes are handeled.
Feb 24, 2023
8885304
Merge branch 'milad_develop' of https://github.com/BodenmillerGroup/s…
Feb 24, 2023
bb46eb3
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 10, 2023
bc527b8
Merge pull request #173 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Apr 11, 2023
df532c7
added cellpose2.0 models
Apr 24, 2023
3c6cf13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 24, 2023
886b367
Fixed reduntant conditional statements and dynamic function calls in …
May 2, 2023
a51ba29
Merge branch 'milad_develop' of https://github.com/BodenmillerGroup/s…
May 2, 2023
5110842
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 2, 2023
85a7f13
changed the onciditional statements based on Jonas' suggestions
May 2, 2023
ea1e5e4
Merge branch 'milad_develop' of https://github.com/BodenmillerGroup/s…
May 2, 2023
5cc8224
Update cellpose.py
Milad4849 May 2, 2023
8078ec4
Added cellpose to third party apps
Jun 9, 2023
db38859
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 9, 2023
179f97f
Added cellpose app and trainable model
Jul 12, 2023
96de30c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 12, 2023
6f319ec
updates to cellpose and training and documentation
Aug 9, 2023
211f7f9
Merge branch 'milad_develop' of https://github.com/BodenmillerGroup/s…
Aug 9, 2023
f5acee9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 9, 2023
f94457c
Updated documentation on flavors and expand functionality
Aug 9, 2023
ddedab1
Merge branch 'milad_develop' of https://github.com/BodenmillerGroup/s…
Aug 9, 2023
cf24b71
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 9, 2023
cac68a8
ädded steinbock to theavailale apps
Aug 16, 2023
275032c
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 21, 2023
cd0b42f
Merge pull request #213 from BodenmillerGroup/main
Milad4849 Aug 22, 2023
db53400
Merge branch 'develop' of https://github.com/BodenmillerGroup/steinbo…
Aug 23, 2023
8fc8a82
updatedthe CHANGE.LOG
Aug 23, 2023
cc9e0f3
Merge pull request #214 from BodenmillerGroup/cellpose_app
Milad4849 Aug 23, 2023
fd393ec
Merge branch 'milad_develop' into develop
Milad4849 Aug 23, 2023
5787d9a
Merge pull request #179 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Aug 23, 2023
37db81e
Update Dockerfile
Milad4849 Aug 24, 2023
dd45ac7
Update segmentation.md
Milad4849 Aug 24, 2023
acd5ff8
Update apps.py
Milad4849 Aug 24, 2023
4188719
Update segmentation.md
Milad4849 Aug 24, 2023
6da23e7
Update segmentation.md
Milad4849 Aug 24, 2023
9773717
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 24, 2023
ddeb92a
Update docs/cli/utils.md
Milad4849 Aug 24, 2023
bfefc72
Update docs/cli/utils.md
Milad4849 Aug 25, 2023
16b54c3
changes 29.08.2023
Aug 29, 2023
afb33ec
changes 30.8.23
Aug 30, 2023
3143f06
changes 30.8.23/2
Aug 30, 2023
791cf27
changes 31.08.2023
Aug 31, 2023
c649834
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 31, 2023
eeeb40a
Updated citation
nilseling Oct 19, 2023
08081e7
Added note that we can share the PDF
nilseling Oct 19, 2023
f29924c
Added citation to README
nilseling Oct 19, 2023
23fdf83
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Nov 13, 2023
4b7ee5f
Merge pull request #226 from BodenmillerGroup/citation
Milad4849 Nov 21, 2023
2bb109e
Merge pull request #221 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Nov 21, 2023
d29803d
added txt generation for xti
Milad4849 Nov 29, 2023
cabfcc7
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Dec 11, 2023
697cd98
Merge pull request #227 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Dec 11, 2023
67eaa34
fixed cellpose_cmd_group function names
Milad4849 Dec 12, 2023
736ed0b
fixed cellpose mcd function names
Milad4849 Dec 12, 2023
b2acf9c
adjusted default cellpose parameters
Milad4849 Dec 12, 2023
cbc3937
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 12, 2023
cb0cbd2
Fixed no neighborhood data in h5ad #210
Milad4849 Dec 13, 2023
436d671
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2023
bb24837
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Dec 18, 2023
5263843
Merge pull request #232 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Dec 18, 2023
1c09ce6
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Dec 25, 2023
0d6a406
Merge pull request #233 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Jan 5, 2024
a4f99b5
Resolve comments and address change requests
Milad4849 Jan 5, 2024
00ca127
Merge branch 'develop' of https://github.com/BodenmillerGroup/steinbo…
Milad4849 Jan 5, 2024
8ee813f
Resolve comments and address change requests 0.1
Milad4849 Jan 5, 2024
c6590aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 5, 2024
5aee184
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 8, 2024
464ca32
merged xti_txt_generation
Milad4849 Jan 14, 2024
34da6ef
corrected the logger
Milad4849 Jan 16, 2024
e81c996
fixed logger import and added pydantic<2 to requirements
Milad4849 Jan 18, 2024
67bdbd9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
3fc4fe1
updated CHANGELOG
Milad4849 Jan 18, 2024
6869c7f
modified hindling of torch import
Milad4849 Jan 18, 2024
66b5c11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
cb7f94e
Merge pull request #234 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Jan 19, 2024
7a21bb0
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 29, 2024
17b47a8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 29, 2024
5cf0a10
Update steinbock/segmentation/_cli/cellpose.py
Milad4849 Feb 7, 2024
e5910e7
Update steinbock/preprocessing/_cli/imc.py
Milad4849 Feb 7, 2024
9254ae2
Update steinbock/segmentation/_cli/cellpose.py
Milad4849 Feb 7, 2024
aa78c3c
Update steinbock/segmentation/_cli/cellpose.py
Milad4849 Feb 7, 2024
5550339
Merge pull request #240 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Feb 13, 2024
b440b80
Update steinbock/segmentation/_cli/cellpose.py
Milad4849 Feb 15, 2024
76aad64
correction/changes based on comments
Milad4849 Feb 27, 2024
fffefdf
merge with head
Milad4849 Feb 27, 2024
bd156ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 27, 2024
c92be38
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 18, 2024
3a184fd
Merge pull request #243 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Mar 26, 2024
b8947fd
corrected small mistake in segmentation docs
Milad4849 Mar 28, 2024
27c99d2
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 15, 2024
4cb3da1
Merge pull request #250 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Apr 25, 2024
a5fba4c
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 29, 2024
a035b7b
use readimc 0.7.0 w/ lenient parsing
matt-sd-watson May 14, 2024
b558aec
Add strict as click
matt-sd-watson May 14, 2024
22ad48f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 14, 2024
8cf35de
update dependencies
matt-sd-watson May 14, 2024
983bb19
Merge branch 'dev' of https://github.com/matt-sd-watson/steinbock int…
matt-sd-watson May 14, 2024
94e315a
Update steinbock/preprocessing/_cli/imc.py
Milad4849 May 19, 2024
ae5ecde
Update steinbock/preprocessing/imc.py
Milad4849 May 19, 2024
c7d9b0c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2024
a6bf141
Update steinbock/segmentation/_cli/cellpose.py
Milad4849 May 19, 2024
aac7b07
Update steinbock/preprocessing/imc.py
Milad4849 May 19, 2024
72d00d3
Update steinbock/preprocessing/imc.py
Milad4849 May 19, 2024
dec0151
Update steinbock/preprocessing/imc.py
Milad4849 May 19, 2024
fb373b4
Update steinbock/preprocessing/imc.py
Milad4849 May 19, 2024
4683975
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2024
9306345
Update steinbock/segmentation/cellpose.py
Milad4849 May 19, 2024
e843deb
corrected txt column naming
Milad4849 May 19, 2024
3ef61bd
Merge branch 'develop' of https://github.com/BodenmillerGroup/steinbo…
Milad4849 May 19, 2024
46602d6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2024
bf25fbe
fixed documentation and minor issues
Milad4849 May 28, 2024
93012e9
Merge branch 'develop' of https://github.com/BodenmillerGroup/steinbo…
Milad4849 May 28, 2024
0d05847
dependencies for lxml
matt-sd-watson May 28, 2024
c21376a
Merge pull request #262 from matt-sd-watson/dev
Milad4849 May 28, 2024
6e66670
Update docs.yml
Milad4849 May 28, 2024
f82bc18
Update docs.yml
Milad4849 May 29, 2024
d4b6a24
Merge pull request #257 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 May 29, 2024
588307f
updated changelog for minor version release
Milad4849 May 29, 2024
dc4a0c9
updated changelog for minor version release
Milad4849 May 29, 2024
88b16b0
Merge remote-tracking branch 'origin/main' into develop
Milad4849 May 29, 2024
14fc238
Merge branch 'develop' of https://github.com/BodenmillerGroup/steinbo…
Milad4849 May 29, 2024
07ec73e
Update build.yml
Milad4849 Jun 20, 2024
91dd95f
Merge pull request #264 from BodenmillerGroup/Milad4849-patch-1
Milad4849 Jun 20, 2024
d232516
Update build.yml to use a large runner
Milad4849 Jun 21, 2024
41edff4
Update build.yml to use self-hosted runner
Milad4849 Jun 21, 2024
49545cf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 21, 2024
7b73f29
Merge pull request #265 from BodenmillerGroup/Milad4849-patch-2
Milad4849 Jun 21, 2024
adf303b
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 5, 2024
42a69ce
Merge pull request #263 from BodenmillerGroup/pre-commit-ci-update-co…
Milad4849 Aug 12, 2024
676664f
minor update docs
Milad4849 Aug 12, 2024
c471ce9
merge with 0.16.3
Milad4849 Aug 12, 2024
e459155
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 12, 2024
2ef58e9
minot update requirments
Milad4849 Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:

test:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-m
steps:

- name: Checkout repository
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
pypi:
needs: test
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
runs-on: ubuntu-latest-m
steps:

- name: Checkout repository
Expand Down Expand Up @@ -74,8 +74,10 @@ jobs:
ghcr:
needs: test
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Print GitHub context
run: echo "GITHUB_REF=$GITHUB_REF"

- name: Checkout repository
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
git config user.name github-actions
git config user.email [email protected]
git fetch origin gh-pages --verbose
mike deploy -p -u --rebase ${GITHUB_REF#refs/tags/}
mike deploy -p -u ${GITHUB_REF#refs/tags/}

- name: Build documentation (latest)
if: github.ref == 'refs/heads/main'
run: |
git config user.name github-actions
git config user.email [email protected]
git fetch origin gh-pages --verbose
mike deploy -p -u --rebase latest
mike deploy -p -u latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/data/
/steinbock/_version.py
images.csv

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ^\.vscode/.*
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -16,25 +16,25 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place, --remove-all-unused-imports]
- repo: https://github.com/psf/black
rev: '23.1.0'
rev: '24.8.0'
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0"
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.0
rev: v1.11.1
hooks:
- id: mypy
additional_dependencies: [types-requests, types-PyYAML]
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.16.3] - 2024-05-29

### Changed

- Updated readimc to 0.7.0

### Added

- Added the option for lenient parsing of corrupted ROIs

## [0.16.2] - 2023-08-15

### Changed
Expand Down Expand Up @@ -376,7 +386,8 @@ Added:

Initial release for beta testing


[0.17.0]: https://github.com/BodenmillerGroup/steinbock/compare/v0.14.2...v0.17.0
[0.16.2]: https://github.com/BodenmillerGroup/steinbock/compare/v0.14.2...v0.16.2
[0.16.1]: https://github.com/BodenmillerGroup/steinbock/compare/v0.16.0...v0.16.1
[0.16.0]: https://github.com/BodenmillerGroup/steinbock/compare/v0.15.0...v0.16.0
[0.15.0]: https://github.com/BodenmillerGroup/steinbock/compare/v0.14.2...v0.15.0
Expand Down
11 changes: 8 additions & 3 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

[[email protected]](mailto:[email protected])

- Logo
- Documentation
- Testing, feedback & discussion
- Logo
- Documentation
- Testing, feedback & discussion


## Milad Adibi

[[email protected]](mailto:[email protected])
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@
A toolkit for processing multiplexed tissue images

Documentation is available at https://bodenmillergroup.github.io/steinbock

## Citation

Please cite the following paper when using `steinbock` in your work:

> Windhager, J., Zanotelli, V.R.T., Schulz, D. et al. An end-to-end workflow for multiplexed image processing and analysis. Nat Protoc (2023). https://doi.org/10.1038/s41596-023-00881-0

@article{Windhager2023,
author = {Windhager, Jonas and Zanotelli, Vito R.T. and Schulz, Daniel and Meyer, Lasse and Daniel, Michelle and Bodenmiller, Bernd and Eling, Nils},
title = {An end-to-end workflow for multiplexed image processing and analysis},
year = {2023},
doi = {10.1038/s41596-023-00881-0},
URL = {https://www.nature.com/articles/s41596-023-00881-0},
journal = {Nature Protocols}
}
4 changes: 4 additions & 0 deletions docs/cli/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ After image extraction, if the `--hpf` option is specified, the images are filte

[^1]: Zanotelli et al. ImcSegmentationPipeline: A pixel classification-based multiplexed image segmentation pipeline. Zenodo, 2017. DOI: [10.5281/zenodo.3841961](https://doi.org/10.5281/zenodo.3841961).

### Support for XTI imc machines

The new generation of imc machines do not provide back-up text files of individual ROIs any more. Instead they provide individual mcd files per ROI as back-up. In some instances the downstream analysis pipelines are configured to use the text files as input. Therefore in order to maintain compatibility with these pieplines, we now provide the option to generate text files for ROIs via the command: `steinbock preprocess imc images --xti`.

## External images

*External images* are images preprocessed externally (i.e., without *steinbock*) that are saved in an image format supported by [imageio](https://imageio.readthedocs.io).
Expand Down
34 changes: 29 additions & 5 deletions docs/cli/segmentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Various segmentation approaches are supported, each of which is described in the
!!! note "Pixel classification-based image segmentation vs end-to-end approaches"
While [pixel classification](classification.md)-based image segmentation using CellProfiler uses probability images to segment objects, end-to-end workflows such as DeepCell/Mesmer and Cellpose directly operate on images without the need for a preceding pixel classification step.


!!! note "Large masks containing more than 65535 objects"
Please refer to the [installation page](../install-docker.md#Using-the-docker-container-with-large-images-containing-more-than-65535-objects) when analizing large masks with more than 65535 objects.



## CellProfiler

[CellProfiler](https://cellprofiler.org) is an open-source software for measuring and analyzing cell images. Here, CellProfiler is used for object detection and region growth-based object segmentation.
Expand Down Expand Up @@ -87,7 +93,7 @@ This will create grayscale cell/nuclear masks of the same x and y dimensions as
Specify `--minmax` to enable min-max normalization and `--zscore` to enable z-score normalization.

!!! note "Preprocessing/postprocessing parameters"
Application-dependent preprocessing/postprocessing parameters can be specified in YAML files using the `--preprocess`/`--postprocess` options. For the Mesmer application, this can e.g. be used to control thresholding, histogram normalization and watershed segmentation. Please refer to the DeepCell online documentation for available parameters. For example, one could specify `--preprocess preprocessing.yml`, where `preprocessing.yml` is a file in the steinbock data/working directory containing:
Application-dependent preprocessing/postprocessing parameters can be specified in YAML files using the `--preprocess`/`--postprocess` options. For the Mesmer application, this can e.g. be used to control thresholding, histogram normalization and watershed segmentation. Please refer to the DeepCell online documentation for available parameters. For example, one could specify `--preprocess preprocessing.yml`, where `preprocessing.yml` is a file in the *steinbock* data/working directory containing:

threshold: true
percentile: 99.9
Expand All @@ -99,20 +105,23 @@ This will create grayscale cell/nuclear masks of the same x and y dimensions as
!!! danger "Experimental feature"
This is an experimental feature and is only available in the `-cellpose` flavors of the *steinbock* Docker container.

Segmentation using cellpose likely requires fine-tuning of parameters, e.g. using steinbock command-line interface options.
Segmentation using cellpose likely requires fine-tuning of parameters, e.g. using steinbock command-line interface options. The steinbock default parameters for the cellpose models (cell probability threshhold, flow threshhold etc) are not the same as the default values of *cellpose* itself. The steinbock default values are the result of manual optimization of cellpose parameters for segmentation of IMC images in the Bodenmiller lab. This default values can be viewed using the command `steinbock segment cellpose run --help`.

[Cellpose](https://www.cellpose.org) is a generalist algorithm for cellular segmentation.

!!! note "End-to-end cell segmentation"
This approach operates directly on image intensities and does not require a preceding pixel classification step.

To segment cells using the default `cyto2` model:
To segment cells using the default `tissuenet` model:

steinbock segment cellpose --minmax
steinbock segment cellpose run --minmax

To segment nuclei using the `nuclei` model:

steinbock segment cellpose --minmax --model nuclei
steinbock segment cellpose run --minmax --model nuclei

Models introduced in [cellpose 2.0](https://www.nature.com/articles/s41592-022-01663-4) can also be chosen, bringing the total number of available models to 14, these are 'nuclei',
'cyto', 'cyto2', 'tissuenet', 'livecell', 'CP', 'CPx', 'TN1', 'TN2', 'TN3', 'LC1', 'LC2', 'LC3' and 'LC4'. The user can utilize any of these models by specifying them using the `--model` argument as demonstrated above. The default is set to `tissuenet` model, please note that `tissuenet` is also the default model for training a cellpose model (See training a cellpose model below). Furthermore the path to a user-trained model (see [`Training a cellpose model` below](### Training a cellpose model)) can be used via the `-pretrained-model` argument.

!!! note "Cellpose image data"
Cellpose expects two-channel images as input, where the first channel must be a nuclear channel (e.g. DAPI) and the second channel must be a cytoplasmic channel (e.g. E-Cadherin). The nuclear channel is optional and only the cytoplasmic channel ("channel to segment") is required. Note that - compared to the original cellpose implementation - the channel order is reversed for compatibility with DeepCell/Mesmer.
Expand All @@ -121,6 +130,21 @@ To segment nuclei using the `nuclei` model:

If no `cellpose` column is present, images are expected to be in the correct format already.

### Training a cellpose model
Training a cellpose model is performed using two commands

steinbock segment cellpose preapre
steinbock segment cellpose train

By default the first command generates crops of images in `img` and stores them in `cellpose_crops` folder. These crops consist of a nuclear and a Cytoplasmic channels as described above. By default crops are then segmented using the `tissuenet` pre-trained model and the resulting masks are placed in the folder `cellpose_labels`. Any model from the model zoo can be specified using the`--model_type` argument. User trained models can be specified by providing the full path to the model using the `pretrained-model` option (when `pretrained-model` is provided, the `--model_type` argument is set to `None`, see above). The user can optionally specify a list of files for cropping and training. After running the first command, the user should open and inspect the generated masks and correct them as needed. This can be done by starting the `cellpose` gui via *steinbock*: `steinbock apps cellpose` (See `Apps`in this document. For details on how to use cellpose to correct gui segmentations, see its relevant [documentation](https://cellpose.readthedocs.io/en/latest/gui.html).

The second command runs the cellpose training module. Unless specified via the `--train-data` and `--train-labels` options, the command looks in `cellpose_crops` and `cellpose_labels` for images and masks that are used as ground truth. The resulting model is by default saved in `training_out`. The trained model can subsequently be used for segmentation via the `--pretrained-model` argument, for example as following;



steinbock segment cellpose run --pretrained-model ./training_out/models/myModel


!!! note "GPU support"
Currently. steinbock does not support cellpose segmentation with GPU support.

Expand Down
7 changes: 7 additions & 0 deletions docs/cli/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ The created image tiles will have the following file name, where `{IMG}` is the
The following command will stitch all mask tiles in `masks` (following the file conventions above) to assemble masks of original size and save them to `masks_full`:

steinbock utils mosaics stitch masks -o masks_full

### Expansion

This utility incorporates the `expand_labels` from [`skimage.segmentation`](https://scikit-image.org/docs/stable/api/skimage.segmentation.html#skimage.segmentation.expand_labels). It expands mask objects outwards by up to a distance specified in pixels without overflowing into neighboring regions.
The following command expands the masks in each fils contained in `masks` directory by a maximum of 5 pixels and saves the resulting masks in `expanded_masks`:

steinbock utils expand masks 5 -o expanded_masks
16 changes: 9 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ Workshop 2023: [https://github.com/BodenmillerGroup/ImagingWorkshop2023](https:/
Please cite the following paper when using *steinbock* in your work:

!!! quote
Windhager J, Bodenmiller B, Eling N (2021). An end-to-end workflow for multiplexed image processing and analysis. bioRxiv. doi: https://doi.org/10.1101/2021.11.12.468357.
Windhager, J., Zanotelli, V.R.T., Schulz, D. et al. An end-to-end workflow for multiplexed image processing and analysis. Nat Protoc (2023). https://doi.org/10.1038/s41596-023-00881-0

```
@article{Windhager2021,
author = {Windhager, Jonas and Bodenmiller, Bernd and Eling, Nils},
@article{Windhager2023,
author = {Windhager, Jonas and Zanotelli, Vito R.T. and Schulz, Daniel and Meyer, Lasse and Daniel, Michelle and Bodenmiller, Bernd and Eling, Nils},
title = {An end-to-end workflow for multiplexed image processing and analysis},
year = {2021},
doi = {10.1101/2021.11.12.468357},
URL = {https://www.biorxiv.org/content/early/2021/11/13/2021.11.12.468357},
journal = {bioRxiv}
year = {2023},
doi = {10.1038/s41596-023-00881-0},
URL = {https://www.nature.com/articles/s41596-023-00881-0},
journal = {Nature Protocols}
}
```

If you have issues accessing the manuscript, please reach out to us and we can share the PDF version.
Loading