magicclass.ext.vispy package

Submodules

magicclass.ext.vispy.layer2d module

class magicclass.ext.vispy.layer2d.Curve(viewbox: ViewBox, x: ArrayLike, y: ArrayLike = None, face_color=None, edge_color=None, size: float = 7, name: str | None = None, lw: float = 1, ls: str = '-', symbol=None)[source]

Bases: magicclass.ext.vispy.layer2d.PlotDataLayer

class magicclass.ext.vispy.layer2d.PlotDataLayer[source]

Bases: magicclass.ext.vispy._base.LayerItem

add(points: np.ndarray | Sequence, **kwargs)[source]

Add new points to the plot data item.

property color
property edge_color: numpy.ndarray

Edge color of the data.

property face_color: numpy.ndarray

Face color of the data.

property name: str
property ndata: int
remove(i: int | Sequence[int])[source]

Remove the i-th data.

property xdata: numpy.ndarray
property ydata: numpy.ndarray
class magicclass.ext.vispy.layer2d.Scatter(viewbox: ViewBox, x: ArrayLike, y: ArrayLike = None, face_color=None, edge_color=None, size: float = 7, name: str | None = None, symbol='o')[source]

Bases: magicclass.ext.vispy.layer2d.PlotDataLayer

magicclass.ext.vispy.layer3d module

class magicclass.ext.vispy.layer3d.Image(data, viewbox: ViewBox, contrast_limits: tuple[float, float] | None = None, rendering: str = 'mip', iso_threshold: float | None = None, attenuation: float = 1.0, cmap: str = 'grays', gamma: str = 1.0, interpolation: str = 'linear')[source]

Bases: magicclass.ext.vispy._base.LayerItem, magicclass.fields.HasFields

INTERPOLATIONS = ['nearest', 'linear']
RENDERINGS = ['translucent', 'mip', 'minip', 'attenuated_mip', 'additive', 'iso', 'average']
attenuation

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

contrast_limits

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

property data: numpy.ndarray
gamma

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

interpolation

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

iso_threshold

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

rendering

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

class magicclass.ext.vispy.layer3d.IsoSurface(data, viewbox: vispy.scene.widgets.viewbox.ViewBox, contrast_limits=None, iso_threshold=None, face_color=None, edge_color=None, shading='smooth')[source]

Bases: magicclass.ext.vispy.layer3d._SurfaceBase, magicclass.fields.HasFields

contrast_limits

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

property data: numpy.ndarray
edge_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

edge_width

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

face_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

iso_threshold

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

shading

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

class magicclass.ext.vispy.layer3d.Surface(data, viewbox: vispy.scene.widgets.viewbox.ViewBox, face_color=None, edge_color=None, shading='none')[source]

Bases: magicclass.ext.vispy.layer3d._SurfaceBase, magicclass.fields.HasFields

property data
edge_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

edge_width

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

face_color

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

shading

Field class for magicgui construction. Unlike MagicField, object of this class always returns value itself.

magicclass.ext.vispy.layerlist module

class magicclass.ext.vispy.layerlist.LayerList(data=())[source]

Bases: psygnal.containers._evented_list.EventedList[magicclass.ext.vispy._base.LayerItem]

events: ListEvents

magicclass.ext.vispy.widgets2d module

class magicclass.ext.vispy.widgets2d.HasViewBox(grid_pos: tuple[int, int] = (0, 0), _scene=None, _row=0, _col=0)[source]

Bases: magicclass.widgets.utils.FreeWidget

add_curve(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, lw: float = 1, ls: str = '-', symbol=None)[source]

Add a line plot like plt.plot(x, y).

Parameters
  • x (array-like) -- X data.

  • y (array-like) -- Y data.

  • face_color (str or array-like, optional) -- Face color of plot. Graphic object will be filled with this color.

  • edge_color (str or array-like, optional) -- Edge color of plot.

  • color (str or array-like, optional) -- Set face color and edge color at the same time.

  • size (float, default is 7) -- Symbol size.

  • name (str, optional) -- Object name of the plot item.

  • lw (float, default is 1.0) -- Line width of edge.

  • ls (str, default is "-") -- Line style of edge. One of "-", "--", ":" or "-.".

  • symbol (str, optional) -- Symbol style. Currently supports circle ("o"), cross ("+", "x"), star ("*"), square ("s", "D") triangle ("^", "<", "v", ">") and others that pyqtgraph supports.

