actor#

Module that provide actors to render.

Container([layout])

Provides functionalities for grouping multiple actors using a given layout.

slicer(data[, affine, value_range, opacity, ...])

Cut 3D scalar or rgb volumes into 2D images.

surface(vertices[, faces, colors, smooth, ...])

Generate a surface actor from an array of vertices.

contour_from_roi(data[, affine, color, opacity])

Generate surface actor from a binary ROI.

contour_from_label(data[, affine, color])

Generate surface actor from a labeled Array.

streamtube(lines[, colors, opacity, ...])

Use streamtubes to visualize polylines.

line(lines[, colors, opacity, linewidth, ...])

Create an actor for one or more lines.

scalar_bar([lookup_table, title])

Default scalar bar actor for a given colormap (colorbar).

axes([scale, colorx, colory, colorz, opacity])

Create an actor with the coordinate's system axes where red = x, green = y, blue = z.

odf_slicer(odfs[, affine, mask, sphere, ...])

Create an actor for rendering a grid of ODFs given an array of spherical function (SF) or spherical harmonics (SH) coefficients.

tensor_slicer(evals, evecs[, affine, mask, ...])

Slice many tensors as ellipsoids in native or world coordinates.

peak_slicer(peaks_dirs[, peaks_values, ...])

Visualize peak directions as given from peaks_from_model.

peak(peaks_dirs[, peaks_values, mask, ...])

Visualize peak directions as given from peaks_from_model.

dot(points[, colors, opacity, dot_size])

Create one or more 3d points.

dots(points[, colors, opacity, dot_size])

Create one or more 3d points.

point(points, colors[, point_radius, phi, ...])

Visualize points as sphere glyphs.

sphere(centers, colors[, radii, phi, theta, ...])

Visualize one or many spheres with different colors and radii.

cylinder(centers, directions, colors[, ...])

Visualize one or many cylinder with different features.

disk(centers, directions, colors[, rinner, ...])

Visualize one or many disks with different features.

square(centers[, directions, colors, scales])

Visualize one or many squares with different features.

rectangle(centers[, directions, colors, scales])

Visualize one or many rectangles with different features.

box(centers[, directions, colors, scales])

Visualize one or many boxes with different features.

cube(centers[, directions, colors, scales])

Visualize one or many cubes with different features.

arrow(centers, directions, colors[, ...])

Visualize one or many arrows with different features.

cone(centers, directions, colors[, heights, ...])

Visualize one or many cones with different features.

triangularprism(centers[, directions, ...])

Visualize one or many regular triangular prisms with different features.

rhombicuboctahedron(centers[, directions, ...])

Visualize one or many rhombicuboctahedron with different features.

pentagonalprism(centers[, directions, ...])

Visualize one or many pentagonal prisms with different features.

octagonalprism(centers[, directions, ...])

Visualize one or many octagonal prisms with different features.

frustum(centers[, directions, colors, scales])

Visualize one or many frustum pyramids with different features.

superquadric(centers[, roundness, ...])

Visualize one or many superquadrics with different features.

billboard(centers[, colors, scales, vs_dec, ...])

Create a billboard actor.

vector_text([text, pos, scale, color, ...])

Create a label actor.

label([text, pos, scale, color, direction, ...])

Create a label actor.

text_3d(text[, position, color, font_size, ...])

Generate 2D text that lives in the 3D world.

grid(actors[, captions, caption_offset, ...])

Creates a grid of actors that lies in the xy-plane.

figure(pic[, interpolation])

Return a figure as an image actor.

texture(rgb[, interp])

Map an RGB or RGBA texture on a plane.

texture_update(texture_actor, arr)

Updates texture of an actor by updating the vtkImageData assigned to the vtkTexture object.

texture_on_sphere(rgb[, theta, phi, interpolate])

Map an RGB or RGBA texture on a sphere.

texture_2d(rgb[, interp])

Create 2D texture from array.

sdf(centers[, directions, colors, ...])

Create a SDF primitive based actor.

markers(centers[, colors, scales, marker, ...])

Create a marker actor with different shapes.

ellipsoid(centers, axes, lengths[, colors, ...])

VTK actor for visualizing ellipsoids.

uncertainty_cone(evals, evecs, signal, ...)

VTK actor for visualizing the cone of uncertainty representing the variance of the main direction of diffusion.

Container#

class fury.actor.Container(layout=<fury.layout.Layout object>)[source]#

Bases: object

Provides functionalities for grouping multiple actors using a given layout.

anchor#

Anchor of this container used when laying out items in a container. The anchor point is relative to the center of the container. Default: (0, 0, 0).

Type:

3-tuple of float

padding#

Padding around this container bounding box. The 6-tuple represents (pad_x_neg, pad_x_pos, pad_y_neg, pad_y_pos, pad_z_neg, pad_z_pos). Default: (0, 0, 0, 0, 0, 0).

Type:

6-tuple of float

__init__(layout=<fury.layout.Layout object>)[source]#
Parameters:

layout (fury.layout.Layout object) – Items of this container will be arranged according to layout.

AddPosition(position)[source]#
GetBounds()[source]#

Get the bounds of the container.

GetCenter()[source]#

Get the center of the bounding box.

GetLength()[source]#

Get the length of bounding box diagonal.

GetPosition()[source]#
GetVisibility()[source]#
NewInstance()[source]#
SetPosition(position)[source]#
SetVisibility(visibility)[source]#
ShallowCopy(other)[source]#
add(*items, **kwargs)[source]#

Adds some items to this container.

Parameters:
  • items (vtkProp3D objects) – Items to add to this container.

  • borrow (bool) – If True the items are added as-is, otherwise a shallow copy is made first. If you intend to reuse the items elsewhere you should set borrow=False. Default: True.

