visualizecell_morphology_visualizerCellMorphologyVisualizer

CellMorphologyVisualizer

class visualize.cell_morphology_visualizer.CellMorphologyVisualizer(cell, align_trunk=True, t_start=None, t_stop=None, t_step=None)

Plot a cell morphology using matplotlib.

Plots static images or time series (videos, gif, animation, interactive window) of a biophysically detailed simulation on a cell morphology. Plots out:

  • Morpholgy

  • Membrane voltage

  • Ion dynamics

  • Synapse activations

  • Dendritic groups

The relevant cell information can also be exported to .vtk format for further visualization or interaction. No explicit VTK dependency is needed for this; it simply writes it out as an ASCII .vtk file.

Initializes the CellMorphologyVisualizer object.

Parameters:
  • cell (Cell) – Cell object

  • align_trunk (bool) – Whether or not to align the cell trunk with the z-axis.

  • t_start (float) – start time point of our time series visualization

  • t_stop (float) – last time point of our time series visualization

  • t_step (float) – time between the different time points of our visualization

Note

align_trunk assumes the cell has a trunk, which is defined as the dendrite between the soma and the main bifurcation section.

Attributes:

camera_position

Camera angles and distance for matplotlib 3D visualizations. Possible keys: ‘azim’, ‘dist’, ‘elev’, ‘roll’ See also: https://matplotlib.org/stable/api/toolkits/mplot3d/view_angles.html

Type:

dict

neuron_rotation

Amount of degrees the azimuth increases per frame in a timeseries visualization.

Type:

float

dpi

Image quality Default: 72

Type:

int

show_synapses

Whether or not to visualize the location of synapses onto the cell.

Type:

bool

synapse_legend

whether the synapse activations legend should appear in the plot

Type:

bool

highlight_arrow_kwargs

Additional arguments for the arrow. See available kwargs on https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.patches.Arrow.html#matplotlib.patches.Arrow

Type:

dict

synapse_group_function

Method to group synapse types. Must accept a name (str) as argument, and return a group name (str) as output. Default: lambda x: x

Type:

callable

population_to_color_dict

Dictionary to map synapse group names (str) to colors Must contain the same keys as self.cell.synapses.keys() after being passed through self.synapse_group_function default: {}

Type:

dict

Methods:

_write_png_timeseries(path, overwrite_frames, color, show_synapses, show_legend, client, highlight_section, highlight_x)

Creates a list of images where a neuron morphology color-coded with voltage together with synapse activations are

plot(color, show_legend, show_synapses, time_point, save, highlight_section, highlight_x)

Plot the cell morphology in 3D.

write_gif(images_path, out_name, color, show_synapses, show_legend, client, t_start, t_stop, t_step, highlight_section, highlight_x, overwrite_frames, tpf)

Creates a set of images where a neuron morphology color-coded with voltage together with synapse activations are

write_video(images_path, out_name, overwrite_frames, color, show_synapses, show_legend, client, t_start, t_stop, t_step, highlight_section, highlight_x, quality, codec, tpf)

Write the individual frames of a neuron during a simulation and merge them into a video.

animation(images_path, overwrite_frames, color, show_synapses, show_legend, client, t_start, t_stop, t_step, highlight_section, highlight_x, display, tpf)

Show an animation of the simulated neuron.

write_vtk_frames(out_name, out_dir, t_start, t_stop, t_step, color, n_decimals, client)

Write the cell morphology to a series of VTK files.

to_vtk(out_dir, fn)

Write out the cell morphology to a VTK file.