Skip to content

Commit 2609835

Browse files
authored
Merge pull request #126 from BodenmillerGroup/develop
Allow handling of MCD files with missing channel labels
2 parents f318a90 + bbc329a commit 2609835

File tree

16 files changed

+396
-271
lines changed

16 files changed

+396
-271
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203

.github/workflows/docs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
on:
2-
push:
3-
branches: [main]
1+
on:
2+
push:
3+
branches: [main]
44
pull_request:
55
branches: [main]
66

@@ -10,9 +10,9 @@ jobs:
1010
deploy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.x
16+
python-version: "3.x"
1717
- run: pip install mkdocs-material
1818
- run: mkdocs gh-deploy --force

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
profile=black

.pre-commit-config.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
exclude: ^(\.vscode/.*|scripts/.*|mkdocs.yml|docs/.*)$
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.4.0
5+
hooks:
6+
- id: check-added-large-files
7+
- id: check-case-conflict
8+
- id: check-docstring-first
9+
- id: check-executables-have-shebangs
10+
- id: check-merge-conflict
11+
- id: check-shebang-scripts-are-executable
12+
- id: check-toml
13+
- id: check-yaml
14+
- id: debug-statements
15+
- id: end-of-file-fixer
16+
- id: requirements-txt-fixer
17+
- id: trailing-whitespace
18+
- repo: https://github.com/PyCQA/isort
19+
rev: "5.12.0"
20+
hooks:
21+
- id: isort
22+
- repo: https://github.com/PyCQA/autoflake
23+
rev: v2.0.1
24+
hooks:
25+
- id: autoflake
26+
args: [--in-place, --remove-all-unused-imports]
27+
- repo: https://github.com/psf/black
28+
rev: '23.1.0'
29+
hooks:
30+
- id: black
31+
- repo: https://github.com/PyCQA/flake8
32+
rev: "6.0.0"
33+
hooks:
34+
- id: flake8
35+
additional_dependencies: [flake8-typing-imports]
36+
- repo: https://github.com/pre-commit/mirrors-mypy
37+
rev: v0.991
38+
hooks:
39+
- id: mypy
40+
additional_dependencies: [types-requests, types-PyYAML]
41+
ci:
42+
autoupdate_branch: develop
43+
skip: [flake8, mypy]

CHANGELOG.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [3.6, 08-03-2023]
4+
5+
- allow handling MCD files with missing channel label entries
6+
- updated links to raw data on Zenodo
7+
- switched from `MCDFile.metadata` to `MCDFile.schema_xml` to keep up with the latest version of `readimc`
8+
9+
## [3.5, 07-11-2022]
10+
11+
- exclude hidden files from processing
12+
13+
## [3.4, 02-06-2022]
14+
15+
- removed `tifffile` version pinning
16+
17+
## [3.3, 27-04-2022]
18+
19+
- fixed `tifffile` version
20+
321
## [3.2]
422

523
- sort channels by metal tag when creating the ilastik and full stacks
@@ -20,22 +38,19 @@
2038
- segmentation masks are directly written out to `cpout/masks` in the second pipeline and read in as objects in the last pipeline
2139
- pixel probabilities are downscaled in the second pipeline and directly written into `cpout/probabilites`
2240
- cell segmentation is performed on downscaled pixel probabilities
23-
41+
2442
## [2.3]
2543

2644
- Bugfixes: `1_prepare_ilastik`: Removed special characters from pipeline comments as this caused encoding issues.
2745

2846
## [2.1]
2947

3048
- Bugfixes: `1_prepare_ilastik`: Fix range to 0-1 for mean image, preventing out of range errors
31-
49+
3250
## [2.0]
3351

3452
- Change to imctools v2: Changes the structure of the folder to the new format, changing the naming of the .ome.tiff files
3553
- Change to Cellprofiler v4: Requires the use of the ImcPluginsCP master branch or a release > v.4.1
3654
- Updated documentation
3755
- Adds var_Cells.csv containing metadata for the measurements
3856
- Adds panel to cpout folder
39-
40-
41-