add_to_scene(scene)[source]#

Adds the items of this container to a given scene.

clear()[source]#

Clears all items of this container.

property items#
remove_from_scene(scene)[source]#

Removes the items of this container from a given scene.

update()[source]#

Updates the position of the items of this container.

slicer#

fury.actor.slicer(data, affine=None, value_range=None, opacity=1.0, lookup_colormap=None, interpolation='linear', picking_tol=0.025)[source]#

Cut 3D scalar or rgb volumes into 2D images.

Parameters:
  • data (array, shape (X, Y, Z) or (X, Y, Z, 3)) – A grayscale or rgb 4D volume as a numpy array. If rgb then values expected on the range [0, 255].

  • affine (array, shape (4, 4)) – Grid to space (usually RAS 1mm) transformation matrix. Default is None. If None then the identity matrix is used.

  • value_range (None or tuple (2,)) – If None then the values will be interpolated from (data.min(), data.max()) to (0, 255). Otherwise from (value_range[0], value_range[1]) to (0, 255).

  • opacity (float, optional) – Opacity of 0 means completely transparent and 1 completely visible.

  • lookup_colormap (vtkLookupTable, optional) – If None (default) then a grayscale map is created.

  • interpolation (string, optional) – If ‘linear’ (default) then linear interpolation is used on the final texture mapping. If ‘nearest’ then nearest neighbor interpolation is used on the final texture mapping.

  • picking_tol (float, optional) – The tolerance for the vtkCellPicker, specified as a fraction of rendering window size.

Returns:

image_actor – An object that is capable of displaying different parts of the volume as slices. The key method of this object is display_extent where one can input grid coordinates and display the slice in space (or grid) coordinates as calculated by the affine parameter.

Return type:

ImageActor

surface#

fury.actor.surface(vertices, faces=None, colors=None, smooth=None, subdivision=3)[source]#

Generate a surface actor from an array of vertices.

The color and smoothness of the surface can be customized by specifying the type of subdivision algorithm and the number of subdivisions.

Parameters:
  • vertices (array, shape (X, Y, Z)) – The point cloud defining the surface.

  • faces (array) – An array of precomputed triangulation for the point cloud. It is an optional parameter, it is computed locally if None.

  • colors ((N, 3) array) – Specifies the colors associated with each vertex in the vertices array. Range should be 0 to 1. Optional parameter, if not passed, all vertices are colored white.

  • smooth (string - "loop" or "butterfly") – Defines the type of subdivision to be used for smoothing the surface.

  • subdivision (integer, default = 3) – Defines the number of subdivisions to do for each triangulation of the point cloud. The higher the value, smoother the surface but at the cost of higher computation.

Returns:

surface_actor – An Actor visualizing the final surface computed from the point cloud is returned.

Return type:

Actor

contour_from_roi#

fury.actor.contour_from_roi(data, affine=None, color=array([1, 0, 0]), opacity=1)[source]#

Generate surface actor from a binary ROI.

The color and opacity of the surface can be customized.

Parameters:
  • data (array, shape (X, Y, Z)) – An ROI file that will be binarized and displayed.

  • affine (array, shape (4, 4)) – Grid to space (usually RAS 1mm) transformation matrix. Default is None. If None then the identity matrix is used.

  • color ((1, 3) ndarray) – RGB values in [0,1].

  • opacity (float) – Opacity of surface between 0 and 1.

Returns:

contour_assembly – ROI surface object displayed in space coordinates as calculated by the affine parameter.

Return type:

vtkAssembly

contour_from_label#

fury.actor.contour_from_label(data, affine=None, color=None)[source]#

Generate surface actor from a labeled Array.

The color and opacity of individual surfaces can be customized.

Parameters:
  • data (array, shape (X, Y, Z)) – A labeled array file that will be binarized and displayed.

  • affine (array, shape (4, 4)) – Grid to space (usually RAS 1mm) transformation matrix. Default is None. If None then the identity matrix is used.

  • color ((N, 3) or (N, 4) ndarray) – RGB/RGBA values in [0,1]. Default is None. If None then random colors are used. Alpha channel is set to 1 by default.

Returns:

contour_assembly – Array surface object displayed in space coordinates as calculated by the affine parameter in the order of their roi ids.

Return type:

vtkAssembly

streamtube#

fury.actor.streamtube(lines, colors=None, opacity=1, linewidth=0.1, tube_sides=9, lod=True, lod_points=10000, lod_points_size=3, spline_subdiv=None, lookup_colormap=None, replace_strips=False)[source]#

Use streamtubes to visualize polylines.

Parameters:
  • lines (list) – list of N curves represented as 2D ndarrays

  • colors (array (N, 3), list of arrays, tuple (3,), array (K,)) – If None or False, a standard orientation colormap is used for every line. If one tuple of color is used. Then all streamlines will have the same colour. If an array (N, 3) is given, where N is equal to the number of lines. Then every line is coloured with a different RGB color. If a list of RGB arrays is given then every point of every line takes a different color. If an array (K, 3) is given, where K is the number of points of all lines then every point is colored with a different RGB color. If an array (K,) is given, where K is the number of points of all lines then these are considered as the values to be used by the colormap. If an array (L,) is given, where L is the number of streamlines then these are considered as the values to be used by the colormap per streamline. If an array (X, Y, Z) or (X, Y, Z, 3) is given then the values for the colormap are interpolated automatically using trilinear interpolation.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

  • linewidth (float, optional) – Default is 0.01.

  • tube_sides (int, optional) – Default is 9.

  • lod (bool, optional) – Use LODActor(level of detail) rather than Actor. Default is True. Level of detail actors do not render the full geometry when the frame rate is low.

  • lod_points (int, optional) – Number of points to be used when LOD is in effect. Default is 10000.

  • lod_points_size (int, optional) – Size of points when lod is in effect. Default is 3.

  • spline_subdiv (int, optional) – Number of splines subdivision to smooth streamtubes. Default is None.

  • lookup_colormap (vtkLookupTable, optional) – Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

  • replace_strips (bool, optional) – If True it changes streamtube representation from triangle strips to triangles. Useful with SelectionManager or PickingManager. Default False.

