actor#
Module that provide actors to render.
  | 
Provides functionalities for grouping multiple actors using a given layout.  | 
  | 
Cut 3D scalar or rgb volumes into 2D images.  | 
  | 
Generate a surface actor from an array of vertices.  | 
  | 
Generate surface actor from a binary ROI.  | 
  | 
Generate surface actor from a labeled Array.  | 
  | 
Use streamtubes to visualize polylines.  | 
  | 
Create an actor for one or more lines.  | 
  | 
Default scalar bar actor for a given colormap (colorbar).  | 
  | 
Create an actor with the coordinate's system axes where red = x, green = y, blue = z.  | 
  | 
Create an actor for rendering a grid of ODFs given an array of spherical function (SF) or spherical harmonics (SH) coefficients.  | 
  | 
Slice many tensors as ellipsoids in native or world coordinates.  | 
  | 
Visualize peak directions as given from   | 
  | 
Visualize peak directions as given from   | 
  | 
Create one or more 3d points.  | 
  | 
Visualize points as sphere glyphs.  | 
  | 
Visualize one or many spheres with different colors and radii.  | 
  | 
Visualize one or many cylinder with different features.  | 
  | 
Visualize one or many disks with different features.  | 
  | 
Visualize one or many squares with different features.  | 
  | 
Visualize one or many rectangles with different features.  | 
  | 
Visualize one or many boxes with different features.  | 
  | 
Visualize one or many cubes with different features.  | 
  | 
Visualize one or many arrows with different features.  | 
  | 
Visualize one or many cones with different features.  | 
  | 
Visualize one or many regular triangular prisms with different features.  | 
  | 
Visualize one or many rhombicuboctahedron with different features.  | 
  | 
Visualize one or many pentagonal prisms with different features.  | 
  | 
Visualize one or many octagonal prisms with different features.  | 
  | 
Visualize one or many frustum pyramids with different features.  | 
  | 
Visualize one or many superquadrics with different features.  | 
  | 
Create a billboard actor.  | 
  | 
Create a label actor.  | 
  | 
Generate 2D text that lives in the 3D world.  | 
  | 
Creates a grid of actors that lies in the xy-plane.  | 
  | 
Return a figure as an image actor.  | 
  | 
Map an RGB or RGBA texture on a plane.  | 
  | 
Updates texture of an actor by updating the vtkImageData assigned to the vtkTexture object.  | 
  | 
Map an RGB or RGBA texture on a sphere.  | 
  | 
Create 2D texture from array.  | 
  | 
Create a SDF primitive based actor.  | 
  | 
Create a marker actor with different shapes.  | 
  | 
VTK actor for visualizing ellipsoids.  | 
  | 
VTK actor for visualizing the cone of uncertainty representing the variance of the main direction of diffusion.  | 
  | 
FURY actor for visualizing Orientation Distribution Functions (ODFs) given an array of Spherical Harmonics (SH) coefficients.  | 
Container#
- class fury.actor.Container(*, layout=None)[source]#
 Bases:
objectProvides functionalities for grouping multiple actors using a given layout.
- Attributes:
 - anchor3-tuple of float
 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).
- padding6-tuple of float
 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).
- add(*items, **kwargs)[source]#
 Adds some items to this container.
- Parameters:
 - itemsvtkProp3D objects
 Items to add to this container.
- borrowbool
 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.
- property items#
 
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:
 - dataarray, 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].
- affinearray, shape (4, 4)
 Grid to space (usually RAS 1mm) transformation matrix. Default is None. If None then the identity matrix is used.
- value_rangeNone 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).
- opacityfloat, optional
 Opacity of 0 means completely transparent and 1 completely visible.
- lookup_colormapvtkLookupTable, optional
 If None (default) then a grayscale map is created.
- interpolationstring, 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_tolfloat, optional
 The tolerance for the vtkCellPicker, specified as a fraction of rendering window size.
- Returns:
 - image_actorImageActor
 An object that is capable of displaying different parts of the volume as slices. The key method of this object is
display_extentwhere one can input grid coordinates and display the slice in space (or grid) coordinates as calculated by the affine parameter.
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:
 - verticesarray, shape (X, Y, Z)
 The point cloud defining the surface.
- facesarray
 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.
