Skip to content

Commit 03b2b01

Browse files
authored
Merge branch 'cy/training' into cy/wnet-train
2 parents d533a3b + 7a4e31f commit 03b2b01

File tree

14 files changed

+396
-152
lines changed

14 files changed

+396
-152
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
push:
88
branches:
99
- main
10-
- cy/wnet-train
1110
tags:
1211
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
1312
pull_request:

napari_cellseg3d/_tests/test_inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_inference_on_folder():
6666
config.images_filepaths = [
6767
str(Path(__file__).resolve().parent / "res/test.tif")
6868
]
69+
6970
config.sliding_window_config.window_size = 8
7071

7172
class mock_work:

napari_cellseg3d/_tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_model_list():
2727
for model_name in MODEL_LIST:
2828
# if model_name=="test":
2929
# continue
30-
dims = 128
30+
dims = 64
3131
test = MODEL_LIST[model_name](
3232
input_img_size=[dims, dims, dims],
3333
in_channels=1,

napari_cellseg3d/_tests/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import random
22
from functools import partial
33
from pathlib import Path
4-
54
import numpy as np
65
import pytest
76
import torch

napari_cellseg3d/code_models/crf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
Philipp Krähenbühl and Vladlen Koltun
88
NIPS 2011
99
10-
Implemented using the pydense libary available at https://github.com/kodalli/pydensecrf.
10+
Implemented using the pydense library available at https://github.com/kodalli/pydensecrf.
1111
"""
12+
1213
from warnings import warn
1314

1415
try:

napari_cellseg3d/code_plugins/plugin_base.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,10 @@ def _update_default_paths(self, path=None):
463463
self.extract_dataset_paths(self.validation_filepaths),
464464
self.results_path,
465465
]
466-
return
466+
return utils.parse_default_path(self._default_path)
467467
if Path(path).is_dir():
468468
self._default_path.append(path)
469+
return utils.parse_default_path(self._default_path)
469470

470471
@staticmethod
471472
def extract_dataset_paths(paths):
@@ -476,8 +477,43 @@ def extract_dataset_paths(paths):
476477
return None
477478
return str(Path(paths[0]).parent)
478479

480+
479481
def _check_all_filepaths(self):
480482
self.image_filewidget.check_ready()
481483
self.labels_filewidget.check_ready()
482484
self.results_filewidget.check_ready()
483485
self.unsupervised_images_filewidget.check_ready()
486+
487+
class BasePluginUtils(BasePluginFolder):
488+
"""Small subclass used to have centralized widgets layer and result path selection in utilities"""
489+
490+
save_path = None
491+
utils_default_paths = [Path.home() / "cellseg3d"]
492+
493+
def __init__(
494+
self,
495+
viewer: napari.viewer.Viewer,
496+
parent=None,
497+
loads_images=True,
498+
loads_labels=True,
499+
):
500+
super().__init__(
501+
viewer=viewer,
502+
loads_images=loads_images,
503+
loads_labels=loads_labels,
504+
parent=parent,
505+
)
506+
if parent is not None:
507+
self.setParent(parent)
508+
self.parent = parent
509+
510+
self.layer = None
511+
"""Should contain the layer associated with the results of the utility widget"""
512+
513+
def _update_default_paths(self, path=None):
514+
"""Override to also update utilities' pool of default paths"""
515+
default_path = super()._update_default_paths(path)
516+
logger.debug(f"Trying to update default with {default_path}")
517+
if default_path is not None:
518+
self.utils_default_paths.append(default_path)
519+

0 commit comments

Comments
 (0)