Examples

>>> import numpy as np
>>> from fury import actor, window
>>> scene = window.Scene()
>>> lines = [np.random.rand(10, 3), np.random.rand(20, 3)]
>>> colors = np.random.rand(2, 3)
>>> c = actor.streamtube(lines, colors)
>>> scene.add(c)
>>> #window.show(scene)

Notes

Streamtubes can be heavy on GPU when loading many streamlines and therefore, you may experience slow rendering time depending on system GPU. A solution to this problem is to reduce the number of points in each streamline. In Dipy we provide an algorithm that will reduce the number of points on the straighter parts of the streamline but keep more points on the curvier parts. This can be used in the following way:

from dipy.tracking.distances import approx_polygon_track
lines = [approx_polygon_track(line, 0.2) for line in lines]

Alternatively we suggest using the line actor which is much more efficient.

line#

fury.actor.line(lines, colors=None, opacity=1, linewidth=1, spline_subdiv=None, lod=True, lod_points=10000, lod_points_size=3, lookup_colormap=None, depth_cue=False, fake_tube=False)[source]#

Create an actor for one or more lines.

Parameters:
  • lines (list of arrays) –

  • colors (array (N, 3), list of arrays, tuple (3,), array (K,)) – If None or False, a standard orientation colormap is used for every line. If one tuple of color is used. Then all streamlines will have the same colour. If an array (N, 3) is given, where N is equal to the number of lines. Then every line is coloured with a different RGB color. If a list of RGB arrays is given then every point of every line takes a different color. If an array (K, 3) is given, where K is the number of points of all lines then every point is colored with a different RGB color. If an array (K,) is given, where K is the number of points of all lines then these are considered as the values to be used by the colormap. If an array (L,) is given, where L is the number of streamlines then these are considered as the values to be used by the colormap per streamline. If an array (X, Y, Z) or (X, Y, Z, 3) is given then the values for the colormap are interpolated automatically using trilinear interpolation.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

  • linewidth (float, optional) – Line thickness. Default is 1.

  • spline_subdiv (int, optional) – Number of splines subdivision to smooth streamtubes. Default is None which means no subdivision.

  • lod (bool, optional) – Use LODActor(level of detail) rather than Actor. Default is True. Level of detail actors do not render the full geometry when the frame rate is low.

  • lod_points (int, optional) – Number of points to be used when LOD is in effect. Default is 10000.

  • lod_points_size (int) – Size of points when lod is in effect. Default is 3.

  • lookup_colormap (vtkLookupTable, optional) – Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

  • depth_cue (boolean, optional) – Add a size depth cue so that lines shrink with distance to the camera. Works best with linewidth <= 1.

  • fake_tube (boolean, optional) – Add shading to lines to approximate the look of tubes.

Returns:

v – Line.

Return type:

Actor or LODActor object

Examples

>>> from fury import actor, window
>>> scene = window.Scene()
>>> lines = [np.random.rand(10, 3), np.random.rand(20, 3)]
>>> colors = np.random.rand(2, 3)
>>> c = actor.line(lines, colors)
>>> scene.add(c)
>>> #window.show(scene)

scalar_bar#

fury.actor.scalar_bar(lookup_table=None, title=' ')[source]#

Default scalar bar actor for a given colormap (colorbar).

Parameters:
  • lookup_table (vtkLookupTable or None) – If None then colormap_lookup_table is called with default options.

  • title (str) –

Returns:

scalar_bar

Return type:

vtkScalarBarActor

See also

fury.actor.colormap_lookup_table()

axes#

fury.actor.axes(scale=(1, 1, 1), colorx=(1, 0, 0), colory=(0, 1, 0), colorz=(0, 0, 1), opacity=1)[source]#

Create an actor with the coordinate’s system axes where red = x, green = y, blue = z.

Parameters:
  • scale (tuple (3,)) – Axes size e.g. (100, 100, 100). Default is (1, 1, 1).

  • colorx (tuple (3,)) – x-axis color. Default red (1, 0, 0).

  • colory (tuple (3,)) – y-axis color. Default green (0, 1, 0).

  • colorz (tuple (3,)) – z-axis color. Default blue (0, 0, 1).

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

Returns:

arrow_actor

Return type:

Actor

odf_slicer#

fury.actor.odf_slicer(odfs, affine=None, mask=None, sphere=None, scale=0.5, norm=True, radial_scale=True, opacity=1.0, colormap=None, global_cm=False, B_matrix=None)[source]#

Create an actor for rendering a grid of ODFs given an array of spherical function (SF) or spherical harmonics (SH) coefficients.

