Skip to content

Commit fde3c71

Browse files
authored
Merge pull request #26 from AdaptiveMotorControlLab/cy/layer-inference
Inference on layer
2 parents f88a38a + ea11dbd commit fde3c71

File tree

7 files changed

+828
-581
lines changed

7 files changed

+828
-581
lines changed

napari_cellseg3d/interface.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ def set_required(self, is_required):
335335
"""If set to True, will be colored red if incorrectly set"""
336336
if is_required:
337337
self.text_field.textChanged.connect(self.check_ready)
338-
self.check_ready()
338+
else:
339+
self.text_field.textChanged.disconnect(self.check_ready)
340+
self.check_ready()
339341

340342
def update_field_color(self, color: str):
341343
"""Updates the background of the text field"""
@@ -494,10 +496,10 @@ def __init__(
494496
fixed: Optional[bool] = True,
495497
):
496498
"""Args:
497-
min (Optional[int]): minimum value, defaults to 0
498-
max (Optional[int]): maximum value, defaults to 10
499-
default (Optional[int]): default value, defaults to 0
500-
step (Optional[int]): step value, defaults to 1
499+
min (Optional[float]): minimum value, defaults to 0
500+
max (Optional[float]): maximum value, defaults to 10
501+
default (Optional[float]): default value, defaults to 0
502+
step (Optional[float]): step value, defaults to 1
501503
parent: parent widget, defaults to None
502504
fixed (bool): if True, sets the QSizePolicy of the spinbox to Fixed"""
503505

napari_cellseg3d/model_instance_seg.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,19 @@ def volume_stats(volume_image):
194194
"""
195195

196196
properties = regionprops(volume_image)
197-
number_objects = np.amax(volume_image)
198197

199-
sphericity_va = []
200-
sphericity_ax = [
201-
sphericity_axis(
202-
region.axis_major_length * 0.5, region.axis_minor_length * 0.5
203-
)
204-
for region in properties
205-
]
198+
# sphericity_va = []
199+
def sphericity(region):
200+
try:
201+
return sphericity_axis(
202+
region.axis_major_length * 0.5, region.axis_minor_length * 0.5
203+
)
204+
except ValueError:
205+
return (
206+
np.nan
207+
) # FIXME better way ? inconsistent errors in region.axis_minor_length
208+
209+
sphericity_ax = [sphericity(region) for region in properties]
206210
# for region in properties:
207211
# object = (volume_image == region.label).transpose(1, 2, 0)
208212
# verts, faces, _, values = marching_cubes(

0 commit comments

Comments
 (0)