How to use the brainspace.vtk_interface.wrappers.BSActor2D function in brainspace

To help you get started, we’ve selected a few brainspace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MICA-MNI / BrainSpace / brainspace / vtk_interface / wrappers.py View on Github external
pass

    # Try to handle abstract classes such as vtkActor, vtkPolyDataMapper
    # That instantiate to vtkOpenGLActor, vtkOpenGLPolyDataMapper
    if cls_name.startswith('OpenGL'):
        cls_name = cls_name[6:]
        try:
            return eval('BS' + cls_name)(obj)
        except:
            pass

    if isinstance(obj, vtk.vtkTexturedActor2D):
        return BSTexturedActor2D(obj)

    if isinstance(obj, vtk.vtkActor2D):
        return BSActor2D(obj)

    if isinstance(obj, vtk.vtkMapper):
        return BSMapper(obj)

    if isinstance(obj, vtk.vtkLookupTable):
        return BSLookupTable(obj)

    if isinstance(obj, vtk.vtkDataSet):
        return BSDataSet(obj)

    if isinstance(obj, vtk.vtkAlgorithm):
        return BSAlgorithm(obj)

    # Fall back to generic wrapper
    return BSVTKObjectWrapper(obj)
github MICA-MNI / BrainSpace / brainspace / vtk_interface / wrappers.py View on Github external
def GetProperty(self):
        """Get property.

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

        Returns
        -------
        prop : BSVTKObjectWrapper
            Actor's property.
        """
        return self._property


class BSScalarBarActor(BSActor2D):
    """Wrapper for vtkScalarBarActor.

    Unresolved requests are forwarded to its 2D property.

    """
    def __init__(self, vtkobject=None, **kwargs):
        super().__init__(vtkobject=vtkobject, **kwargs)


class BSTexturedActor2D(BSActor2D):
    """Wrapper for vtkTexturedActor2D.

    Unresolved requests are forwarded to its 2D property.

    """
    def __init__(self, vtkobject=None, **kwargs):
github MICA-MNI / BrainSpace / brainspace / vtk_interface / wrappers.py View on Github external
Actor's property.
        """
        return self._property


class BSScalarBarActor(BSActor2D):
    """Wrapper for vtkScalarBarActor.

    Unresolved requests are forwarded to its 2D property.

    """
    def __init__(self, vtkobject=None, **kwargs):
        super().__init__(vtkobject=vtkobject, **kwargs)


class BSTexturedActor2D(BSActor2D):
    """Wrapper for vtkTexturedActor2D.

    Unresolved requests are forwarded to its 2D property.

    """
    def __init__(self, vtkobject=None, **kwargs):
        super().__init__(vtkobject=vtkobject, **kwargs)


class BSTextActor(BSTexturedActor2D):
    """Wrapper for vtkTextActor.

    Unresolved requests are forwarded to its 2D property.

    """
    def __init__(self, vtkobject=None, **kwargs):
github MICA-MNI / BrainSpace / brainspace / vtk_interface / wrappers.py View on Github external
def AddActor2D(self, actor, **kwargs):
        """Set mapper.

        Wraps the `AddActor2D` method of `vtkViewport` to accept a
        `vtkActor2D` or BSActor2D.

        Parameters
        ----------
        actor : vtkActor or BSActor
            2D Actor.
        kwargs : optional keyword arguments
            Arguments are used to set the actor.
        """
        actor = BSActor2D(vtkobject=actor, **kwargs)
        self.VTKObject.AddActor2D(actor.VTKObject)
        return actor