actor#

Init file for visualization package.

Actor()

Base Actor class for making APIs user-friendly.

Billboard

alias of BillboardActor

Group(*[, visible, name])

Group actor class.

Image

alias of ImageActor

Line

alias of LineActor

Mesh([geometry, material])

Mesh actor class.

Points([geometry, material, visible, ...])

Points actor class.

SphGlyph(coeffs, sphere, *[, basis_type, ...])

Visualize a spherical harmonic glyph with different features.

Text

alias of TextActor

VectorField(field, *[, actor_type, ...])

Class to visualize a vector field.

Volume([geometry, material, visible, ...])

Volume actor class.

actor_from_primitive(vertices, faces, centers, *)

Build an actor from a primitive.

apply_affine_to_actor(actor, affine)

Apply a transformation to an actor.

apply_affine_to_group(group, affine)

Apply a transformation to all actors in a group.

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

Create one or many arrows with different features.

axes(*[, scale, color_x, color_y, color_z, ...])

Create coordinate system axes using colored arrows.

billboard(centers, *[, colors, sizes, ...])

Create a billboard world object.

billboard_sphere(centers, *[, colors, ...])

Create a billboard impostor sphere world object.

box(centers, *[, directions, colors, ...])

Create one or many boxes with different features.

cone(centers, *[, colors, height, sectors, ...])

Create one or many cones with different features.

contour_from_label(data, *[, affine, ...])

Generate surface actor from a labeled volume.

contour_from_roi(data, *[, affine, color, ...])

Generate surface actor from a binary ROI.

contour_from_volume(data, *[, color, ...])

Generate surface actor from a binary ROI.

create_axes_helper(*[, labels, colors, ...])

Create actors composing a UI axes helper.

create_image(image_input, material, **kwargs)

Create an image object.

create_line(geometry, material)

Create a line object.

create_mesh(geometry, material)

Create a mesh object.

create_point(geometry, material)

Create a point object.

create_text(text, material, **kwargs)

Create a text object.

cylinder(centers, *[, colors, height, ...])

Create one or many cylinders with different features.

data_slicer(data, *[, value_range, opacity, ...])

Visualize a 3D volume data as a slice.

disk(centers, *[, colors, radii, sectors, ...])

Visualize one or many disks with different features.

ellipsoid(centers, *[, ...])

Create ellipsoid actor(s) with specified orientation and scaling.

ellipsoid_slicer(lengths, *[, ...])

Render an ellipsoid field on the union of enabled world-space slice planes.

frustum(centers, *[, directions, colors, ...])

Create one or many frustums with different features.

get_slices(group)

Get the current positions of the slices.

icosahedron(centers, *[, directions, ...])

Create one or many icosahedrons with different features.

image(image, *[, position, directions, ...])

Visualize a 2D image from a NumPy array or image file.

line(lines, *[, colors, opacity, material, ...])

Visualize one or many lines with different colors.

line_projection(lines, *[, plane, colors, ...])

Initialize the line projection object.

marker(centers, *[, size, colors, marker, ...])

Create one or many markers with different features.

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

Create one or many octagonal prisms with different features.

peaks_slicer(peak_dirs, *[, affine, ...])

Visualize peaks as lines in 3D space.

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

Create one or many pentagonal prisms with different features.

point(centers, *[, size, colors, material, ...])

Create one or many points with different features.

read_buffer(buffer, *[, sync_cpu])

Read the contents of a wgpu buffer into a NumPy array.

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

Create one or many rhombicuboctahedrons with different features.

ring(centers, *[, inner_radius, ...])

Create one or many rings with different features.

set_group_opacity(group, opacity)

Set the opacity of the group of actors.

set_group_visibility(group, visibility)

Set the visibility of a group of actors.

set_opacity(actor, opacity)

Set the opacity of an actor.

show_slices(group, position)

Show the slices at the specified position.

sph_glyph(coeffs, *[, sphere, basis_type, ...])

Visualize a spherical harmonic glyph with different features.

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

Create one or many spheres with different colors and radii.

square(centers, *[, directions, colors, ...])

Create one or many squares with different features.

star(centers, *[, dim, directions, colors, ...])

Create one or many stars with different features.

streamlines(lines, *[, colors, thickness, ...])

Create a streamline representation.

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

Create a streamtube from a list of lines using parallel processing.

superquadric(centers, *[, directions, ...])

Create one or many superquadrics with different features.

surface(vertices, faces, *[, material, ...])

Create a surface mesh actor from vertices and faces.

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

Render tensor eigenpairs as a sliced ellipsoid field.

tetrahedron(centers, *[, directions, ...])

Create one or many tetrahedrons with different features.

text(text, *[, colors, position, font_size, ...])

Create text with different features.

texture_on_sphere([texture, theta, phi, ...])

Map an equirectangular image onto a smooth unit sphere.

triangle(centers, *[, directions, colors, ...])

Create one or many triangles with different features.

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

Create one or many triangular prisms with different features.

vector_field(field, *[, actor_type, colors, ...])

Visualize a vector field with different features.

vector_field_slicer(field, *[, actor_type, ...])

Visualize a vector field with different features.

volume_slicer(data, *[, affine, ...])

Visualize a 3D volume data as a slice.

Actor#

class fury.actor.Actor[source]#

Bases: object

Base Actor class for making APIs user-friendly.

__init__()#
property opacity#

Get the opacity of the actor.

Returns:

Opacity value between 0 (fully transparent) and 1 (fully opaque).

Return type:

float

rotate(rotation)[source]#

Rotate the actor by the given rotation.

Parameters:

rotation (tuple) – Rotation angles (in degrees) around the x, y, and z axes.

scale(scales)[source]#

Scale the actor by the given scale factors.

Parameters:

scales (tuple or float) – Scale factors along the x, y, and z axes. If a single float is provided, uniform scaling is applied.

transform(matrix)[source]#

Apply a transformation matrix to the actor.

This transformation replaces any existing transformations.

Parameters:

matrix (ndarray, shape (4, 4)) – Transformation matrix to be applied to the actor.

translate(translation)[source]#

Translate the actor by the given translation vector.

Parameters:

translation (tuple) – Translation vector along the x, y, and z axes.

Billboard#

fury.actor.Billboard#

alias of BillboardActor

Group#

class fury.actor.Group(*, visible=True, name='')[source]#

Bases: Group, Actor

Group actor class.

__init__(*, visible=True, name='')[source]#

Image#

fury.actor.Image#

alias of ImageActor

Line#

fury.actor.Line#

alias of LineActor

Mesh#

class fury.actor.Mesh(geometry=None, material=None, *args, **kwargs)[source]#

Bases: Mesh, Actor

Mesh actor class.

__init__(geometry=None, material=None, *args, **kwargs)[source]#

Points#

class fury.actor.Points(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, name: str = '', cast_shadow: bool = False, receive_shadow: bool = False, nonlinear_transform: str | None = None)[source]#

Bases: Points, Actor

Points actor class.

__init__(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, name: str = '', cast_shadow: bool = False, receive_shadow: bool = False, nonlinear_transform: str | None = None) → None#

SphGlyph#

class fury.actor.SphGlyph(coeffs, sphere, *, basis_type='standard', color_type='sign', shininess=50)[source]#

Bases: Mesh

Visualize a spherical harmonic glyph with different features.

Parameters:
  • coeffs (ndarray, shape (X, Y, Z, N)) – The spherical harmonics coefficients. X, Y, Z denotes the position and N represents the number of coefficients.

  • sphere (tuple) – Vertices and faces of the sphere to use for the glyph.

  • basis_type (str, optional) – The type of basis to use for the spherical harmonics. Options are ‘standard’, ‘descoteaux07’.

  • color_type (str, optional) – The type of color mapping to use for the spherical glyph. Options are ‘sign’ and ‘orientation’.

  • shininess (float, optional) – The shininess of the material for the spherical glyph.

