visbrain.objects.SourceObj

class visbrain.objects.SourceObj(name, xyz, data=None, color='red', alpha=1.0, symbol='disc', radius_min=5.0, radius_max=10.0, edge_width=0.0, edge_color='black', system='mni', mask=None, mask_color='gray', mask_radius=5.0, text=None, text_size=2.0, text_color='white', text_bold=False, text_translate=(0.0, 2.0, 0.0), visible=True, transform=None, parent=None, verbose=None, _z=-10.0, **kw)[source][source]

Create a source object.

Parameters:
namestring

Name of the source object.

xyzarray_like

Array of positions of shape (n_sources, 2) or (n_sources, 3).

dataarray_like | None

Array of weights of shape (n_sources,).

colorarray_like/string/tuple | ‘red’

Marker’s color. Use a string (i.e ‘green’) to use the same color across markers or a list of colors of length n_sources to use different colors for markers.

alphafloat | 1.

Transparency level.

symbolstring | ‘disc’

Symbol to use for sources. Allowed style strings are: disc, arrow, ring, clobber, square, diamond, vbar, hbar, cross, tailed_arrow, x, triangle_up, triangle_down, and star.

radius_min / radius_maxfloat | 5. / 10.

Define the minimum and maximum source’s possible radius. By default if all sources have the same value, the radius will be radius_min.

edge_colorstring/list/array_like | ‘black’

Edge color of source’s markers.

edge_widthfloat | 0.

Edge width source’s markers.

system{‘mni’, ‘tal’}

Specify if the coodinates are in the MNI space (‘mni’) or Talairach (‘tal’).

maskarray_like | None

Array of boolean values to specify masked sources. For example, if data are p-values, mask could be non-significant sources.

mask_colorarray_like/tuple/string | ‘gray’

Color to use for masked sources.

mask_radiusfloat | None

Radius size of masked sources.

textlist | None

Text to attach to each source. For example, text could be the name of each source.

text_sizefloat | 2.

Text size attached to sources.

text_colorarray_like/string/tuple | ‘white’

Text color attached to sources.

text_boldbool | False

Specify if the text attached to sources should be bold.

text_translatetuple | (0., 2., 0.)

Translate the text along the (x, y, z) axis.

visiblebool/array_like | True

Specify which source’s have to be displayed. If visible is True, all sources are displayed, False all sources are hiden. Alternatively, use an array of shape (n_sources,) to select which sources to display.

transformVisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parentVisPy.parent | None

Markers object parent.

verbosestring

Verbosity level.

_zfloat | 10.

In case of (n_sources, 2) use _z to specify the elevation.

kwdict | {}

Optional arguments are used to control the colorbar (See ColorbarObj).

Notes

List of supported shortcuts :

  • s : save the figure

  • <delete> : reset camera

Examples

>>> import numpy as np
>>> from visbrain.objects import SourceObj
>>> n_sources = 100
>>> pos = np.random.uniform(-10, 10, (n_sources, 3))
>>> color = ['orange'] * 50 + ['red'] * 50
>>> data = np.random.rand(n_sources)
>>> text = ['s' + str(k) for k in range(n_sources)]
>>> s = SourceObj('test', pos, color=color, data=data, radius_min=10.,
>>>               radius_max=20., edge_color='black', edge_width=1.,
>>>               text=text, text_size=10.)
>>> s.preview(axis=True)

Methods

__init__(name, xyz[, data, color, alpha, ...])

Init.

analyse_sources([roi_obj, replace_bad, ...])

Analyse sources using Region of interest (ROI).

animate([step, interval, iterations])

Animate the object.

color_sources([analysis, color_by, data, ...])

Custom color sources methods.

copy()

Get a copy of the object.

describe_tree()

Tree description.

fit_to_vertices(v)

Move sources to the closest vertex.

preview([bgcolor, axis, xyz, show, obj, ...])

Previsualize the result.

project_sources(b_obj[, project, radius, ...])

Project source's activity or repartition onto the brain object.

record_animation(name[, n_pic, bgcolor])

Record an animated object and save as a *.gif file.

render()

Render the canvas.

screenshot(saveas[, print_size, dpi, unit, ...])

Take a screeshot of the scene.

set_shortcuts_to_canvas(canvas)

Set shortcuts to a VisbrainCanvas.

set_visible_sources([select, v, distance])

Select sources that are either inside or outside the mesh.

to_dict()

Return a dictionary of all colorbar args.

to_kwargs([addisminmax])

Return a dictionary for input arguments.

update()

Update the source object.

update_from_dict(kwargs)

Update attributes from a dictionary.

Examples using visbrain.objects.SourceObj

Animate objects in the scene

Animate objects in the scene

Brain object (BrainObj) : complete tutorial

Brain object (BrainObj) : complete tutorial

Combine multiple objects

Combine multiple objects

Connectivity object (ConnectObj) : complete tutorial

Connectivity object (ConnectObj) : complete tutorial

Region Of Interest object (RoiObj) : complete tutorial

Region Of Interest object (RoiObj) : complete tutorial

Source object (SourceObj) : complete tutorial

Source object (SourceObj) : complete tutorial

Add deep sources

Add deep sources

Connect deep sources

Connect deep sources

Add Region of interest (ROI)

Add Region of interest (ROI)

Add time series

Add time series

Add pictures

Add pictures

Screenshot example

Screenshot example

Add multiple objects to the scene

Add multiple objects to the scene

Add Nifti volume

Add Nifti volume

Add vectors

Add vectors

Plot source space

Plot source space