Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
582 commits
Select commit Hold shift + click to select a range
ec2cdd0
Testing instance methods
C-Achard Mar 17, 2023
10444f8
Many fixes
C-Achard Mar 22, 2023
55f6fdc
black
C-Achard Mar 22, 2023
43ebdcd
Complete instance method evaluation
C-Achard Mar 22, 2023
df4f9da
Enfore pre-commit style
C-Achard Mar 22, 2023
6f1906e
Removing dask-image
C-Achard Apr 19, 2023
dd58a06
Fixed erroneous dtype conversion
C-Achard Apr 19, 2023
01d2473
Update test_plugin_utils.py
C-Achard Apr 23, 2023
a1468ff
Update tox.ini
C-Achard Apr 23, 2023
9d97ac2
Added new pre-commit hooks
C-Achard Apr 23, 2023
6f4e4b6
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
90cfbd5
Enforce style
C-Achard Apr 28, 2023
817e3cb
Documentation update, crop contrast fix
C-Achard Apr 28, 2023
e72df69
Updated hooks
C-Achard Jun 10, 2023
142ceee
Update setup.cfg
C-Achard Mar 15, 2023
10699f6
Many fixes
C-Achard Mar 22, 2023
e716653
Enfore pre-commit style
C-Achard Mar 22, 2023
e433cf3
Updated project files
C-Achard Apr 12, 2023
adc337a
Removing dask-image
C-Achard Apr 19, 2023
9342597
Latest pre-commit hooks
C-Achard Apr 23, 2023
cb9e306
Instance segmentation refactor + Voronoi-Otsu
C-Achard Mar 13, 2023
6a78fb0
isort
C-Achard Mar 15, 2023
82cfccd
Fix inference
C-Achard Mar 15, 2023
16193a1
Added labeling tools + UI tweaks
C-Achard Mar 17, 2023
ba2062e
Many fixes
C-Achard Mar 22, 2023
890e3b1
Added pre-commit hooks
C-Achard Mar 22, 2023
a6ad19e
Update .pre-commit-config.yaml
C-Achard Mar 22, 2023
c9d76f4
Update pyproject.toml
C-Achard Mar 22, 2023
3a9548b
Update pyproject.toml
C-Achard Mar 22, 2023
3f3829f
Enfore pre-commit style
C-Achard Mar 22, 2023
fc67737
Update .gitignore
C-Achard Apr 11, 2023
ab78666
Version bump
C-Achard Apr 11, 2023
830a25e
Revert "Version bump"
C-Achard Apr 11, 2023
51f3f0f
Updated project files
C-Achard Apr 12, 2023
ea0ddaf
Fixed wrong value in instance sliders
C-Achard Apr 15, 2023
845fbc9
Removing dask-image
C-Achard Apr 19, 2023
bd77860
Update test_plugin_utils.py
C-Achard Apr 23, 2023
0ffa377
Relabeling tests
C-Achard Apr 23, 2023
023a5db
Added new pre-commit hooks
C-Achard Apr 23, 2023
682e4ef
Latest pre-commit hooks
C-Achard Apr 23, 2023
29f1469
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
4be5f42
Model class refactor
C-Achard Mar 24, 2023
5f5978e
Added LR scheduler in training
C-Achard Mar 29, 2023
65347c4
Update assess_instance.ipynb
C-Achard Mar 31, 2023
ee8af0a
Update .gitignore
C-Achard Apr 19, 2023
03cacc8
Started adding WNet
C-Achard Apr 19, 2023
84f4227
Specify no grad in inference
C-Achard Apr 20, 2023
b370b8c
First functional WNet inference, no CRF
C-Achard Apr 22, 2023
13faa9c
Create test_models.py
C-Achard Apr 23, 2023
d16273e
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
858c1e9
Patch for tests action + style
C-Achard Apr 23, 2023
c65e4f5
Add softNCuts basic test
C-Achard Apr 23, 2023
d74576e
Added crf
C-Achard Apr 26, 2023
56f50e0
More pre-commit checks
C-Achard Apr 26, 2023
543b3f8
Functional CRF
C-Achard Apr 26, 2023
79859b0
Fix erroneous test comment, added toggle for crf
C-Achard Apr 26, 2023
0865b25
Specify missing test deps
C-Achard Apr 26, 2023
a887103
Trying to fix deps on Git
C-Achard Apr 26, 2023
a174264
Removed master link to pydensecrf
C-Achard Apr 26, 2023
00b7722
Use commit hash
C-Achard Apr 26, 2023
a8435f3
Removed commit hash
C-Achard Apr 26, 2023
99c66f5
Removed master
C-Achard Apr 26, 2023
e326e95
Update tox.ini
C-Achard Apr 26, 2023
1691e6e
Update pyproject.toml
C-Achard Apr 28, 2023
e4b37bc
Fixes and improvements
C-Achard Apr 28, 2023
8b2fc1d
Fixes and channel labeling prototype
C-Achard May 3, 2023
be5bce6
Fixes
C-Achard May 5, 2023
db435d0
Update plugin_model_inference.py
C-Achard May 5, 2023
bc26463
Update plugin_crop.py
C-Achard May 6, 2023
77dbc9b
Fixed patch_func sample number mismatch
C-Achard May 11, 2023
ae5d7c5
Testing relabel tools
C-Achard May 11, 2023
9b71743
Fixes in inference
C-Achard May 11, 2023
61e7a6e
add model template + fix test + wnet loading opti
C-Achard May 12, 2023
32e703f
Update model_WNet.py
C-Achard May 12, 2023
519c050
Update model_VNet.py
C-Achard May 13, 2023
6dff8ae
Fixed folder creation when saving to folder
C-Achard May 14, 2023
43a7849
Fix check_ready for results filewidget
C-Achard May 14, 2023
e313122
Added remapping in WNet + ruff config
C-Achard May 16, 2023
6e0d4e3
Run new hooks
C-Achard May 16, 2023
0c2a9de
Small docs update
C-Achard May 16, 2023
4a81882
Testing fix
C-Achard May 16, 2023
b9b377a
Fixed multithread testing (locally)
C-Achard May 16, 2023
ecc127f
Added proper tests for train/infer
C-Achard May 16, 2023
7188c64
Slight coverage increase
C-Achard May 16, 2023
bd72e72
Update test_plugin_inference.py
C-Achard May 16, 2023
17426c9
Set window inference to 64 for WNet
C-Achard May 17, 2023
eb6b199
Update instance_segmentation.py
C-Achard May 17, 2023
ad4069c
Moved normalization to the correct place
C-Achard May 20, 2023
6c3e438
Added auto-set dims for cropping
C-Achard May 24, 2023
6c82e2b
Update test_plugin_utils.py
C-Achard May 24, 2023
23bb52f
More WNet
C-Achard May 26, 2023
0ef93ac
Update crf test/deps for testing
C-Achard May 26, 2023
7882738
Update test_and_deploy.yml
C-Achard May 26, 2023
fee1fcc
Update test_and_deploy.yml
C-Achard May 26, 2023
8b64602
Update tox.ini
C-Achard May 26, 2023
b621da1
Update test_and_deploy.yml
C-Achard May 26, 2023
caf3060
Trying to fix tox install of pydensecrf
C-Achard May 26, 2023
cb29858
Added experimental ONNX support for inference
C-Achard May 29, 2023
4e1b0a8
Updated WNet for ONNX conversion
C-Achard May 29, 2023
a052d2c
Added dropout param
C-Achard May 29, 2023
ea91159
Minor fixes in training
C-Achard May 31, 2023
f07d3eb
Fix weights file extension in inference + coverage
C-Achard Jun 2, 2023
f854bf3
Run all hooks
C-Achard Jun 2, 2023
c55dfac
Fix inference testing
C-Achard Jun 2, 2023
dba9d8e
Changed anisotropy calculation
C-Achard Jun 2, 2023
6c1b33b
Finish rebase + bump version
C-Achard Jun 10, 2023
556f132
Instance segmentation refactor + Voronoi-Otsu
C-Achard Mar 13, 2023
db4babf
Disabled small removal in Voronoi-Otsu
C-Achard Mar 13, 2023
517ae33
Added new docs for instance seg
C-Achard Mar 14, 2023
45ce321
Docs + UI update
C-Achard Mar 15, 2023
87810fa
Update requirements.txt
C-Achard Mar 15, 2023
5beafd9
isort
C-Achard Mar 15, 2023
334cae0
Fix tests
C-Achard Mar 15, 2023
fa01b7d
Fixed parental issues and instance seg widget init
C-Achard Mar 15, 2023
5684d8f
Fix inference
C-Achard Mar 15, 2023
16766b8
Added labeling tools + UI tweaks
C-Achard Mar 17, 2023
984b212
Testing instance methods
C-Achard Mar 17, 2023
7bba627
Many fixes
C-Achard Mar 22, 2023
1cd7f0e
black
C-Achard Mar 22, 2023
ab8e078
Complete instance method evaluation
C-Achard Mar 22, 2023
bb43b54
Added pre-commit hooks
C-Achard Mar 22, 2023
0f44f38
Enfore pre-commit style
C-Achard Mar 22, 2023
e722ae2
Update .gitignore
C-Achard Apr 11, 2023
2204aa9
Version bump
C-Achard Apr 11, 2023
27e1ee4
Updated project files
C-Achard Apr 12, 2023
576cc19
Fixed missing parent error
C-Achard Apr 15, 2023
2908156
Fixed wrong value in instance sliders
C-Achard Apr 15, 2023
d926a2b
Removing dask-image
C-Achard Apr 19, 2023
a1926ae
Fixed erroneous dtype conversion
C-Achard Apr 19, 2023
8c5bd10
Update test_plugin_utils.py
C-Achard Apr 23, 2023
c116632
Temporary test action patch
C-Achard Apr 23, 2023
49aa95b
Update plugin_convert.py
C-Achard Apr 23, 2023
54f5910
Update tox.ini
C-Achard Apr 23, 2023
242bd57
Update tox.ini
C-Achard Apr 23, 2023
7187bfa
Found existing pocl
C-Achard Apr 23, 2023
7b79d5e
Updated utils test to avoid Voronoi-Otsu
C-Achard Apr 23, 2023
6e81c3f
Relabeling tests
C-Achard Apr 23, 2023
75246f4
Latest pre-commit hooks
C-Achard Apr 23, 2023
8b4f5ba
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
d9dc775
Enforce style
C-Achard Apr 23, 2023
234dfaa
Instance segmentation refactor + Voronoi-Otsu
C-Achard Mar 13, 2023
a46b590
Disabled small removal in Voronoi-Otsu
C-Achard Mar 13, 2023
3ce6f28
Added new docs for instance seg
C-Achard Mar 14, 2023
b736337
Docs + UI update
C-Achard Mar 15, 2023
ba53463
Update requirements.txt
C-Achard Mar 15, 2023
b286727
isort
C-Achard Mar 15, 2023
85976b6
Fix tests
C-Achard Mar 15, 2023
ef67ac1
Fixed parental issues and instance seg widget init
C-Achard Mar 15, 2023
07da249
Fix inference
C-Achard Mar 15, 2023
7740517
Added labeling tools + UI tweaks
C-Achard Mar 17, 2023
fc957e2
Testing instance methods
C-Achard Mar 17, 2023
2bafffc
Many fixes
C-Achard Mar 22, 2023
fd11680
black
C-Achard Mar 22, 2023
1f95455
Complete instance method evaluation
C-Achard Mar 22, 2023
54519ac
Added pre-commit hooks
C-Achard Mar 22, 2023
9887cc7
Update .pre-commit-config.yaml
C-Achard Mar 22, 2023
2b0bb6d
Update pyproject.toml
C-Achard Mar 22, 2023
c978043
Update pyproject.toml
C-Achard Mar 22, 2023
2bf9494
Enfore pre-commit style
C-Achard Mar 22, 2023
51a6c35
Update .gitignore
C-Achard Apr 11, 2023
c2e90f7
Version bump
C-Achard Apr 11, 2023
2354211
Revert "Version bump"
C-Achard Apr 11, 2023
22868a5
Updated project files
C-Achard Apr 12, 2023
0e403b8
Fixed missing parent error
C-Achard Apr 15, 2023
b6fc3f6
Fixed wrong value in instance sliders
C-Achard Apr 15, 2023
11e0dcc
Removing dask-image
C-Achard Apr 19, 2023
5db5b78
Fixed erroneous dtype conversion
C-Achard Apr 19, 2023
e80a655
Update test_plugin_utils.py
C-Achard Apr 23, 2023
deb4592
Update plugin_convert.py
C-Achard Apr 23, 2023
d6c359b
Update tox.ini
C-Achard Apr 23, 2023
c0cbbbe
Update tox.ini
C-Achard Apr 23, 2023
80f6ea3
Found existing pocl
C-Achard Apr 23, 2023
5e5f63c
Updated utils test to avoid Voronoi-Otsu
C-Achard Apr 23, 2023
94384db
Relabeling tests
C-Achard Apr 23, 2023
757c8b0
Added new pre-commit hooks
C-Achard Apr 23, 2023
8b0c7a8
Latest pre-commit hooks
C-Achard Apr 23, 2023
dcdfaca
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
122a733
Model class refactor
C-Achard Mar 24, 2023
926125d
Added LR scheduler in training
C-Achard Mar 29, 2023
e8a3e95
Update assess_instance.ipynb
C-Achard Mar 31, 2023
954cc54
Update .gitignore
C-Achard Apr 19, 2023
4fc31ba
Started adding WNet
C-Achard Apr 19, 2023
8f0ca84
Specify no grad in inference
C-Achard Apr 20, 2023
8a36ebf
First functional WNet inference, no CRF
C-Achard Apr 22, 2023
fbfc513
Create test_models.py
C-Achard Apr 23, 2023
b280f4b
Run full suite of pre-commit hooks
C-Achard Apr 23, 2023
c2b5168
Patch for tests action + style
C-Achard Apr 23, 2023
0376621
Add softNCuts basic test
C-Achard Apr 23, 2023
181a934
Added crf
C-Achard Apr 26, 2023
164eac6
More pre-commit checks
C-Achard Apr 26, 2023
ebdfd7c
Functional CRF
C-Achard Apr 26, 2023
106f4b7
Fix erroneous test comment, added toggle for crf
C-Achard Apr 26, 2023
c5bd372
Specify missing test deps
C-Achard Apr 26, 2023
ae5810b
Trying to fix deps on Git
C-Achard Apr 26, 2023
1f7dae9
Removed master link to pydensecrf
C-Achard Apr 26, 2023
fd1c6c6
Use commit hash
C-Achard Apr 26, 2023
4401b89
Removed commit hash
C-Achard Apr 26, 2023
c0f851a
Removed master
C-Achard Apr 26, 2023
781cd0d
Update tox.ini
C-Achard Apr 26, 2023
a3c9dbf
Update pyproject.toml
C-Achard Apr 28, 2023
8c93b65
Fixes and improvements
C-Achard Apr 28, 2023
de939c0
Fixes and channel labeling prototype
C-Achard May 3, 2023
33a6da8
Fixes
C-Achard May 5, 2023
23261e2
Update plugin_model_inference.py
C-Achard May 5, 2023
04a44d0
Fixed patch_func sample number mismatch
C-Achard May 11, 2023
314ddd4
Testing relabel tools
C-Achard May 11, 2023
aa228a8
Fixes in inference
C-Achard May 11, 2023
db6ed07
add model template + fix test + wnet loading opti
C-Achard May 12, 2023
277d2b5
Update model_WNet.py
C-Achard May 12, 2023
6269c93
Update model_VNet.py
C-Achard May 13, 2023
4d7bd24
Fixed folder creation when saving to folder
C-Achard May 14, 2023
333a0c3
Fix check_ready for results filewidget
C-Achard May 14, 2023
b1d2bac
Added remapping in WNet + ruff config
C-Achard May 16, 2023
cb26f76
Run new hooks
C-Achard May 16, 2023
526e7ba
Small docs update
C-Achard May 16, 2023
1dc6715
Testing fix
C-Achard May 16, 2023
4fe2e6d
Fixed multithread testing (locally)
C-Achard May 16, 2023
259823a
Added proper tests for train/infer
C-Achard May 16, 2023
8d30d5c
Slight coverage increase
C-Achard May 16, 2023
e83847d
Update test_plugin_inference.py
C-Achard May 16, 2023
25fe3d7
Set window inference to 64 for WNet
C-Achard May 17, 2023
644038e
Moved normalization to the correct place
C-Achard May 20, 2023
14b3516
Added auto-set dims for cropping
C-Achard May 24, 2023
e3ea954
Update test_plugin_utils.py
C-Achard May 24, 2023
6d47bb2
More WNet
C-Achard May 26, 2023
8fd582d
Update crf test/deps for testing
C-Achard May 26, 2023
ced0422
Update test_and_deploy.yml
C-Achard May 26, 2023
ba51551
Update test_and_deploy.yml
C-Achard May 26, 2023
2deb7a8
Update tox.ini
C-Achard May 26, 2023
8820c2b
Update test_and_deploy.yml
C-Achard May 26, 2023
3a03e27
Trying to fix tox install of pydensecrf
C-Achard May 26, 2023
dcd1f7e
Added experimental ONNX support for inference
C-Achard May 29, 2023
3ba51f7
Updated WNet for ONNX conversion
C-Achard May 29, 2023
99e7e2a
Added dropout param
C-Achard May 29, 2023
8678bfb
Minor fixes in training
C-Achard May 31, 2023
858fe7e
Fix weights file extension in inference + coverage
C-Achard Jun 2, 2023
41b5ba4
Run all hooks
C-Achard Jun 2, 2023
0463e2e
Fix inference testing
C-Achard Jun 2, 2023
b8bc533
Changed anisotropy calculation
C-Achard Jun 2, 2023
560afc9
Fixed aniso correction and CRF interaction
C-Achard Jun 10, 2023
91e923b
Remove duplicate tests
C-Achard Jun 10, 2023
04eae7e
Finish rebase + changed step to auto in spinbox
C-Achard Jun 11, 2023
06d3ef3
Merge
C-Achard Jun 11, 2023
7c6e3c8
Updated based on feedback from CYHSM
C-Achard Jun 12, 2023
41a2194
Added minimal WNet notebook for training
C-Achard Jul 10, 2023
2ba3603
Remove dask
C-Achard Jul 10, 2023
02fdcf7
WNet model docs
C-Achard Jul 10, 2023
1839f39
Added QoL shape info for layer selecter
C-Achard Jul 10, 2023
d639b21
WNet fixes + PR feedback improvements
C-Achard Jul 12, 2023
3083705
Added imagecodecs to open external datasets
C-Achard Jul 12, 2023
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
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[report]
exclude_lines =
if __name__ == .__main__.:

