This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LazyImporter: | |
def __init__(self, name: str, alias: str = None): | |
self._name = name | |
self._alias = alias or name | |
def __repr__(self): | |
return repr(self._mod) | |
def __str__(self): | |
return str(self._mod) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from magicclass import magicclass, field | |
from magicclass.widgets import Figure | |
from magicgui.widgets import CheckBox, Container | |
@magicclass | |
class A: | |
plt = field(Figure) | |
cbs = field(Container) | |
def add_plot(self): | |
line, *_ = self.plt.ax.plot(np.random.random(100)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import napari | |
import numpy as np | |
class MtModel: | |
def __init__( | |
self, | |
npf: int = 13, | |
start: int = 3, | |
space: float = 4.0, | |
radius: float = 9.8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from qtpy.QtWidgets import QWidget, QFileSystemModel, QTreeView, QGridLayout, QPushButton, QFileDialog | |
from qtpy.QtCore import Qt, QModelIndex | |
import os | |
from skimage import io | |
import napari | |
class Explorer(QWidget): | |
def __init__(self, viewer:"napari.Viewer", path:str=""): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import inspect | |
from magicgui import magicgui | |
import napari | |
from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout | |
# Usage: | |
# >>> viewer = napari.Viewer() | |
# >>> cgui = ClassGui(viewer) | |
# >>> @cgui.from_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import inspect | |
from typing import Callable | |
import napari | |
from magicgui.widgets import Label, Table, create_widget, Container | |
import numpy as np | |
from skimage.measure import regionprops_table | |
# GUI class can generate image analysis protocols using decorator @gui.bind_protocol |