__init__(coeffs, sphere, *, basis_type='standard', color_type='sign', shininess=50)[source]#

Visualize a spherical harmonic glyph with different features.

property l_max#

Get the maximum degree of the spherical harmonics.

Returns:

The maximum degree of the spherical harmonics used in the glyph.

Return type:

int

property scale#

Get the scale of the spherical glyph.

Returns:

The scale of the spherical glyph.

Return type:

float

Text#

fury.actor.Text#

alias of TextActor

VectorField#

class fury.actor.VectorField(field, *, actor_type='thin_line', cross_section=None, colors=None, scales=1.0, opacity=1.0, thickness=1.0, visibility=None)[source]#

Bases: WorldObject, Actor

Class to visualize a vector field.

Parameters:
  • field (ndarray, shape {(X, Y, Z, N, 3), (X, Y, Z, 3)}) – The vector field data, where X, Y, Z represent the position in 3D, N is the number of vectors per voxel, and 3 represents the vector

  • actor_type (str, optional) – The type of vector field visualization. Options are “thin_line”, “line”, and “arrow”.

  • cross_section (list or tuple, shape (3,), optional) – A list or tuple representing the cross section dimensions. If None, the cross section will be ignored and complete field will be shown.

  • colors (str, tuple, list or ndarray, optional) – Color for the vectors. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255]. If None, the color is taken from the orientation.

  • scales ({float, ndarray}, shape {(X, Y, Z, N) or (X, Y, Z)}, optional) – Scale factor for the vectors. If ndarray, it should match the shape of the field.

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

  • thickness (float, optional) – The thickness of the lines in the vector field visualization. Only applicable for “line” and “arrow” types.

  • visibility (tuple, optional) – A tuple of three boolean values indicating the visibility of the slices in the x, y, and z dimensions, respectively.

__init__(field, *, actor_type='thin_line', cross_section=None, colors=None, scales=1.0, opacity=1.0, thickness=1.0, visibility=None)[source]#

Initialize a vector field.

property cross_section#

Get the cross section of the vector field.

Returns:

The cross section of the vector field.

Return type:

ndarray

get_bounding_box()[source]#

Get the bounding box of the vector field.

Returns:

A list containing two elements, each a list of three floats representing the minimum and maximum coordinates of the bounding box.

Return type:

list

property visibility#

Get the visibility of the vector field.

Returns:

A tuple of three boolean values indicating the visibility of the slices in the x, y, and z dimensions, respectively.

Return type:

tuple

Volume#

class fury.actor.Volume(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, name: str = '', cast_shadow: bool = False, receive_shadow: bool = False, nonlinear_transform: str | None = None)[source]#

Bases: Volume, Actor

Volume actor class.

__init__(geometry: Geometry | None = None, material: Material | None = None, *, visible: bool = True, render_order: float = 0, name: str = '', cast_shadow: bool = False, receive_shadow: bool = False, nonlinear_transform: str | None = None) → None#

actor_from_primitive#

fury.actor.actor_from_primitive(vertices, faces, centers, *, colors=(1, 0, 0), scales=(1, 1, 1), directions=(1, 0, 0), opacity=None, material='phong', smooth=False, enable_picking=True, repeat_primitive=True, have_tiled_verts=False, wireframe=False, wireframe_thickness=1.0, material_params=None)[source]#

Build an actor from a primitive.

Parameters:
  • vertices (ndarray) – Vertices of the primitive.

  • faces (ndarray) – Faces of the primitive.

  • centers (ndarray, shape (N, 3)) – Primitive positions.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the primitive in each dimension. If a single value is provided, the same size will be used for all primitives.

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

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the primitive. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • smooth (bool, optional) – Whether to create a smooth primitive or a faceted primitive.

  • enable_picking (bool, optional) – Whether the primitive should be pickable in a 3D scene.

  • repeat_primitive (bool, optional) – Whether to repeat the primitive for each center. If False, only one instance of the primitive is created at the first center.

  • have_tiled_verts (bool, optional) – If True, vertices are already tiled (one set per center) and should not be duplicated again inside repeat_primitive.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

Returns:

A mesh actor containing the generated primitive, with the specified material and properties.

Return type:

Actor

apply_affine_to_actor#

fury.actor.apply_affine_to_actor(actor, affine)[source]#

Apply a transformation to an actor.

Parameters:
  • actor (WorldObject) – The actor to apply the transformation to.

  • affine (ndarray, shape (4, 4)) – The transformation to apply to the actor.

apply_affine_to_group#

fury.actor.apply_affine_to_group(group, affine)[source]#

Apply a transformation to all actors in a group.

Parameters:
  • group (Group) – The group of actors to apply the transformation to.

  • affine (ndarray, shape (4, 4)) – The transformation to apply to the actors in the group.

arrow#

fury.actor.arrow(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), height=1.0, resolution=10, tip_length=0.35, tip_radius=0.1, shaft_radius=0.03, scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True)[source]#

Create one or many arrows with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • height (float or ndarray, shape (N,), optional) – The total height of the arrow, including the shaft and tip. A single value applies to all arrows, while an array specifies a value per arrow.

  • resolution (int, optional) – The number of divisions along the arrow’s circular cross-sections. Higher values produce smoother arrows.

  • tip_length (float or ndarray, shape (N,), optional) – The length of the arrowhead tip relative to the total height. A single value applies to all arrows, while an array specifies a value per arrow.

  • tip_radius (float or ndarray, shape (N,), optional) – The radius of the arrowhead tip. A single value applies to all arrows, while an array specifies a value per arrow.

  • shaft_radius (float or ndarray, shape (N,), optional) – The radius of the arrow shaft. A single value applies to all arrows, while an array specifies a value per arrow.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the arrow in each dimension. If a single value is provided, the same size will be used for all arrows.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the arrows. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the arrows should be pickable in a 3D scene.

Returns:

