3
3
Advanced Scripting with Mayavi
4
4
===============================
6
As elaborated in the :ref:`an-overview-of-mayavi` section, mayavi can be
7
scripted from Python in order to visualize data. Mayavi2 was designed
8
from the ground up to be highly scriptable. Everything that can be done
9
from the user interface can be achieved using Python scripts.
11
If you are not looking to script mayavi itself but looking for quick
12
ways to get your visualization done with simple code you may want to
13
check out mayavi's mlab module. This is described in more detail in the
14
:ref:`simple-scripting-with-mlab` section. In addition to this mayavi
15
features an automatic script recording feature that automatically writes
16
Python scripts for you as you use the GUI. This is described in more
17
detail in the :ref:`automatic-script-generation` chapter. This is
18
probably the easiest and most powerful way to script mayavi.
20
However, to best understand how to script mayavi, a reasonable
6
As elaborated in the :ref:`an-overview-of-mayavi` section, the Mayavi2
7
can be scripted from Python in order to visualize data. Mayavi2 was
8
designed from the ground up to be highly scriptable. Everything that can
9
be done from the user interface can be achieved using Python scripts.
11
Scripting the Mayavi2 application is a great way to add domain-specific
12
functionality to the existing framework. In addition, understanding this
13
application can help you design your own applications using Mayavi as
14
powerful visualization library.
16
If you are not looking to script mayavi itself or to build an
17
application, but looking for quick ways to get your visualization done
18
with simple code you may want to check out Mayavi's `mlab` module. This
19
is described in more detail in the :ref:`simple-scripting-with-mlab`
20
section. In addition to this Mayavi features an automatic script
21
recording feature that automatically writes Python scripts for you as you
22
use the GUI. This is described in more detail in the
23
:ref:`automatic-script-generation` chapter. This is probably the easiest
24
and most powerful way to script Mayavi.
26
However, to best understand how to script Mayavi, a reasonable
21
27
understanding of the mayavi internals is necessary. The following
22
28
sections provides an overview of the basic design and objects in the
23
mayavi pipeline. Subsequent sections consider specific example scripts
29
Mayavi pipeline. Subsequent sections consider specific example scripts
24
30
that are included with the mayavi sources that illustrate the ideas.
26
32
Mayavi2 uses Traits_ and TVTK_ internally. Traits_ in many ways
27
33
changes the way we program. So it is important to have a good idea of
28
Traits in order to understand mayavi's internals. If you are unsure
29
of traits it is a good idea to get a general idea about traits now.
34
Traits in order to understand Mayavi's internals. If you are unsure
35
of Traits it is a good idea to get a general idea about Traits now.
30
36
Trust me, your efforts learning Traits will not be wasted!
32
38
.. _Traits: http://code.enthought.com/projects/traits
33
39
.. _TVTK: http://code.enthought.com/projects/mayavi
42
Design Overview: Mayavi as a visualization framework
43
-----------------------------------------------------
39
45
This section provides a brief introduction to mayavi's internal