magicclass.ext.vtk package

Submodules

magicclass.ext.vtk.components module

class magicclass.ext.vtk.components.Arrow(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Arrows(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Box(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.CSpline(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Circle(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Cone(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Cube(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Cylinder(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Disc(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Earth(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Ellipsoid(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.KSpline(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Mesh(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.VtkComponent

backface_color

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

backface_culling

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

color

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

frontface_culling

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

lines_as_tubes

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

linewidth

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

occlusion

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

representation

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

scale

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

class magicclass.ext.vtk.components.Path(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Points(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.VtkComponent

color

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

occlusion

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

pos

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

scale

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

size

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

spherical

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

class magicclass.ext.vtk.components.Ribbon(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Sphere(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Spheres(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Spline(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Spring(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Text(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.Tube(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.ext.vtk.components.Mesh

class magicclass.ext.vtk.components.VtkComponent(*args, _parent: Optional[vedo.plotter.Plotter] = None, _emit: bool = True, **kwargs)[source]

Bases: magicclass.fields._group.HasFields

visible

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

magicclass.ext.vtk.components.get_object_type(name: str) type[magicclass.ext.vtk.components.VtkComponent][source]

magicclass.ext.vtk.const module

class magicclass.ext.vtk.const.AxesMode(value)[source]

Bases: magicclass.ext.vtk.const.StringEnum

An enumeration.

box = 9
cartesian = 2
cartesian_pos = 3
circle = 10
corner = 6
cube = 5
grid = 11
none = 0
polar = 12
ruler = 7
ruler1d = 13
ruler_axes = 8
triad = 4
wall = 1
class magicclass.ext.vtk.const.Mode(value)[source]

Bases: magicclass.ext.vtk.const.StringEnum

An enumeration.

iso = 'iso'
lego = 'lego'
mesh = 'mesh'
volume = 'volume'
wireframe = 'wireframe'
class magicclass.ext.vtk.const.Rendering(value)[source]

Bases: magicclass.ext.vtk.const.StringEnum

Volume rendering mode suppored in vtk.

additive = 4
average = 3
composite = 0
minip = 2
mip = 1
class magicclass.ext.vtk.const.Representation(value)[source]

Bases: magicclass.ext.vtk.const.StringEnum

An enumeration.

points = 0
surface = 2
wireframe = 1
class magicclass.ext.vtk.const.StringEnum(value)[source]

Bases: enum.Enum

An enumeration.

magicclass.ext.vtk.volume module

class magicclass.ext.vtk.volume.Volume(data, _parent)[source]

Bases: magicclass.ext.vtk.components.VtkComponent

color

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
iso_threshold

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

mode

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.

visible

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

magicclass.ext.vtk.volume.split_rgba(col: str | Sequence[float]) tuple[str | Sequence[float], float][source]

magicclass.ext.vtk.widgets module

class magicclass.ext.vtk.widgets.LayerList(data=(), parent: Optional[magicclass.ext.vtk.widgets.VtkCanvas] = None)[source]

Bases: psygnal.containers._evented_list.EventedList

events: ListEvents
property parent: magicclass.ext.vtk.widgets.VtkCanvas
class magicclass.ext.vtk.widgets.QtVtkCanvas(parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

class magicclass.ext.vtk.widgets.VtkCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

add_object(*args, object_type: Optional[str] = None, **kwargs)[source]
add_surface(data: tuple[np.ndarray, np.ndarray] | tuple[np.ndarray])[source]
add_volume(volume: numpy.ndarray, color: Union[Iterable[float], str] = (0.7, 0.7, 0.7), mode: str = 'iso')[source]

Add a 3D volume to the canvas.

Parameters
  • volume (np.ndarray) -- Volume data. Must be 3D array.

  • color (Color, optional) -- Initial color of the volume.

  • mode (str, default is "iso") -- Initial visualization mode of the volume.

Returns

A volume layer.

Return type

Volume

property axes: str

The axes object.

property layers
screenshot() numpy.ndarray[source]

Get screenshot as a numpy array.

Module contents

VTK (Visualization Toolkit) support in a magicgui/magic-class way. This extension submodule depends on vedo.

pip install vedo
class magicclass.ext.vtk.VtkCanvas[source]

Bases: magicclass.widgets.utils.FreeWidget

add_object(*args, object_type: Optional[str] = None, **kwargs)[source]
add_surface(data: tuple[np.ndarray, np.ndarray] | tuple[np.ndarray])[source]
add_volume(volume: numpy.ndarray, color: Union[Iterable[float], str] = (0.7, 0.7, 0.7), mode: str = 'iso')[source]

Add a 3D volume to the canvas.

Parameters
  • volume (np.ndarray) -- Volume data. Must be 3D array.

  • color (Color, optional) -- Initial color of the volume.

  • mode (str, default is "iso") -- Initial visualization mode of the volume.

Returns

A volume layer.

Return type

Volume

property axes: str

The axes object.

property layers
screenshot() numpy.ndarray[source]

Get screenshot as a numpy array.