Actor#

class brainrender.actor.Actor(mesh, name=None, br_class=None, is_text=False, color=None, alpha=None)[source]#

Bases: object

Represents any object displayed in a brainrender scene.

Wraps a vedo Mesh with a name and class type, and provides helpers for creating silhouettes and 3D labels. Unknown attribute lookups are delegated to the underlying mesh.

Parameters:
  • mesh (Mesh) – The 3D mesh for this actor.

  • name (str | None) – Actor name. Default "Actor".

  • br_class (str | None) – Brainrender class type. Default "None".

  • is_text (bool) – Whether this actor is a 2D text annotation. Default False.

  • color (str | None) – Colour to apply to the mesh on construction.

  • alpha (float | None) – Transparency to apply to the mesh on construction.

Methods

make_actor(mesh, name, br_class)

Construct an Actor from an existing mesh.

make_label(atlas)

Create 3D label actors anchored to this actor's mesh.

make_silhouette()

Create a silhouette actor outlining this actor's mesh.

mirror(axis[, origin, atlas])

Mirror the actor's mesh across the given axis.

Attributes

center

Return the mesh's centre of mass coordinates.

labels

silhouette

property center: ndarray[tuple[Any, ...], dtype[float64]]#

Return the mesh’s centre of mass coordinates.

Returns:

Array of shape (3,) with (x, y, z) coordinates.

Return type:

numpy.ndarray

classmethod make_actor(mesh, name, br_class)[source]#

Construct an Actor from an existing mesh.

Parameters:
  • mesh (Mesh) – Mesh to wrap.

  • name (str) – Actor name.

  • br_class (str) – Brainrender class type.

Return type:

Actor

make_label(atlas)[source]#

Create 3D label actors anchored to this actor’s mesh.

Parameters:

atlas (BrainGlobeAtlas) – Atlas used for hemisphere queries and mirroring.

Returns:

Label actors (text and optional sphere markers).

Return type:

list of Actor

make_silhouette()[source]#

Create a silhouette actor outlining this actor’s mesh.

Returns:

Silhouette actor with brainrender class "silhouette".

Return type:

Actor

mirror(axis, origin=None, atlas=None)[source]#

Mirror the actor’s mesh across the given axis.

Accepts Cartesian axes ('x', 'y', 'z') or anatomical plane names ('sagittal', 'vertical', 'frontal'). If an anatomical name is used without an atlas, 'asr' space is assumed. The mesh is updated in place.

Parameters:
  • axis (str) – Axis or anatomical plane to mirror across.

  • origin (ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]] | None) – Centre of the mirroring operation. Default None.

  • atlas (BrainGlobeAtlas | None) – Atlas used to resolve anatomical axis names. Default None.

Return type:

None