Objects populating the Mayavi pipeline¶
Here we give a brief description of the key objects in the Mayavi pipeline.
Note
Given a Mayavi object, a simple way to see what important attribute
is, display it to call it’s print_traits()
. Note that, for
certain objects, when used in IPython, this can cause a segfault, due
to threading problems in IPython.
Scene¶
Key attributes |
|
---|---|
|
a |
|
a list of |
The Scene
class is defined in the mayavi.core.scene
module.
See also
API reference for the Scene
class.
Source¶
All the data sources, file readers, Parametric surface etc. are
subclasses of the Source
class.
Key attributes |
|
---|---|
|
a list of either |
|
|
The Source
class is defined in the mayavi.core.source
module.
See also
API reference for the Source
class.
Filter¶
All the Filters
described in the Filters section are
subclasses of this class.
Key attributes |
|
---|---|
|
a list of either |
|
a |
|
a list of outputs produced by the filter. These are TVTK datasets, that are explained in the section Data representation in Mayavi. |
Key methods |
|
---|---|
|
used to create the underlying TVTK pipeline objects if needed. |
|
called when the upstream pipeline
has been changed, i.e. an upstream object fires a
|
|
called when the upstream pipeline
has not been changed but the data in the
pipeline has been changed. This happens when the
upstream object fires a |
The filter class is defined in the mayavi.core.filter
module.
See also
API reference for the Filter
class.
ModuleManager: Colors and legends node¶
This object is the one called Colors and legends in the tree view on
the UI. The main purpose of this object is to control how data is turned
in colors in the Modules
it manages. All modules typically will use
a lookup table (LUT) in order to produce a meaningful visualization.
This lookup table is managed by the module manager.
Key attributes |
|
---|---|
|
the |
|
a list of the |
|
an instance of a |
|
an instance of a |
|
|
This class is defined in the mayavi.core.module_manager
module.
See also
API reference for the ModuleManager
class.
Module¶
These objects are the ones that typically produce a visualization on the scene. All the modules defined in the Modules section are subclasses of this.
A module is typically returned by the mlab 3D plotting functions.
Key attributes |
|
---|---|
|
The |
|
The TVTK actor of the modules, in other words the object displayed in the scene. This is where you will have the properties such as scaling, or GL material properties. |
|
a list of various reusable components that are used
by the module. These usually are never used directly
by the user. However, they are extremely useful
when creating new modules. A |
Key methods |
|
---|---|
|
used to create the underlying TVTK pipeline objects if needed. |
|
called when the upstream pipeline
has been changed, i.e. an upstream object fires a
|
|
called when the upstream pipeline
has not been changed but the data in the
pipeline has been changed. This happens when the
upstream object fires a |
Defined in the mayavi.core.module
module.
See also
API reference for the Module
class.
Engine¶
The Mayavi engine is the central object dealing with life-cycle of visualization objects and scene, as well as connecting and updating the pipeline. It is at the root of the pipeline and is not displayed in the pipeline view.
For contextual operation, the engine has the notion of a ‘current object’
and a ‘current scene’ and features several methods that let one add a
Filter/Source/Module
instance to it. The contextual operations are
important in a menu-driven graphical user interface.
It allows one to create new scenes and delete them. Also has methods to load and save the entire visualization.
When using mlab, the engine used by mlab can be retrieved using
mlab.get_engine()
.
Key attributes |
|
---|---|
|
a list of |
|
the object on which contextual operations, such
as |
|
the scene in which data sources will be added by default. |
|
The object selected in the pipeline view. |
Key methods |
|
---|---|
|
this is the method called to create a new scene. Subclasses override this method. |
Important sub-classes |
|
---|---|
|
defined in the
|
|
defined in the
|
|
defined in the
|
The Engine base class is defined in the mayavi.engine
module.
See also
API reference for the Engine
class.
Base class: PipelineBase¶
The PipelineBase
is the base class for all
objects in the mayavi pipeline except the Scene
and Engine
(which really isn’t in the pipeline but contains the pipeline).
Defined in the mayavi.core.pipeline_base
module.
Derives from Base
which merely abstracts out common
functionality.
Key attributes |
|
---|---|
|
This is an object.pipeline_changed = True
then the |
|
Similarly, if the |
|
a list of outputs produced by the object. |
|
the scene to which the object is attached. |
|
a boolean that toggle the Hide/Show status of the object and its downstream pipeline. |
Key methods |
|
---|---|
|
can be used to remove the object (if added) from the mayavi pipeline. |
See also
API reference for the PipelineBase
class.
Class hierarchy¶
The following figures show the class hierarchy of the various objects involved.
This hierarchy depicts the ``Base`` object, the ``Scene``, ``PipelineBase`` and the ``ModuleManager``.
This hierarchy depicts the ``PipelineBase`` object, the ``Source``, ``Filter``, ``Module`` and the ``Component``.