API

GUI based modules

visbrain:

Brain([bgcolor, verbose]) Visualization of brain-data on a standard MNI brain.
Sleep([data, hypno, config_file, …]) Visualize and edit sleep data.
Topo([verbose]) Display topographic representation.
Signal(data[, axis, time, sf, enable_grid, …]) Signal inspection module (data mining).
Figure(files[, path, grid, figtitle, y, …]) Automatically arange pictures in a grid and save a paper ready figure.

Objects

visbrain.objects:

Import visbrain objects.

BrainObj(name[, vertices, faces, normals, …]) Create a brain object.
ColorbarObj(name[, rect, transform, parent, …]) Create a colorbar object.
ConnectObj(name, nodes, edges[, select, …]) Create a connectivity object.
CrossSecObj(name[, vol, hdr, coords, …]) Create a Cross-sections object.
HypnogramObj(name[, data, time, datafile, …]) Hypnogram object.
ImageObj(name[, data, xaxis, yaxis, cmap, …]) Create a single image object.
PacmapObj(name[, data, sf, f_pha, f_amp, …]) Create a Phase-Amplitude Coupling (PAC) object.
Picture3DObj(name, data, xyz[, select, …]) Create a 3-D picture object.
RoiObj(name[, vol, labels, index, hdr, …]) Create a Region Of Interest (ROI) object.
SceneObj([bgcolor, camera_state, verbose]) Create a scene and add objects to it.
SourceObj(name, xyz[, data, color, alpha, …]) Create a source object.
TimeFrequencyObj(name[, data, sf, method, …]) Compute the time-frequency map (or spectrogram).
TimeSeries3DObj(name, data, xyz[, select, …]) Create a 3-D time-series object.
VectorObj(name, arrows[, data, …]) Create a vector object.
VolumeObj(name[, vol, hdr, method, …]) Create a 3-D volume object.

Compatibility with existing software

MNE-python

visbrain.mne:

mne_plot_source_estimation(sbj, sbj_dir, …) Plot source estimation.
mne_plot_source_space(fif_file[, …]) Plot source space.

I/O

visbrain.io:

Load read and write functions.

download_file(name[, filename, to_path, …]) Download a file.
path_to_visbrain_data([file, folder]) Get the path to the visbrain_data folder.
read_stc(path) Read an STC file from the MNE package.

Miscellaneous

visbrain.utils:

generate_eeg([sf, n_pts, n_channels, …]) Generate random eeg signals.
tal2mni(xyz) Transform Talairach coordinates into MNI.
mni2tal(xyz) Transform MNI coordinates into Talairach.
rereferencing(data, chans, reference[, …]) Re-reference data.
bipolarization(data, chans[, to_ignore, sep]) Bipolarize data.
commonaverage(data, chans[, to_ignore]) Re-referencement using common average.
convert_meshdata([vertices, faces, normals, …]) Convert mesh data to be compatible with visbrain.
volume_to_mesh(vol[, smooth_factor, level]) Convert a volume into a mesh with vertices, faces and normals.
color2vb([color, default, length, alpha, …]) Turn into a RGBA compatible color format.
array2colormap(x[, cmap, clim, alpha, vmin, …]) Transform an array of data into colormap (array of RGBA).

Command line

In addition to using Python script, you can also use the following command-lines from a terminal :

  • visbrain_sleep : open the graphical user interface of Sleep.
  • visbrain_fig_hyp : export a hypnogram file (.txt, .csv or .hyp) into a high definition colored or black and white image.
  • visbrain_sleep_stats : Compute sleep statistics from hypnogram file and export them in csv.

visbrain_sleep

Open the graphical user interface of Sleep.

visbrain_sleep [OPTIONS]

Options

-d, --data <data>

Name of the polysomnographic file to load.

-h, --hypno <hypno>

Name of the hypnogram file to load.

-c, --config_file <config_file>

Path to a configuration file.

-a, --annotations <annotations>

Path to an annotation file.

--downsample <downsample>

Down-sampling frequency. Default is 100.

--use_mne <use_mne>

Load your file using MNE-python. Default is False.

--preload <preload>

Preload data in memory. Default is True

--show <show>

Display GUI. Default is True

visbrain_fig_hyp

Create hypnogram figure from hypnogram file.

visbrain_fig_hyp [OPTIONS]

Options

-h, --hypno <hypno>

Name of the hypnogram file to load (with extension).

-g, --grid <grid>

Add X and Y grids to figure. Default is False.

-c, --color <color>

Get colored figure. Default is False (black and white).

-o, --outfile <outfile>

Output filename (with extension).

--dpi <dpi>

Dots per inches (resolution). Default is 300.

visbrain_sleep_stats

Compute sleep statistics from hypnogram file and export them in csv.

Sleep statistics specifications:

  • Time in Bed (TIB) : total duration of the hypnogram.
  • Total Dark Time (TDT) : duration of the hypnogram from beginning to last period of sleep.
  • Sleep Period Time (SPT) : duration from first to last period of sleep.
  • Wake After Sleep Onset (WASO) : duration of wake periods within SPT
  • Sleep Efficiency (SE) : TST / TDT * 100 (%).
  • Total Sleep Time (TST) : SPT - WASO.
  • W, N1, N2, N3 and REM: sleep stages duration.
  • % (W, … REM) : sleep stages duration expressed in percentages of TDT.
  • Latencies: latencies of sleep stages from the beginning of the record.

(All values except SE and percentages are expressed in minutes)

visbrain_sleep_stats [OPTIONS]

Options

-h, --hypno <hypno>

Name of the hypnogram file to load (with extension).

-o, --outfile <outfile>

Output filename (with extension - *.csv). If None, sleep statistics will only be displayed and not saved into a file