Skip to content

Commit d2a9399

Browse files
committed
Merge branch 'feature/swinunetr' of https://github.com/AdaptiveMotorControlLab/CellSeg3d into feature/swinunetr
2 parents da713e5 + 1030581 commit d2a9399

File tree

8 files changed

+933
-615
lines changed

8 files changed

+933
-615
lines changed

napari_cellseg3d/interface.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ def set_required(self, is_required):
341341
"""If set to True, will be colored red if incorrectly set"""
342342
if is_required:
343343
self.text_field.textChanged.connect(self.check_ready)
344-
self.check_ready()
344+
else:
345+
self.text_field.textChanged.disconnect(self.check_ready)
346+
self.check_ready()
345347

346348
def update_field_color(self, color: str):
347349
"""Updates the background of the text field"""
@@ -501,10 +503,10 @@ def __init__(
501503
label: Optional[str] = None,
502504
):
503505
"""Args:
504-
min (Optional[int]): minimum value, defaults to 0
505-
max (Optional[int]): maximum value, defaults to 10
506-
default (Optional[int]): default value, defaults to 0
507-
step (Optional[int]): step value, defaults to 1
506+
min (Optional[float]): minimum value, defaults to 0
507+
max (Optional[float]): maximum value, defaults to 10
508+
default (Optional[float]): default value, defaults to 0
509+
step (Optional[float]): step value, defaults to 1
508510
parent: parent widget, defaults to None
509511
fixed (bool): if True, sets the QSizePolicy of the spinbox to Fixed
510512
label (Optional[str]): if provided, creates a label with the chosen title to use with the counter"""

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)