Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Latest commit

 

History

History
36 lines (20 loc) · 2.56 KB

actors.md

File metadata and controls

36 lines (20 loc) · 2.56 KB

Actors

Everything rendered in brainrender is first used to create an instance of brainrender's Actor class. This class handles the 3D mesh data for the object to be rendered and provides a few useful methods for the behind-the-scenes work necessary to render your data.

{% hint style="warning" %} Before rendering data in brainrender you should ensure that they are registered to a reference atlas. Check how to use your data in brainrender. {% endhint %}

While a general Actor class can be used to render any type of data that can be used to create a vedo Mesh object, several specific Actor classes are provided for more conveniently loading commonly used data types.

Specific actor classes

  • brainrender.actors.Neuron is used to render neurons morphology (e.g. downloaded with morphapi or from a .swc file).
  • brainrender.actors.Points is used to render anything that can be represented as a set of points (e.g. labelled cells from cellfinder. Points can load data directly from a .npy file or a numpy array of coordinates can be passed to it.
  • brainrender.actors.Streamlines is used to render streamlines tractography data. It expects the data as a pandas DataFrame and can load data from a .json file.
  • brainrender.actors.Volume renders volumetric data (e.g. gene expression) from a numpy array or from a .npy file.
  • Other actor classes like Cylinder, Point and Ruler can be used to render other types of data.

In all cases an actor instance can be created by passing the data to be rendered to the dedicated Actor class. For instance, to render the position of labelled cells, a Nx3 numpy array with the cells coordinates has to be passed to the Points class to create an actor representing the cells' locations. Some actors can also load data directly from file.

{% hint style="info" %} Some types of actors (e.g. Streamlines and Neuron) are generally used to visualize several instances of the same neuron at once. For these actors we also provide helper functions that facilitate the generation of multiple instances of the same actor class. {% endhint %}

Visualizing other types of data

While the provided Actor classes should support the vast majority of users' needs, occasionally you might need to render an unsupported type of data: read here to learn how.

Adding actors to your scene

Rendering actors is as simple as can be: just use the Scene.add method and pass to it the actors you would like to see added to your rendering.