Skip to content

Commit

Permalink
fix(agglomeration): fix mode str, related to #325
Browse files Browse the repository at this point in the history
Better make `Enum`s. But some refactored `Enum`s in PlantSeg are really hard to use. Need to refactor and make a generic class with `to_choice()`
  • Loading branch information
qin-yu committed Sep 19, 2024
1 parent bd7365a commit f4251cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plantseg/viewer_napari/widgets/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
########################################################################################################################

STACKED = [('2D Watershed', True), ('3D Watershed', False)]
AGGLOMERATION_MODES = [('GASP', 'gasp'), ('MutexWS', 'mutex_ws'), ('MultiCut', 'multicut')]


@magicgui(
Expand All @@ -31,7 +32,7 @@
},
mode={
'label': 'Agglomeration mode',
'choices': ['GASP', 'MutexWS', 'MultiCut'],
'choices': AGGLOMERATION_MODES,
'tooltip': 'Select which agglomeration algorithm to use.',
"widget_type": "RadioButtons",
"orientation": "horizontal",
Expand All @@ -52,7 +53,7 @@
def widget_agglomeration(
image: Image,
superpixels: Labels,
mode: str = "GASP",
mode: str = AGGLOMERATION_MODES[0][1],
beta: float = 0.6,
minsize: int = 100,
) -> Future[LayerDataTuple]:
Expand Down

0 comments on commit f4251cb

Please sign in to comment.