Parameters:
  • odfs (ndarray) – 4D ODFs array in SF or SH coefficients. If SH coefficients, B_matrix must be supplied.

  • affine (array) – 4x4 transformation array from native coordinates to world coordinates.

  • mask (ndarray) – 3D mask to apply to ODF field.

  • sphere (dipy Sphere) – The sphere used for SH to SF projection. If None, a default sphere of 100 vertices will be used.

  • scale (float) – Multiplicative factor to apply to ODF amplitudes.

  • norm (bool) – Normalize SF amplitudes so that the maximum ODF amplitude per voxel along a direction is 1.

  • radial_scale (bool) – Scale sphere points by ODF values.

  • opacity (float) – Takes values from 0 (fully transparent) to 1 (opaque).

  • colormap (None or str or tuple) – The name of the colormap to use. Matplotlib colormaps are supported (e.g., ‘inferno’). A plain color can be supplied as a RGB tuple in range [0, 255]. If None then a RGB colormap is used.

  • global_cm (bool) – If True the colormap will be applied in all ODFs. If False it will be applied individually at each voxel.

  • B_matrix (ndarray (n_coeffs, n_vertices)) – Optional SH to SF matrix for projecting odfs given in SH coefficients on the sphere. If None, then the input is assumed to be expressed in SF coefficients.

Returns:

actor – Actor representing the ODF field.

Return type:

OdfSlicerActor

tensor_slicer#

fury.actor.tensor_slicer(evals, evecs, affine=None, mask=None, sphere=None, scale=2.2, norm=True, opacity=1.0, scalar_colors=None)[source]#

Slice many tensors as ellipsoids in native or world coordinates.

Parameters:
  • evals ((3,) or (X, 3) or (X, Y, 3) or (X, Y, Z, 3) ndarray) – eigenvalues

  • evecs ((3, 3) or (X, 3, 3) or (X, Y, 3, 3) or (X, Y, Z, 3, 3) ndarray) – eigenvectors

  • affine (array) – 4x4 transformation array from native coordinates to world coordinates*

  • mask (ndarray) – 3D mask

  • sphere (Sphere) – a sphere

  • scale (float) – Distance between spheres.

  • norm (bool) – Normalize sphere_values.

  • opacity (float) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

  • scalar_colors ((3,) or (X, 3) or (X, Y, 3) or (X, Y, Z, 3) ndarray) – RGB colors used to show the tensors Default None, color the ellipsoids using color_fa

Returns:

tensor_actor – Ellipsoid

Return type:

Actor

peak_slicer#

fury.actor.peak_slicer(peaks_dirs, peaks_values=None, mask=None, affine=None, colors=(1, 0, 0), opacity=1.0, linewidth=1, lod=False, lod_points=10000, lod_points_size=3, symmetric=True)[source]#

Visualize peak directions as given from peaks_from_model.

Parameters:
  • peaks_dirs (ndarray) – Peak directions. The shape of the array can be (M, 3) or (X, M, 3) or (X, Y, M, 3) or (X, Y, Z, M, 3).

  • peaks_values (ndarray) – Peak values. The shape of the array can be (M, ) or (X, M) or (X, Y, M) or (X, Y, Z, M).

  • affine (array) – 4x4 transformation array from native coordinates to world coordinates.

  • mask (ndarray) – 3D mask.

  • colors (tuple or None) – Default red color. If None then every peak gets an orientation color in similarity to a DEC map.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque).

  • linewidth (float, optional) – Line thickness. Default is 1.

  • lod (bool) – Use LODActor(level of detail) rather than Actor. Default is False. Level of detail actors do not render the full geometry when the frame rate is low.

  • lod_points (int) – Number of points to be used when LOD is in effect. Default is 10000.

  • lod_points_size (int) – Size of points when lod is in effect. Default is 3.

  • symmetric (bool, optional) – If True, peaks are drawn for both peaks_dirs and -peaks_dirs. Else, peaks are only drawn for directions given by peaks_dirs. Default is True.

Returns:

peak_actor

Return type:

Actor

See also

fury.actor.odf_slice()

peak#

fury.actor.peak(peaks_dirs, peaks_values=None, mask=None, affine=None, colors=None, linewidth=1, lookup_colormap=None, symmetric=True)[source]#

Visualize peak directions as given from peaks_from_model.

Parameters:
  • peaks_dirs (ndarray) – Peak directions. The shape of the array should be (X, Y, Z, D, 3).

  • peaks_values (ndarray, optional) – Peak values. The shape of the array should be (X, Y, Z, D).

  • affine (array, optional) – 4x4 transformation array from native coordinates to world coordinates.

  • mask (ndarray, optional) – 3D mask

  • colors (tuple or None, optional) – Default None. If None then every peak gets an orientation color in similarity to a DEC map.

  • lookup_colormap (vtkLookupTable, optional) – Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

  • linewidth (float, optional) – Line thickness. Default is 1.

  • symmetric (bool, optional) – If True, peaks are drawn for both peaks_dirs and -peaks_dirs. Else, peaks are only drawn for directions given by peaks_dirs. Default is True.

Returns:

peak_actor – Actor or LODActor representing the peaks directions and/or magnitudes.

Return type:

PeakActor

Examples

>>> from fury import actor, window
>>> import numpy as np
>>> scene = window.Scene()
>>> peak_dirs = np.random.rand(3, 3, 3, 3, 3)
>>> c = actor.peak(peak_dirs)
>>> scene.add(c)
>>> #window.show(scene)

dot#

fury.actor.dot(points, colors=None, opacity=None, dot_size=5)[source]#

Create one or more 3d points.

Parameters:
  • points (ndarray, (N, 3)) – dots positions.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If a value is given, each dot will have the same opacity otherwise opacity is set to 1 by default, or is defined by Alpha parameter in colors if given.

  • dot_size (int) –

Returns:

dot_actor

Return type:

Actor

dots#

fury.actor.dots(points, colors=None, opacity=None, dot_size=5)#

Create one or more 3d points.

dots function has been renamed dot

  • deprecated from version: 0.8.1

  • Raises <class ‘fury.deprecator.ExpiredDeprecationError’> as of version: 0.9.0

Parameters:
  • points (ndarray, (N, 3)) – dots positions.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If a value is given, each dot will have the same opacity otherwise opacity is set to 1 by default, or is defined by Alpha parameter in colors if given.

  • dot_size (int) –