README.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
## Introduction
55

6-
The pipeline is based on [CellProfiler](http://cellprofiler.org/) (tested v4.2.1) for segmentation and [Ilastik](http://ilastik.org/) (tested v1.3.3post3) for pixel classification.
7-
It is streamlined by using the `imcsegpipe` python package available via this repository as well as custom CellProfiler modules ([ImcPluginsCP](https://github.com/BodenmillerGroup/ImcPluginsCP), release v4.2.1).
6+
The pipeline is based on [CellProfiler](http://cellprofiler.org/) (tested v4.2.1) for segmentation and [Ilastik](http://ilastik.org/) (tested v1.3.3post3) for pixel classification. It is streamlined by using the `imcsegpipe` python package available via this repository as well as custom CellProfiler modules ([ImcPluginsCP](https://github.com/BodenmillerGroup/ImcPluginsCP), release v4.2.1).
87

9-
This repository showcases the basis of the workflow with step-by-step instructions.
10-
As an alternative and dockerized version of the pipeline, check out [steinbock](https://github.com/BodenmillerGroup/steinbock).
8+
This repository showcases the basis of the workflow with step-by-step instructions. As an alternative and dockerized version of the pipeline, check out [steinbock](https://github.com/BodenmillerGroup/steinbock).
119

12-
This pipeline was developed in the Bodenmiller laboratory at the University of Zurich ([www.bodenmillerlab.com](https://www.bodenmillerlab.com/)) to segment hundreds of highly multiplexed imaging mass cytometry (IMC) images.
13-
The concepts applied here to IMC data can also be transfered to data generated by other highly multiplexed imaging modalities.
10+
This pipeline was developed in the Bodenmiller laboratory at the University of Zurich ([www.bodenmillerlab.com](https://www.bodenmillerlab.com/)) to segment hundreds of highly multiplexed imaging mass cytometry (IMC) images. The concepts applied here to IMC data can also be transfered to data generated by other highly multiplexed imaging modalities.
1411

1512
For a general overview on IMC as technology and data processing tasks, please refer to [bodenmillergroup.github.io/IMCWorkflow](https://bodenmillergroup.github.io/IMCWorkflow/).
1613

@@ -22,13 +19,13 @@ Before being able to pre-process the data, you will need to setup the environmen
2219

2320
1. [Install conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)
2421

25-
2. Clone the repository:
22+
2. Clone the repository:
2623

2724
```bash
2825
git clone --recursive https://github.com/BodenmillerGroup/ImcSegmentationPipeline.git
2926
```
3027

31-
3. Setup the conda environment:
28+
3. Setup the conda environment:
3229

3330
```bash
3431
cd ImcSegmentationPipeline
@@ -44,15 +41,14 @@ conda activate imcsegpipe
4441
jupyter-lab
4542
```
4643

47-
This will automatically open a jupyter instance at `http://localhost:8888/lab` in your browser.
48-
From there, you can open the `scripts/imc_preprocessing.ipynb` notebook and start the data pre-processing.
44+
This will automatically open a jupyter instance at `http://localhost:8888/lab` in your browser. From there, you can open the `scripts/imc_preprocessing.ipynb` notebook and start the data pre-processing.
4945

5046
In brief, the main analysis steps include:
5147

52-
1. Pre-processing of the raw images to create `.ome.tiffs` and `.tiff` stacks for ilastik training and measurement (python).
53-
2. Ilastik pixel classification based on random crops of the images (CellProfiler, Ilastik).
54-
3. Image segmentation based on the classification probabilities (CellProfiler).
55-
4. Measurement and export of cell-specific features, such as marker expression (CellProfiler).
48+
1. Pre-processing of the raw images to create `.ome.tiffs` and `.tiff` stacks for ilastik training and measurement (python).
49+
2. Ilastik pixel classification based on random crops of the images (CellProfiler, Ilastik).
50+
3. Image segmentation based on the classification probabilities (CellProfiler).
51+
4. Measurement and export of cell-specific features, such as marker expression (CellProfiler).
5652

5753
## Example data
5854

@@ -69,21 +65,22 @@ The slides briefly explain why we chose this approach to image segmentation and
6965
## Changelog
7066

7167
For changes in specific releases, please refer to the [CHANGELOG](CHANGELOG.md).
72-
68+
7369
## License
7470

75-
We [freely share](LICENSE) this pipeline in the hope that it will be useful for others to perform high quality image segmentation and serve as a basis to develop more complicated open source IMC image processing workflows.
76-
In return we would like you to be considerate and give us and others feedback if you find a bug/issue and [raise a GitHub Issue](https://github.com/BodenmillerGroup/ImcSegmentationPipeline/issues) on the affected projects or on this page.
71+
We [freely share](LICENSE) this pipeline in the hope that it will be useful for others to perform high quality image segmentation and serve as a basis to develop more complicated open source IMC image processing workflows. In return we would like you to be considerate and give us and others feedback if you find a bug/issue and [raise a GitHub Issue](https://github.com/BodenmillerGroup/ImcSegmentationPipeline/issues) on the affected projects or on this page.
7772

7873
## Contributing
7974

8075
To contribute to this work, please fork the repository, make changes to it and open a pull request.
8176

8277
## Contributors
8378

84-
**Creator:** Vito Zanotelli
85-
**Contributor:** Jonas Windhager, Nils Eling
86-
**Maintainer:** Nils Eling
79+
**Creator:** Vito Zanotelli
80+
81+
**Contributor:** Jonas Windhager, Nils Eling
82+
83+
**Maintainer:** Nils Eling
8784

8885
## Citation
8986

@@ -100,4 +97,3 @@ If you use this workflow for your research, please cite us:
10097
url = {https://doi.org/10.5281/zenodo.3841961}
10198
}
10299
```
103-

docs/index.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,31 @@ Furthermore, before running the analysis, you will need to setup a `conda` envir
4040

4141
2. Clone the repository:
4242

43-
```bash
44-
git clone --recursive https://github.com/BodenmillerGroup/ImcSegmentationPipeline.git
45-
```
43+
```
44+
git clone --recursive https://github.com/BodenmillerGroup/ImcSegmentationPipeline.git
45+
```
4646
4747
3. Setup the conda environment:
4848
49-
```bash
50-
cd ImcSegmentationPipeline
51-
conda env create -f environment.yml
52-
```
49+
```
50+
cd ImcSegmentationPipeline
51+
```
52+
53+
```
54+
conda env create -f environment.yml
55+
```
5356
5457
4. Configure CellProfiler to use the plugins by opening the CellProfiler GUI, selecting `Preferences` and setting the `CellProfiler plugins directory` to `path/to/ImcSegmentationPipeline/resources/ImcPluginsCP/plugins` and **restart CellProfiler**. Alternatively you can clone the `ImcPluginsCP` repository individually and set the path correctly in CellProfiler.
5558
5659
5. Activate the environment created in 3. and start a jupyter instance
5760
58-
```bash
59-
conda activate imcsegpipe
60-
jupyter-lab
61-
```
61+
```
62+
conda activate imcsegpipe
63+
```
64+
65+
```
66+
jupyter-lab
67+
```
6268
6369
This will automatically open a jupyter instance at `http://localhost:8888/lab` in your browser.
6470
From there, you can open the `scripts/imc_preprocessing.ipynb` notebook and start the data pre-processing.

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ nav:
2222
- Cell segmentation: segmentation.md
2323
- Cell measurement: measurement.md
2424
- Output files: output.md
25-
25+
2626
markdown_extensions:
2727
- footnotes
2828
- attr_list
2929
- md_in_html
3030
- pymdownx.emoji:
3131
emoji_index: !!python/name:materialx.emoji.twemoji
32-
emoji_generator: !!python/name:materialx.emoji.to_svg
32+
emoji_generator: !!python/name:materialx.emoji.to_svg

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
2+
requires = ["setuptools>=64", "wheel"]
33
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)