A mesh actor containing the generated arrows, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> arrow_actor = actor.arrow(centers=centers, colors=colors)
>>> _ = scene.add(arrow_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

axes#

fury.actor.axes(*, scale=(1.0, 1.0, 1.0), color_x=(1.0, 0.0, 0.0), color_y=(0.0, 1.0, 0.0), color_z=(0.0, 0.0, 1.0), opacity=1.0)[source]#

Create coordinate system axes using colored arrows.

The axes are represented as arrows with different colors: red = X-axis, green = Y-axis, blue = Z-axis.

Parameters:
  • scale (tuple (3,), optional) – The size (length) of each axis in the x, y, and z directions.

  • color_x (str, tuple, list or ndarray, optional) – Color for the X-axis. Accepts a hex string, RGB in [0, 1], or RGB in [0, 255].

  • color_y (str, tuple, list or ndarray, optional) – Color for the Y-axis. Same formats as color_x.

  • color_z (str, tuple, list or ndarray, optional) – Color for the Z-axis. Same formats as color_x.

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

Returns:

An axes actor representing the coordinate axes with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> axes_actor = actor.axes()
>>> _ = scene.add(axes_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

billboard#

fury.actor.billboard(centers, *, colors=(1, 1, 1), sizes=(1, 1), opacity=None, enable_picking=True)[source]#

Create a billboard world object.

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

  • colors (str, tuple, list or ndarray, optional) – Per-billboard color. Accepts a hex string, RGB(A) in [0, 1], RGB(A) in [0, 255], or one such color per billboard.

  • sizes ((N,2) | (2,) | float | (N,) array_like) – Width/height per billboard. Scalar or single pair broadcast.

  • opacity (float, optional) – Global opacity multiplier (0..1).

  • enable_picking (bool) – Whether billboard is pickable.

Returns:

Billboard world object configured with the provided geometry and material.

Return type:

Billboard

billboard_sphere#

fury.actor.billboard_sphere(centers, *, colors=(1, 1, 1), radii=0.5, opacity=None, enable_picking=True)[source]#

Create a billboard impostor sphere world object.

Parameters:
  • centers (array_like) – Sphere centers provided as an (N, 3) array or broadcastable input.

  • colors (str, tuple, list or ndarray, optional) – Color per sphere. Accepts a hex string, RGB(A) in [0, 1], RGB(A) in [0, 255], or one such color per sphere. Single colors are broadcast.

  • radii (array_like, optional) – Scalar radii or per-sphere radii array. Used to compute billboard size.

  • opacity (float, optional) – Opacity multiplier applied to the material.

  • enable_picking (bool, optional) – Whether the impostor spheres support picking.

Returns:

Billboard actor configured to simulate spheres using impostor quads.

Return type:

Billboard

box#

fury.actor.box(centers, *, directions=(1, 0, 0), colors=(1, 0, 0), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, detailed=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many boxes with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the box in each dimension. If a single value is provided, the same size will be used for all boxes.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the boxes. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the boxes should be pickable in a 3D scene.

  • detailed (bool, optional) – Whether to create a detailed box with 24 vertices or a simple box with 8 vertices.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated boxes, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> scales = np.random.rand(5, 3)
>>> box_actor = actor.box(centers=centers, scales=scales)
>>> _ = scene.add(box_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

cone#

fury.actor.cone(centers, *, colors=(1, 1, 1), height=1, sectors=10, radii=0.5, scales=(1, 1, 1), directions=(0, 1, 0), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many cones with different features.

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • height (float or ndarray, shape (N,), optional) – The height of the cone. A single value applies to all cones, while an array specifies a height for each cone individually.

  • sectors (int, optional) – The number of divisions around the cone’s circumference. Higher values produce smoother cones.

  • radii (float or ndarray, shape (N,) or tuple, optional) – The radius of the base of the cones. A single value applies to all cones, while an array specifies a radius for each cone individually.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the cone in each dimension. If a single value is provided, the same size will be used for all cones.

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

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the cones. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the cones should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated cones, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> cone_actor = actor.cone(centers=centers, colors=colors)
>>> _ = scene.add(cone_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

contour_from_label#

fury.actor.contour_from_label(data, *, affine=None, colors=None, opacities=None)[source]#

Generate surface actor from a labeled volume.

Parameters:
  • data (ndarray, shape (X, Y, Z)) – A labeled volume where each integer label represents a different region.

  • affine (ndarray, optional) – The affine transformation matrix to apply to the contour.

  • colors (list or ndarray, shape (N, 3) or (N, 4), optional) – A color for each unique label in the volume, where N is the number of unique labels (excluding background label 0). Each entry accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255]. If None, random colors will be assigned.

  • opacities (ndarray, shape (N,) or None, optional) – The opacities of the contours. Takes values from 0 (fully transparent) to 1 (opaque). It will be overridden if RGBA colors are provided.

Returns:

A group of actors containing the generated contours for each label in the volume data.

Return type:

Group

contour_from_roi#

fury.actor.contour_from_roi(data, *, affine=None, color=(1, 0, 0), opacity=0.5, material='phong')[source]#

Generate surface actor from a binary ROI.

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

  • affine (ndarray, optional) – The affine transformation matrix to apply to the contour.

  • color (str, tuple, list or ndarray, optional) – The output color of the contour. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255].

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

  • material (str, optional) – The material type for the contour mesh. Options are ‘phong’ and ‘basic’.

Returns:

A group of actors containing the generated contours of ROI from the volume data.

Return type:

Group

contour_from_volume#

fury.actor.contour_from_volume(data, *, color=(1, 0, 0), opacity=0.5, material='phong', material_params=None)[source]#

Generate surface actor from a binary ROI.

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

  • color (str, tuple, list or ndarray, optional) – The output color of the contour. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255].

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

  • material (str, optional) – The material type for the contour mesh. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

Returns:

A group of actors containing the generated contours from the volume data.

Return type:

Group

create_axes_helper#

fury.actor.create_axes_helper(*, labels=None, colors=None, thickness=2, center_disk_radius=0.11, endpoint_disk_radius=0.33, label_font_size=0.4)[source]#

Create actors composing a UI axes helper.

This returns the helper group and related actor lists so callers can attach callbacks and place it in scene-specific coordinate systems.

Parameters:
  • labels (list of str, optional) – Labels for [-X, +X, -Y, +Y, -Z, +Z].

  • colors (list, optional) – Color for each axis endpoint. Each entry accepts a hex string, RGB in [0, 1], or RGB in [0, 255].

  • thickness (float, optional) – Thickness for endpoint lines.

  • center_disk_radius (float, optional) – Radius of the center disk.

  • endpoint_disk_radius (float, optional) – Radius of endpoint disks.

  • label_font_size (float, optional) – Font size for endpoint labels.

Returns:

A dictionary containing: - group - center_disk - disks - labels - lines - line_points - axis_vectors

Return type:

dict

create_image#

fury.actor.create_image(image_input, material, **kwargs)[source]#

Create an image object.

Parameters:
  • image_input (str or np.ndarray) – The image content. Can be a file path (string) to an image file, or a NumPy array. Supported array shapes: - (H, W) for grayscale images - (H, W, 1) for single-channel images (squeezed to grayscale) - (H, W, 3) for RGB images (converted to RGBA internally) - (H, W, 4) for RGBA images

  • material (ImageBasicMaterial) – The material object.

  • **kwargs (dict, optional) – Additional properties like position, visible, etc.

Returns:

The image object.

Return type:

Image

Raises:
  • TypeError – If image_input is not a string or NumPy array, or if material is not an instance of ImageBasicMaterial.

  • ValueError – If the array has an unsupported number of dimensions or channels.

create_line#

fury.actor.create_line(geometry, material)[source]#

Create a line object.

Parameters:
  • geometry (Geometry) – The geometry object.

  • material (Material) – The material object.

Returns:

The line object.

Return type:

Line

create_mesh#

fury.actor.create_mesh(geometry, material)[source]#

Create a mesh object.

Parameters:
  • geometry (Geometry) – The geometry object.

  • material (Material) – The material object. Must be an instance of MeshPhongMaterial, MeshBasicMaterial or MeshStandardMaterial (which MeshPhysicalMaterial derives from).

Returns:

The mesh object.

Return type:

Mesh

Raises:

TypeError – If geometry is not an instance of Geometry or material is not an instance of MeshPhongMaterial, MeshBasicMaterial or MeshStandardMaterial.

create_point#

fury.actor.create_point(geometry, material)[source]#

Create a point object.

Parameters:
  • geometry (Geometry) – The geometry object.

  • material (Material) – The material object. Must be either PointsMaterial, PointsGaussianBlobMaterial, or PointsMarkerMaterial.

Returns:

The point object.

Return type:

Points

Raises:

TypeError – If geometry is not an instance of Geometry or material is not an instance of PointsMaterial, PointsGaussianBlobMaterial, or PointsMarkerMaterial.

create_text#

fury.actor.create_text(text, material, **kwargs)[source]#

Create a text object.

Parameters:
  • text (str) – The text content.

  • material (TextMaterial) – The material object.

  • **kwargs (dict) – Additional properties like font_size, anchor, etc.

Returns:

The text object.

Return type:

Text

Raises:

TypeError – If text is not a string or material is not an instance of TextMaterial.

Examples

>>> mat = TextMaterial()
>>> t = create_text("Hello", mat)

cylinder#

fury.actor.cylinder(centers, *, colors=(1, 1, 1), height=1, sectors=36, radii=0.5, scales=(1, 1, 1), directions=(0, 1, 0), capped=True, opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many cylinders with different features.

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • height (float or ndarray, shape (N,), optional) – The height of the cylinder. A single value applies to all cylinders, while an array specifies a height for each cylinder individually.

  • sectors (int, optional) – The number of divisions around the cylinder’s circumference. Higher values produce smoother cylinders.

  • radii (float or ndarray, shape (N,) or tuple, optional) – The radius of the base of the cylinders. A single value applies to all cylinders, while an array specifies a radius for each cylinder individually.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the cylinder in each dimension. If a single value is provided, the same size will be used for all cylinders.

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

  • capped (bool, optional) – Whether to add caps (circular ends) to the cylinders.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the cylinders. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the cylinders should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated cylinders, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> cylinder_actor = actor.cylinder(centers=centers, colors=colors)
>>> _ = scene.add(cylinder_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

data_slicer#

fury.actor.data_slicer(data, *, value_range=None, opacity=1.0, interpolation='linear', visibility=(True, True, True), initial_slices=None, alpha_mode='auto', depth_write=False)[source]#

Visualize a 3D volume data as a slice.

Parameters:
  • data (ndarray, shape (X, Y, Z) or (X, Y, Z, 3)) – The 3D volume data to be sliced.

  • value_range (tuple, optional) – The minimum and maximum values for the color mapping. If None, the range is determined from the data.

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

  • interpolation (str, optional) – The interpolation method for the slice. Options are ‘linear’ and ‘nearest’.

  • visibility (tuple, optional) – A tuple of three boolean values indicating the visibility of the slices in the x, y, and z dimensions, respectively.

  • initial_slices (tuple, optional) – A tuple of three initial slice positions in the x, y, and z dimensions, respectively. If None, the slices are initialized to the middle of the volume.

  • alpha_mode (str, optional) – The alpha mode for the material. Please see the below link for details: https://docs.pygfx.org/stable/_autosummary/materials/pygfx.materials.Material.html#pygfx.materials.Material.alpha_mode.

  • depth_write (bool, optional) – Whether to write depth information for the material.

Returns:

An actor containing the generated slice with the specified properties.

Return type:

Group

disk#

fury.actor.disk(centers, *, colors=(1.0, 1.0, 1.0), radii=0.5, sectors=36, scales=(1.0, 1.0, 1.0), directions=(0.0, 0.0, 0.0), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Visualize one or many disks with different features.

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

  • colors (ndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • radii (float or ndarray (N,) or tuple, optional) – The radius of the disks, single value applies to all disks, while an array specifies a radius for each disk individually.

  • sectors (int, optional) – The number of divisions around the disk’s circumference . Higher values produce smoother disk.

  • scales (int or ndarray (N,3) or tuple (3,), optional) – The size of the disks in each dimension. If a single value is provided, the same size will be used for all disks.

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

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the disk. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the disk should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated disks, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> disk_actor = actor.disk(centers=centers, colors=colors)
>>> _ = scene.add(disk_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

ellipsoid#

fury.actor.ellipsoid(centers, *, orientation_matrices=None, lengths=(4, 2, 2), colors=(1, 0, 0), opacity=None, phi=16, theta=16, material='phong', material_params=None, enable_picking=True, smooth=True, wireframe=False, wireframe_thickness=1.0, impostor=True)[source]#

Create ellipsoid actor(s) with specified orientation and scaling.

Parameters:
  • centers (ndarray, shape (N, 3) or (3,)) – Centers of the ellipsoids.

  • orientation_matrices (ndarray, shape (N, 3, 3) or (3, 3), optional) – Orthonormal matrices whose columns define the local semi-axis directions. Either handedness gives the same ellipsoid. A single matrix, including shape (1, 3, 3), is broadcast to all ellipsoids.

  • lengths (ndarray (N, 3) or (3,) or tuple (3,), optional) – Nonnegative semi-axis lengths, not diameters. A single triple is broadcast to all ellipsoids; zero-axis glyphs have no renderable volume.

  • colors (array-like or tuple, optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • opacity (float, optional) – Opacity of the ellipsoids. Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • phi (int, optional) – Number of latitude segments for the mesh branch only.

  • theta (int, optional) – Number of longitude segments for the mesh branch only.

  • material (str, optional) – The material type for the ellipsoids. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Allow picking of the ellipsoids in a 3D scene.

  • smooth (bool, optional) – Whether to create a smooth ellipsoid or a faceted ellipsoid.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

  • impostor (bool, optional) – Render smooth Phong ellipsoids as compact billboard impostors by default. Other materials, nonempty material_params, wireframe, or faceted shading retain the requested appearance through the mesh branch, with a warning.

Returns:

An actor containing the generated ellipsoids.

Return type:

Actor

Notes

Impostor rendering logs a warning because it provides no mesh surface vertices or faces, ignores phi and theta, and picks glyph_index instead of mesh face coordinates. Use impostor=False to retain mesh behavior.

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> from fury import actor, window
>>> centers = np.array([[0, 0, 0]])
>>> lengths = np.array([[2, 1, 1]])
>>> colors = np.array([[1, 0, 0]])
>>> ellipsoid = actor.ellipsoid(centers=centers, lengths=lengths, colors=colors)
>>> window.show([ellipsoid])

ellipsoid_slicer#

fury.actor.ellipsoid_slicer(lengths, *, orientation_matrices=None, mask=None, colors=None, scale=1.0, cross_section=None, opacity=1.0, visibility=(True, True, True), enable_picking=True)[source]#

Render an ellipsoid field on the union of enabled world-space slice planes.

Parameters:
  • lengths (ndarray, shape (X, Y, Z, 3)) – Nonnegative semi-axis lengths at integer voxel centers. Zero axes have no renderable volume.

  • orientation_matrices (ndarray, optional) – Orthonormal columns defining the semi-axes, as a uniform (3, 3) matrix or a field with shape (X, Y, Z, 3, 3). Either handedness is supported.

  • mask (ndarray, shape (X, Y, Z), optional) – Boolean active-voxel mask. Masked lengths and orientations may contain invalid background values.

  • colors (str, tuple, list or ndarray, optional) – Uniform RGB(A) or hex color, or an (X, Y, Z, 3/4) RGB(A) field. Numeric colors accept the [0, 1] and [0, 255] conventions. None uses WGSL orient2rgb on the longest unscaled semi-axis’s input/model-frame orientation column. Ties select the first axis.

  • scale (float, optional) – Finite nonnegative real scalar multiplying semi-axis lengths without changing centers, slice bounds or directional colors. Zero hides all glyphs without excusing invalid unmasked input lengths or orientations. All unmasked scaled semi-axis lengths must fit in float32 buffers.

  • cross_section (list, tuple or ndarray, optional) – Three world-space plane positions, clamped to full-field center bounds and converted to integers. None selects the voxel-shape midpoint.

  • opacity (float, optional) – Material opacity in [0, 1].

  • visibility (tuple, optional) – Visibility of the X, Y and Z slice planes.

  • enable_picking (bool, optional) – Enable surface picking with the original full-field voxel index.

Returns:

A flat group of material-bearing resident ellipsoid tiles.

Return type:

Group

Notes

Slice changes update uniforms without repacking glyphs. Chunks satisfy individual device buffer limits; total GPU residency grows with the field. Plane selection and center snapping follow vector-field distance semantics.

frustum#

fury.actor.frustum(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many frustums with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the frustum in each dimension. If a single value is provided, the same size will be used for all frustums.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the frustums. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the frustums should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated frustums, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> frustum_actor = actor.frustum(centers=centers, colors=colors)
>>> _ = scene.add(frustum_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

get_slices#

fury.actor.get_slices(group)[source]#

Get the current positions of the slices.

Parameters:

group (Group) – The group of actors to get the slices from.

Returns:

An array containing the current positions of the slices.

Return type:

ndarray

icosahedron#

fury.actor.icosahedron(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many icosahedrons with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the icosahedron in each dimension. If a single value is provided, the same size will be used for all icosahedrons.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the icosahedrons. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the icosahedrons should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated icosahedrons, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> icosahedron_actor = actor.icosahedron(centers=centers, colors=colors)
>>> _ = scene.add(icosahedron_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

image#

fury.actor.image(image, *, position=(0.0, 0.0, 0.0), directions=(0.0, 0.0, 1.0), visible=True, clim=None, map=None, gamma=1.0, interpolation='nearest')[source]#

Visualize a 2D image from a NumPy array or image file.

Parameters:
  • image (str or ndarray) – The image input. Can be a file path (string) or a NumPy array.

  • position (tuple, optional) – The position of the image in 3D space.

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

  • visible (bool, optional) – Whether the image should be visible.

  • clim (tuple, optional) – Contrast limits for image scaling.

  • map (TextureMap or Texture, optional) – The texture map used to convert image values into color.

  • gamma (float, optional) – Gamma correction to apply to the image. Must be greater than 0.

  • interpolation (str, optional) – Interpolation method for rendering the image. Either ‘nearest’ or ‘linear’.

Returns:

An image actor containing the rendered 2D image.

Return type:

ImageActor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> image_data = np.random.rand(256, 256)
>>> image_actor = actor.image(image=image_data)
>>> _ = scene.add(image_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

line#

fury.actor.line(lines, *, colors=(1, 0, 0), opacity=None, material='basic', enable_picking=True)[source]#

Visualize one or many lines with different colors.

Parameters:
  • lines (list of ndarray of shape (P, 3) or ndarray of shape (N, P, 3)) – Lines points.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

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

  • material (str, optional) – The material type for the lines. Options are ‘basic’, ‘segment’, ‘arrow’, ‘thin’, and ‘thin_segment’.

  • enable_picking (bool, optional) – Whether the lines should be pickable in a 3D scene.

Returns:

A mesh actor containing the generated lines, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> lines = [np.random.rand(10, 3) for _ in range(5)]
>>> colors = np.random.rand(5, 3)
>>> line_actor = actor.line(lines=lines, colors=colors)
>>> _ = scene.add(line_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

line_projection#

fury.actor.line_projection(lines, *, plane='XY', colors=(1, 0, 0), lengths=None, offsets=None, thickness=1.0, outline_color=(0, 0, 0), outline_thickness=0.2, opacity=1.0, lift=0.0)[source]#

Initialize the line projection object.

This projection is best visualized when the plane normal is aligned with the camera view direction.

Parameters:
  • lines (sequence) – A list of lines to be projected.

  • plane ({str, tuple}, optional) – The plane equation (a, b, c, d) for the projection.

  • colors (str, tuple, list or ndarray, optional) – The color of the cross-section point. Accepts a hex string, RGB(A) in [0, 1], RGB(A) in [0, 255], or one such color per line.

  • lengths (list, optional) – A list of lengths for each line.

  • offsets (list, optional) – A list of offsets for each line.

  • thickness (float, optional) – Thickness of the cross-section.

  • outline_color (str, tuple, list or ndarray, optional) – The color of the outline. Same formats as colors.

  • outline_thickness (float, optional) – The thickness of the outline.

  • opacity (float, optional) – The opacity of the lines.

  • lift (float, optional) – A small lift applied to the projected points along the plane normal to avoid z-fighting.

Returns:

The created line projection object.

Return type:

LineProjection

marker#

fury.actor.marker(centers, *, size=15, colors=(1.0, 0.0, 0.0), marker='circle', edge_color='black', edge_width=1.0, opacity=1.0, enable_picking=True)[source]#

Create one or many markers with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – The positions of the markers.

  • size (float, optional) – The size (diameter) of the points in logical pixels.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • marker (str or MarkerShape, optional) – The shape of the marker. Options are “●”: “circle”, “+”: “plus”, “x”: “cross”, “♥”: “heart”, “✳”: “asterix”.

  • edge_color (str or tuple or Color, optional) – The color of line marking the edge of the markers.

  • edge_width (float, optional) – The width of the edge of the markers.

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

  • enable_picking (bool, optional) – Whether the points should be pickable in a 3D scene.

Returns:

A marker actor containing the generated markers with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(1000, 3) * 10
>>> colors = np.random.rand(1000, 3)
>>> marker_actor = actor.marker(centers=centers, colors=colors)
>>> _ = scene.add(marker_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

octagonalprism#

fury.actor.octagonalprism(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many octagonal prisms with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the octagonal prism in each dimension. If a single value is provided, the same size will be used for all octagonal prisms.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the octagonal prisms. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the octagonal prisms should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated octagonal prisms, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> octagonalprism_actor = actor.octagonalprism(centers=centers, colors=colors)
>>> _ = scene.add(octagonalprism_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

peaks_slicer#

fury.actor.peaks_slicer(peak_dirs, *, affine=None, peak_values=1.0, actor_type='thin_line', cross_section=None, colors=None, opacity=1.0, thickness=1.0, visibility=(True, True, True))[source]#

Visualize peaks as lines in 3D space.

Parameters:
  • peak_dirs (ndarray, shape {(X, Y, Z, N, 3), (X, Y, Z, 3)}) – The directions of the peaks.

  • affine (ndarray, shape (4, 4), optional) – The affine transformation matrix to apply to the peak directions.

  • peak_values (float or ndarray, optional) – The values associated with each peak direction. If a single float is provided, it is applied uniformly to all peaks.

  • actor_type (str, optional) – The type of actor to create for the peaks. Options are ‘thin_line’ and ‘line’.

  • cross_section (float, optional) – The cross-section size for the peaks. If None, it defaults to a small value.

  • colors (ndarray, shape (N, 3) or None, optional) – The colors for each peak direction. If None, a default color is used.

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

  • thickness (float, optional) – The thickness of the peaks if actor_type is ‘thick_line’.

  • visibility (tuple, optional) – A tuple of three boolean values indicating the visibility of the peaks in the x, y, and z dimensions, respectively.

Returns:

An actor containing the generated peaks with the specified properties.

Return type:

VectorField

pentagonalprism#

fury.actor.pentagonalprism(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many pentagonal prisms with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the pentagonal prism in each dimension. If a single value is provided, the same size will be used for all pentagonal prisms.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the pentagonal prisms. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the pentagonal prisms should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated pentagonal prisms, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> pentagonalprism_actor = actor.pentagonalprism(centers=centers, colors=colors)
>>> _ = scene.add(pentagonalprism_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

point#

fury.actor.point(centers, *, size=4.0, colors=(1.0, 0.0, 0.0), material='basic', map=None, aa=True, opacity=1.0, enable_picking=True)[source]#

Create one or many points with different features.

Parameters:
  • centers (ndarray, shape (N, 3)) – The positions of the points.

  • size (float, optional) – The size (diameter) of the points in logical pixels.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • material (str, optional) – The material type for the points. Options are ‘basic’, ‘gaussian’.

  • map (TextureMap or Texture, optional) – The texture map specifying the color for each texture coordinate.

  • aa (bool, optional) – Whether or not the points are anti-aliased in the shader.

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

  • enable_picking (bool, optional) – Whether the points should be pickable in a 3D scene.

Returns:

A point actor containing the generated points with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(1000, 3) * 10
>>> colors = np.random.rand(1000, 3)
>>> point_actor = actor.point(centers=centers, colors=colors)
>>> _ = scene.add(point_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

read_buffer#

fury.actor.read_buffer(buffer, *, sync_cpu=True)[source]#

Read the contents of a wgpu buffer into a NumPy array.

Parameters:
  • buffer (wgpu.Buffer) – The buffer to read from.

  • sync_cpu (bool, optional) – Whether to synchronize the CPU data with the GPU data. If True and the buffer has a CPU-side data array, it will be updated with the contents of the GPU buffer.

Returns:

The contents of the buffer as a NumPy array.

Return type:

np.ndarray

rhombicuboctahedron#

fury.actor.rhombicuboctahedron(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many rhombicuboctahedrons with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the rhombicuboctahedron in each dimension. If a single value is provided, the same size will be used for all rhombicuboctahedrons.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the rhombicuboctahedrons. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the rhombicuboctahedrons should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated rhombicuboctahedrons, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> rhombicuboctahedron_actor = actor.rhombicuboctahedron(
...    centers=centers, colors=colors)
>>> _ = scene.add(rhombicuboctahedron_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

ring#

fury.actor.ring(centers, *, inner_radius=0.5, outer_radius=1.0, radial_segments=1, circumferential_segments=32, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True)[source]#

Create one or many rings with different features.

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

  • inner_radius (float or ndarray, shape (N,), optional) – The inner radius of the ring (radius of the hole). A single value applies to all rings, while an array specifies a value per ring.

  • outer_radius (float or ndarray, shape (N,), optional) – The outer radius of the ring. A single value applies to all rings, while an array specifies a value per ring.

  • radial_segments (int, optional) – Number of segments along the radial direction.

  • circumferential_segments (int, optional) – Number of segments around the circumference.

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the ring in each dimension. If a single value is provided, the same size will be used for all rings.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the rings. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the rings should be pickable in a 3D scene.

Returns:

A mesh actor containing the generated rings, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> ring_actor = actor.ring(centers=centers, colors=colors)
>>> _ = scene.add(ring_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

set_group_opacity#

fury.actor.set_group_opacity(group, opacity)[source]#

Set the opacity of the group of actors.

Parameters:
  • group (Group) – The group of actors to set opacity for.

  • opacity (float) – The opacity value to set for the group of actors, ranging from 0 (fully transparent) to 1 (opaque).

set_group_visibility#

fury.actor.set_group_visibility(group, visibility)[source]#

Set the visibility of a group of actors.

Parameters:
  • group (Group) – The group of actors to set visibility for.

  • visibility (tuple or list of bool) – If a single boolean value is provided, it sets the visibility for all actors in the group. If a tuple or list is provided, it sets the visibility for each actor in the group individually.

set_opacity#

fury.actor.set_opacity(actor, opacity)[source]#

Set the opacity of an actor.

Parameters:
  • actor (WorldObject) – The actor to set opacity for.

  • opacity (float) – The opacity value to set for the actor, ranging from 0 (fully transparent) to 1 (opaque).

show_slices#

fury.actor.show_slices(group, position)[source]#

Show the slices at the specified position.

Plane positions include a small offset to avoid boundary issues.

Parameters:
  • group (Group) – The group of actors to get the slices from.

  • position (tuple or list or ndarray) – A tuple containing the positions of the slices in the 3D space.

sph_glyph#

fury.actor.sph_glyph(coeffs, *, sphere=None, basis_type='standard', color_type='sign', shininess=50)[source]#

Visualize a spherical harmonic glyph with different features.

Parameters:
  • coeffs (ndarray, shape (X, Y, Z, N)) – The spherical harmonics coefficients. X, Y, Z denotes the position and N represents the number of coefficients.

  • sphere ({str, tuple}, optional) – The name of the sphere to use or a custom sphere tuple (phi, theta), where phi is the number of latitude segments and theta is the number of longitude segments: (latitude_segments, longitude_segments). Available options for the named spheres: * ‘symmetric362’ * ‘symmetric642’ * ‘symmetric724’ * ‘repulsion724’ * ‘repulsion100’ * ‘repulsion200’

  • basis_type (str, optional) – The type of basis to use for the spherical harmonics. Options are ‘standard’, ‘descoteaux07’.

  • color_type (str, optional) – The type of color mapping to use for the spherical glyph. Options are ‘sign’ and ‘orientation’.

  • shininess (float, optional) – The shininess of the material for the spherical glyph.

Returns:

A spherical glyph object.

Return type:

SphGlyph

sphere#

fury.actor.sphere(centers, *, colors=(1, 0, 0), radii=1.0, phi=16, theta=16, opacity=None, material='phong', material_params=None, enable_picking=True, smooth=True, wireframe=False, wireframe_thickness=1.0, impostor=True)[source]#

Create one or many spheres with different colors and radii.

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”).

  • radii (float or ndarray, shape (N,), optional) – Sphere radius. Can be a single value for all spheres or an array of radii for each sphere.

  • phi (int, optional) – Number of latitude segments for the mesh branch only.

  • theta (int, optional) – Number of longitude segments for the mesh branch only.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the spheres. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the spheres should be pickable in a 3D scene.

  • smooth (bool, optional) – Whether to create a smooth sphere or a faceted sphere.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

  • impostor (bool, optional) – Render spheres as billboard impostors instead of geometry when True.

Returns:

A mesh actor containing the generated spheres, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> radii = np.random.rand(5)
>>> sphere_actor = actor.sphere(centers=centers, colors=colors, radii=radii)
>>> _ = scene.add(sphere_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

square#

fury.actor.square(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many squares with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the square in each dimension. If a single value is provided, the same size will be used for all squares.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the squares. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the squares should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated squares, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> square_actor = actor.square(centers=centers, colors=colors)
>>> _ = scene.add(square_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

star#

fury.actor.star(centers, *, dim=2, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many stars with different features.

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

  • dim (int, optional) – The dimensionality of the star (2D or 3D).

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the star in each dimension. If a single value is provided, the same size will be used for all stars.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the stars. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the stars should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated stars, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> star_actor = actor.star(centers=centers, colors=colors)
>>> _ = scene.add(star_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

streamlines#

fury.actor.streamlines(lines, *, colors=(1, 0, 0), thickness=2.0, opacity=1.0, outline_thickness=1.0, outline_color=(0, 0, 0), roi_mask=None, roi_origin=None, enable_picking=True)[source]#

Create a streamline representation.

Parameters:
  • lines (list of ndarray of shape (P, 3) or ndarray of shape (N, P, 3)) – Lines points.

  • colors (str, tuple, list or ndarray, optional) – A hex string, RGB(A) in [0, 1], RGB(A) in [0, 255], or a per-line / per-vertex array of such colors. See normalize_colors().

  • thickness (float or array_like, optional) – A positive finite thickness for all streamlines, or a 1D array with one positive finite thickness per streamline.

  • opacity (float, optional) – The opacity of the streamline.

  • outline_thickness (float, optional) – The thickness of the outline.

  • outline_color (str, tuple, list or ndarray, optional) – The color of the outline. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255].

  • roi_mask (ndarray, optional) – 3D array where values > 0 define the ROI voxels. When provided, streamlines are filtered in a compute baking pass using this volumetric mask, which is assumed to be centered at the origin with unit voxel spacing.

  • roi_origin (array-like of shape (3,), optional) – Origin of the ROI voxel (0, 0, 0) in world-space coordinates. When not provided, defaults to (0, 0, 0).

  • enable_picking (bool, optional) – Whether the streamline should be pickable in a 3D scene.

Returns:

The created streamline object.

Return type:

Streamline

streamtube#

fury.actor.streamtube(lines, *, opacity=1.0, colors=(1, 1, 1), radius=0.2, segments=8, end_caps=True, flat_shading=False, material='phong', enable_picking=True, backend='gpu')[source]#

Create a streamtube from a list of lines using parallel processing.

Parameters:
  • lines (list of ndarray, shape (N, 3)) – List of lines, where each line is a set of 3D points.

  • opacity (float, optional) – Overall opacity of the actor, from 0.0 to 1.0.

  • colors (str, tuple, list or ndarray, optional) –

    • A hex string (e.g. "#FF0000") or RGB(A) tuple for all lines.

    • RGB(A) values in [0, 255] are accepted and normalized.

    • An array of colors, one for each line (e.g., [[1,0,0], [0,1,0],…]).

    • The special string "rgb" colors each tube by orientation (requires backend="gpu").

  • radius (float, optional) – The radius of the tubes.

  • segments (int, optional) – Number of segments for the tube’s cross-section.

  • end_caps (bool, optional) – If True, adds flat caps to the ends of each tube.

  • flat_shading (bool, optional) – If True, use flat shading; otherwise, smooth shading is used.

  • material (str, optional) – Material model (e.g., ‘phong’, ‘basic’).

  • enable_picking (bool, optional) – If True, the actor can be picked in a 3D scene.

  • backend ({"gpu", "cpu"}, optional) – Backend selection for streamtube generation. Options: - “gpu”: Use GPU compute shaders for baked geometry generation. - “cpu”: Force CPU-based geometry generation.

Returns:

A mesh actor containing the generated streamtubes. When the input data exceeds the available buffer size, multiple actors are created, added to a Group, and the group is returned.

Return type:

Actor or Group

Notes

This function performs streamtube geometry creation internally. By default, it uses GPU compute shaders to bake the geometry once using a compute pass and then renders with a standard material. The backend parameter defaults to "gpu" for optimal performance. Set backend="cpu" to force CPU-based geometry generation as a fallback option. When buffers would exceed device limits, the data is split into evenly sized batches based on the ratio of estimated total size to available buffer size.

superquadric#

fury.actor.superquadric(centers, *, directions=(0, 0, 0), roundness=(1, 1), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many superquadrics with different features.

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

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

  • roundness (tuple, optional) – Parameters (Phi and Theta) that control the shape of the superquadric.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the superquadric in each dimension. If a single value is provided, the same size will be used for all superquadrics.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the superquadrics. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the superquadrics should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated superquadrics, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> superquadric_actor = actor.superquadric(centers=centers, colors=colors)
>>> _ = scene.add(superquadric_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

surface#

fury.actor.surface(vertices, faces, *, material='phong', material_params=None, colors=None, texture=None, texture_axis='xy', texture_coords=None, normals=None, opacity=1.0)[source]#

Create a surface mesh actor from vertices and faces.

Parameters:
  • vertices (ndarray, shape (N, 3)) – The vertex positions of the surface mesh.

  • faces (ndarray, shape (M, 3)) – The indices of the vertices that form each triangular face.

  • material (str, optional) – The material type for the surface mesh. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • colors (str, tuple, list or ndarray, optional) – A per-vertex (N, 3)/(N, 4) array, or a single color as a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255].

  • texture (str, optional) – Path to the texture image file. For spherical imagery, use texture_on_sphere().

  • texture_axis (str, optional) – The axis to generate UV coordinates for the texture. Options are ‘xy’, ‘yz’, and ‘xz’. This option only works with texture is passed.

  • texture_coords (ndarray, shape (N, 2), optional) – Predefined UV coordinates for the texture mapping. If not provided, they will be generated based on the texture_axis.

  • normals (ndarray, shape (N, 3), optional) – The normal vectors for each vertex. If not provided, normals will be computed automatically.

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

Returns:

A mesh actor containing the generated surface with the specified properties.

Return type:

Mesh

tensor_slicer#

fury.actor.tensor_slicer(evals, evecs, *, affine=None, mask=None, colors=None, scale=1.0, norm=True, cross_section=None, opacity=1.0, visibility=(True, True, True), enable_picking=True)[source]#

Render tensor eigenpairs as a sliced ellipsoid field.

Parameters:
  • evals (ndarray, shape (X, Y, Z, 3)) – Eigenvalues paired with the corresponding eigenvector columns. Negative values are clipped to zero; zero axes have no renderable volume.

  • evecs (ndarray, shape (X, Y, Z, 3, 3)) – Orthonormal eigenvector columns. Eigenpairs need not be sorted, and either handedness is supported.

  • affine (ndarray, shape (4, 4), optional) – Finite affine transforming voxel placement and glyph shape.

  • mask (ndarray, shape (X, Y, Z), optional) – Converted to boolean: zero is inactive and nonzero is active. Must match the exact spatial shape. Masked eigenpairs may contain invalid values.

  • colors (str, tuple, list or ndarray, optional) – Uniform RGB(A) or hex color, or an (X, Y, Z, 3/4) color field. Numeric colors accept [0, 1] and [0, 255]. None uses shader orient2rgb of the principal eigenvector, weighted by fractional anisotropy in the input data frame; ties select the first maximum nonnegative eigenvalue.

  • scale (float, optional) – Finite, nonnegative semi-axis multiplier, validated and applied by ellipsoid_slicer.

  • norm (bool, optional) – Normalize each voxel’s nonnegative eigenvalues by their maximum before scaling. If False, preserve eigenvalue magnitudes.

  • cross_section (list, tuple or ndarray, optional) – Three world-space plane positions, clamped to transformed voxel-center bounds and converted to integers. None selects the center-bounds midpoint after an affine, or the voxel-shape midpoint without one.

  • opacity (float, optional) – Material opacity in [0, 1].

  • visibility (tuple, optional) – Visibility of the X, Y and Z slice planes.

  • enable_picking (bool, optional) – Enable surface picking with the original full-field voxel index.

Returns:

A flat group of material-bearing resident ellipsoid tiles.

Return type:

Group

Notes

Inputs are not modified. Unmasked eigenvalues must be finite.

FA is computed on eigenvalues already clipped to be nonnegative. Noisy DTI voxels with a negative eigenvalue get a different FA than dipy.reconst.dti.fractional_anisotropy(evals), so the default colors do not match DIPY’s. For matching FA, compute it from the raw finite eigenvalues (masked entries zeroed), then clip only the glyph lengths. Any voxel with a nonpositive eigenvalue is omitted after clipping: a zero semi-axis makes the entire glyph inactive, rather than rendering a flat disc.

tetrahedron#

fury.actor.tetrahedron(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many tetrahedrons with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the tetrahedron in each dimension. If a single value is provided, the same size will be used for all tetrahedrons.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the tetrahedrons. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the tetrahedrons should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated tetrahedrons, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> tetrahedron_actor = actor.tetrahedron(centers=centers, colors=colors)
>>> _ = scene.add(tetrahedron_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

text#

fury.actor.text(text, *, colors=(1.0, 1.0, 1.0), position=(0.0, 0.0, 0.0), font_size=1.0, family='Arial', anchor='middle-center', max_width=0.0, line_height=1.2, text_align='start', outline_color=(0.0, 0.0, 0.0), outline_thickness=0.0, opacity=1.0)[source]#

Create text with different features.

Parameters:
  • text (str or list of str) – The plain text to render. When a list is given, each item becomes a separate text actor and a Group is returned.

  • colors (str, tuple, list or ndarray, optional) – A hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255]. When text is a list, this can be a single color applied to all actors, or a list of colors (one per text item). See normalize_colors().

  • position (tuple (3,) or list of tuple (3,), optional) – The (x, y, z) coordinates to place the text in 3D space. When text is a list, this can be a single position applied to all actors, or a list of positions (one per text item).

  • font_size (float, optional) – The size of the font, in object coordinates or pixel screen coordinates.

  • family (str, optional) – The name(s) of the font to prefer.

  • anchor (str, optional) – The position of the origin of the text. Can be “top-left”, “top-center”, “top-right”, “middle-left”, “middle-center”, “middle-right”, “bottom-left”, “bottom-center”, “bottom-right”.

  • max_width (float, optional) – The maximum width of the text. Words are wrapped if necessary.

  • line_height (float, optional) – A factor to scale the distance between lines. A value of 1 means the “native” font’s line distance.

  • text_align (str, optional) – The horizontal alignment of the text. Can be “start”, “end”, “left”, “right”, “center”, “justify” or “justify_all”. Text alignment is ignored for vertical text.

  • outline_color (tuple, optional) – The color of the outline of the text.

  • outline_thickness (float, optional) – A value indicating the relative width of the outline. Valid values are between 0.0 and 0.5.

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

Returns:

A single Text actor if text is a string, or a Group of Text actors if text is a list.

Return type:

Text or Group

Raises:
  • TypeError – If text is not a string or list of strings.

  • ValueError – If colors or position is a list whose length does not match the length of text.

Examples

>>> from fury import window, actor
>>> scene = window.Scene()
>>> text_actor = actor.text(text='FURY')
>>> _ = scene.add(text_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

texture_on_sphere#

fury.actor.texture_on_sphere(texture=None, *, theta=60, phi=60, interpolation='linear', material='phong', material_params=None, opacity=1.0)[source]#

Map an equirectangular image onto a smooth unit sphere.

Parameters:
  • texture (str, os.PathLike or ndarray, optional) – Local image filename or uint8 RGB/RGBA array of shape (H, W, 3) or (H, W, 4). None leaves the material color and environment in control.

  • theta (int, optional) – Number of longitude segments, at least 3.

  • phi (int, optional) – Number of latitude segments, at least 3.

  • interpolation (str, optional) – Image sampling method, either ‘linear’ or ‘nearest’.

  • material (str, optional) – Mesh material: ‘phong’, ‘basic’, ‘standard’ or ‘physical’.

  • material_params (dict, optional) – Extra material properties, including PBR parameters. See fury.material._create_mesh_material().

  • opacity (float, optional) – Opacity from 0 (transparent) to 1 (opaque).

Returns:

Origin-centered sphere of radius 1, with poles on the Y axis.

Return type:

Mesh

Raises:
  • TypeError – If the texture type or dtype is unsupported, or a resolution is not an integer.

  • ValueError – If an image is empty or not RGB/RGBA, a resolution is below 3, or interpolation, material properties or opacity are invalid.

  • FileNotFoundError – If the local image file does not exist.

Notes

U increases around Y from the seam at -Z through +Z at U=0.5. V runs from 0 at +Y to 1 at -Y; image rows are not flipped. Separate UV endpoints, radial normals and pole-safe tangents avoid geometric shading seams. The image’s left and right edges must still match for its content to appear continuous.

Use the mesh’s local transform to change its radius or placement. Smooth shading is used unless overridden in material_params.

Examples

>>> import numpy as np
>>> from fury import actor
>>> image = np.full((32, 64, 3), 255, dtype=np.uint8)
>>> globe = actor.texture_on_sphere(image)
>>> globe.local.scale = 2.0

triangle#

fury.actor.triangle(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many triangles with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the triangle in each dimension. If a single value is provided, the same size will be used for all triangles.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the triangles. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the triangles should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated triangles, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> triangle_actor = actor.triangle(centers=centers, colors=colors)
>>> _ = scene.add(triangle_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

triangularprism#

fury.actor.triangularprism(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', material_params=None, enable_picking=True, wireframe=False, wireframe_thickness=1.0)[source]#

Create one or many triangular prisms with different features.

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

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

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA colors. Accepts values in [0, 255] (int), [0, 1] (float), or hex strings (e.g. “#FF0000”). Values above 1.0 are treated as [0, 255] and normalized internally.

  • scales (ndarray, shape (N, 3) or tuple (3,) or float, optional) – The size of the triangular prism in each dimension. If a single value is provided, the same size will be used for all triangular prisms.

  • opacity (float, optional) – Takes values from 0 (fully transparent) to 1 (opaque). If both opacity and RGBA are provided, the final alpha will be: final_alpha = alpha_in_RGBA * opacity.

  • material (str, optional) – The material type for the triangular prisms. Options are ‘phong’, ‘basic’, ‘standard’ and ‘physical’. The last two are physically based (PBR) materials.

  • material_params (dict, optional) – Extra properties forwarded to the material, e.g. {'metalness': 1.0, 'roughness': 0.2} for the PBR materials. See fury.material._create_mesh_material() for the supported keys.

  • enable_picking (bool, optional) – Whether the triangular prisms should be pickable in a 3D scene.

  • wireframe (bool, optional) – Whether to render the mesh as a wireframe.

  • wireframe_thickness (float, optional) – The thickness of the wireframe lines.

Returns:

A mesh actor containing the generated triangular prisms, with the specified material and properties.

Return type:

Actor

Examples

>>> from fury import window, actor
>>> import numpy as np
>>> scene = window.Scene()
>>> centers = np.random.rand(5, 3) * 10
>>> colors = np.random.rand(5, 3)
>>> triangularprism_actor = actor.triangularprism(centers=centers, colors=colors)
>>> _ = scene.add(triangularprism_actor)
>>> show_manager = window.ShowManager(scene=scene, size=(600, 600))
>>> show_manager.start()

vector_field#

fury.actor.vector_field(field, *, actor_type='thin_line', colors=None, scales=1.0, opacity=1.0, thickness=1.0)[source]#

Visualize a vector field with different features.

Parameters:
  • field (ndarray, shape {(X, Y, Z, N, 3), (X, Y, Z, 3)}) – The vector field data, where X, Y, Z represent the position in 3D, N is the number of vectors per voxel, and 3 represents the vector

  • actor_type (str, optional) – The type of vector field visualization. Options are “thin_line”, “line”, and “arrow”.

  • colors (str, tuple, list or ndarray, optional) – Color for the vectors. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255]. If None, the color is taken from the orientation.

  • scales ({float, ndarray}, shape {(X, Y, Z, N) or (X, Y, Z)}, optional) – Scale factor for the vectors. If ndarray, it should match the shape of the field.

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

  • thickness (float, optional) – The thickness of the lines in the vector field visualization. Only applicable for “line” and “arrow” types.

Returns:

A Group of VectorField chunks.

Return type:

Group

vector_field_slicer#

fury.actor.vector_field_slicer(field, *, actor_type='thin_line', cross_section=None, colors=None, scales=1.0, opacity=1.0, thickness=1.0, visibility=(True, True, True))[source]#

Visualize a vector field with different features.

Parameters:
  • field (ndarray, shape {(X, Y, Z, N, 3), (X, Y, Z, 3)}) – The vector field data, where X, Y, Z represent the position in 3D, N is the number of vectors per voxel, and 3 represents the vector

  • actor_type (str, optional) – The type of vector field visualization. Options are “thin_line”, “line”, and “arrow”.

  • cross_section (list or tuple, shape (3,), optional) – A list or tuple representing the cross section dimensions. If None, the cross section will be ignored and complete field will be shown.

  • colors (str, tuple, list or ndarray, optional) – Color for the vectors. Accepts a hex string, RGB(A) in [0, 1], or RGB(A) in [0, 255]. If None, the color is taken from the orientation.

  • scales ({float, ndarray}, shape {(X, Y, Z, N) or (X, Y, Z)}, optional) – Scale factor for the vectors. If ndarray, it should match the shape of the field.

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

  • thickness (float, optional) – The thickness of the lines in the vector field visualization. Only applicable for “line” and “arrow” types.

  • visibility (tuple, optional) – A tuple of three boolean values indicating the visibility of the slices in the x, y, and z dimensions, respectively.

Returns:

A single VectorField when the data fits within the device limits, or a Group of VectorField chunks otherwise.

Return type:

VectorField or Group

volume_slicer#

fury.actor.volume_slicer(data, *, affine=None, value_range=None, opacity=1.0, interpolation='linear', visibility=(True, True, True), initial_slices=None, alpha_mode='auto', depth_write=False)[source]#

Visualize a 3D volume data as a slice.

Parameters:
  • data (ndarray, shape (X, Y, Z) or (X, Y, Z, 3)) – The 3D volume data to be sliced.

  • affine (ndarray, shape (4, 4), optional) – The affine transformation matrix to apply to the data.

  • value_range (tuple, optional) – The minimum and maximum values for the color mapping. If None, the range is determined from the data.

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

  • interpolation (str, optional) – The interpolation method for the slice. Options are ‘linear’ and ‘nearest’.

  • visibility (tuple, optional) – A tuple of three boolean values indicating the visibility of the slices in the x, y, and z dimensions, respectively.

  • initial_slices (tuple, optional) – A tuple of three initial slice positions in the x, y, and z dimensions, respectively. If None, the slices are initialized to the middle of the volume.

  • alpha_mode (str, optional) – The alpha mode for the material. Please see the below link for details: https://docs.pygfx.org/stable/_autosummary/materials/pygfx.materials.Material.html#pygfx.materials.Material.alpha_mode.

  • depth_write (bool, optional) – Whether to write depth information for the material.

Returns:

An actor containing the generated slice with the specified properties.

Return type:

Group