[run]
omit =
napari_cellseg3d/setup.py
5 changes: 1 addition & 4 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ on:
push:
branches:
- main
- npe2
- cy/voronoi-otsu
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
- npe2
- cy/voronoi-otsu
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -55,6 +51,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install setuptools tox tox-gh-actions
# pip install git+https://github.com/lucasb-eyer/pydensecrf.git@master#egg=pydensecrf

# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ notebooks/csv_cell_plot.html
notebooks/full_plot.html
*.csv
*.png
notebooks/instance_test.ipynb
*.prof

#include test data
!napari_cellseg3d/_tests/res/test.tif
!napari_cellseg3d/_tests/res/test.png
!napari_cellseg3d/_tests/res/test_labels.tif
cov.syspath.txt
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Welcome to napari-cellseg3d's documentation!
res/code/plugin_convert
res/code/plugin_metrics
res/code/model_framework
res/code/model_workers
res/code/model_instance_seg
res/code/workers
res/code/instance_segmentation
res/code/plugin_model_inference
res/code/plugin_model_training
res/code/utils
Expand Down
53 changes: 53 additions & 0 deletions docs/res/code/instance_segmentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
instance_segmentation.py
===========================================

Classes
-------------

InstanceMethod
**************************************
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::InstanceMethod
:members: __init__

