Skip to content

Commit 23578a4

Browse files
committed
Button fix + log
- Fixed button behaviour - Fixed log text errors
1 parent a765860 commit 23578a4

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
@@ -257,7 +257,7 @@ def load_layer(self):
257257

258258
volume = np.swapaxes(
259259
volume, 0, 2
260-
) # for anisotropy to be monai-like, i.e. zyx
260+
) # for anisotropy to be monai-like, i.e. zyx # FIXME rotation not always correct
261261
print("Loading layer")
262262
dims_check = volume.shape
263263
self.log("\nChecking dimensions...")
@@ -321,7 +321,7 @@ def aniso_transform(self, image):
321321
)
322322
return anisotropic_transform(image[0])
323323

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

326326
if image_id is not None:
327327
self.log(f"\nRunning instance segmentation for image n°{image_id}")
@@ -479,7 +479,7 @@ def inference_on_layer(self, image, model, post_process_transforms):
479479
# File output save name : original-name_model_date+time_number.filetype
480480
file_path = os.path.join(
481481
self.results_path,
482-
f"Prediction_"
482+
f"Prediction_layer"
483483
+ "_"
484484
+ self.model_dict["name"]
485485
+ 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
##################
@@ -651,6 +657,7 @@ def start(self, on_layer=False):
651657
else: # once worker is started, update buttons
652658
self.worker.start()
653659
self.btn_start.setText("Running... Click to stop")
660+
self.btn_start_layer.setVisible(False)
654661

655662
def on_start(self):
656663
"""Catches start signal from worker to call :py:func:`~display_status_report`"""
@@ -677,6 +684,7 @@ def on_finish(self):
677684
self.log.print_and_log(f"\nWorker finished at {utils.get_time()}")
678685
self.log.print_and_log("*" * 20)
679686
self.btn_start.setText("Start on folder")
687+
self.btn_start_layer.setVisible(True)
680688
self.btn_close.setVisible(True)
681689

682690
self.worker = None

0 commit comments

Comments
 (0)