visbrain.objects.Picture3DObj

class visbrain.objects.Picture3DObj(name, data, xyz, select=None, pic_width=7.0, pic_height=7.0, alpha=1.0, cmap='viridis', clim=None, vmin=None, vmax=None, under='gray', over='red', translate=(0.0, 0.0, 1.0), transform=None, parent=None, verbose=None, _z=-10.0, **kw)[source][source]

Create a 3-D picture object.

Parameters:
name : string

The name of the connectivity object.

data : array_like

Array of data pictures of shape (n_sources, n_rows, n_columns).

xyz : array_like

The 3-d position of each picture of shape (n_sources, 3).

select : array_like | None

Select the pictures to display. Should be a vector of bolean values of shape (n_sources,).

pic_width : float | 7.

Width of each picture.

pic_height : float | 7.

Height of each picture.

alpha : float | 1.

Image transparency.

cmap : string | ‘viridis’

Colormap to use.

vmin : float | None

Lower threshold of the colormap.

under : string | None

Color to use for values under vmin.

vmin : float | None

Higher threshold of the colormap.

over : string | None

Color to use for values over vmax.

translate : tuple | (0., 0., 1.)

Translation over the (x, y, z) axis.

transform : VisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parent : VisPy.parent | None

Line object parent.

verbose : string

Verbosity level.

_z : float | 10.

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

kw : dict | {}

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 Picture3DObj
>>> n_rows, n_cols, n_pic = 10, 20, 5
>>> data = np.random.rand(n_pic, n_rows, n_cols)
>>> xyz = np.random.uniform(-10, 10, (n_pic, 3))
>>> pic = Picture3DObj('Pic', data, xyz, cmap='plasma')
>>> pic.preview(axis=True)

Methods

__init__(name, data, xyz[, select, …]) Init.
describe_tree() Tree description.
preview([bgcolor, axis, xyz, show, obj, size]) Previsualize the result.
screenshot(saveas[, print_size, dpi, unit, …]) Take a screeshot of the scene.
set_shortcuts_to_canvas(canvas) Set shortcuts to a VisbrainCanvas.
to_dict() Return a dictionary of all colorbar args.
to_kwargs([addisminmax]) Return a dictionary for input arguments.
update() Update image.
update_from_dict(kwargs) Update attributes from a dictionary.
alpha

Get the alpha value.

cmap

Get the cmap value.

name

Get the name value.

parent

Get the parent value.

pic_height

Get the height value.

pic_width

Get the pic_width value.

preview(bgcolor='black', axis=False, xyz=False, show=True, obj=None, size=(1200, 800), **kwargs)[source]

Previsualize the result.

Parameters:
bgcolor : array_like/string/tuple | ‘black’

Background color for the preview.

axis : bool | False

Add x and y axis with ticks.

xyz : bool | False

Add an (x, y, z) axis to the scene.

obj : VisbrainObj | None

Pass a Visbrain object if you want to use the camera of an other object.

size : tuple | (1200, 800)

Default size of the window.

kwargs : dict | {}

Optional arguments are passed to the VisbrainCanvas class.

screenshot(saveas, print_size=None, dpi=300.0, unit='centimeter', factor=None, region=None, autocrop=False, bgcolor=None, transparent=False, obj=None, line_width=1.0, **kwargs)[source]

Take a screeshot of the scene.

By default, the rendered canvas will have the size of your screen. The screenshot() method provides two ways to increase to exported image resolution :

  • Using print_size, unit and dpi inputs : specify the size of the image at a specific dpi level. For example, you might want to have an (10cm, 15cm) image at 300 dpi.
  • Using the factor input : multiply the default image size by this factor. For example, if you have a (1920, 1080) monitor and if factor is 2, the exported image should have a shape of (3840, 2160) pixels.
Parameters:
saveas : str

The name of the file to be saved. This file must contains a extension like .png, .tiff, .jpg…

print_size : tuple | None

The desired print size. This argument should be used in association with the dpi and unit inputs. print_size describe should be a tuple of two floats describing (width, height) of the exported image for a specific dpi level. The final image might not have the exact desired size but will try instead to find a compromize regarding to the proportion of width/height of the original image.

dpi : float | 300.

Dots per inch for printing the image.

unit : {‘centimeter’, ‘millimeter’, ‘pixel’, ‘inch’}

Unit of the printed size.

factor : float | None

If you don’t want to use the print_size input, factor simply multiply the resolution of your screen.

region : tuple | None

Select a specific region. Must be a tuple of four integers each one describing (x_start, y_start, width, height).

autocrop : bool | False

Automaticaly crop the figure in order to have the smallest space between the brain and the border of the picture.

bgcolor : array_like/string | None

The background color of the image.

transparent : bool | False

Specify if the exported figure have to contains a transparent background.

obj : VisbrainObj | None

Pass a Visbrain object if you want to use the camera of an other object for the sceen rendering.

kwargs : dict | {}

Optional arguments are passed to the VisbrainCanvas class.

transform

Get the transform value.

translate

Get the translate value.

visible_obj

Get the visible_obj value.

Examples using visbrain.objects.Picture3DObj