Returns:

dot_actor

Return type:

Actor

point#

fury.actor.point(points, colors, point_radius=0.1, phi=8, theta=8, opacity=1.0)[source]#

Visualize points as sphere glyphs.

Parameters:
  • points (ndarray, shape (N, 3)) –

  • colors (ndarray (N,3) or tuple (3,)) –

  • point_radius (float) –

  • phi (int) –

  • theta (int) –

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

Returns:

point_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> pts = np.random.rand(5, 3)
>>> point_actor = actor.point(pts, window.colors.coral)
>>> scene.add(point_actor)
>>> # window.show(scene)

sphere#

fury.actor.sphere(centers, colors, radii=1.0, phi=16, theta=16, vertices=None, faces=None, opacity=1, use_primitive=False)[source]#

Visualize one or many spheres with different colors and radii.

Parameters:
  • centers (ndarray, shape (N, 3)) – Spheres positions.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • radii (float or ndarray, shape (N,)) – Sphere radius.

  • phi (int, optional) – Set the number of points in the latitude direction.

  • theta (int, optional) – Set the number of points in the longitude direction.

  • vertices (ndarray, shape (N, 3)) – The point cloud defining the sphere.

  • faces (ndarray, shape (M, 3)) – If faces is None then a sphere is created based on theta and phi angles If not then a sphere is created with the provided vertices and faces.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

  • use_primitive (boolean, optional) – If True, uses primitives to create an actor.

Returns:

sphere_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> sphere_actor = actor.sphere(centers, window.colors.coral)
>>> scene.add(sphere_actor)
>>> # window.show(scene)

cylinder#

fury.actor.cylinder(centers, directions, colors, radius=0.05, heights=1, capped=False, resolution=8, vertices=None, faces=None, repeat_primitive=True)[source]#

Visualize one or many cylinder with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Cylinder positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the cylinder.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • radius (float) – cylinder radius.

  • heights (ndarray, shape (N)) – The height of the cylinder.

  • capped (bool) – Turn on/off whether to cap cylinder with polygons. Default (False).

  • resolution (int) – Number of facets/sectors used to define cylinder.

  • vertices (ndarray, shape (N, 3)) – The point cloud defining the sphere.

  • faces (ndarray, shape (M, 3)) – If faces is None then a sphere is created based on theta and phi angles. If not then a sphere is created with the provided vertices and faces.

  • repeat_primitive (bool) – If True, cylinder will be generated with primitives If False, repeat_sources will be invoked to use VTK filters for cylinder.

Returns:

cylinder_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> heights = np.random.rand(5)
>>> actor = actor.cylinder(centers, dirs, (1, 1, 1), heights=heights)
>>> scene.add(actor)
>>> # window.show(scene)

disk#

fury.actor.disk(centers, directions, colors, rinner=0.3, router=0.7, cresolution=6, rresolution=2, vertices=None, faces=None)[source]#

Visualize one or many disks with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Disk positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the disk.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • rinner (float) – disk inner radius, default: 0.3

  • router (float) – disk outer radius, default: 0.5

  • cresolution (int, optional) – Number of facets used to define perimeter of disk, default: 6

  • rresolution (int, optional) – Number of facets used radially, default: 2

  • vertices (ndarray, shape (N, 3)) – The point cloud defining the disk.

  • faces (ndarray, shape (M, 3)) – If faces is None then a disk is created based on theta and phi angles. If not then a disk is created with the provided vertices and faces.

Returns:

disk_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> colors = np.random.rand(5, 4)
>>> actor = actor.disk(centers, dirs, colors,
>>>                    rinner=.1, router=.8, cresolution=30)
>>> scene.add(actor)
>>> window.show(scene)

square#

