The Virtual Brain Project

Table Of Contents

Previous topic

zip_surface Package

Next topic

config Package

This Page

visualizers Package

List here all Python modules where Visualization adapters are described. Listed modules will be introspected and DB filled.

annotations_viewer

class tvb.adapters.visualizers.annotations_viewer.ConnectivityAnnotationsView[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Given a Connectivity Matrix and a Surface data the viewer will display the matrix ‘inside’ the surface data. The surface is only displayed as a shadow.

get_input_tree()[source]

Take as Input a Connectivity Object.

get_required_memory_size(**kwargs)[source]
launch(annotations, region_map=None, **kwarg)[source]

brain

class tvb.adapters.visualizers.brain.BrainViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Interface between the 3D view of the Brain Cortical Surface and TVB framework. This viewer will build the required parameter dictionary that will be sent to the HTML / JS for further processing, having as end result a brain surface plus activity that will be displayed in 3D.

PAGE_SIZE = 500
compute_parameters(time_series, shell_surface=None)[source]

Create the required parameter dictionary for the HTML/JS viewer.

Return type:dict
Raises Exception:
 when * number of measure points exceeds the maximum allowed * a Face object cannot be found in database
generate_preview(time_series, shell_surface=None, figure_size=None)[source]

Generate the preview for the burst page

get_input_tree()[source]
get_required_memory_size(time_series, shell_surface=None)[source]

Assume one page doesn’t get ‘dumped’ in time and it is highly probably that two consecutive pages will be in the same time in memory.

launch(time_series, shell_surface=None)[source]

Build visualizer’s page.

populate_surface_fields(time_series)[source]

To be overwritten for populating fields: one_to_one_map/connectivity/region_map/surface fields

retrieve_measure_points_prams(time_series)[source]

To be overwritten method, for retrieving the measurement points (region centers, EEG sensors).

class tvb.adapters.visualizers.brain.DualBrainViewer[source]

Bases: tvb.adapters.visualizers.brain.BrainViewer

Visualizer merging Brain 3D display and EEG lines display.

get_input_tree()[source]
launch(time_series, projection_surface=None, shell_surface=None)[source]
populate_surface_fields(time_series)[source]

Prepares the urls from which the client may read the data needed for drawing the surface.

retrieve_measure_points_prams(time_series)[source]

complex_imaginary_coherence

class tvb.adapters.visualizers.complex_imaginary_coherence.ImaginaryCoherenceDisplay[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

This viewer takes as inputs a result from complex coherence analysis, and returns required parameters for a MatplotLib representation.

generate_preview(input_data, **kwargs)[source]
get_input_tree()[source]

Accept as input result from ComplexCoherence Analysis.

get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

launch(input_data, **kwargs)[source]

Draw interactive display.

connectivity

class tvb.adapters.visualizers.connectivity.Connectivity2DViewer[source]

Bases: object

Having as inputs a Connectivity matrix(required) and two arrays that represent the colors and shapes of the nodes from the matrix(optional) the viewer will build the required parameter dictionary that will be sent to the HTML/JS 2D representation of the connectivity matrix.

DEFAULT_COLOR = '#d73027'
MAX_RAY = 40
MAX_WEIGHT_VALUE = 0.6
MIN_RAY = 4
MIN_WEIGHT_VALUE = 0.0
OTHER_COLOR = '#1a9850'
compute_parameters(input_data, colors=None, rays=None, step=None)[source]

Build the required HTML response to be displayed.

Raises LaunchException:
 when number of regions in input_data is less than 3
compute_preview_parameters(input_data, width, height, colors=None, rays=None, step=None)[source]

Build the required HTML response to be displayed in the BURST preview iFrame.

point2json(node_lbl, x_coord, y_coord, adjacencies, angle, shape_dimension, shape_color)[source]

Method used for creating a valid JSON for a certain point.

class tvb.adapters.visualizers.connectivity.Connectivity3DViewer[source]

Bases: object

Behavior for the HTML/JS 3D representation of the connectivity matrix.

static compute_parameters(input_data, colors=None, rays=None)[source]

Having as inputs a Connectivity matrix(required) and two arrays that represent the rays and colors of the nodes from the matrix(optional) this method will build the required parameter dictionary that will be sent to the HTML/JS 3D representation of the connectivity matrix.

class tvb.adapters.visualizers.connectivity.ConnectivityViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Given a Connectivity Matrix and a Surface data the viewer will display the matrix ‘inside’ the surface data. The surface is only displayed as a shadow.

compute_connectivity_global_params(input_data, surface_data=None)[source]

Returns a dictionary which contains the data needed for drawing a connectivity.

Parameters:
  • input_data – the Connectivity object
  • surface_data (CorticalSurface) – if provided, it is displayed as a shadow to give an idea of the connectivity position relative to the full brain cortical surface
generate_preview(input_data, figure_size=None, surface_data=None, colors=None, rays=None, step=None, **kwargs)[source]

Generate the preview for the BURST cockpit.

see launch_

static get_connectivity_parameters(input_connectivity, surface_data=None)[source]

Returns a dictionary which contains all the needed data for drawing a connectivity.

get_input_tree()[source]

Take as Input a Connectivity Object.

get_required_memory_size(input_data, surface_data, **kwargs)[source]

Return the required memory to run this algorithm.

launch(input_data, surface_data=None, colors=None, rays=None, step=None)[source]

Given the input connectivity data and the surface data, build the HTML response to be displayed.

Parameters:
  • input_data – the Connectivity object which will be displayed
  • surface_data (CorticalSurface) – if provided, it is displayed as a shadow to give an idea of the connectivity position relative to the full brain cortical surface
  • colors (ConnectivityMeasure) – used to establish a colormap for the nodes displayed in 2D Connectivity viewers
  • rays (ConnectivityMeasure) – used to establish the size of the spheres representing each node in 3D Nodes viewer
  • step (float) – a threshold applied to the 2D Connectivity Viewers to differentiate 2 types of nodes the ones with a value greater that this will be displayed as red discs, instead of yellow

connectivity_edge_bundle

A Javascript displayer for connectivity, using hierarchical edge bundle diagrams from d3.js.

class tvb.adapters.visualizers.connectivity_edge_bundle.ConnectivityEdgeBundle[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]

Inform caller of the data we need as input.

get_required_memory_size(**kwargs)[source]

Return required memory.

launch(connectivity)[source]

Construct data for visualization and launch it.

covariance

A displayer for covariance.

class tvb.adapters.visualizers.covariance.CovarianceVisualizer[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArrayVisualizer

get_input_tree()[source]

Inform caller of the data we need

launch(datatype)[source]

Construct data for visualization and launch it.

cross_coherence

A displayer for the cross coherence of a time series.

class tvb.adapters.visualizers.cross_coherence.CrossCoherenceVisualizer[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArraySVGVisualizerMixin, tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]

Inform caller of the data we need

launch(datatype)[source]

Construct data for visualization and launch it.

cross_correlation

A displayer for cross correlation.

class tvb.adapters.visualizers.cross_correlation.CrossCorrelationVisualizer[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArraySVGVisualizerMixin, tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]

Inform caller of the data we need as input

launch(datatype)[source]

Construct data for visualization and launch it.

eeg_monitor

class tvb.adapters.visualizers.eeg_monitor.EegMonitor[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

This viewer takes as inputs at least one ArrayWrapper and at most 3 ArrayWrappers, and returns the needed parameters for a 2D representation of the values from these arrays, in EEG form. So far arrays of at most 3 dimensions are supported.

compute_parameters(input_data, data_2=None, data_3=None, is_preview=False, is_extended_view=False, selected_dimensions=None)[source]

Start the JS visualizer, similar to EEG-lab

Parameters:
  • input_data (TimeSeriesEEG) – Time series to display
  • data_2 – additional input data
  • data_3 – additional input data
Returns:

the needed parameters for a 2D representation

Return type:

dict

Raises LaunchException:
 

when at least two input data parameters are provided and they sample periods differ

compute_required_info(list_of_timeseries)[source]

Compute average difference between Max and Min.

current_page = 0
generate_preview(input_data, data_2=None, data_3=None, figure_size=None)[source]
get_input_tree()[source]

Accept as input Array of any size

get_required_memory_size(time_series)[source]

Return the required memory to run this algorithm.

has_nan = False
launch(input_data, data_2=None, data_3=None)[source]

Compute visualizer’s page

page_size = 4000
preview_page_size = 250

fourier_spectrum

class tvb.adapters.visualizers.fourier_spectrum.FourierSpectrumDisplay[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

This viewer takes as inputs a result form FFT analysis, and returns required parameters for a MatplotLib representation.

generate_preview(**kwargs)[source]
get_input_tree()[source]

Accept as input result from FFT Analysis.

get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

launch(**kwargs)[source]

histogram

class tvb.adapters.visualizers.histogram.HistogramViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

The viewer takes as input a result DataType as computed by BCT analyzers.

generate_preview(input_data, figure_size)[source]

The preview for the burst page.

get_input_tree()[source]
get_required_memory_size(input_data, figure_size)[source]

Return the required memory to run this algorithm.

launch(input_data)[source]

Prepare input data for display.

Parameters:input_data (ConnectivityMeasure) – A BCT computed measure for a Connectivity
prepare_parameters(input_data)[source]

Prepare all required parameters for a launch.

ica

A matrix displayer for the Independent Component Analysis. It displays the mixing matrix of siae n_features x n_components

class tvb.adapters.visualizers.ica.ICA[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArraySVGVisualizerMixin, tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]

Inform caller of the data we need

launch(datatype, i_svar=0, i_mode=0)[source]

Construct data for visualization and launch it.

local_connectivity_view

class tvb.adapters.visualizers.local_connectivity_view.LocalConnectivityViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Local connectivity visualizer

get_input_tree()[source]
get_required_memory_size()[source]
launch(local_conn)[source]

matrix_viewer

class tvb.adapters.visualizers.matrix_viewer.MappedArraySVGVisualizerMixin[source]

Bases: object

To be mixed in a ABCDisplayer

compute_params(matrix, viewer_title, given_slice=None, labels=None)[source]

Prepare a 2d matrix to display :param matrix: input matrix :param given_slice: a string representation of a slice. This slice should cut a 2d view from matrix If the matrix is not 2d and the slice will not make it 2d then a default slice is used

static compute_raw_matrix_params(matrix)[source]

Serializes matrix data, shape and stride metadata to json

generate_preview(datatype, **kwargs)[source]
get_required_memory_size(datatype)[source]
class tvb.adapters.visualizers.matrix_viewer.MappedArrayVisualizer[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArraySVGVisualizerMixin, tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]
launch(datatype, slice='')[source]
tvb.adapters.visualizers.matrix_viewer.compute_2d_view(matrix, slice_s)[source]

Create a 2d view of the matrix using the suggested slice If the given slice is invalid or fails to produce a 2d array the default is used which selects the first 2 dimensions. If the matrix is complex the real part is shown :param slice_s: a string representation of a slice :return: (a 2d array, the slice used to make it, is_default_returned)

pca

A displayer for the principal components analysis.

class tvb.adapters.visualizers.pca.PCA[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

generate_preview(pca, figure_size=None)[source]
get_input_tree()[source]

Inform caller of the data we need

get_required_memory_size(**kwargs)[source]

Return required memory. Here, it’s unknown/insignificant.

launch(pca)[source]

Construct data for visualization and launch it.

pearson_cross_correlation

class tvb.adapters.visualizers.pearson_cross_correlation.PearsonCorrelationCoefficientVisualizer[source]

Bases: tvb.adapters.visualizers.matrix_viewer.MappedArrayVisualizer

Viewer for Pearson CorrelationCoefficients. Very similar to the CrossCorrelationVisualizer - this one done with Matplotlib

get_input_tree()[source]

Inform caller of the data we need as input

get_required_memory_size(datatype)[source]

Return required memory.

launch(datatype)[source]

Construct data for visualization and launch it.

pearson_edge_bundle

class tvb.adapters.visualizers.pearson_edge_bundle.PearsonEdgeBundle[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Viewer for Pearson CorrelationCoefficients. Very similar to the CrossCorrelationVisualizer - this one done with Matplotlib

get_input_tree()[source]

Inform caller of the data we need as input

get_required_memory_size(datatype)[source]

Return required memory.

launch(datatype)[source]

Construct data for visualization and launch it.

phase_plane_interactive

class tvb.adapters.visualizers.phase_plane_interactive.PhaseLineD3(model, integrator)[source]

Bases: tvb.adapters.visualizers.phase_plane_interactive._PhaseSpace

compute_phase_plane()[source]
update_axis(mode, svx, x_range)[source]
class tvb.adapters.visualizers.phase_plane_interactive.PhasePlane(model, integrator)[source]

Bases: tvb.adapters.visualizers.phase_plane_interactive._PhaseSpace

Responsible with computing phase space slices and trajectories. A collection of math-y utilities it is view independent (holds no state related to views).

nullcline(x, y, z)[source]
class tvb.adapters.visualizers.phase_plane_interactive.PhasePlaneD3(model, integrator)[source]

Bases: tvb.adapters.visualizers.phase_plane_interactive.PhasePlane

Provides data for a d3 client

compute_phase_plane()[source]
Returns:A json representation of the phase plane.
trajectories(starting_points, n_steps=512)[source]
Parameters:starting_points – A list of starting points represented as dicts of state_var_name to value
Returns:a tuple of trajectories and signals
update_axis(mode, svx, svy, x_range, y_range, state_vars)[source]
update_integrator_clamping()[source]
tvb.adapters.visualizers.phase_plane_interactive.phase_space_d3(model, integrator)[source]
Returns:A phase plane or a phase line depending on the dimensionality of the model

pse_discrete

class tvb.adapters.visualizers.pse_discrete.DiscretePSEAdapter[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Visualization adapter for Parameter Space Exploration. Will be used as a generic visualizer, accessible when input entity is DataTypeGroup. Will also be used in Burst as a supplementary navigation layer.

get_input_tree()[source]

Take as Input a Connectivity Object.

get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

static get_value_on_axe(op_range, only_numbers, range_param_name, fake_numbers)[source]
launch(datatype_group)[source]

Launch the visualizer.

static prepare_parameters(datatype_group_gid, back_page, color_metric=None, size_metric=None)[source]

We suppose that there are max 2 ranges and from each operation results exactly one dataType.

Parameters:
  • datatype_group_gid – the group id for the DataType to be visualised
  • back_page – Page where back button will direct
  • color_metric – a list of DataTypeMeasure which has been executed on datatype_group_gid
  • size_metric – a list of DataTypeMeasure which has been executed on datatype_group_gid
Returns:

ContextDiscretePSE

Raises Exception:
 

when datatype_group_id is invalid (not in database)

static prepare_range_labels(operation_group, range_json)[source]

Prepare Range labels for display in UI. When the current range_json is empty, returns None, [RANGE_MISSING_STRING], [RANGE_MISSING_STRING]

Parameters:
  • operation_group – model.OperationGroup instance
  • range_json – Stored JSON for for a given range
Returns:

String with current range label, Array of ranged numbers, Array of labels for current range

pse_isocline

class tvb.adapters.visualizers.pse_isocline.IsoclinePSEAdapter[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Visualization adapter for Parameter Space Exploration. Will be used as a generic visualizer, accessible when input entity is DataTypeGroup. Will also be used in Burst as a supplementary navigation layer.

burst_preview(datatype_group_gid)[source]

Generate the preview for the burst page.

get_input_tree()[source]

Take as Input a Connectivity Object.

get_metric_matrix(datatype_group, selected_metric=None)[source]
get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

launch(datatype_group, **kwargs)[source]
static prepare_node_data(datatype_group)[source]
class tvb.adapters.visualizers.pse_isocline.PseIsoModel(range1, range2, apriori_data, metrics, datatype_gids)[source]

Bases: object

classmethod from_db(operation_group_id)[source]

Collects from db the information about the operation group that is required by the isocline view.

region_volume_mapping

Backend-side for Visualizers that display measures on regions in the brain volume.

class tvb.adapters.visualizers.region_volume_mapping.ConnectivityMeasureVolumeVisualizer[source]

Bases: tvb.adapters.visualizers.region_volume_mapping._MappedArrayVolumeBase

get_input_tree()[source]
launch(connectivity_measure, region_mapping_volume=None, background=None)[source]
class tvb.adapters.visualizers.region_volume_mapping.MappedArrayVolumeVisualizer[source]

Bases: tvb.adapters.visualizers.region_volume_mapping._MappedArrayVolumeBase

This is a generic mapped array visualizer on a region volume. To view a multidimensional array one has to give this viewer a slice.

get_input_tree()[source]
launch(measure, region_mapping_volume=None, data_slice='', background=None)[source]
class tvb.adapters.visualizers.region_volume_mapping.MriVolumeVisualizer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]
get_required_memory_size(**kwargs)[source]
launch(background=None)[source]
class tvb.adapters.visualizers.region_volume_mapping.RegionVolumeMappingVisualiser[source]

Bases: tvb.adapters.visualizers.region_volume_mapping._MappedArrayVolumeBase

get_input_tree()[source]
launch(region_mapping_volume, connectivity_measure=None, background=None)[source]

sensors

class tvb.adapters.visualizers.sensors.SensorsViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Sensor visualizer - for visual inspecting of TVB Sensors DataTypes.

get_input_tree()[source]
get_required_memory_size()[source]
launch(sensors, projection_surface=None, shell_surface=None)[source]

Prepare visualizer parameters.

We support viewing all sensor types through a single viewer, so that a user doesn’t need to go back to the data-page, for loading a different type of sensor.

tvb.adapters.visualizers.sensors.prepare_mapped_sensors_as_measure_points_params(project_id, sensors, eeg_cap=None)[source]

Compute sensors positions by mapping them to the eeg_cap surface If eeg_cap is not specified the mapping will use a default EEGCal DataType in current project. If no default EEGCap is found, return sensors as they are (not projected)

Returns:dictionary to be used in Viewers for rendering measure_points
Return type:dict
tvb.adapters.visualizers.sensors.prepare_sensors_as_measure_points_params(sensors)[source]

Returns urls from where to fetch the measure points and their labels

surface_view

class tvb.adapters.visualizers.surface_view.ConnectivityMeasureOnSurfaceViewer[source]

Bases: tvb.adapters.visualizers.surface_view.SurfaceViewer

This displays a connectivity measure on a surface via a RegionMapping It reuses almost everything from SurfaceViewer, but it make required another input param.

get_input_tree()[source]
launch(connectivity_measure, region_map=None, shell_surface=None)[source]
class tvb.adapters.visualizers.surface_view.RegionMappingViewer[source]

Bases: tvb.adapters.visualizers.surface_view.SurfaceViewer

This is a viewer for RegionMapping DataTypes. It reuses almost everything from SurfaceViewer, but it make required another input param.

get_input_tree()[source]
launch(region_map, connectivity_measure=None, shell_surface=None)[source]
class tvb.adapters.visualizers.surface_view.SurfaceViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Static SurfaceData visualizer - for visual inspecting imported surfaces in TVB. Optionally it can display associated RegionMapping entities.

get_input_tree()[source]
get_required_memory_size()[source]
launch(surface, region_map=None, connectivity_measure=None, shell_surface=None, title='Surface Visualizer')[source]
tvb.adapters.visualizers.surface_view.prepare_shell_surface_urls(project_id, shell_surface=None, preferred_type=<class 'tvb.datatypes.surfaces.FaceSurface'>)[source]

time_series

A Javascript displayer for time series, using SVG.

class tvb.adapters.visualizers.time_series.TimeSeries[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

MAX_PREVIEW_DATA_LENGTH = 200
generate_preview(time_series, figure_size)[source]
get_input_tree()[source]

Inform caller of the data we need as input.

get_required_memory_size(**kwargs)[source]

Return required memory.

launch(time_series, preview=False, figsize=None)[source]

Construct data for visualization and launch it.

time_series_volume

Backend-side for TS Visualizer of TS Volume DataTypes.

class tvb.adapters.visualizers.time_series_volume.TimeSeriesVolumeVisualiser[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

get_input_tree()[source]
get_required_memory_size(**kwargs)[source]

Return required memory.

launch(time_series, background=None)[source]

topographic

class tvb.adapters.visualizers.topographic.TopographicViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Interface between TVB Framework and web display of a topography viewer.

generate_preview(data_0, data_1=None, data_2=None, figure_size=None)[source]
get_input_tree()[source]
get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

launch(data_0, data_1=None, data_2=None)[source]
class tvb.adapters.visualizers.topographic.TopographyCalculations[source]

Bases: object

static compute_topography_data(topography, sensor_locations)[source]

Trim data, to make sure everything is inside the head contour.

static normalize_sensors(points_positions)[source]

Centers the brain.

tract

A tracts visualizer .. moduleauthor:: Mihai Andrei <mihai.andrei@codemart.ro>

class tvb.adapters.visualizers.tract.TractViewer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Tract visualizer

get_input_tree()[source]
get_required_memory_size()[source]
launch(tracts, shell_surface=None)[source]

wavelet_spectrogram

Plot the power of a WaveletCoefficients object

class tvb.adapters.visualizers.wavelet_spectrogram.WaveletSpectrogramVisualizer[source]

Bases: tvb.core.adapters.abcdisplayer.ABCDisplayer

Plot the power of a WaveletCoefficients object using SVG an D3.

generate_preview(input_data, **kwargs)[source]
get_input_tree()[source]

Accept as input result from Continuous wavelet transform analysis.

get_required_memory_size(**kwargs)[source]

Return the required memory to run this algorithm.

launch(input_data, **kwarg)[source]