actor#

Init file for visualization package.

Actor()

Base Actor class for making APIs user-friendly.

Billboard([geometry, material])

World object representing one or more billboards.

Group(*[, visible, name])

Group actor class.

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

Image actor class.

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

Line actor class.

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([geometry, material, text, markdown, ...])

Text actor class.

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.

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.

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

Create one or many tetrahedrons with different features.

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

Create text with different features.

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#

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

Bases: Mesh

World object representing one or more billboards.

Geometry buffers are duplicated per 6 vertices (two triangles) per billboard; the vertex shader reconstructs the quad via vertex_index math and uses camera right/up vectors to orient it. Size metadata is stored on billboard_sizes and reused by shaders for impostor variants.

Parameters:
  • geometry (Geometry, optional) – The geometry object containing vertex data.

  • material (Material, optional) – The material used to render the billboard.

  • **kwargs (dict) – Additional keyword arguments forwarded to Mesh.

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

Initialize a Billboard actor.

property billboard_centers#

Get the billboard center positions.

Returns:

Billboard center positions.

Return type:

ndarray, shape (N, 3)

property billboard_count#

Get the number of billboards in this actor.

Returns:

Number of billboards.

Return type:

int

property billboard_sizes#

Get the billboard width/height pairs.

Returns:

Billboard width/height pairs.

Return type:

ndarray, shape (N, 2)

get_bounding_box()[source]#

Compute the axis-aligned bounding box including billboard visual size.

Returns:

Axis-aligned bounding box as [[min, min, min], [max, max, max]].

Return type:

ndarray, shape (2, 3), or None

Group#

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

Bases: Group, Actor

Group actor class.

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

Image#

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

Bases: Image, Actor

Image actor class.

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

Line#

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

Bases: Line, Actor

Line actor class.

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

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 = '')[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 = '') 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#

class fury.actor.Text(geometry=None, material=None, *, text=None, markdown=None, font_size=12, family=None, direction=None, screen_space=False, anchor='middle-center', anchor_offset=0, max_width=0, line_height=1.2, paragraph_spacing=0, text_align='start', text_align_last='auto', visible: bool = True, render_order: float = 0, name: str = '')[source]#

Bases: Text, Actor

Text actor class.

__init__(geometry=None, material=None, *, text=None, markdown=None, font_size=12, family=None, direction=None, screen_space=False, anchor='middle-center', anchor_offset=0, max_width=0, line_height=1.2, paragraph_spacing=0, text_align='start', text_align_last='auto', visible: bool = True, render_order: float = 0, name: str = '')[source]#

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 (tuple, optional) – Color for the vectors. If None, the color will used 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 = '')[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 = '') 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)[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’ and ‘basic’.

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

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', 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’ and ‘basic’.

  • 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 (tuple (3,), optional) – Color for the X-axis.

  • color_y (tuple (3,), optional) – Color for the Y-axis.

  • color_z (tuple (3,), optional) – Color for the Z-axis.

  • 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 ((N,3|4) array_like or single color) – Per-billboard RGB(A) colors.

  • 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 (array_like, optional) – RGB or RGBA color per sphere. Single color inputs 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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 (ndarray, shape (N, 3) or (N, 4), optional) – An array of RGB or RGBA colors for each unique label in the volume. where N is the number of unique labels (excluding background label 0). 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 (tuple, optional) – The RGB output color of the contour in the range [0, 1].

  • 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')[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 (tuple, optional) – The RGB output color of the contour in the range [0, 1].

  • 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 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 of tuple, optional) – RGB colors for each axis endpoint.

  • 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, optional) – The image content.

  • material (Material) – The material object.

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

Returns:

The image object.

Return type:

Image

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 either MeshPhongMaterial or MeshBasicMaterial.

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

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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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', enable_picking=True, smooth=True, wireframe=False, wireframe_thickness=1.0)[source]#

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

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

  • orientation_matrices (ndarray, shape (N, 3, 3) or (3, 3), optional) – Orthonormal rotation matrices defining the orientation of each ellipsoid. Each 3×3 matrix represents a local coordinate frame, with columns corresponding to the ellipsoid’s x-, y-, and z-axes in world coordinates. Must be right-handed and orthonormal. If a single (3, 3) matrix is provided, it is broadcast to all ellipsoids.

  • lengths (ndarray (N, 3) or (3,) or tuple (3,), optional) – Scaling factors along each axis.

  • 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) – The number of segments in the longitude direction.

  • theta (int, optional) – The number of segments in the latitude direction.

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

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

Returns:

A mesh actor containing the generated ellipsoids.

Return type:

Actor

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

frustum#

fury.actor.frustum(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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 ({tuple, list, ndarray}, optional) – The color of the cross-section point. It can be a single color or a list of colors for each 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 (tuple, optional) – The color of the outline.

  • 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

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

Added with 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 tuple containing the phi and theta segments for a custom sphere. 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', 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) – The number of segments in the longitude direction.

  • theta (int, optional) – The number of segments in the latitude direction.

  • 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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 (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1].

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

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

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

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

  • 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 (tuple or ndarray, optional) –

    • A single color tuple (e.g., (1,0,0)) for all lines.

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

  • 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', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’. This option only works with colors is passed.

  • colors (ndarray, shape (N, 3) or (N, 4) or tuple (3,) or tuple (4,), optional) – RGB or RGBA values in the range [0, 1].

  • texture (str, optional) – Path to the texture image file.

  • 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

tetrahedron#

fury.actor.tetrahedron(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', 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’ and ‘basic’.

  • 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 (tuple (3,) or tuple (4,) or list of tuple, optional) – RGB or RGBA values in the range [0, 1]. When text is a list, this can be a single color applied to all actors, or a list of colors (one per text item).

  • 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()

triangle#

fury.actor.triangle(centers, *, directions=(0, 0, 0), colors=(1, 1, 1), scales=(1, 1, 1), opacity=None, material='phong', 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’ and ‘basic’.

  • 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', 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’ and ‘basic’.

  • 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 (tuple, optional) – Color for the vectors. If None, the color will used 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 (tuple, optional) – Color for the vectors. If None, the color will used 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