Skip to content

Commit 5ec83ee

Browse files
authored
Merge pull request #43 from AdaptiveMotorControlLab/cy/training
v1.0
2 parents 7fa2c4e + ca0c192 commit 5ec83ee

File tree

153 files changed

+17689
-7182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+17689
-7182
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ exclude_lines =
44

55
[run]
66
omit =
7-
napari_cellseg3d/setup.py, napari_cellseg3d/code_models/models/wnet/train_wnet.py, napari_cellseg3d/code_models/models/wnet/model.py,napari_cellseg3d/code_models/models/TEMPLATE_model.py, napari_cellseg3d/code_models/models/unet/*, napari_cellseg3d/dev_scripts/*
7+
napari_cellseg3d/setup.py, napari_cellseg3d/code_models/models/wnet/train_wnet.py, napari_cellseg3d/code_models/models/wnet/model.py,napari_cellseg3d/code_models/models/TEMPLATE_model.py, napari_cellseg3d/code_models/models/unet/*, napari_cellseg3d/dev_scripts/*, napari_cellseg3d/code_plugins/plugin_metrics.py

.github/workflows/build_docs.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
1-
name: Deploy Sphinx documentation to Pages
1+
name: deploy
22

33
on:
44
push:
55
branches: # branch to trigger deployment
66
- main
77

8+
# This job installs dependencies, build the book, and pushes it to `gh-pages`
89
jobs:
9-
pages:
10-
runs-on: ubuntu-20.04
10+
build-and-deploy-book:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest]
15+
python-version: [3.8]
1116
steps:
12-
- id: deployment
13-
uses: sphinx-notes/pages@v3
17+
- uses: actions/checkout@v2
18+
19+
# Install dependencies
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
1422
with:
15-
publish: false
16-
- uses: peaceiris/actions-gh-pages@v3
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
pip install jupyter-book
27+
pip install -e .
28+
29+
# Build the book
30+
- name: Build the book
31+
run: |
32+
jupyter-book build docs/
33+
34+
# Deploy the book's HTML to gh-pages branch
35+
- name: GitHub Pages action
36+
uses: peaceiris/[email protected]
1737
with:
1838
github_token: ${{ secrets.GITHUB_TOKEN }}
19-
publish_dir: ${{ steps.deployment.outputs.artifact }}
39+
publish_dir: docs/_build/html

.github/workflows/test_and_deploy.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- main
10+
- cy/training
1011
tags:
1112
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
1213
pull_request:
@@ -20,9 +21,10 @@ jobs:
2021
runs-on: ${{ matrix.platform }}
2122
strategy:
2223
matrix:
23-
# platform: [ubuntu-latest, windows-latest, macos-latest]
24-
platform: [windows-latest]
25-
python-version: [3.8, 3.9] # 3.10
24+
# platform: [windows-latest]
25+
# , macos-latest
26+
platform: [ubuntu-latest, windows-latest]
27+
python-version: ['3.8', '3.9', '3.10']
2628

2729
steps:
2830
- uses: actions/checkout@v3
@@ -51,7 +53,7 @@ jobs:
5153
run: |
5254
python -m pip install --upgrade pip
5355
python -m pip install setuptools tox tox-gh-actions
54-
# pip install git+https://github.com/kodalli/pydensecrf.git@master#egg=pydensecrf
56+
# pip install git+https://github.com/lucasb-eyer/pydensecrf.git@master#egg=pydensecrf
5557

5658
# this runs the platform-specific tests declared in tox.ini
5759
- name: Test with tox

.gitignore

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,30 @@ venv/
9393
# written by setuptools_scm
9494
**/_version.py
9595

96+
# WANDB
97+
/wandb/
9698

9799