ConnectedComponents
**************************************
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::ConnectedComponents
:members: __init__

Watershed
**************************************
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::Watershed
:members: __init__

VoronoiOtsu
**************************************
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::VoronoiOtsu
:members: __init__


Functions
-------------

binary_connected
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::binary_connected

binary_watershed
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::binary_watershed

volume_stats
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::volume_stats

clear_small_objects
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::clear_small_objects

to_instance
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::to_instance

to_semantic
**************************************
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::to_semantic
53 changes: 0 additions & 53 deletions docs/res/code/model_instance_seg.rst

This file was deleted.

15 changes: 0 additions & 15 deletions docs/res/code/plugin_convert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,3 @@ ThresholdUtils
**********************************
.. autoclass:: napari_cellseg3d.code_plugins.plugin_convert::ThresholdUtils
:members: __init__

Functions
-----------------------------------

save_folder
*****************************************
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::save_folder

save_layer
****************************************
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::save_layer

show_result
****************************************
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::show_result
1 change: 0 additions & 1 deletion docs/res/code/plugin_model_training.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ Methods

Attributes
*********************

.. autoclass:: napari_cellseg3d.code_plugins.plugin_model_training::Trainer
:members: _viewer, worker, loss_dict, canvas, train_loss_plot, dice_metric_plot
4 changes: 0 additions & 4 deletions docs/res/code/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,3 @@ denormalize_y
load_images
**************************************
.. autofunction:: napari_cellseg3d.utils::load_images

