visbrain.objects.ImageObj¶
- class visbrain.objects.ImageObj(name, data=None, xaxis=None, yaxis=None, cmap='viridis', clim=None, vmin=None, under='gray', vmax=None, over='red', interpolation='nearest', max_pts=-1, parent=None, transform=None, verbose=None, **kw)[source][source]¶
Create a single image object.
- Parameters:
- dataarray_like
Array of data. If data.ndim in [1, 2] the color is inferred from the data. Otherwise, if data.ndim is 3, data is interpreted as color if the last dimension is either 3 (RGB) or 4 (RGBA).
- xaxisarray_like | None
Vector to use for the x-axis (number of columns in the image). If None, xaxis is inferred from the second dimension of data.
- yaxisarray_like | None
Vector to use for the y-axis (number of rows in the image). If None, yaxis is inferred from the first dimension of data.
- climtuple | None
Colorbar limits. If None, clim=(data.min(), data.max())
- cmapstring | None
Colormap name.
- vminfloat | None
Minimum threshold of the colorbar.
- understring/tuple/array_like | None
Color for values under vmin.
- vmaxfloat | None
Maximum threshold of the colorbar.
- understring/tuple/array_like | None
Color for values over vmax.
- interpolationstring | ‘nearest’
Interpolation method for the image. See vispy.scene.visuals.Image for availables interpolation methods.
- max_ptsint | -1
Maximum number of points of the image along the x or y axis. This parameter is essentially used to solve OpenGL issues with very large images.
- transformVisPy.visuals.transforms | None
VisPy transformation to set to the parent node.
- parentVisPy.parent | None
Markers object parent.
- verbosestring
Verbosity level.
- 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 ImageObj >>> n = 100 >>> time = np.r_[np.arange(n - 1), np.arange(n)[::-1]] >>> time = time.reshape(-1, 1) + time.reshape(1, -1) >>> im = ImageObj('im', time, cmap='Spectral_r', interpolation='bicubic') >>> im.preview(axis=True)
Methods
__init__
(name[, data, xaxis, yaxis, cmap, ...])Init.
animate
([step, interval, iterations])Animate the object.
copy
()Get a copy of the object.
Tree description.
preview
([bgcolor, axis, xyz, show, obj, ...])Previsualize the result.
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_data
(data[, xaxis, yaxis, clim, cmap, ...])Set data to the image.
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
()Fonction to run when an update is needed.
update_from_dict
(kwargs)Update attributes from a dictionary.