brainspace.vtk_interface.wrappers.actor.BSActor

class brainspace.vtk_interface.wrappers.actor.BSActor(vtkobject=None, **kwargs)[source]

Wrapper for vtkActor.

Unresolved requests are forwarded to its property.

Examples

>>> from brainspace.vtk_interface.wrappers import BSActor
>>> a = BSActor()
>>> a.GetProperty().GetOpacity()
1.0
>>> a.GetOpacity() # It is forwarded to the property
1.0
>>> a.opacity = .5
>>> a.VTKObject.GetProperty().GetOpacity()
0.5
__init__(vtkobject=None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

GetProperty() Get property.
SetDataSetMapper([obj]) Set DataSetMapper.
SetLabeledContourMapper([obj]) Set LabeledContourMapper.
SetMapper([obj]) Set mapper.
SetPolyDataMapper([obj]) Set a PolyDataMapper.
__init__([vtkobject]) Initialize self.
getVTK(*args, **kwargs) Invoke get methods on the vtk object.
setVTK(*args, **kwargs) Invoke set methods on the vtk object.

Attributes

vtk_map Dictionary of vtk setter and getter methods.
GetProperty()[source]

Get property.

Wraps the GetProperty method of vtkActor to return a wrapped property.

Returns:prop (BSProperty) – Actor’s property.
SetDataSetMapper(obj=None, **kwargs)[source]

Set DataSetMapper.

Parameters:
  • obj (vtkMapper or BSMapper, optional) – Mapper. If None, the mapper is created. Default is None.
  • kwargs (optional keyword arguments) – Arguments are used to set the mapper.
SetLabeledContourMapper(obj=None, **kwargs)[source]

Set LabeledContourMapper.

Parameters:
  • obj (vtkMapper or BSMapper, optional) – Mapper. If None, the mapper is created. Default is None.
  • kwargs (optional keyword arguments) – Arguments are used to set the mapper.
SetMapper(obj=None, **kwargs)[source]

Set mapper.

Wraps the SetMapper method of vtkActor to accept a vtkMapper or BSMapper.

Parameters:
  • obj (vtkMapper or BSMapper, optional) – Mapper. If None, a PolyDataMapper is created. Default is None.
  • kwargs (optional keyword arguments) – Arguments are used to set the mapper.
SetPolyDataMapper(obj=None, **kwargs)[source]

Set a PolyDataMapper.

Parameters:
  • obj (vtkMapper or BSMapper, optional) – Mapper. If None, the mapper is created. Default is None.
  • kwargs (optional keyword arguments) – Arguments are used to set the mapper.
getVTK(*args, **kwargs)

Invoke get methods on the vtk object.

Parameters:
  • args (list of str) – Method that require no arguments.
  • kwargs (list of keyword-value arguments) – key-word arguments can be use for methods that require arguments. When several arguments are required, use a tuple. Methods that require no arguments can also be used here using None as the argument.
Returns:

results (dict) – Dictionary of results where the keys are the method names and the values the results.

Examples

>>> import vtk
>>> from brainspace.vtk_interface.wrappers import BSVTKObjectWrapper
>>> m1 = BSVTKObjectWrapper(vtk.vtkPolyDataMapper())
>>> m1.getVTK('arrayId', colorModeAsString=None)
{'arrayId': -1, 'colorModeAsString': 'Default'}
>>> m1.getVTK('colorModeAsString', arrayId=None)
{'colorModeAsString': 'Default', 'arrayId': -1}
>>> m1.getVTK(numberOfInputConnections=0)
{'numberOfInputConnections': 0}
setVTK(*args, **kwargs)

Invoke set methods on the vtk object.

Parameters:
  • args (list of str) – Setter methods that require no arguments.
  • kwargs (list of keyword-value arguments) – key-word arguments can be use for methods that require arguments. When several arguments are required, use a tuple. Methods that require no arguments can also be used here using None as the argument.
Returns:

self (BSVTKObjectWrapper object) – Return self.

Examples

>>> import vtk
>>> from brainspace.vtk_interface.wrappers import BSVTKObjectWrapper
>>> m1 = BSVTKObjectWrapper(vtk.vtkPolyDataMapper())
>>> m1.setVTK(arrayId=3, colorMode='mapScalars')
<brainspace.vtk_interface.base.BSVTKObjectWrapper at 0x7f38a4ace320>
>>> m1.arrayId
3
>>> m1.colorModeAsString
'MapScalars'
vtk_map

Dictionary of vtk setter and getter methods.

Type:dict