Returns

A plot item of a curve.

Return type

Curve

add_scatter(x=None, y=None, face_color=None, edge_color=None, color=None, size: float = 7, name: str | None = None, symbol=None)[source]

Add a line plot like plt.plot(x, y).

Parameters
  • x (array-like) -- X data.

  • y (array-like) -- Y data.

  • face_color (str or array-like, optional) -- Face color of plot. Graphic object will be filled with this color.

  • edge_color (str or array-like, optional) -- Edge color of plot.

  • color (str or array-like, optional) -- Set face color and edge color at the same time.

  • size (float, default is 7) -- Symbol size.

  • name (str, optional) -- Object name of the plot item.

  • symbol (str, optional) -- Symbol style. Currently supports circle ("o"), cross ("+", "x"), star ("*"), square ("s", "D") triangle ("^", "<", "v", ">") and others that pyqtgraph supports.

Returns

A plot item of a curve.

Return type

Curve

property enabled: bool

Whether widget is enabled (editable).

property layers
property xrange: tuple[float, float]
property yrange: tuple[float, float]
class magicclass.ext.vispy.widgets2d.ImageItem(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.HasViewBox

property cmap
property image
class magicclass.ext.vispy.widgets2d.PlotItem(grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.HasViewBox

property title: str

The title string.

property xlabel: str

The x-label string.

property ylabel: str

The x-label string.

class magicclass.ext.vispy.widgets2d.VispyImageCanvas(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.ImageItem

A Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.widgets2d.VispyMultiImageCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.widgets2d.VispyMultiPlotCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.widgets2d.VispyPlotCanvas(grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.PlotItem

A Vispy based 2-D plot canvas for curve, histogram, bar plot etc.

magicclass.ext.vispy.widgets3d module

class magicclass.ext.vispy.widgets3d.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

A Vispy canvas for 3-D object visualization.

Very similar to napari. This widget can be used independent of napari, or as a mini-viewer of napari.

add_image(data: ArrayLike, *, contrast_limits: tuple[float, float] = None, rendering: str = 'mip', iso_threshold: float | None = None, attenuation: float = 1.0, cmap: str = 'grays', gamma: float = 1.0, interpolation: str = 'linear')[source]
add_isosurface(data: ArrayLike, *, contrast_limits: tuple[float, float] | None = None, iso_threshold: float | None = None, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
add_surface(data: tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike], *, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
property camera

Return the native camera.

property layers

Return the layer list.

Module contents

class magicclass.ext.vispy.Vispy3DCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

A Vispy canvas for 3-D object visualization.

Very similar to napari. This widget can be used independent of napari, or as a mini-viewer of napari.

add_image(data: ArrayLike, *, contrast_limits: tuple[float, float] = None, rendering: str = 'mip', iso_threshold: float | None = None, attenuation: float = 1.0, cmap: str = 'grays', gamma: float = 1.0, interpolation: str = 'linear')[source]
add_isosurface(data: ArrayLike, *, contrast_limits: tuple[float, float] | None = None, iso_threshold: float | None = None, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
add_surface(data: tuple[ArrayLike, ArrayLike] | tuple[ArrayLike, ArrayLike, ArrayLike], *, face_color: Color | None = None, edge_color: Color | None = None, shading: str = 'smooth')[source]
property camera

Return the native camera.

property layers

Return the layer list.

class magicclass.ext.vispy.VispyImageCanvas(lock_contrast_limits: bool = False, grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.ImageItem

A Vispy based 2-D plot canvas for images.

class magicclass.ext.vispy.VispyMultiImageCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.VispyMultiPlotCanvas(nrows: int = 1, ncols: int = 1)[source]

Bases: magicclass.ext.vispy.widgets2d._MultiPlot

class magicclass.ext.vispy.VispyPlotCanvas(grid_pos=(0, 0), _scene=None)[source]

Bases: magicclass.ext.vispy.widgets2d.PlotItem

A Vispy based 2-D plot canvas for curve, histogram, bar plot etc.