format_Warning
**************************************
.. autofunction:: napari_cellseg3d.utils::format_Warning
8 changes: 4 additions & 4 deletions docs/res/code/model_workers.rst → docs/res/code/workers.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
model_workers.py
workers.py
===========================================


Expand All @@ -10,7 +10,7 @@ Class : LogSignal

Attributes
************************
.. autoclass:: napari_cellseg3d.code_models.model_workers::LogSignal
.. autoclass:: napari_cellseg3d.code_models.workers::LogSignal
:members: log_signal
:noindex:

Expand All @@ -24,7 +24,7 @@ Class : InferenceWorker

Methods
************************
.. autoclass:: napari_cellseg3d.code_models.model_workers::InferenceWorker
.. autoclass:: napari_cellseg3d.code_models.workers::InferenceWorker
:members: __init__, log, create_inference_dict, inference
:noindex:

Expand All @@ -39,6 +39,6 @@ Class : TrainingWorker

Methods
************************
.. autoclass:: napari_cellseg3d.code_models.model_workers::TrainingWorker
.. autoclass:: napari_cellseg3d.code_models.workers::TrainingWorker
:members: __init__, log, train
:noindex:
46 changes: 22 additions & 24 deletions docs/res/guides/custom_model_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,33 @@
Advanced : Declaring a custom model
=============================================

