actor

Container([layout])

Provides functionalities for grouping multiple actors using a given layout.

apply_affine(aff, pts)

Apply affine matrix aff to points pts.

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

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

colormap_lookup_table([scale_range, …])

Lookup table for the colormap.

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

Generate surface actor from a binary ROI.

create_colormap(v[, name, auto])

Create colors from a specific colormap and return it as an array of shape (N,3) where every row gives the corresponding r,g,b value.

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

Create one or more 3d points.

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

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

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

Create a label actor.

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

Create an actor for one or more lines.

lines_to_vtk_polydata(lines[, colors])

Create a vtkPolyData with lines and colors.

numpy_to_vtk_colors(colors)

Convert Numpy color array to a vtk color array.

numpy_to_vtk_matrix(array)

Convert a numpy array to a VTK matrix.

numpy_to_vtk_points(points)

Convert Numpy points array to a vtk points array.

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

Slice spherical fields in native or world coordinates

orient2rgb(v)

Get Standard orientation 2 rgb colormap.

peak_slicer(peaks_dirs[, peaks_values, …])

Visualize peak directions as given from peaks_from_model.

point(points, colors[, _opacity, …])

Visualize points as sphere glyphs

scalar_bar([lookup_table, title])

Default scalar bar actor for a given colormap (colorbar)

set_input(vtk_object, inp)

Set Generic input function which takes into account VTK 5 or 6.

set_polydata_triangles(polydata, triangles)

Set polydata triangles with a numpy array (ndarrays Nx3 int).

set_polydata_vertices(polydata, vertices)

Set polydata vertices with a numpy array (ndarrays Nx3 int).

shallow_copy(vtk_object)

Create a shallow copy of a given vtkObject object.

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

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

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

Visualize one or many spheres with different colors and radii

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

Use streamtubes to visualize polylines

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

Generates 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.

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

Slice many tensors as ellipsoids in native or world coordinates.

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

Generate 2D text that lives in the 3D world

Container

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

Bases: object

Provides 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)

__init__(self, layout=<fury.layout.Layout object at 0x7f26656b9cc0>)[source]
Parameters
layoutfury.layout.Layout object

Items of this container will be arranged according to layout.

AddPosition(self, position)[source]
GetBounds(self)[source]

Get the bounds of the container.

GetCenter(self)[source]

Get the center of the bounding box.

GetLength(self)[source]

Get the length of bounding box diagonal.

