visbrain.objects.VolumeObj

class visbrain.objects.VolumeObj(name, vol=None, hdr=None, method='mip', threshold=0.0, cmap='OpaqueGrays', select=None, transform=None, parent=None, preload=True, verbose=None, **kw)[source][source]

Create a 3-D volume object.

Parameters:
namestring

Name of the volume object. If name is ‘brodmann’, ‘aal’ or ‘talairach’ a predefined volume object is used and vol, index and label are ignored. The name input can also be the path to an nii.gz file.

volarray_like

The volume to use. Should be a 3-d array.

hdrarray_like | None

Matrix transformation to apply. hdr should be a (4, 4) array.

method{‘mip’, ‘translucent’, ‘additive’, ‘iso’}

Volume rendering method. Default is ‘mip’.

thresholdfloat | 0.

Threshold value for iso rendering method.

cmap{‘OpaqueGrays’, ‘TransFire’, ‘OpaqueFire’, ‘TransGrays’}

Colormap to use.

selectlist | None

Select some structures in the volume.

transformVisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parentVisPy.parent | None

Volume object parent.

kwdict | {}

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

Notes

List of supported shortcuts :

  • s : save the figure

  • <delete> : reset camera

Examples

>>> from visbrain.objects import VolumeObj
>>> select = [4, 6]  # select Brodmann area 4 and 6
>>> v = VolumeObj('brodmann', method='iso', select=select)
>>> v.preview(axis=True)

Methods

__init__(name[, vol, hdr, method, ...])

Init.

animate([step, interval, iterations])

Animate the object.

copy()

Get a copy of the object.

describe_tree()

Tree description.

extract_activity(xyz[, radius])

Extract activity of a volume around (x, y, z) points.

list([file])

Get the list of installed volumes.

pos_to_slice(pos[, axis, hdr])

Return the slice from position.

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.

remove()

Remove the volume template.

render()

Render the canvas.

save([tmpfile])

Save the volume template.

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

Take a screeshot of the scene.

set_data(vol[, hdr, threshold, cmap, ...])

Set data to the volume.

set_shortcuts_to_canvas(canvas)

Set shortcuts to a VisbrainCanvas.

slice_to_pos(sl[, axis, hdr])

Return the position from slice in the volume space.

to_dict()

Return a dictionary of all colorbar args.

to_kwargs([addisminmax])

Return a dictionary for input arguments.

update()

Update the volume.

update_from_dict(kwargs)

Update attributes from a dictionary.

Examples using visbrain.objects.VolumeObj

Volume object (VolumeObj) : complete tutorial

Volume object (VolumeObj) : complete tutorial

Cross-sections and volume control

Cross-sections and volume control

Add Nifti volume

Add Nifti volume