To add a custom model, you will need a **.py** file with the following structure to be placed in the *napari_cellseg3d/models* folder:
.. warning::
**WIP** : Adding new models is still a work in progress and will likely not work out of the box, leading to errors.

.. note::
**WIP** : Currently you must modify :ref:`model_framework.py` as well : import your model class and add it to the ``model_dict`` attribute

::

def get_net():
return ModelClass # should return the class of the model,
# for example SegResNet or UNET
Please `file an issue`_ if you would like to add a custom model and we will help you get it working.

To add a custom model, you will need a **.py** file with the following structure to be placed in the *napari_cellseg3d/models* folder::

def get_weights_file():
return "weights_file.pth" # name of the weights file for the model,
# which should be in *napari_cellseg3d/models/pretrained*
class ModelTemplate_(ABC): # replace ABC with your PyTorch model class name
use_default_training = True # not needed for now, will serve for WNet training if added to the plugin
weights_file = (
"model_template.pth" # specify the file name of the weights file only
) # download URL goes in pretrained_models.json

@abstractmethod
def __init__(
self, input_image_size, in_channels=1, out_channels=1, **kwargs
):
"""Reimplement this as needed; only include input_image_size if necessary. For now only in/out channels = 1 is supported."""
pass

def get_output(model, input):
out = model(input) # should return the model's output as [C, N, D,H,W]
# (C: channel, N, batch size, D,H,W : depth, height, width)
return out
@abstractmethod
def forward(self, x):
"""Reimplement this as needed. Ensure that output is a torch tensor with dims (batch, channels, z, y, x)."""
pass