GetPosition(self)[source]
GetVisibility(self)[source]
NewInstance(self)[source]
SetPosition(self, position)[source]
SetVisibility(self, visibility)[source]
ShallowCopy(self, other)[source]
add(self, *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.

add_to_scene(self, ren)[source]

Adds the items of this container to a given renderer.

clear(self)[source]

Clears all items of this container.

items
update(self)[source]

Updates the position of the items of this container.

apply_affine

fury.actor.apply_affine(aff, pts)[source]

Apply affine matrix aff to points pts.

Returns result of application of aff to the right of pts. The coordinate dimension of pts should be the last. For the 3D case, aff will be shape (4,4) and pts will have final axis length 3 - maybe it will just be N by 3. The return value is the transformed points, in this case:: res = np.dot(aff[:3,:3], pts.T) + aff[:3,3:4] transformed_pts = res.T This routine is more general than 3D, in that aff can have any shape (N,N), and pts can have any shape, as long as the last dimension is for the coordinates, and is therefore length N-1.

Parameters
aff(N, N) array-like

Homogenous affine, for 3D points, will be 4 by 4. Contrary to first appearance, the affine will be applied on the left of pts.

pts(…, N-1) array-like

Points, where the last dimension contains the coordinates of each point. For 3D, the last dimension will be length 3.

Returns
transformed_pts(…, N-1) array

transformed points

Notes

Copied from nibabel to remove dependency.

Examples

>>> aff = np.array([[0,2,0,10],[3,0,0,11],[0,0,4,12],[0,0,0,1]])
>>> pts = np.array([[1,2,3],[2,3,4],[4,5,6],[6,7,8]])
>>> apply_affine(aff, pts) #doctest: +ELLIPSIS
array([[14, 14, 24],
       [16, 17, 28],
       [20, 23, 36],
       [24, 29, 44]]...)
Just to show that in the simple 3D case, it is equivalent to:
>>> (np.dot(aff[:3,:3], pts.T) + aff[:3,3:4]).T #doctest: +ELLIPSIS
array([[14, 14, 24],
       [16, 17, 28],
       [20, 23, 36],
       [24, 29, 44]]...)
But `pts` can be a more complicated shape:
>>> pts = pts.reshape((2,2,3))
>>> apply_affine(aff, pts) #doctest: +ELLIPSIS
array([[[14, 14, 24],
        [16, 17, 28]],
<BLANKLINE>
       [[20, 23, 36],
        [24, 29, 44]]]...)

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
vtkAssembly

colormap_lookup_table

fury.actor.colormap_lookup_table(scale_range=(0, 1), hue_range=(0.8, 0), saturation_range=(1, 1), value_range=(0.8, 0.8))[source]

Lookup table for the colormap.

Parameters
scale_rangetuple

It can be anything e.g. (0, 1) or (0, 255). Usually it is the mininum and maximum value of your data. Default is (0, 1).

hue_rangetuple of floats

HSV values (min 0 and max 1). Default is (0.8, 0).

saturation_rangetuple of floats

HSV values (min 0 and max 1). Default is (1, 1).

value_rangetuple of floats

HSV value (min 0 and max 1). Default is (0.8, 0.8).

Returns
lookup_tablevtkLookupTable

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
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.

create_colormap

fury.actor.create_colormap(v, name='plasma', auto=True)[source]

Create colors from a specific colormap and return it as an array of shape (N,3) where every row gives the corresponding r,g,b value. The colormaps we use are similar with those of matplotlib.

Parameters
v(N,) array

vector of values to be mapped in RGB colors according to colormap

namestr.

Name of the colormap. Currently implemented: ‘jet’, ‘blues’, ‘accent’, ‘bone’ and matplotlib colormaps if you have matplotlib installed. For example, we suggest using ‘plasma’, ‘viridis’ or ‘inferno’. ‘jet’ is popular but can be often misleading and we will deprecate it the future.

autobool,

if auto is True then v is interpolated to [0, 10] from v.min() to v.max()

Notes

FURY supports a few colormaps for those who do not use Matplotlib, for more colormaps consider downloading Matplotlib (see matplotlib.org).

dots

fury.actor.dots(points, color=(1, 0, 0), opacity=1, dot_size=5)[source]

Create one or more 3d points.

Parameters
pointsndarray, (N, 3)
colortuple (3,)
opacityfloat, optional

Takes values from 0 (fully transparent) to 1 (opaque)

dot_sizeint
Returns
vtkActor

See also

fury.actor.point

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.Container object

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

label

fury.actor.label(text='Origin', pos=(0, 0, 0), scale=(0.2, 0.2, 0.2), color=(1, 1, 1))[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.

Returns
lvtkActor object

Label.

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> l = actor.label(text='Hello')
>>> scene.add(l)
>>> #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,), None

If None then 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, ) 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

Use vtkLODActor(level of detail) rather than vtkActor. Default is True. 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.

lookup_colormapbool, optional

Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

depth_cueboolean

Add a size depth cue so that lines shrink with distance to the camera. Works best with linewidth <= 1.

fake_tube: boolean

Add shading to lines to approximate the look of tubes.

Returns
vvtkActor or vtkLODActor 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)
>>> scene.add(c)
>>> #window.show(scene)

lines_to_vtk_polydata

fury.actor.lines_to_vtk_polydata(lines, colors=None)[source]

Create a vtkPolyData with lines and colors.

Parameters
lineslist

list of N curves represented as 2D ndarrays

colorsarray (N, 3), list of arrays, tuple (3,), array (K,), None

If None then 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.

Returns
poly_datavtkPolyData
is_colormapbool, true if the input color array was a colormap

numpy_to_vtk_colors

fury.actor.numpy_to_vtk_colors(colors)[source]

Convert Numpy color array to a vtk color array.

Parameters
colors: ndarray
Returns
vtk_colorsvtkDataArray

Notes

If colors are not already in UNSIGNED_CHAR you may need to multiply by 255.

Examples

