Skip to content

Commit 12916f9

Browse files
committed
Update V-O defaults
1 parent dd020bd commit 12916f9

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

napari_cellseg3d/code_models/instance_segmentation.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Instance segmentation methods for 3D images."""
2+
23
import abc
34
from dataclasses import dataclass
45
from functools import partial
@@ -128,14 +129,14 @@ def record_parameters(self):
128129
"""Records all the parameters of the instance segmentation method from the current values of the widgets."""
129130
if len(self.sliders) > 0:
130131
for slider in self.sliders:
131-
self.recorded_parameters[
132-
slider.label.text()
133-
] = slider.slider_value
132+
self.recorded_parameters[slider.label.text()] = (
133+
slider.slider_value
134+
)
134135
if len(self.counters) > 0:
135136
for counter in self.counters:
136-
self.recorded_parameters[
137-
counter.label.text()
138-
] = counter.value()
137+
self.recorded_parameters[counter.label.text()] = (
138+
counter.value()
139+
)
139140

140141
def run_method_from_params(self, image):
141142
"""Runs the method on the image with the RECORDED parameters set in the widget.
@@ -327,10 +328,9 @@ def binary_connected(
327328
)
328329
semantic = np.squeeze(volume)
329330
foreground = np.where(semantic > thres, volume, 0) # int(255 * thres)
330-
segm = label(foreground)
331-
segm = remove_small_objects(segm, thres_small)
331+
seg = label(foreground)
332+
return remove_small_objects(seg, thres_small)
332333

333-
return segm
334334

335335

336336
def binary_watershed(
@@ -551,9 +551,9 @@ def __init__(self, widget_parent=None):
551551
)
552552

553553
self.sliders[0].label.setText("Foreground probability threshold")
554-
self.sliders[
555-
0
556-
].tooltips = "Probability threshold for foreground object"
554+
self.sliders[0].tooltips = (
555+
"Probability threshold for foreground object"
556+
)
557557
self.sliders[0].setValue(500)
558558

559559
self.sliders[1].label.setText("Seed probability threshold")
@@ -652,9 +652,9 @@ def __init__(self, widget_parent=None):
652652
)
653653

654654
self.sliders[0].label.setText("Foreground probability threshold")
655-
self.sliders[
656-
0
657-
].tooltips = "Probability threshold for foreground object"
655+
self.sliders[0].tooltips = (
656+
"Probability threshold for foreground object"
657+
)
658658
self.sliders[0].setValue(800)
659659

660660
self.counters[0].label.setText("Small objects removal")
@@ -715,18 +715,18 @@ def __init__(self, widget_parent=None):
715715
widget_parent=widget_parent,
716716
)
717717
self.counters[0].label.setText("Spot sigma") # closeness
718-
self.counters[
719-
0
720-
].tooltips = "Determines how close detected objects can be"
718+
self.counters[0].tooltips = (
719+
"Determines how close detected objects can be"
720+
)
721721
self.counters[0].setMaximum(100)
722-
self.counters[0].setValue(2)
722+
self.counters[0].setValue(0.65)
723723

724724
self.counters[1].label.setText("Outline sigma") # smoothness
725-
self.counters[
726-
1
727-
].tooltips = "Determines the smoothness of the segmentation"
725+
self.counters[1].tooltips = (
726+
"Determines the smoothness of the segmentation"
727+
)
728728
self.counters[1].setMaximum(100)
729-
self.counters[1].setValue(2)
729+
self.counters[1].setValue(0.65)
730730

731731
self.counters[2].label.setText("Small object removal")
732732
self.counters[2].tooltips = (

0 commit comments

Comments
 (0)