fury.actor.square(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many squares with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Square positions.

  • directions (ndarray, shape (N, 3), optional) – The orientation vector of the square.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Square size on each direction (x, y), default(1)

Returns:

sq_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> sq_actor = actor.square(centers, dirs)
>>> scene.add(sq_actor)
>>> # window.show(scene)

rectangle#

fury.actor.rectangle(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=(1, 2, 0))[source]#

Visualize one or many rectangles with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Rectangle positions.

  • directions (ndarray, shape (N, 3), optional) – The orientation vector of the rectangle.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Rectangle size on each direction (x, y), default(1)

Returns:

rect_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> rect_actor = actor.rectangle(centers, dirs)
>>> scene.add(rect_actor)
>>> # window.show(scene)

box#

fury.actor.box(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=(1, 2, 3))[source]#

Visualize one or many boxes with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Box positions.

  • directions (ndarray, shape (N, 3), optional) – The orientation vector of the box.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Box size on each direction (x, y), default(1)

Returns:

box_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> box_actor = actor.box(centers, dirs, (1, 1, 1))
>>> scene.add(box_actor)
>>> # window.show(scene)

cube#

fury.actor.cube(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many cubes with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Cube positions.

  • directions (ndarray, shape (N, 3), optional) – The orientation vector of the cube.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Cube size, default: 1

Returns:

cube_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> dirs = np.random.rand(5, 3)
>>> cube_actor = actor.cube(centers, dirs)
>>> scene.add(cube_actor)
>>> # window.show(scene)

arrow#

fury.actor.arrow(centers, directions, colors, heights=1.0, resolution=10, tip_length=0.35, tip_radius=0.1, shaft_radius=0.03, scales=1, vertices=None, faces=None, repeat_primitive=True)[source]#

Visualize one or many arrows with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Arrow positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the arrow.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • heights (ndarray, shape (N)) – The height of the arrow.

  • resolution (int) – The resolution of the arrow.

  • tip_length (float) – The tip size of the arrow (default: 0.35)

  • tip_radius (float) – the tip radius of the arrow (default: 0.1)

  • shaft_radius (float) – The shaft radius of the arrow (default: 0.03)

  • vertices (ndarray, shape (N, 3)) – The point cloud defining the arrow.

  • faces (ndarray, shape (M, 3)) – If faces is None then a arrow is created based on directions, heights and resolution. If not then a arrow is created with the provided vertices and faces.

Returns:

arrow_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> directions = np.random.rand(5, 3)
>>> heights = np.random.rand(5)
>>> arrow_actor = actor.arrow(centers, directions, (1, 1, 1), heights)
>>> scene.add(arrow_actor)
>>> # window.show(scene)

cone#

fury.actor.cone(centers, directions, colors, heights=1.0, resolution=10, vertices=None, faces=None, use_primitive=True)[source]#

Visualize one or many cones with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Cone positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the cone.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • heights (ndarray, shape (N)) – The height of the cone.

  • resolution (int) – The resolution of the cone.

  • vertices (ndarray, shape (N, 3)) – The point cloud defining the cone.

  • faces (ndarray, shape (M, 3)) – If faces is None then a cone is created based on directions, heights and resolution. If not then a cone is created with the provided. vertices and faces.

  • use_primitive (boolean, optional) – If True uses primitives to create the cone actor.

Returns:

cone_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3)
>>> directions = np.random.rand(5, 3)
>>> heights = np.random.rand(5)
>>> cone_actor = actor.cone(centers, directions, (1, 1, 1), heights)
>>> scene.add(cone_actor)
>>> # window.show(scene)

triangularprism#

fury.actor.triangularprism(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many regular triangular prisms with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Triangular prism positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector(s) of the triangular prism(s).

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Triangular prism size on each direction (x, y), default(1)

Returns:

tprism_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(3, 3)
>>> dirs = np.random.rand(3, 3)
>>> colors = np.random.rand(3, 3)
>>> scales = np.random.rand(3, 1)
>>> actor = actor.triangularprism(centers, dirs, colors, scales)
>>> scene.add(actor)
>>> # window.show(scene)

rhombicuboctahedron#

fury.actor.rhombicuboctahedron(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many rhombicuboctahedron with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Rhombicuboctahedron positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector(s) of the Rhombicuboctahedron(s).

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Rhombicuboctahedron size on each direction (x, y), default(1)

Returns:

rcoh_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(3, 3)
>>> dirs = np.random.rand(3, 3)
>>> colors = np.random.rand(3, 3)
>>> scales = np.random.rand(3, 1)
>>> actor = actor.rhombicuboctahedron(centers, dirs, colors, scales)
>>> scene.add(actor)
>>> # window.show(scene)

pentagonalprism#

fury.actor.pentagonalprism(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many pentagonal prisms with different features.

Parameters:
  • centers (ndarray, shape (N, 3), optional) – Pentagonal prism positions.

  • directions (ndarray, shape (N, 3), optional) – The orientation vector of the pentagonal prism.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Pentagonal prism size on each direction (x, y), default(1)

Returns:

pent_actor

Return type:

Actor

Examples

>>> import numpy as np
>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(3, 3)
>>> dirs = np.random.rand(3, 3)
>>> colors = np.random.rand(3, 3)
>>> scales = np.random.rand(3, 1)
>>> actor_pentagonal = actor.pentagonalprism(centers, dirs, colors, scales)
>>> scene.add(actor_pentagonal)
>>> # window.show(scene)

octagonalprism#

fury.actor.octagonalprism(centers, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many octagonal prisms with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Octagonal prism positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the octagonal prism.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Octagonal prism size on each direction (x, y), default(1)

Returns:

oct_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(3, 3)
>>> dirs = np.random.rand(3, 3)
>>> colors = np.random.rand(3, 3)
>>> scales = np.random.rand(3, 1)
>>> actor = actor.octagonalprism(centers, dirs, colors, scales)
>>> scene.add(actor)
>>> # window.show(scene)

frustum#

fury.actor.frustum(centers, directions=(1, 0, 0), colors=(0, 1, 0), scales=1)[source]#

Visualize one or many frustum pyramids with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Frustum pyramid positions.

  • directions (ndarray, shape (N, 3)) – The orientation vector of the frustum pyramid.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (int or ndarray (N,3) or tuple (3,), optional) – Frustum pyramid size on each direction (x, y), default(1)

Returns:

frustum_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(4, 3)
>>> dirs = np.random.rand(4, 3)
>>> colors = np.random.rand(4, 3)
>>> scales = np.random.rand(4, 1)
>>> actor = actor.frustum(centers, dirs, colors, scales)
>>> scene.add(actor)
>>> # window.show(scene)

superquadric#

fury.actor.superquadric(centers, roundness=(1, 1), directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#

Visualize one or many superquadrics with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – Superquadrics positions.

  • roundness (ndarray, shape (N, 2) or tuple/list (2,), optional) – parameters (Phi and Theta) that control the shape of the superquadric.

  • directions (ndarray, shape (N, 3) or tuple (3,), optional) – The orientation vector of the cone.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (ndarray, shape (N) or (N,3) or float or int, optional) – The height of the cone.

Returns:

spq_actor

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> centers = np.random.rand(3, 3) * 10
>>> directions = np.random.rand(3, 3)
>>> scales = np.random.rand(3)
>>> colors = np.random.rand(3, 3)
>>> roundness = np.array([[1, 1], [1, 2], [2, 1]])
>>> sq_actor = actor.superquadric(centers, roundness=roundness,
...                               directions=directions,
...                               colors=colors, scales=scales)
>>> scene.add(sq_actor)
>>> # window.show(scene)

billboard#

fury.actor.billboard(centers, colors=(0, 1, 0), scales=1, vs_dec=None, vs_impl=None, gs_prog=None, fs_dec=None, fs_impl=None, bb_type='spherical')[source]#

Create a billboard actor. - Billboards are 2D elements placed in a 3D world. They offer possibility to draw different shapes/elements at the fragment shader level.

Parameters:
  • centers (ndarray, shape (N, 3)) – Billboard positions.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (ndarray, shape (N) or (N,3) or float or int, optional) – The scale of the billboards.

  • vs_dec (str or list of str, optional) – Vertex Shader code that contains all variable/function declarations.

  • vs_impl (str or list of str, optional) – Vertex Shaders code that contains all variable/function implementations.

  • gs_prog (str, optional) – Geometry Shader program.

  • fs_dec (str or list of str, optional) – Fragment Shaders code that contains all variable/function declarations.

  • fs_impl (str or list of str, optional) – Fragment Shaders code that contains all variable/function implementation.

  • bb_type (str, optional) – Type of billboard (spherical, cylindrical_x, cylindrical_y). If spherical, billboard will always face the camera. If cylindrical_x or cylindrical_y, billboard will face the camera only when rotating around x-axis and y-axis respectively.

Returns:

billboard_actor

Return type:

Actor

vector_text#

fury.actor.vector_text(text='Origin', pos=(0, 0, 0), scale=(0.2, 0.2, 0.2), color=(1, 1, 1), direction=(0, 0, 1), extrusion=0.0, align_center=False)[source]#

Create a label actor.

This actor will always face the camera.

Parameters:
  • text (str) – Text for the label.

  • pos ((3,) array_like, optional) – Left down position of the label.

  • scale ((3,) array_like) – Changes the size of the label.

  • color ((3,) array_like) – Label color as (r,g,b) tuple.

  • direction ((3,) array_like, optional, default: (0, 0, 1)) – The direction of the label. If None, label will follow the camera.

  • extrusion (float, optional) – The extrusion amount of the text in Z axis.

  • align_center (bool, optional, default: True) – If True, the anchor of the actor will be the center of the text. If False, the anchor will be at the left bottom of the text.

Returns:

l – Label.

Return type:

Actor object

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> l = actor.vector_text(text='Hello')
>>> scene.add(l)
>>> # window.show(scene)

label#

fury.actor.label(text='Origin', pos=(0, 0, 0), scale=(0.2, 0.2, 0.2), color=(1, 1, 1), direction=(0, 0, 1), extrusion=0.0, align_center=False)#

Create a label actor.

Label function has been renamed vector_text

  • deprecated from version: 0.7.1

  • Raises <class ‘fury.deprecator.ExpiredDeprecationError’> as of version: 0.9.0

This actor will always face the camera.

Parameters:
  • text (str) – Text for the label.

  • pos ((3,) array_like, optional) – Left down position of the label.

  • scale ((3,) array_like) – Changes the size of the label.

  • color ((3,) array_like) – Label color as (r,g,b) tuple.

  • direction ((3,) array_like, optional, default: (0, 0, 1)) – The direction of the label. If None, label will follow the camera.

  • extrusion (float, optional) – The extrusion amount of the text in Z axis.

  • align_center (bool, optional, default: True) – If True, the anchor of the actor will be the center of the text. If False, the anchor will be at the left bottom of the text.

Returns:

l – Label.

Return type:

Actor object

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> l = actor.vector_text(text='Hello')
>>> scene.add(l)
>>> # window.show(scene)

text_3d#

fury.actor.text_3d(text, position=(0, 0, 0), color=(1, 1, 1), font_size=12, font_family='Arial', justification='left', vertical_justification='bottom', bold=False, italic=False, shadow=False)[source]#

Generate 2D text that lives in the 3D world.

Parameters:
  • text (str) –

  • position (tuple) –

  • color (tuple) –

  • font_size (int) –

  • font_family (str) –

  • justification (str) – Left, center or right (default left).

  • vertical_justification (str) – Bottom, middle or top (default bottom).

  • bold (bool) –

  • italic (bool) –

  • shadow (bool) –

Return type:

Text3D

grid#

fury.actor.grid(actors, captions=None, caption_offset=(0, -100, 0), cell_padding=0, cell_shape='rect', aspect_ratio=1.7777777777777777, dim=None)[source]#

Creates a grid of actors that lies in the xy-plane.

Parameters:
  • actors (list of vtkProp3D objects) – Actors to be layout in a grid manner.

  • captions (list of vtkProp3D objects or list of str) – Objects serving as captions (can be any vtkProp3D object, not necessarily text). There should be one caption per actor. By default, there are no captions.

  • caption_offset (tuple of float (optional)) – Tells where to position the caption w.r.t. the center of its associated actor. Default: (0, -100, 0).

  • cell_padding (tuple of 2 floats or float) – Each grid cell will be padded according to (pad_x, pad_y) i.e. horizontally and vertically. Padding is evenly distributed on each side of the cell. If a single float is provided then both pad_x and pad_y will have the same value.

  • cell_shape (str) – Specifies the desired shape of every grid cell. ‘rect’ ensures the cells are the tightest. ‘square’ ensures the cells are as wide as high. ‘diagonal’ ensures the content of the cells can be rotated without colliding with content of the neighboring cells.

  • aspect_ratio (float) – Aspect ratio of the grid (width/height). Default: 16:9.

  • dim (tuple of int) – Dimension (nb_rows, nb_cols) of the grid. If provided, aspect_ratio will be ignored.

Returns:

Object that represents the grid containing all the actors and captions, if any.

Return type:

fury.actor.Container object

figure#

fury.actor.figure(pic, interpolation='nearest')[source]#

Return a figure as an image actor.

Parameters:
  • pic (filename or numpy RGBA array) –

  • interpolation (str) – Options are nearest, linear or cubic. Default is nearest.

Returns:

image_actor

Return type:

vtkImageActor

texture#

fury.actor.texture(rgb, interp=True)[source]#

Map an RGB or RGBA texture on a plane.

Parameters:
  • rgb (ndarray) – Input 2D RGB or RGBA array. Dtype should be uint8.

  • interp (bool) – Interpolate between grid centers. Default True.

Returns:

act

Return type:

Actor

texture_update#

fury.actor.texture_update(texture_actor, arr)[source]#

Updates texture of an actor by updating the vtkImageData assigned to the vtkTexture object.

Parameters:
  • texture_actor (Actor) – Actor whose texture is to be updated.

  • arr (ndarray) – Input 2D image in the form of RGB or RGBA array. This is the new image to be rendered on the actor. Dtype should be uint8.

  • Implementation

  • --------------

  • docs/examples/viz_video_on_plane.py (Check) –

texture_on_sphere#

fury.actor.texture_on_sphere(rgb, theta=60, phi=60, interpolate=True)[source]#

Map an RGB or RGBA texture on a sphere.

Parameters:
  • rgb (ndarray) – Input 2D RGB or RGBA array. Dtype should be uint8.

  • theta (int, optional) – Set the number of points in the longitude direction.

  • phi (int, optional) – Set the number of points in the latitude direction.

  • interpolate (bool, optional) – Interpolate between grid centers.

Returns:

earthActor

Return type:

Actor

texture_2d#

fury.actor.texture_2d(rgb, interp=False)[source]#

Create 2D texture from array.

Parameters:
  • rgb (ndarray) – Input 2D RGB or RGBA array. Dtype should be uint8.

  • interp (bool, optional) – Interpolate between grid centers.

Return type:

vtkTexturedActor

sdf#

fury.actor.sdf(centers, directions=(1, 0, 0), colors=(1, 0, 0), primitives='torus', scales=1)[source]#

Create a SDF primitive based actor.

Parameters:
  • centers (ndarray, shape (N, 3)) – SDF primitive positions.

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • directions (ndarray, shape (N, 3)) – The orientation vector of the SDF primitive.

  • primitives (str, list, tuple, np.ndarray) – The primitive of choice to be rendered. Options are sphere, torus and ellipsoid. Default is torus.

  • scales (float) – The size of the SDF primitive.

Returns:

box_actor

Return type:

Actor

markers#

fury.actor.markers(centers, colors=(0, 1, 0), scales=1, marker='3d', marker_opacity=0.8, edge_width=0.0, edge_color=(255, 255, 255), edge_opacity=0.8)[source]#

Create a marker actor with different shapes.

Parameters:
  • centers (ndarray, shape (N, 3)) –

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

  • scales (ndarray, shape (N) or (N,3) or float or int, optional) –

  • marker (str or a list) – Available markers are: ‘3d’, ‘o’, ‘s’, ‘d’, ‘^’, ‘p’, ‘h’, ‘s6’, ‘x’, ‘+’, optional.

  • marker_opacity (float, optional) –

  • edge_width (int, optional) –

  • edge_color (ndarray, shape (3), optional) –

  • edge_opacity (float, optional) –

Returns:

sq_actor

Return type:

Actor

Examples

>>> import numpy as np
>>> from fury import actor, window
>>> scene = window.Scene()
>>> markers = ['o', 'x', '^', 's']  # some examples
>>> n = len(markers)
>>> centers = np.random.normal(size=(n, 3), scale=10)
>>> colors = np.random.rand(n, 4)
>>> nodes_actor = actor.markers(
        centers,
        marker=markers,
        edge_width=.1,
        edge_color=[255, 255, 0],
        colors=colors,
        scales=10,
    )
>>> center = np.random.normal(size=(1, 3), scale=10)
>>> nodes_3d_actor = actor.markers(
        center,
        marker='3d',
        scales=5,
    )
>>> scene.add(nodes_actor, nodes_3d_actor)
>>> # window.show(scene, size=(600, 600))

ellipsoid#

fury.actor.ellipsoid(centers, axes, lengths, colors=(1, 0, 0), scales=1.0, opacity=1.0)[source]#

VTK actor for visualizing ellipsoids.

Parameters:
  • centers (ndarray(N, 3)) – Ellipsoid positions.

  • axes (ndarray (3, 3) or (N, 3, 3)) – Axes of the ellipsoid.

  • lengths (ndarray (3, ) or (N, 3)) – Axes lengths.

  • colors (ndarray (N,3) or tuple (3,), optional) – Default red color. R, G and B should be in the range [0, 1].

  • scales (float or ndarray (N, ), optional) – Ellipsoid size, default(1.0).

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque), default(1.0).

Returns:

tensor_ellipsoid

Return type:

Actor

uncertainty_cone#

fury.actor.uncertainty_cone(evals, evecs, signal, sigma, b_matrix, scales=0.6, opacity=1.0)[source]#

VTK actor for visualizing the cone of uncertainty representing the variance of the main direction of diffusion.

Parameters:
  • evals (ndarray (3, ) or (N, 3)) – Eigenvalues.

  • evecs (ndarray (3, 3) or (N, 3, 3)) – Eigenvectors.

  • signal (3D or 4D ndarray) – Predicted signal.

  • sigma (ndarray) – Standard deviation of the noise.

  • b_matrix (array (N, 7)) – Design matrix for DTI.

  • scales (float or ndarray (N, ), optional) – Cones of uncertainty size.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque), default(1.0).

Returns:

double_cone

Return type:

Actor