Skip to content

Commit 30387e9

Browse files
committed
Button fix + log
- Fixed button behaviour - Fixed log text errors
1 parent 32f9b4f commit 30387e9

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

napari_cellseg3d/model_workers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def load_layer(self):
357357

358358
volume = np.swapaxes(
359359
volume, 0, 2
360-
) # for anisotropy to be monai-like, i.e. zyx
360+
) # for anisotropy to be monai-like, i.e. zyx # FIXME rotation not always correct
361361
print("Loading layer")
362362
dims_check = volume.shape
363363
self.log("\nChecking dimensions...")
@@ -421,7 +421,7 @@ def aniso_transform(self, image):
421421
)
422422
return anisotropic_transform(image[0])
423423

424-
def instance_seg(self, to_instance, image_id=None, original_filename=""):
424+
def instance_seg(self, to_instance, image_id=0, original_filename="layer"):
425425

426426
if image_id is not None:
427427
self.log(f"\nRunning instance segmentation for image n°{image_id}")
@@ -579,7 +579,7 @@ def inference_on_layer(self, image, model, post_process_transforms):
579579
# File output save name : original-name_model_date+time_number.filetype
580580
file_path = os.path.join(
581581
self.results_path,
582-
f"Prediction_"
582+
f"Prediction_layer"
583583
+ "_"
584584
+ self.model_dict["name"]
585585
+ f"_{time}_"

napari_cellseg3d/plugin_model_inference.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
220220
"Image size on which the SegResNet has been trained (default : 128)"
221221
)
222222

223-
thresh_desc = "Thresholding : all values in the image below the chosen probability threshold will be set to 0, and all others to 1."
223+
thresh_desc = "Thresholding : all values in the image below the chosen probability" \
224+
" threshold will be set to 0, and all others to 1."
224225
self.thresholding_checkbox.setToolTip(thresh_desc)
225226
self.thresholding_count.setToolTip(thresh_desc)
226227
self.window_infer_box.setToolTip(
@@ -235,12 +236,16 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
235236
"If enabled, data will be kept on the RAM rather than the VRAM.\nCan avoid out of memory issues with CUDA"
236237
)
237238
self.instance_box.setToolTip(
238-
"Instance segmentation will convert instance (0/1) labels to labels that attempt to assign an unique ID to each cell."
239+
"Instance segmentation will convert instance (0/1) labels to labels"
240+
" that attempt to assign an unique ID to each cell."
239241
)
240242
self.instance_method_choice.setToolTip(
241243
"Choose which method to use for instance segmentation"
242-
"\nConnected components : all separated objects will be assigned an unique ID. Robust but will not work correctly with adjacent/touching objects\n"
243-
"Watershed : assigns objects ID based on the probability gradient surrounding an object. Requires the model to surround objects in a gradient; can possibly correctly separate unique but touching/adjacent objects."
244+
"\nConnected components : all separated objects will be assigned an unique ID. "
245+
"Robust but will not work correctly with adjacent/touching objects\n"
246+
"Watershed : assigns objects ID based on the probability gradient surrounding an object. "
247+
"Requires the model to surround objects in a gradient;"
248+
" can possibly correctly separate unique but touching/adjacent objects."
244249
)
245250
self.instance_prob_thresh.setToolTip(
246251
"All objects below this probability will be ignored (set to 0)"
@@ -249,7 +254,8 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
249254
"Will remove all objects smaller (in volume) than the specified number of pixels"
250255
)
251256
self.save_stats_to_csv_box.setToolTip(
252-
"Will save several statistics for each object to a csv in the results folder. Stats include : volume, centroid coordinates, sphericity"
257+
"Will save several statistics for each object to a csv in the results folder. Stats include : "
258+
"volume, centroid coordinates, sphericity"
253259
)
254260
##################
255261
##################
@@ -654,6 +660,7 @@ def start(self, on_layer=False):
654660
else: # once worker is started, update buttons
655661
self.worker.start()
656662
self.btn_start.setText("Running... Click to stop")
663+
self.btn_start_layer.setVisible(False)
657664

658665
def on_start(self):
659666
"""Catches start signal from worker to call :py:func:`~display_status_report`"""
@@ -680,6 +687,7 @@ def on_finish(self):
680687
self.log.print_and_log(f"\nWorker finished at {utils.get_time()}")
681688
self.log.print_and_log("*" * 20)
682689
self.btn_start.setText("Start on folder")
690+
self.btn_start_layer.setVisible(True)
683691
self.btn_close.setVisible(True)
684692

685693
self.worker = None

0 commit comments

Comments
 (0)