actor#
Init file for visualization package.
|
Base Actor class for making APIs user-friendly. |
|
World object representing one or more billboards. |
|
Group actor class. |
|
Image actor class. |
|
Line actor class. |
|
Mesh actor class. |
|
Points actor class. |
|
Visualize a spherical harmonic glyph with different features. |
|
Text actor class. |
|
Class to visualize a vector field. |
|
Volume actor class. |
|
Build an actor from a primitive. |
|
Apply a transformation to an actor. |
|
Apply a transformation to all actors in a group. |
|
Create one or many arrows with different features. |
|
Create coordinate system axes using colored arrows. |
|
Create a billboard world object. |
|
Create a billboard impostor sphere world object. |
|
Create one or many boxes with different features. |
|
Create one or many cones with different features. |
|
Generate surface actor from a labeled volume. |
|
Generate surface actor from a binary ROI. |
|
Generate surface actor from a binary ROI. |
|
Create actors composing a UI axes helper. |
|
Create an image object. |
|
Create a line object. |
|
Create a mesh object. |
|
Create a point object. |
|
Create a text object. |
|
Create one or many cylinders with different features. |
|
Visualize a 3D volume data as a slice. |
|
Visualize one or many disks with different features. |
|
Create ellipsoid actor(s) with specified orientation and scaling. |
|
Create one or many frustums with different features. |
|
Get the current positions of the slices. |
|
Create one or many icosahedrons with different features. |
|
Visualize a 2D image from a NumPy array or image file. |
|
Visualize one or many lines with different colors. |
|
Initialize the line projection object. |
|
Create one or many markers with different features. |
|
Create one or many octagonal prisms with different features. |
|
Visualize peaks as lines in 3D space. |
|
Create one or many pentagonal prisms with different features. |
|
Create one or many points with different features. |
|
Read the contents of a wgpu buffer into a NumPy array. |
|
Create one or many rhombicuboctahedrons with different features. |
|
Create one or many rings with different features. |
|
Set the opacity of the group of actors. |
|
Set the visibility of a group of actors. |
|
Set the opacity of an actor. |
|
Show the slices at the specified position. |
|
Visualize a spherical harmonic glyph with different features. |
|
Create one or many spheres with different colors and radii. |
|
Create one or many squares with different features. |
|
Create one or many stars with different features. |
|
Create a streamline representation. |
|
Create a streamtube from a list of lines using parallel processing. |
|
Create one or many superquadrics with different features. |
|
Create a surface mesh actor from vertices and faces. |
|
Create one or many tetrahedrons with different features. |
|
Create text with different features. |
|
Create one or many triangles with different features. |
|
Create one or many triangular prisms with different features. |
|
Visualize a vector field with different features. |
|
Visualize a vector field with different features. |
|
Visualize a 3D volume data as a slice. |
Actor#
- class fury.actor.Actor[source]#
Bases:
objectBase 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:
- rotate(rotation)[source]#
Rotate the actor by the given rotation.
- Parameters:
rotation (tuple) – Rotation angles (in degrees) around the x, y, and z axes.
Billboard#
- class fury.actor.Billboard(geometry=None, material=None, **kwargs)[source]#
Bases:
MeshWorld 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_indexmath and uses camera right/up vectors to orient it. Size metadata is stored onbillboard_sizesand reused by shaders for impostor variants.- Parameters:
- 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:
- property billboard_sizes#
Get the billboard width/height pairs.
- Returns:
Billboard width/height pairs.
- Return type:
ndarray, shape (N, 2)
Group#
Image#
Line#
Mesh#
Points#
SphGlyph#
- class fury.actor.SphGlyph(coeffs, sphere, *, basis_type='standard', color_type='sign', shininess=50)[source]#
Bases:
MeshVisualize 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:
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,ActorText 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,ActorClass 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
Volume#
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:
apply_affine_to_actor#
apply_affine_to_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:
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:
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_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:
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:
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:
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:
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:
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 (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 from the volume data.
- Return type:
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:
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:
- 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#
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:
- 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:
- Raises:
TypeError – If geometry is not an instance of Geometry or material is not an instance of PointsMaterial, PointsGaussianBlobMaterial, or PointsMarkerMaterial.
create_text#
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:
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:
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:
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:
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:
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#
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:
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:
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:
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:
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:
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:
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:
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:
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:
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#
set_group_visibility#
set_opacity#
show_slices#
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:
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:
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:
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:
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, 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 (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 (requiresbackend="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:
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. Setbackend="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:
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 (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.
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:
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:
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
textis a list, this can be a single color applied to all actors, or a list of colors (one per text item). Seenormalize_colors().position (tuple (3,) or list of tuple (3,), optional) – The (x, y, z) coordinates to place the text in 3D space. When
textis 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
textis a string, or a Group of Text actors iftextis a list.- Return type:
- Raises:
TypeError – If
textis not a string or list of strings.ValueError – If
colorsorpositionis a list whose length does not match the length oftext.
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:
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:
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:
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: