Skip to content

Commit

Permalink
Hotfix : v0.1.1 (#62)
Browse files Browse the repository at this point in the history
* Fix shape >3 issues in sliding_window

* Fix artefact removal widget visibility
  • Loading branch information
C-Achard authored Dec 14, 2023
1 parent 50c252e commit 0083e99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion napari_cellseg3d/code_models/instance_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def sliding_window(volume, func, patch_size=512, increment_labels=True):
"""
result = np.zeros(volume.shape, dtype=np.uint32)
max_label_id = 0
x, y, z = volume.shape
x, y, z = volume.shape[-3:]
pbar_total = (x // patch_size) * (y // patch_size) * (z // patch_size)
pbar = tqdm(total=pbar_total)
for i in range(0, x, patch_size):
Expand Down
5 changes: 4 additions & 1 deletion napari_cellseg3d/code_plugins/plugin_model_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ def _toggle_display_instance(self):
def _toggle_artifact_removal_widgets(self):
"""Shows or hides the options for instance segmentation based on current user selection."""
ui.toggle_visibility(self.use_instance_choice, self.artifact_container)
ui.toggle_visibility(
self.use_instance_choice, self.attempt_artifact_removal_box
)

def _toggle_display_window_size(self):
"""Show or hide window size choice depending on status of self.window_infer_box."""
Expand Down Expand Up @@ -513,7 +516,7 @@ def _build(self):
self.artifact_removal_size,
],
)
# self.attempt_artifact_removal_box.setVisible(False)
self.attempt_artifact_removal_box.setVisible(False)
self.remove_artifacts_label.setVisible(False)
self.artifact_removal_size.setVisible(False)

Expand Down
9 changes: 5 additions & 4 deletions napari_cellseg3d/dev_scripts/sliding_window_voronoi.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Test script for sliding window Voronoi-Otsu segmentation.""."""
import numpy as np
import pyclesperanto_prototype as cle
from tqdm import tqdm


def sliding_window_voronoi_otsu(volume, spot_sigma, outline_sigma, patch_size):
"""Given a volume of dimensions HxWxD, a spot_sigma and an outline_sigma,
perform Voronoi-Otsu segmentation on the volume using a sliding window of
size patch_size. If the edge has been reached, the patch size is reduced
"""Given a volume of dimensions HxWxD, a spot_sigma and an outline_sigma, perform Voronoi-Otsu segmentation on the volume using a sliding window of size patch_size.
If the edge has been reached, the patch size is reduced
to fit the remaining space. The result is a segmentation of the same size
as the input volume.
Expand All @@ -18,7 +19,7 @@ def sliding_window_voronoi_otsu(volume, spot_sigma, outline_sigma, patch_size):
"""
result = np.zeros(volume.shape, dtype=np.uint32)
max_label_id = 0
x, y, z = volume.shape
x, y, z = volume.shape[-3:]
for i in tqdm(range(0, x, patch_size)):
for j in range(0, y, patch_size):
for k in range(0, z, patch_size):
Expand Down

0 comments on commit 0083e99

Please sign in to comment.