- smoothstring - “loop” or “butterfly”
 Defines the type of subdivision to be used for smoothing the surface.
- subdivisioninteger, 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_actorActor
 An Actor visualizing the final surface computed from the point cloud is returned.
contour_from_roi#
- fury.actor.contour_from_roi(data, *, affine=None, color=None, opacity=1)[source]#
 Generate surface actor from a binary ROI.
The color and opacity of the surface can be customized.
- Parameters:
 - dataarray, shape (X, Y, Z)
 An ROI file that will be binarized and displayed.
- affinearray, 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].
- opacityfloat
 Opacity of surface between 0 and 1.
- Returns:
 - contour_assemblyvtkAssembly
 ROI surface object displayed in space coordinates as calculated by the affine parameter.
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:
 - dataarray, shape (X, Y, Z)
 A labeled array file that will be binarized and displayed.
- affinearray, 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_assemblyvtkAssembly
 Array surface object displayed in space coordinates as calculated by the affine parameter in the order of their roi ids.
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:
 - lineslist
 list of N curves represented as 2D ndarrays
- colorsarray (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.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.
- linewidthfloat, optional
 Default is 0.01.
- tube_sidesint, optional
 Default is 9.
- lodbool, 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_pointsint, optional
 Number of points to be used when LOD is in effect. Default is 10000.
- lod_points_sizeint, optional
 Size of points when lod is in effect. Default is 3.
- spline_subdivint, optional
 Number of splines subdivision to smooth streamtubes. Default is None.
- lookup_colormapvtkLookupTable, optional
 Add a default lookup table to the colormap. Default is None which calls
fury.actor.colormap_lookup_table().- replace_stripsbool, optional
 If True it changes streamtube representation from triangle strips to triangles. Useful with SelectionManager or PickingManager. Default False.
See also
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
lineactor which is much more efficient.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=colors) >>> scene.add(c) >>> #window.show(scene)
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:
 - lineslist of arrays
 - colorsarray (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.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.
- linewidthfloat, optional
 Line thickness. Default is 1.
- spline_subdivint, optional
 Number of splines subdivision to smooth streamtubes. Default is None which means no subdivision.
- lodbool, 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_pointsint, optional
 Number of points to be used when LOD is in effect. Default is 10000.
- lod_points_sizeint
 Size of points when lod is in effect. Default is 3.
- lookup_colormapvtkLookupTable, optional
 Add a default lookup table to the colormap. Default is None which calls
fury.actor.colormap_lookup_table().- depth_cueboolean, 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:
 - vActor or LODActor object
 Line.
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=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_tablevtkLookupTable or None
 If None then
colormap_lookup_tableis called with default options.- titlestr
 
- Returns:
 - scalar_barvtkScalarBarActor
 
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:
 - scaletuple (3,)
 Axes size e.g. (100, 100, 100). Default is (1, 1, 1).
- colorxtuple (3,)
 x-axis color. Default red (1, 0, 0).
- colorytuple (3,)
 y-axis color. Default green (0, 1, 0).
- colorztuple (3,)
 z-axis color. Default blue (0, 0, 1).
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.
- Returns:
 - arrow_actor: 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:
 - odfsndarray
 4D ODFs array in SF or SH coefficients. If SH coefficients, B_matrix must be supplied.
- affinearray
 4x4 transformation array from native coordinates to world coordinates.
- maskndarray
 3D mask to apply to ODF field.
- spheredipy Sphere
 The sphere used for SH to SF projection. If None, a default sphere of 100 vertices will be used.
- scalefloat
 Multiplicative factor to apply to ODF amplitudes.
- normbool
 Normalize SF amplitudes so that the maximum ODF amplitude per voxel along a direction is 1.
- radial_scalebool
 Scale sphere points by ODF values.
- opacityfloat
 Takes values from 0 (fully transparent) to 1 (opaque).
- colormapNone 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_cmbool
 If True the colormap will be applied in all ODFs. If False it will be applied individually at each voxel.
- B_matrixndarray (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:
 - actorOdfSlicerActor
 Actor representing the ODF field.
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
- affinearray
 4x4 transformation array from native coordinates to world coordinates*
- maskndarray
 3D mask
- sphereSphere
 a sphere
- scalefloat
 Distance between spheres.
- normbool
 Normalize sphere_values.
- opacityfloat
 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_actorActor
 Ellipsoid
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_dirsndarray
 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_valuesndarray
 Peak values. The shape of the array can be (M, ) or (X, M) or (X, Y, M) or (X, Y, Z, M).
- affinearray
 4x4 transformation array from native coordinates to world coordinates.
- maskndarray
 3D mask.
- colorstuple or None
 Default red color. If None then every peak gets an orientation color in similarity to a DEC map.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque).
- linewidthfloat, optional
 Line thickness. Default is 1.
- lodbool
 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_pointsint
 Number of points to be used when LOD is in effect. Default is 10000.
- lod_points_sizeint
 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: 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_dirsndarray
 Peak directions. The shape of the array should be (X, Y, Z, D, 3).
- peaks_valuesndarray, optional
 Peak values. The shape of the array should be (X, Y, Z, D).
- affinearray, optional
 4x4 transformation array from native coordinates to world coordinates.
- maskndarray, optional
 3D mask
- colorstuple or None, optional
 Default None. If None then every peak gets an orientation color in similarity to a DEC map.
- lookup_colormapvtkLookupTable, optional
 Add a default lookup table to the colormap. Default is None which calls
fury.actor.colormap_lookup_table().- linewidthfloat, optional
 Line thickness. Default is 1.
- symmetricbool, 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_actorPeakActor
 Actor or LODActor representing the peaks directions and/or magnitudes.
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:
 - pointsndarray, (N, 3)
 dots positions.
- colorsndarray (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].
- opacityfloat, 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_sizeint
 
- Returns:
 - dot_actor: Actor
 
See also
point#
- fury.actor.point(points, colors, *, point_radius=0.1, phi=8, theta=8, opacity=1.0)[source]#
 Visualize points as sphere glyphs.
- Parameters:
 - pointsndarray, shape (N, 3)
 - colorsndarray (N,3) or tuple (3,)
 - point_radiusfloat
 - phiint
 - thetaint
 - opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.
- Returns:
 - point_actor: Actor
 
See also
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:
 - centersndarray, shape (N, 3)
 Spheres positions.
- colorsndarray (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].
- radiifloat or ndarray, shape (N,)
 Sphere radius.
- phiint, optional
 Set the number of points in the latitude direction.
- thetaint, optional
 Set the number of points in the longitude direction.
- verticesndarray, shape (N, 3)
 The point cloud defining the sphere.
- facesndarray, 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.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.
- use_primitiveboolean, optional
 If True, uses primitives to create an actor.
- Returns:
 - sphere_actor: 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:
 - centersndarray, shape (N, 3)
 Cylinder positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the cylinder.
- colorsndarray (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].
- radiusfloat
 cylinder radius.
- heightsndarray, shape (N)
 The height of the cylinder.
- cappedbool
 Turn on/off whether to cap cylinder with polygons. Default (False).
- resolution: int
 Number of facets/sectors used to define cylinder.
- verticesndarray, shape (N, 3)
 The point cloud defining the sphere.
- facesndarray, 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: 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:
 - centersndarray, shape (N, 3)
 Disk positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the disk.
- colorsndarray (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].
- rinnerfloat
 disk inner radius, default: 0.3
- routerfloat
 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
- verticesndarray, shape (N, 3)
 The point cloud defining the disk.
- facesndarray, 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: 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:
 - centersndarray, shape (N, 3)
 Square positions.
- directionsndarray, shape (N, 3), optional
 The orientation vector of the square.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Square size on each direction (x, y), default(1)
- Returns:
 - sq_actor: 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, directions=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:
 - centersndarray, shape (N, 3)
 Rectangle positions.
- directionsndarray, shape (N, 3), optional
 The orientation vector of the rectangle.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Rectangle size on each direction (x, y), default(1)
- Returns:
 - rect_actor: Actor
 
See also
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, directions=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:
 - centersndarray, shape (N, 3)
 Box positions.
- directionsndarray, shape (N, 3), optional
 The orientation vector of the box.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Box size on each direction (x, y), default(1)
- Returns:
 - box_actor: 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, directions=dirs, colors=(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:
 - centersndarray, shape (N, 3)
 Cube positions.
- directionsndarray, shape (N, 3), optional
 The orientation vector of the cube.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Cube size, default: 1
- Returns:
 - cube_actor: 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, directions=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:
 - centersndarray, shape (N, 3)
 Arrow positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the arrow.
- colorsndarray (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].
- heightsndarray, shape (N)
 The height of the arrow.
- resolutionint
 The resolution of the arrow.
- tip_lengthfloat
 The tip size of the arrow (default: 0.35)
- tip_radiusfloat
 the tip radius of the arrow (default: 0.1)
- shaft_radiusfloat
 The shaft radius of the arrow (default: 0.03)
- verticesndarray, shape (N, 3)
 The point cloud defining the arrow.
- facesndarray, 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: 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=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:
 - centersndarray, shape (N, 3)
 Cone positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the cone.
- colorsndarray (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].
- heightsndarray, shape (N)
 The height of the cone.
- resolutionint
 The resolution of the cone.
- verticesndarray, shape (N, 3)
 The point cloud defining the cone.
- facesndarray, 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_primitiveboolean, optional
 If True uses primitives to create the cone actor.
- Returns:
 - cone_actor: 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=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:
 - centersndarray, shape (N, 3)
 Triangular prism positions.
- directionsndarray, shape (N, 3)
 The orientation vector(s) of the triangular prism(s).
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Triangular prism size on each direction (x, y), default(1)
- Returns:
 - tprism_actor: 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, directions=dirs, colors=colors, scales=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:
 - centersndarray, shape (N, 3)
 Rhombicuboctahedron positions.
- directionsndarray, shape (N, 3)
 The orientation vector(s) of the Rhombicuboctahedron(s).
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Rhombicuboctahedron size on each direction (x, y), default(1)
- Returns:
 - rcoh_actor: 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, directions=dirs, colors=colors, scales=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:
 - centersndarray, shape (N, 3), optional
 Pentagonal prism positions.
- directionsndarray, shape (N, 3), optional
 The orientation vector of the pentagonal prism.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Pentagonal prism size on each direction (x, y), default(1)
- Returns:
 - pent_actor: 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, directions=dirs, colors=colors, scales=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:
 - centersndarray, shape (N, 3)
 Octagonal prism positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the octagonal prism.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Octagonal prism size on each direction (x, y), default(1)
- Returns:
 - oct_actor: 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, directions=dirs, colors=colors, scales=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:
 - centersndarray, shape (N, 3)
 Frustum pyramid positions.
- directionsndarray, shape (N, 3)
 The orientation vector of the frustum pyramid.
- colorsndarray (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].
- scalesint or ndarray (N,3) or tuple (3,), optional
 Frustum pyramid size on each direction (x, y), default(1)
- Returns:
 - frustum_actor: 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, directions=dirs, colors=colors, scales=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:
 - centersndarray, shape (N, 3)
 Superquadrics positions.
- roundnessndarray, shape (N, 2) or tuple/list (2,), optional
 parameters (Phi and Theta) that control the shape of the superquadric.
- directionsndarray, shape (N, 3) or tuple (3,), optional
 The orientation vector of the cone.
- colorsndarray (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].
- scalesndarray, shape (N) or (N,3) or float or int, optional
 The height of the cone.
- Returns:
 - spq_actor: 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:
 - centersndarray, shape (N, 3)
 Billboard positions.
- colorsndarray (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].
- scalesndarray, shape (N) or (N,3) or float or int, optional
 The scale of the billboards.
- vs_decstr or list of str, optional
 Vertex Shader code that contains all variable/function declarations.
- vs_implstr or list of str, optional
 Vertex Shaders code that contains all variable/function implementations.
- gs_progstr, optional
 Geometry Shader program.
- fs_decstr or list of str, optional
 Fragment Shaders code that contains all variable/function declarations.
- fs_implstr or list of str, optional
 Fragment Shaders code that contains all variable/function implementation.
- bb_typestr, 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: 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:
 - textstr
 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.
- extrusionfloat, optional
 The extrusion amount of the text in Z axis.
- align_centerbool, 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:
 - lActor object
 Label.
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:
 - textstr
 - positiontuple
 - colortuple
 - font_sizeint
 - font_familystr
 - justificationstr
 Left, center or right (default left).
- vertical_justificationstr
 Bottom, middle or top (default bottom).
- boldbool
 - italicbool
 - shadowbool
 
- Returns:
 - 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:
 - actorslist of vtkProp3D objects
 Actors to be layout in a grid manner.
- captionslist 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_offsettuple of float (optional)
 Tells where to position the caption w.r.t. the center of its associated actor. Default: (0, -100, 0).
- cell_paddingtuple 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_shapestr
 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_ratiofloat
 Aspect ratio of the grid (width/height). Default: 16:9.
- dimtuple of int
 Dimension (nb_rows, nb_cols) of the grid. If provided, aspect_ratio will be ignored.
- Returns:
 fury.actor.ContainerobjectObject that represents the grid containing all the actors and captions, if any.
figure#
texture#
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.
- arrndarray
 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.
Notes
Check docs/examples/viz_video_on_plane.py
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:
 - rgbndarray
 Input 2D RGB or RGBA array. Dtype should be uint8.
- thetaint, optional
 Set the number of points in the longitude direction.
- phiint, optional
 Set the number of points in the latitude direction.
- interpolatebool, optional
 Interpolate between grid centers.
- Returns:
 - earthActorActor
 
texture_2d#
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:
 - centersndarray, shape (N, 3)
 SDF primitive positions.
- colorsndarray (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].
- directionsndarray, shape (N, 3)
 The orientation vector of the SDF primitive.
- primitivesstr, list, tuple, np.ndarray
 The primitive of choice to be rendered. Options are sphere, torus and ellipsoid. Default is torus.
- scalesfloat
 The size of the SDF primitive.
- Returns:
 - box_actor: 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:
 - centersndarray, shape (N, 3)
 - colorsndarray (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].
- scalesndarray, shape (N) or (N,3) or float or int, optional
 - markerstr or a list
 Available markers are: ‘3d’, ‘o’, ‘s’, ‘d’, ‘^’, ‘p’, ‘h’, ‘s6’, ‘x’, ‘+’, optional.
- marker_opacityfloat, optional
 - edge_widthint, optional
 - edge_colorndarray, shape (3), optional
 - edge_opacityfloat, optional
 
- Returns:
 - sq_actor: 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:
 - centersndarray(N, 3)
 Ellipsoid positions.
- axesndarray (3, 3) or (N, 3, 3)
 Axes of the ellipsoid.
- lengthsndarray (3, ) or (N, 3)
 Axes lengths.
- colorsndarray (N,3) or tuple (3,), optional
 Default red color. R, G and B should be in the range [0, 1].
- scalesfloat or ndarray (N, ), optional
 Ellipsoid size, default(1.0).
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque), default(1.0).
- Returns:
 - tensor_ellipsoid: 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:
 - evalsndarray (3, ) or (N, 3)
 Eigenvalues.
- evecsndarray (3, 3) or (N, 3, 3)
 Eigenvectors.
- signal3D or 4D ndarray
 Predicted signal.
- sigmandarray
 Standard deviation of the noise.
- b_matrixarray (N, 7)
 Design matrix for DTI.
- scalesfloat or ndarray (N, ), optional
 Cones of uncertainty size.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque), default(1.0).
- Returns:
 - double_cone: Actor
 
odf#
- fury.actor.odf(centers, coeffs, sh_basis='descoteaux', scales=1.0, opacity=1.0)[source]#
 FURY actor for visualizing Orientation Distribution Functions (ODFs) given an array of Spherical Harmonics (SH) coefficients.
- Parameters:
 - centersndarray(N, 3)
 ODFs positions.
- coeffs(N, M) or (N, 6) or (N, 15) or (N, 28) or (N, 45) or (N, 66) or
 (N, 91) ndarray. Corresponding SH coefficients for the ODFs.
- sh_basis: str, optional
 Type of basis (descoteaux, tournier) ‘descoteaux’ for the default
descoteaux07DIPY basis. ‘tournier’ for the defaulttournier07DIPY basis.- scalesfloat or ndarray (N, ), optional
 ODFs size.
- opacityfloat, optional
 Takes values from 0 (fully transparent) to 1 (opaque).
- Returns:
 - odf: Actor