def get_validation(model, val_inputs):
val_outputs = model(val_inputs) # should return the proper type for validation
# with sliding_window_inference from MONAI
return val_outputs

.. note::
**WIP** : Currently you must modify :ref:`model_framework.py` as well : import your model class and add it to the ``model_dict`` attribute

def ModelClass(x1,x2...):
# your Pytorch model here...
return results # should return as [C, N, D,H,W]
.. _file an issue: https://github.com/AdaptiveMotorControlLab/CellSeg3d/issues
4 changes: 2 additions & 2 deletions docs/res/guides/detailed_walkthrough.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _detailed_walkthrough:

Detailed walkthrough
Detailed walkthrough - Supervised learning
===================================

The following guide will show you how to use the plugin's workflow, starting from human-labeled annotation volume, to running inference on novel volumes.
Expand Down Expand Up @@ -109,7 +109,7 @@ of two no matter the size you choose. For optimal performance, make sure to use
a power of two still, such as 64 or 120.

.. important::
Using a too large value for the size will cause memory issues. If this happens, restart napari (better handling for these situations might be added in the future).
Using a too large value for the size will cause memory issues. If this happens, restart the worker with smaller volumes.

You also have the option to use data augmentation, which can improve performance and generalization.
In most cases this should left enabled.
Expand Down
37 changes: 23 additions & 14 deletions docs/res/guides/inference_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ This module allows you to use pre-trained segmentation algorithms (written in Py
to automatically label cells.

.. important::
Currently, only inference on **3D volumes is supported**. Your image and label folders should both contain a set of
**3D image files**, currently either **.tif** or **.tiff**.
Currently, only inference on **3D volumes is supported**. If using folders, your images and labels folders
should both contain a set of **3D image files**, either **.tif** or **.tiff**.
Otherwise you may run inference on layers in napari.

Currently, the following pre-trained models are available :

Expand All @@ -20,13 +21,18 @@ SegResNet `3D MRI brain tumor segmentation using autoencoder regularizati
TRAILMAP_MS A PyTorch implementation of the `TRAILMAP project on GitHub`_ pretrained with mesoSPIM data
TRAILMAP An implementation of the `TRAILMAP project on GitHub`_ using a `3DUNet for PyTorch`_
SwinUNetR `Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images`_
WNet `WNet, A Deep Model for Fully Unsupervised Image Segmentation`_
============== ================================================================================================

.. _Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation: https://arxiv.org/pdf/1606.04797.pdf
.. _3D MRI brain tumor segmentation using autoencoder regularization: https://arxiv.org/pdf/1810.11654.pdf
.. _TRAILMAP project on GitHub: https://github.com/AlbertPun/TRAILMAP
.. _3DUnet for Pytorch: https://github.com/wolny/pytorch-3dunet
.. _Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images: https://arxiv.org/abs/2201.01266
.. _WNet, A Deep Model for Fully Unsupervised Image Segmentation: https://arxiv.org/abs/1711.08506

.. note::
For WNet-specific instruction please refer to the appropriate section below.

Interface and functionalities
--------------------------------
Expand Down Expand Up @@ -67,8 +73,7 @@ Interface and functionalities

* **Instance segmentation** :

| You can convert the semantic segmentation into instance labels by using either the `watershed`_ or `connected components`_ method.
| You can set the probability threshold from which a pixel is considered as a valid instance, as well as the minimum size in pixels for objects. All smaller objects will be removed.
| You can convert the semantic segmentation into instance labels by using either the Voronoi-Otsu, `Watershed`_ or `Connected Components`_ method, as detailed in :ref:`utils_module_guide`.
| Instance labels will be saved (and shown if applicable) separately from other results.


Expand All @@ -78,7 +83,7 @@ Interface and functionalities

* **Computing objects statistics** :

You can choose to compute various stats from the labels and save them to a csv for later use.
You can choose to compute various stats from the labels and save them to a .csv for later use.

This includes, for each object :

Expand All @@ -98,13 +103,6 @@ Interface and functionalities

In the ``notebooks`` folder you can find an example of plotting cell statistics using the result csv.

* **Viewing results** :

| You can also select whether you'd like to **see the results** in napari afterwards.
| By default the first image processed will be displayed, but you can choose to display up to **ten at once**.
| You can also request to see the originals.


When you are done choosing your parameters, you can press the **Start** button to begin the inference process.
Once it has finished, results will be saved then displayed in napari; each output will be paired with its original.
On the left side, a progress bar and a log will keep you informed on the process.
Expand All @@ -115,7 +113,7 @@ On the left side, a progress bar and a log will keep you informed on the process
| ``{original_name}_{model}_{date & time}_pred{id}.file_ext``
| For example, using a VNet on the third image of a folder, called "somatomotor.tif" will yield the following name :
| *somatomotor_VNet_2022_04_06_15_49_42_pred3.tif*
| Instance labels will have the "Instance_seg" prefix appened to the name.
| Instance labels will have the "Instance_seg" prefix appended to the name.


.. hint::
Expand All @@ -128,8 +126,19 @@ On the left side, a progress bar and a log will keep you informed on the process
.. note::
You can save the log after the worker is finished to easily remember which parameters you ran inference with.

WNet
--------------------------------

The WNet model, from the paper `WNet, A Deep Model for Fully Unsupervised Image Segmentation`_, is a fully unsupervised model that can be used to segment images without any labels.
It clusters pixels based on brightness, and can be used to segment cells in a variety of modalities.
Its use and available options are similar to the above models, with a few differences :
.. note::
| Our provided, pre-trained model should use an input size of 64x64x64. As such, window inference is always enabled
| and set to 64. If you want to use a different size, you will have to train your own model using the provided notebook.
All it requires are images; for nucleus segmentation, it is recommended to use 2 classes (default).

Source code
--------------------------------
* :doc:`../code/plugin_model_inference`
* :doc:`../code/model_framework`
* :doc:`../code/model_workers`
* :doc:`../code/workers`
Loading