Skip to content

Commit 634f5a4

Browse files
C-AchardgityvesNevexiosCYHSM
authored
WNet + models code refactor (#36)
* Testing instance methods Co-Authored-By: gityves <[email protected]> * Many fixes - Fixed monai reqs - Added custom functions for label checking - Fixed return type of voronoi_otsu and utils.resize - black * black * Complete instance method evaluation * Enfore pre-commit style * Removing dask-image * Fixed erroneous dtype conversion * Update test_plugin_utils.py * Update tox.ini * Added new pre-commit hooks * Run full suite of pre-commit hooks * Enforce style * Documentation update, crop contrast fix * Updated hooks * Update setup.cfg * Many fixes - Fixed monai reqs - Added custom functions for label checking - Fixed return type of voronoi_otsu and utils.resize - black * Enfore pre-commit style * Updated project files * Removing dask-image * Latest pre-commit hooks * Instance segmentation refactor + Voronoi-Otsu - Improved code for instance segmentation - Added Voronoi-Otsu labeling from pyclesperanto TODO : credits for labeling * isort * Fix inference * Added labeling tools + UI tweaks - Added tools from MLCourse to evaluate labels and auto-correct them - Instance seg benchmark notebook - Tweaked utils UI to scale according to Viewer size Co-Authored-By: gityves <[email protected]> * Many fixes - Fixed monai reqs - Added custom functions for label checking - Fixed return type of voronoi_otsu and utils.resize - black * Added pre-commit hooks * Update .pre-commit-config.yaml * Update pyproject.toml * Update pyproject.toml Ruff config * Enfore pre-commit style * Update .gitignore * Version bump * Revert "Version bump" This reverts commit 6e39971. * Updated project files * Fixed wrong value in instance sliders * Removing dask-image * Update test_plugin_utils.py * Relabeling tests * Added new pre-commit hooks * Latest pre-commit hooks * Run full suite of pre-commit hooks * Model class refactor * Added LR scheduler in training - Added ReduceLROnPlateau with params in training - Updated training guide - Minor UI attribute refactor - black * Update assess_instance.ipynb * Update .gitignore * Started adding WNet * Specify no grad in inference * First functional WNet inference, no CRF * Create test_models.py * Run full suite of pre-commit hooks * Patch for tests action + style * Add softNCuts basic test * Added crf Co-Authored-By: Nevexios <[email protected]> * More pre-commit checks * Functional CRF * Fix erroneous test comment, added toggle for crf - Warn if crf not installed - Fix test * Specify missing test deps * Trying to fix deps on Git * Removed master link to pydensecrf * Use commit hash * Removed commit hash * Removed master * Update tox.ini * Update pyproject.toml * Fixes and improvements - More CRF info - Added error handling to scheduler rate - Added ETA to training - Updated padding warning trigger size * Fixes and channel labeling prototype * Fixes - Fixed multi-channel instance and csv stats - Fixed rotation of inference outputs - Raised max crop size * Update plugin_model_inference.py * Update plugin_crop.py * Fixed patch_func sample number mismatch * Testing relabel tools * Fixes in inference * add model template + fix test + wnet loading opti - test fixes - changed crf input reqs - adapted instance seg for several channels * Update model_WNet.py * Update model_VNet.py * Fixed folder creation when saving to folder * Fix check_ready for results filewidget * Added remapping in WNet + ruff config * Run new hooks * Small docs update * Testing fix * Fixed multithread testing (locally) * Added proper tests for train/infer * Slight coverage increase * Update test_plugin_inference.py * Set window inference to 64 for WNet * Update instance_segmentation.py * Moved normalization to the correct place * Added auto-set dims for cropping * Update test_plugin_utils.py * More WNet - Added experimental .pt loading for jit models - More CRF tests - Optimized WNet by loading inference only * Update crf test/deps for testing * Update test_and_deploy.yml * Update test_and_deploy.yml * Update tox.ini * Update test_and_deploy.yml * Trying to fix tox install of pydensecrf * Added experimental ONNX support for inference * Updated WNet for ONNX conversion * Added dropout param * Minor fixes in training * Fix weights file extension in inference + coverage - Remove unused scripts - More tests - Fixed weights type in inference * Run all hooks * Fix inference testing * Changed anisotropy calculation * Finish rebase + bump version * Instance segmentation refactor + Voronoi-Otsu - Improved code for instance segmentation - Added Voronoi-Otsu labeling from pyclesperanto TODO : credits for labeling * Disabled small removal in Voronoi-Otsu * Added new docs for instance seg * Docs + UI update - Updated welcome/README - Changed step for DoubleCounter * Update requirements.txt Fix typo * isort * Fix tests * Fixed parental issues and instance seg widget init - Fixed widgets parents that were incorrectly init - Improve use of instance seg. method classes and init * Fix inference * Added labeling tools + UI tweaks - Added tools from MLCourse to evaluate labels and auto-correct them - Instance seg benchmark notebook - Tweaked utils UI to scale according to Viewer size Co-Authored-By: gityves <[email protected]> * Testing instance methods Co-Authored-By: gityves <[email protected]> * Many fixes - Fixed monai reqs - Added custom functions for label checking - Fixed return type of voronoi_otsu and utils.resize - black * black * Complete instance method evaluation * Added pre-commit hooks * Enfore pre-commit style * Update .gitignore * Version bump * Updated project files * Fixed missing parent error * Fixed wrong value in instance sliders * Removing dask-image * Fixed erroneous dtype conversion * Update test_plugin_utils.py * Temporary test action patch * Update plugin_convert.py * Update tox.ini Added pocl for testing on GH Actions * Update tox.ini * Found existing pocl * Updated utils test to avoid Voronoi-Otsu VO is missing CL runtime * Relabeling tests * Latest pre-commit hooks * Run full suite of pre-commit hooks * Enforce style * Instance segmentation refactor + Voronoi-Otsu - Improved code for instance segmentation - Added Voronoi-Otsu labeling from pyclesperanto TODO : credits for labeling * Disabled small removal in Voronoi-Otsu * Added new docs for instance seg * Docs + UI update - Updated welcome/README - Changed step for DoubleCounter * Update requirements.txt Fix typo * isort * Fix tests * Fixed parental issues and instance seg widget init - Fixed widgets parents that were incorrectly init - Improve use of instance seg. method classes and init * Fix inference * Added labeling tools + UI tweaks - Added tools from MLCourse to evaluate labels and auto-correct them - Instance seg benchmark notebook - Tweaked utils UI to scale according to Viewer size Co-Authored-By: gityves <[email protected]> * Testing instance methods Co-Authored-By: gityves <[email protected]> * Many fixes - Fixed monai reqs - Added custom functions for label checking - Fixed return type of voronoi_otsu and utils.resize - black * black * Complete instance method evaluation * Added pre-commit hooks * Update .pre-commit-config.yaml * Update pyproject.toml * Update pyproject.toml Ruff config * Enfore pre-commit style * Update .gitignore * Version bump * Revert "Version bump" This reverts commit 6e39971. * Updated project files * Fixed missing parent error * Fixed wrong value in instance sliders * Removing dask-image * Fixed erroneous dtype conversion * Update test_plugin_utils.py * Update plugin_convert.py * Update tox.ini Added pocl for testing on GH Actions * Update tox.ini * Found existing pocl * Updated utils test to avoid Voronoi-Otsu VO is missing CL runtime * Relabeling tests * Added new pre-commit hooks * Latest pre-commit hooks * Run full suite of pre-commit hooks * Model class refactor * Added LR scheduler in training - Added ReduceLROnPlateau with params in training - Updated training guide - Minor UI attribute refactor - black * Update assess_instance.ipynb * Update .gitignore * Started adding WNet * Specify no grad in inference * First functional WNet inference, no CRF * Create test_models.py * Run full suite of pre-commit hooks * Patch for tests action + style * Add softNCuts basic test * Added crf Co-Authored-By: Nevexios <[email protected]> * More pre-commit checks * Functional CRF * Fix erroneous test comment, added toggle for crf - Warn if crf not installed - Fix test * Specify missing test deps * Trying to fix deps on Git * Removed master link to pydensecrf * Use commit hash * Removed commit hash * Removed master * Update tox.ini * Update pyproject.toml * Fixes and improvements - More CRF info - Added error handling to scheduler rate - Added ETA to training - Updated padding warning trigger size * Fixes and channel labeling prototype * Fixes - Fixed multi-channel instance and csv stats - Fixed rotation of inference outputs - Raised max crop size * Update plugin_model_inference.py * Fixed patch_func sample number mismatch * Testing relabel tools * Fixes in inference * add model template + fix test + wnet loading opti - test fixes - changed crf input reqs - adapted instance seg for several channels * Update model_WNet.py * Update model_VNet.py * Fixed folder creation when saving to folder * Fix check_ready for results filewidget * Added remapping in WNet + ruff config * Run new hooks * Small docs update * Testing fix * Fixed multithread testing (locally) * Added proper tests for train/infer * Slight coverage increase * Update test_plugin_inference.py * Set window inference to 64 for WNet * Moved normalization to the correct place * Added auto-set dims for cropping * Update test_plugin_utils.py * More WNet - Added experimental .pt loading for jit models - More CRF tests - Optimized WNet by loading inference only * Update crf test/deps for testing * Update test_and_deploy.yml * Update test_and_deploy.yml * Update tox.ini * Update test_and_deploy.yml * Trying to fix tox install of pydensecrf * Added experimental ONNX support for inference * Updated WNet for ONNX conversion * Added dropout param * Minor fixes in training * Fix weights file extension in inference + coverage - Remove unused scripts - More tests - Fixed weights type in inference * Run all hooks * Fix inference testing * Changed anisotropy calculation * Fixed aniso correction and CRF interaction * Remove duplicate tests * Finish rebase + changed step to auto in spinbox * Updated based on feedback from CYHSM Co-Authored-By: Markus Frey <[email protected]> * Added minimal WNet notebook for training * Remove dask * WNet model docs * Added QoL shape info for layer selecter * WNet fixes + PR feedback improvements * Added imagecodecs to open external datasets --------- Co-authored-by: gityves <[email protected]> Co-authored-by: Nevexios <[email protected]> Co-authored-by: Markus Frey <[email protected]>
1 parent e00806c commit 634f5a4

Some content is hidden

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

76 files changed

+4502
-1733
lines changed

.coveragerc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[report]
2+
exclude_lines =
3+
if __name__ == .__main__.:
4+
5+
[run]
6+
omit =
7+
napari_cellseg3d/setup.py

.github/workflows/test_and_deploy.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ on:
77
push:
88
branches:
99
- main
10-
- npe2
11-
- cy/voronoi-otsu
1210
tags:
1311
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
1412
pull_request:
1513
branches:
1614
- main
17-
- npe2
18-
- cy/voronoi-otsu
1915
workflow_dispatch:
2016

2117
jobs:
@@ -55,6 +51,7 @@ jobs:
5551
run: |
5652
python -m pip install --upgrade pip
5753
python -m pip install setuptools tox tox-gh-actions
54+
# pip install git+https://github.com/lucasb-eyer/pydensecrf.git@master#egg=pydensecrf
5855

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ notebooks/csv_cell_plot.html
104104
notebooks/full_plot.html
105105
*.csv
106106
*.png
107+
notebooks/instance_test.ipynb
107108
*.prof
108109

109110
#include test data
110111
!napari_cellseg3d/_tests/res/test.tif
111112
!napari_cellseg3d/_tests/res/test.png
112113
!napari_cellseg3d/_tests/res/test_labels.tif
114+
cov.syspath.txt

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Welcome to napari-cellseg3d's documentation!
3939
res/code/plugin_convert
4040
res/code/plugin_metrics
4141
res/code/model_framework
42-
res/code/model_workers
43-
res/code/model_instance_seg
42+
res/code/workers
43+
res/code/instance_segmentation
4444
res/code/plugin_model_inference
4545
res/code/plugin_model_training
4646
res/code/utils
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
instance_segmentation.py
2+
===========================================
3+
4+
Classes
5+
-------------
6+
7+
InstanceMethod
8+
**************************************
9+
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::InstanceMethod
10+
:members: __init__
11+
12+
ConnectedComponents
13+
**************************************
14+
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::ConnectedComponents
15+
:members: __init__
16+
17+
Watershed
18+
**************************************
19+
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::Watershed
20+
:members: __init__
21+
22+
VoronoiOtsu
23+
**************************************
24+
.. autoclass:: napari_cellseg3d.code_models.instance_segmentation::VoronoiOtsu
25+
:members: __init__
26+
27+
28+
Functions
29+
-------------
30+
31+
binary_connected
32+
**************************************
33+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::binary_connected
34+
35+
binary_watershed
36+
**************************************
37+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::binary_watershed
38+
39+
volume_stats
40+
**************************************
41+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::volume_stats
42+
43+
clear_small_objects
44+
**************************************
45+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::clear_small_objects
46+
47+
to_instance
48+
**************************************
49+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::to_instance
50+
51+
to_semantic
52+
**************************************
53+
.. autofunction:: napari_cellseg3d.code_models.instance_segmentation::to_semantic

docs/res/code/model_instance_seg.rst

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/res/code/plugin_convert.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,3 @@ ThresholdUtils
2828
**********************************
2929
.. autoclass:: napari_cellseg3d.code_plugins.plugin_convert::ThresholdUtils
3030
:members: __init__
31-
32-
Functions
33-
-----------------------------------
34-
35-
save_folder
36-
*****************************************
37-
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::save_folder
38-
39-
save_layer
40-
****************************************
41-
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::save_layer
42-
43-
show_result
44-
****************************************
45-
.. autofunction:: napari_cellseg3d.code_plugins.plugin_convert::show_result

docs/res/code/plugin_model_training.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ Methods
1818

1919
Attributes
2020
*********************
21-
2221
.. autoclass:: napari_cellseg3d.code_plugins.plugin_model_training::Trainer
2322
:members: _viewer, worker, loss_dict, canvas, train_loss_plot, dice_metric_plot

docs/res/code/utils.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,3 @@ denormalize_y
6262
load_images
6363
**************************************
6464
.. autofunction:: napari_cellseg3d.utils::load_images
65-
66-
format_Warning
67-
**************************************
68-
.. autofunction:: napari_cellseg3d.utils::format_Warning
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
model_workers.py
1+
workers.py
22
===========================================
33

44

@@ -10,7 +10,7 @@ Class : LogSignal
1010

1111
Attributes
1212
************************
13-
.. autoclass:: napari_cellseg3d.code_models.model_workers::LogSignal
13+
.. autoclass:: napari_cellseg3d.code_models.workers::LogSignal
1414
:members: log_signal
1515
:noindex:
1616

@@ -24,7 +24,7 @@ Class : InferenceWorker
2424

2525
Methods
2626
************************
27-
.. autoclass:: napari_cellseg3d.code_models.model_workers::InferenceWorker
27+
.. autoclass:: napari_cellseg3d.code_models.workers::InferenceWorker
2828
:members: __init__, log, create_inference_dict, inference
2929
:noindex:
3030

@@ -39,6 +39,6 @@ Class : TrainingWorker
3939

4040
Methods
4141
************************
42-
.. autoclass:: napari_cellseg3d.code_models.model_workers::TrainingWorker
42+
.. autoclass:: napari_cellseg3d.code_models.workers::TrainingWorker
4343
:members: __init__, log, train
4444
:noindex:

0 commit comments

Comments
 (0)