98100
########
99101
#project specific
100102
#dataset, weights, old logos, requirements
101103
/napari_cellseg3d/code_models/models/dataset/
102104
/napari_cellseg3d/code_models/models/saved_weights/
103-
/docs/res/logo/old_logo/
105+
/docs/source/logo/old_logo/
106+
/docs/source/code/_autosummary/
104107
/reqs/
105108
/loss_plots/
109+
/wandb/
106110
notebooks/csv_cell_plot.html
107111
notebooks/full_plot.html
108112
*.csv
109113
*.png
110114
notebooks/instance_test.ipynb
111115
*.prof
112-
docs/source/code/_autosummary/*.rst
116+
/docs/_build/
117+
/docs/source/code/_autosummary/*.rst
118+
cov.syspath.txt
119+
napari_cellseg3d/dev_scripts/wandb
113120
wandb/
114121

115122
#include test data
@@ -119,4 +126,9 @@ wandb/
119126
!napari_cellseg3d/_tests/res/wnet_test/*.tif
120127
!napari_cellseg3d/_tests/res/wnet_test/lab/*.tif
121128
!napari_cellseg3d/_tests/res/wnet_test/vol/*.tif
122-
cov.syspath.txt
129+
130+
#include docs images
131+
!docs/source/logo/*
132+
!docs/source/images/*
133+
lcov.info
134+
coverage.lcov

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ repos:
77
- id: trailing-whitespace
88
- id: check-yaml
99
- id: check-added-large-files
10+
args: [--maxkb=5000]
1011
- id: check-toml
1112
# - repo: https://github.com/pycqa/isort
1213
# rev: 5.12.0

README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# napari-cellseg3D: a napari plug-in for direct 3D cell segmentation with deep learning
22

3-
43
<img src="https://images.squarespace-cdn.com/content/v1/57f6d51c9f74566f55ecf271/838605d0-9723-4e43-83cd-6dbfe4adf36b/cellseg-logo.png?format=1500w" title="cellseg3d" alt="cellseg3d logo" width="350" align="right" vspace = "80"/>
54

65
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
@@ -10,23 +9,34 @@
109
[![codecov](https://codecov.io/gh/AdaptiveMotorControlLab/CellSeg3d/branch/main/graph/badge.svg?token=hzUcn3XN8F)](https://codecov.io/gh/AdaptiveMotorControlLab/CellSeg3d)
1110
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-cellseg3d)](https://www.napari-hub.org/plugins/napari-cellseg3d)
1211

13-
1412
A napari plugin for 3D cell segmentation: training, inference, and data review. In particular, this project was developed for analysis of mesoSPIM-acquired (cleared tissue + lightsheet) datasets.
1513

14+
**Help us make the code better by reporting issues and adding your feature requests!**
15+
1616
----------------------------------
1717

1818
## News
1919

20-
*April 2023: New version with interface overhaul published ! New model and utilities coming soon*
20+
**New version : v1.0**
2121

22+
Added :
2223

23-
**This is an alpha version, please expect bugs and issues, and help us make the code better by reporting them as an issue!**
24+
- Improved training interface
25+
- Unsupervised model : WNet
26+
- Generate labels directly from raw data !
27+
- Can be trained in napari directly or in Colab
28+
- Pretrained weights for mesoSPIM whole-brain cell segmentation
29+
- WandB support (install wandb and login to use automatically when training)
30+
- Remade and improved documentation
31+
- Moved to Jupyter Book
32+
- Dedicated installation page, and working ARM64 install for macOS Silicon users
33+
- New utilities
34+
- Many small improvements and many bug fixes
2435

2536
## Demo
2637

2738
![demo](https://images.squarespace-cdn.com/content/v1/57f6d51c9f74566f55ecf271/0d16a71b-3ff2-477a-9d83-18d96cb1ce28/full_demo.gif?format=500w)
2839

29-
3040
## Installation
3141

3242
**Note** : we recommend using conda to create a new environment for the plugin.
@@ -58,14 +68,15 @@ To avoid issues when installing on the ARM64 architecture, please follow these s
5868
conda env create -f conda/napari_cellseg3d_m1.yml
5969
conda activate napari_cellseg3d_m1
6070

61-
2) Then install PyQt5 from conda separately :
71+
2) Install the plugin.
72+
From repository root folder, run :
6273

63-
conda install -c anaconda pyqt
64-
65-
3) And install the plugin :
74+
pip install -e .
75+
OR directly via PyPi :
6676

6777
pip install napari-cellseg3d
6878

79+
OR directly via [napari-hub] (see Installation section above)
6980

7081
## Documentation
7182

@@ -86,21 +97,21 @@ Then go into Plugins > napari-cellseg3d, and choose which tool to use.
8697
- **Train**: This module allows you to train segmentation algorithms from labeled volumes.
8798
- **Utilities**: This module allows you to perform several actions like cropping your volumes and labels dynamically, by selecting a fixed size volume and moving it around the image; computing prediction scores from ground truth and predicition labels; or converting labels from instance to segmentation and the opposite.
8899

89-
90100
## Requirements
91-
**Python >= 3.8 required**
92101

93-
Requires **pytorch** and **MONAI**.
94-
For PyTorch, please see [PyTorch's website for installation instructions].
102+
**Python 3.8 or 3.9 required.**
103+
Requires **[napari]**, **[PyTorch]** and **[MONAI]**.
104+
105+
For PyTorch, please see [the PyTorch website for installation instructions].
106+
95107
A CUDA-capable GPU is not needed but very strongly recommended, especially for training.
96-
If you get errors from MONAI regarding missing readers, please see [MONAI's optional dependencies] page for instructions on getting the readers required by your images.
97108

109+
If you get errors from MONAI regarding missing readers, please see [MONAI's optional dependencies] page for instructions on getting the readers required by your images.
98110

99111
## Issues
100112

101113
If you encounter any problems, please [file an issue] along with a detailed description.
102114

103-
104115
## Testing
105116

106117
To run tests locally:
@@ -134,20 +145,15 @@ Distributed under the terms of the [MIT] license.
134145
[Cookiecutter]: https://github.com/audreyr/cookiecutter
135146
[@napari]: https://github.com/napari
136147
[MIT]: http://opensource.org/licenses/MIT
137-
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
138-
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
139-
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
140-
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
141-
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
142148
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin
143-
144-
[napari]: https://github.com/napari/napari
145149
[tox]: https://tox.readthedocs.io/en/latest/
146150
[pip]: https://pypi.org/project/pip/
147151
[PyPI]: https://pypi.org/
148152

149-
[PyTorch's website for installation instructions]: https://pytorch.org/get-started/locally/
153+
[the PyTorch website for installation instructions]: https://pytorch.org/get-started/locally/
154+
[PyTorch]: https://pytorch.org/get-started/locally/
150155
[MONAI's optional dependencies]: https://docs.monai.io/en/stable/installation.html#installing-the-recommended-dependencies
156+
[MONAI]: https://docs.monai.io/en/stable/installation.html#installing-the-recommended-dependencies
151157

152158
## Acknowledgements
153159

@@ -156,12 +162,5 @@ This work was funded, in part, from the Wyss Center to the [Mathis Laboratory of
156162
Please refer to the documentation for full acknowledgements.
157163

158164
## Plugin base
159-
This [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.
160165

161-
<!--
162-
Don't miss the full getting started guide to set up your new package:
163-
https://github.com/napari/cookiecutter-napari-plugin#getting-started
164-
165-
and review the napari docs for plugin developers:
166-
https://napari.org/plugins/stable/index.html
167-
-->
166+
This [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.

conda/napari_cellseg3d_m1.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@ channels:
44
- conda-forge
55
- defaults
66
dependencies:
7-
- python=3.8
7+
- python=3.9
88
- pip
9+
- pyqt
10+
- imagecodecs
911
- pip:
1012
- numpy
1113
- napari>=0.4.14
12-
- QtPy
13-
- opencv-python>=4.5.5
14+
# - opencv-python>=4.5.5
1415
- scikit-image>=0.19.2
1516
- matplotlib>=3.4.1
1617
- tifffile>=2022.2.9
17-
- imageio-ffmpeg>=0.4.5
18+
# - imageio-ffmpeg>=0.4.5
1819
- torch>=1.11
19-
- monai[nibabel,einops]>=0.9.0
20+
- monai[nibabel, einops]>=0.9.0
2021
- tqdm
21-
- nibabel
22+
# - nibabel
2223
- scikit-image
23-
- pillow
24+
# - pillow
25+
- pyclesperanto-prototype
2426
- tqdm
2527
- matplotlib
26-
- vispy>=0.9.6
28+
# - vispy>=0.9.6

0 commit comments

Comments
 (0)