Skip to content

Commit bee33f5

Browse files
authored
Update tests (#97)
* Fix default mutables in config * Re-enable CRF optional dependency * Fix layer set to invisible causing test errors * Update README.md * Update credits for example data
1 parent ee7944e commit bee33f5

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

examples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Testing CellSeg3D on demo data
22

33
Here is a very small volume (from [IDR project 853](https://idr.openmicroscopy.org/webclient/?show=project-853)) to test on.
4+
All credits to the original authors of the data.
45
You can install, launch `napari`, activate the CellSeg3D plugin app, and drag & drop this volume into the canvas.
5-
Then, for example, run `inference` with one of our models.
6-
7-
See [CellSeg3D documentation](https://adaptivemotorcontrollab.github.io/CellSeg3D/welcome.html) for more details.
6+
Then, for example, run the `Inference` module with one of our models.
87

8+
See [CellSeg3D documentation](https://adaptivemotorcontrollab.github.io/CellSeg3D/welcome.html) for more details.

napari_cellseg3d/code_plugins/plugin_crop.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(self, viewer: "napari.viewer.Viewer", parent=None):
7575

7676
self.create_new_layer = ui.CheckBox("Create new layers")
7777
self.create_new_layer.setToolTip(
78-
'Use this to create a new layer everytime you start cropping, so you can "zoom in" your volume'
78+
'Use this to create a new layer every time you start cropping, so you can "zoom in" your volume'
7979
)
8080

8181
self._viewer.layers.events.inserted.connect(self._check_image_list)
@@ -324,8 +324,9 @@ def _start(self):
324324

325325
if self.crop_second_image:
326326
self.image_layer2 = self._add_isotropic_layer(
327-
self.image_layer2, visible=False
327+
self.image_layer2
328328
)
329+
self.image_layer2.visible = False
329330
else:
330331
self.image_layer1.opacity = 0.7
331332
self.image_layer1.colormap = "inferno"

napari_cellseg3d/config.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Module to store configuration parameters for napari_cellseg3d."""
22
import datetime
3-
from dataclasses import dataclass
3+
from dataclasses import dataclass, field
44
from pathlib import Path
55
from typing import List, Optional
66

@@ -182,9 +182,9 @@ class PostProcessConfig:
182182
instance (InstanceSegConfig): instance segmentation config
183183
"""
184184

185-
zoom: Zoom = Zoom()
186-
thresholding: Thresholding = Thresholding()
187-
instance: InstanceSegConfig = InstanceSegConfig()
185+
zoom: Zoom = field(default_factory=Zoom)
186+
thresholding: Thresholding = field(default_factory=Thresholding)
187+
instance: InstanceSegConfig = field(default_factory=InstanceSegConfig)
188188
artifact_removal: bool = False
189189
artifact_removal_size: int = 500
190190

@@ -265,16 +265,16 @@ class InferenceWorkerConfig:
265265
"""
266266

267267
device: str = "cpu"
268-
model_info: ModelInfo = ModelInfo()
269-
weights_config: WeightsInfo = WeightsInfo()
268+
model_info: ModelInfo = field(default_factory=ModelInfo)
269+
weights_config: WeightsInfo = field(default_factory=WeightsInfo)
270270
results_path: str = str(Path.home() / "cellseg3d" / "inference")
271271
filetype: str = ".tif"
272272
keep_on_cpu: bool = False
273273
compute_stats: bool = False
274-
post_process_config: PostProcessConfig = PostProcessConfig()
275-
sliding_window_config: SlidingWindowConfig = SlidingWindowConfig()
274+
post_process_config: PostProcessConfig = field(default_factory=PostProcessConfig)
275+
sliding_window_config: SlidingWindowConfig = field(default_factory=SlidingWindowConfig)
276276
use_crf: bool = False
277-
crf_config: CRFConfig = CRFConfig()
277+
crf_config: CRFConfig = field(default_factory=CRFConfig)
278278

279279
images_filepaths: List[str] = None
280280
layer: napari.layers.Layer = None
@@ -329,10 +329,10 @@ class TrainingWorkerConfig:
329329
learning_rate: np.float64 = 1e-3
330330
validation_interval: int = 2
331331
batch_size: int = 1
332-
deterministic_config: DeterministicConfig = DeterministicConfig()
332+
deterministic_config: DeterministicConfig = field(default_factory=DeterministicConfig)
333333
scheduler_factor: float = 0.5
334334
scheduler_patience: int = 10
335-
weights_info: WeightsInfo = WeightsInfo()
335+
weights_info: WeightsInfo = field(default_factory=WeightsInfo)
336336
# data params
337337
results_path_folder: str = str(Path.home() / "cellseg3d" / "training")
338338
sampling: bool = False

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ profile = "black"
123123
line_length = 79
124124

125125
[project.optional-dependencies]
126-
#crf = [
127-
# "pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git#egg=master",
128-
#]
126+
crf = [
127+
"pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git#egg=master",
128+
]
129129
pyqt5 = [
130130
"pyqt5",
131131
]
@@ -164,7 +164,7 @@ test = [
164164
"coverage",
165165
"tox",
166166
"twine",
167-
# "pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git#egg=master",
167+
"pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git#egg=master",
168168
"onnx",
169169
"onnxruntime",
170170
]

0 commit comments

Comments
 (0)