NaviNIBS.util.pyvista.plotting module

Bases: object

Handle manual update of volume scalars that were hard-converted to previous scale within add_volume

Fix some issues with update_scalar_bar_ranges and handling of all nan values

Similar to plotter.add_lines but with a few improvements: - Allows lines arg to already be pv.PolyData (e.g. to already been passed through pv.lines_from_points.) This

allows for the possibility of grouping multiple discontinuous line segments into one actor.

  • Added opacity arg

  • Added reset_camera arg

  • Allows specifying user transform in same call

Return type:

Actor

Return type:

vtkActor

Wrapper around add_mesh with some extra defaults for things like mesh color handling

defaultMeshColor: use this if the mesh has no color arrays

Similar to show_grid, but simplified and with fixes for tick rounding issues introduced in https://github.com/pyvista/pyvista/commit/344f8388841043e0ff68b5813c4560f55333f057.

As part of this, specified number of tick marks will be used as a suggestion, but actual number may be different.

Bases: _DelayedPlotter, QtInteractor, PlotterImprovementsMixin

Similar to pvqt.BackgroundPlotter, with a few key differences: - This batches multiple render calls together with an async coroutine - This sets default background color based on app palette - This doesn’t include some of the “extra” functionality in pvqt.BackgroundPlotter related to

toolbars and single-plotter-per-window management.

For now, this is does nothing. Is here for interface compatibility with RemotePlotterProxy that may be used instead. :return:

For now, this is does nothing. Is here for interface compatibility with RemotePlotterProxy that may be used instead. :return:

Not actually async. Is here for interface compatibility with RemotePlotterProxy that may be used instead

Not actually async. Is here for interface compatibility with RemotePlotterProxy that may be used instead

Bases: _DelayedPlotter, BasePlotter, PlotterImprovementsMixin

For now, this is does nothing. Is here for interface compatibility with RemotePlotterProxy that may be used instead. :return:

For now, this is does nothing. Is here for interface compatibility with RemotePlotterProxy that may be used instead. :return:

Enable depth peeling to improve rendering of translucent geometry.

Parameters

number_of_peelsint, optional

The maximum number of peeling layers. Initial value is 4 and is set in the pyvista.global_theme. A special value of 0 means no maximum limit. It has to be a positive value.

occlusion_ratiofloat, optional

The threshold under which the depth peeling algorithm stops to iterate over peel layers. This is the ratio of the number of pixels that have been touched by the last layer over the total number of pixels of the viewport area. Initial value is 0.0, meaning rendering has to be exact. Greater values may speed up the rendering with small impact on the quality.

Returns

bool

If depth peeling is supported.

Render the main window.

Will not render until show has been called.

Any render callbacks added with add_on_render_callback() and the render_event=False option set will still execute on any call.

Reset camera clipping planes.

Bases: RenderWindowInteractor

Some quirks for layered plotter setup require us to override some behavior in pyvista’s RenderWindowInteractor

Get the subplot location of the last event.

Bases: BackgroundPlotter

Return type:

SecondaryLayeredPlotter

Override the render method to handle threading issues.

Set the background color.

Parameters

colorColorLike, optional

Either a string, rgb list, or hex color string. Defaults to current theme parameters. For example:

  • color='white'

  • color='w'

  • color=[1.0, 1.0, 1.0]

  • color='#FFFFFF'

topColorLike, optional

If given, this will enable a gradient background where the color argument is at the bottom and the color given in top will be the color at the top of the renderer.

all_renderersbool, default: True

If True, applies to all renderers in subplots. If False, then only applies to the active renderer.

Examples

Set the background color to black.

>>> import pyvista
>>> plotter = pyvista.Plotter()
>>> plotter.set_background('black')
>>> plotter.background_color
Color(name='black', hex='#000000ff', opacity=255)
>>> plotter.close()

Set the background color at the bottom to black and white at the top. Display a cone as well.

>>> import pyvista
>>> pl = pyvista.Plotter()
>>> actor = pl.add_mesh(pyvista.Cone())
>>> pl.set_background('black', top='white')
>>> pl.show()

Enable depth peeling to improve rendering of translucent geometry.

Parameters

number_of_peelsint, optional

The maximum number of peeling layers. Initial value is 4 and is set in the pyvista.global_theme. A special value of 0 means no maximum limit. It has to be a positive value.

occlusion_ratiofloat, optional

The threshold under which the depth peeling algorithm stops to iterate over peel layers. This is the ratio of the number of pixels that have been touched by the last layer over the total number of pixels of the viewport area. Initial value is 0.0, meaning rendering has to be exact. Greater values may speed up the rendering with small impact on the quality.

Returns

bool

If depth peeling is supported.

Reset the camera of the active render window.

The camera slides along the vector defined from camera position to focal point until all of the actors can be seen.

Parameters

renderbool, default: True

Trigger a render after resetting the camera.

boundsiterable(int), optional

Automatically set up the camera based on a specified bounding box (xmin, xmax, ymin, ymax, zmin, zmax).

Examples

Add a mesh and place the camera position too close to the mesh. Then reset the camera and show the mesh.

>>> import pyvista
>>> pl = pyvista.Plotter()
>>> actor = pl.add_mesh(pyvista.Sphere(), show_edges=True)
>>> pl.set_position((0, 0.1, 0.1))
>>> pl.reset_camera()
>>> pl.show()

Reset camera clipping planes.

Quit application.