Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complexity in prediction widget #308

Open
qin-yu opened this issue Sep 4, 2024 · 3 comments
Open

Complexity in prediction widget #308

qin-yu opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
BioImage.IO Related to BioImage.IO and AI4Life enhancement New feature or request GUI Napari GUI related

Comments

@qin-yu
Copy link
Collaborator

qin-yu commented Sep 4, 2024

To make it a no-brainer:

  1. Provide halo for models:
    1. Fix halo implementation and tiling artefact #220
    2. Recommend users a halo for U-Nets #252
  2. Provide patch size for samples:
    1. Automatic patch shape recommendation #302
    2. Compute best patch and halo shapes by default, reduce user effort #307
  3. Make model filters look different and like filters:
    1. Improve model filters | Use RadioButtons | Custom modality #314
  4. Unify prediction of PlantSeg zoo and Bioimage.IO model zoo, avoiding choices for users.
@qin-yu qin-yu added enhancement New feature or request BioImage.IO Related to BioImage.IO and AI4Life GUI Napari GUI related labels Sep 4, 2024
@qin-yu qin-yu self-assigned this Sep 4, 2024
@qin-yu qin-yu pinned this issue Sep 4, 2024
@qin-yu
Copy link
Collaborator Author

qin-yu commented Sep 10, 2024

Hi @tlambert03,

I hope you're doing well! I would like to consult you regarding a layout question for a @magicgui widget in my software.

Context

I am working on a widget that uses three ComboBoxes ("Dimensionality", "Microscopy modality", and "Prediction type") to filter a "PlantSeg model". My goal is to improve the visual organization of the widget.

Current Layout

I currently have the following layout:

PlantSeg model model a
Dimensionality 3D
Microscopy modality confocal
Prediction type boundary

image

Desired Layout

I would like to restructure it into the following format, where the filters are arranged horizontally beneath the "PlantSeg model":

PlantSeg model mo- dal a
Dimensionality Microscopy modality Prediction type
Filters 3D confocal boundary

This format organizes the "PlantSeg model" row above the filter labels and values, making it easier to understand at a glance.

Question

Could you guide me on the best way to achieve this custom layout in Magicgui? Is there a recommended way to arrange the ComboBoxes in a table-like structure or grid within the widget?

Many thanks!

@tlambert03
Copy link
Contributor

unfortunately, magicgui doesn't yet implement any complex grid/table layouts. So you'll have to build it with subwidgets arranged in a Container.

This may of course mean that you no longer have a single function that you can mark with a single decorator, so you will likely need your function to access widgets defined outside of the scope of your run function. For example

from typing import Literal

from magicgui import magicgui
from magicgui.widgets import Container, create_widget

# horizontal layout
cont = Container(
    widgets=[
        create_widget(annotation=Literal["a", "b"], name="dimensionality"),
        create_widget(annotation=Literal["c", "d"], name="modality"),
        create_widget(annotation=Literal["e", "f"], name="prediction_type"),
    ],
    layout="horizontal",
)


def main_func(image: str, mode: str, prediction_type: str, device: str):
    # access values either with asdict or by widget name
    print(cont.asdict())
    print(cont.dimensionality.value)


widget = magicgui(main_func)
# insert the horizontal layout container at index 2
widget.insert(2, cont)

widget.show(run=True)
Screenshot 2024-09-10 at 2 25 24 PM

note that there is no currently to have that subcontainer fill the whole row

qin-yu added a commit that referenced this issue Sep 11, 2024
Refactor dimensions, modalities, and output types ComboBoxes into a unified component to improve the interface and enhance user experience

Co-authored-by: Talley Lambert <[email protected]>
qin-yu added a commit that referenced this issue Sep 11, 2024
Refactor dimensions, modalities, and output types ComboBoxes into a unified component to improve the interface and enhance user experience

Co-authored-by: Talley Lambert <[email protected]>
@qin-yu
Copy link
Collaborator Author

qin-yu commented Sep 11, 2024

Thank you so much, @tlambert03! I followed your detailed suggestions, and the new UI is working great. I’ve just pushed commit 2ccfcb1, adding you as a co-author. Please let me know if you spot any areas for further improvement!

(I force pushed twice, 053dffb and f3e1667 are no longer valid).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BioImage.IO Related to BioImage.IO and AI4Life enhancement New feature or request GUI Napari GUI related
Projects
None yet
Development

No branches or pull requests

2 participants