>>> import numpy as np
>>> from fury.utils import numpy_to_vtk_colors
>>> rgb_array = np.random.rand(100, 3)
>>> vtk_colors = numpy_to_vtk_colors(255 * rgb_array)

numpy_to_vtk_matrix

fury.actor.numpy_to_vtk_matrix(array)[source]

Convert a numpy array to a VTK matrix.

numpy_to_vtk_points

fury.actor.numpy_to_vtk_points(points)[source]

Convert Numpy points array to a vtk points array.

Parameters
pointsndarray
Returns
vtk_pointsvtkPoints()

odf_slicer

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

Slice spherical fields in native or world coordinates

Parameters
odfsndarray

4D array of spherical functions

affinearray

4x4 transformation array from native coordinates to world coordinates

maskndarray

3D mask

sphereSphere

a sphere

scalefloat

Distance between spheres.

normbool

Normalize sphere_values.

radial_scalebool

Scale sphere points according to odf values.

opacityfloat

Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

colormapNone or str

If None then white color is used. Otherwise the name of colormap is given. Matplotlib colormaps are supported (e.g., ‘inferno’).

global_cmbool

If True the colormap will be applied in all ODFs. If False it will be applied individually at each voxel (default False).

Returns
actorvtkActor

Spheres

orient2rgb

fury.actor.orient2rgb(v)[source]

Get Standard orientation 2 rgb colormap.

v : array, shape (N, 3) of vectors not necessarily normalized

Returns
carray, shape (N, 3) matrix of rgb colors corresponding to the vectors

given in V.

Examples

>>> from fury import colormap
>>> v = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
>>> c = colormap.orient2rgb(v)

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)[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 vtkLODActor(level of detail) rather than vtkActor. 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.

Returns
vtkActor

point

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

Visualize points as sphere glyphs

Parameters
pointsndarray, shape (N, 3)
colorsndarray (N,3) or tuple (3,)
point_radiusfloat
thetaint
phiint
opacityfloat, optional

Takes values from 0 (fully transparent) to 1 (opaque)

Returns
vtkActor

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)

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_table is called with default options.

titlestr
Returns
scalar_barvtkScalarBarActor

set_input

fury.actor.set_input(vtk_object, inp)[source]

Set Generic input function which takes into account VTK 5 or 6.

Parameters
vtk_object: vtk object
inp: vtkPolyData or vtkImageData or vtkAlgorithmOutput
Returns
vtk_object

Notes

This can be used in the following way::

from fury.utils import set_input poly_mapper = set_input(vtk.vtkPolyDataMapper(), poly_data)

set_polydata_triangles

fury.actor.set_polydata_triangles(polydata, triangles)[source]

Set polydata triangles with a numpy array (ndarrays Nx3 int).

Parameters
polydatavtkPolyData
trianglesarray (N, 3)

triangles, represented as 2D ndarrays (Nx3)

set_polydata_vertices

fury.actor.set_polydata_vertices(polydata, vertices)[source]

Set polydata vertices with a numpy array (ndarrays Nx3 int).

Parameters
polydatavtkPolyData
verticesvertices, represented as 2D ndarrays (Nx3)

shallow_copy

fury.actor.shallow_copy(vtk_object)[source]

Create a shallow copy of a given vtkObject object.

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.

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

If None (default) then a grayscale map is created.

interpolationstring

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

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_extent where one can input grid coordinates and display the slice in space (or grid) coordinates as calculated by the affine parameter.

sphere

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

Visualize one or many spheres with different colors and radii

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]

radiifloat or ndarray, shape (N,)
thetaint
phiint
verticesndarray, shape (N, 3)
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.

Returns
vtkActor

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)

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)[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,), None

If None then 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, ) 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

Takes values from 0 (fully transparent) to 1 (opaque). Default is 1.

linewidthfloat

Default is 0.01.

tube_sidesint

Default is 9.

lodbool

Use vtkLODActor(level of detail) rather than vtkActor. Default is True. 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.

spline_subdivint

Number of splines subdivision to smooth streamtubes. Default is None.

lookup_colormapvtkLookupTable

Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

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.

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)

surface

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

Generates 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. 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_actorvtkActor

A vtkActor visualizing the final surface computed from the point cloud is returned.

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
actorvtkActor

Ellipsoid

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
textActor3D