6242 lines (4647 with data), 104.6 kB
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass amsbook
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\layout Chapter
3D visualization with MayaVi
\layout Standard
\align right
Chapter contributed by Prabhu Ramachandran
\layout Section
Introduction
\layout Standard
\begin_inset LatexCommand \label{introduction}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{introduction}{}
\end_inset
MayaVi is a scientific data visualizer.
It is written in Python <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.python.org}{
\backslash
textgreater}
\end_inset
and uses the Visualization Toolkit (VTK) <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/}{
\backslash
textgreater}
\end_inset
for the visualization.
An easy to use GUI using Tkinter <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.pythonware.com/library/tkinter/introduction/index.htm}{
\backslash
textgreater}
\end_inset
is provided.
MayaVi is free software and is distributed under the conditions of the
BSD license <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.opensource.org/licenses/bsd-license.html}{
\backslash
textgreater}
\end_inset
.
It is also cross platform and should run on any platform where both Python
and VTK are available (which is almost any *nix, Mac OSX or Windows).
\layout Standard
In Sanskrit "Mayavi" means magician.
The name wasn't exactly chosen for its meaning but was the result of a
long and hard search with the author pestering a lot of people for suggestions.
My sincere thanks to all of those who offered suggestions.
\layout Standard
MayaVi has a quite a few useful features:
\layout Itemize
An easy to use GUI.
\layout Itemize
MayaVi can be used as a Python module from other Python programs.
MayaVi can also be used interactively from the Python interpreter.
\layout Itemize
Provides modules to visualize grids, scalar and vector data fields.
Rudimentary tensor support is also available.
\layout Itemize
It provides support for
\emph on
any
\emph default
VTK dataset using the VTK data format <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/pdf/file-formats.pdf}{
\backslash
textgreater}
\end_inset
.
This includes rectilinear, structured and unstructured grid data and also
polygonal data.
Both the original VTK data formats and the new XML formats are supported.
\layout Itemize
Support for PLOT3D data.
Both ASCII and binary files work.
Only the structured grid format works because of current limitations in
the vtkPLOT3DReader.
Simple support for multi-block data is also incorporated.
\layout Itemize
Support for EnSight data.
EnSight6 and EnSightGold formats are supported.
Only single parts are supported at this time.
\layout Itemize
Many datasets can be used simultaneously.
\layout Itemize
Multiple visualization modules can be used simultaneously.
\layout Itemize
Quite a few basic data filters are also provided.
\layout Itemize
Supports volume visualization of data via texture and ray cast mappers.
\layout Itemize
Support for importing a simple VRML scene or a 3D Studio file.
Texturing is not yet supported due to limitations in VTK's vtkVRMLImporter.
\layout Itemize
A pipeline browser with which one can browse and edit objects in the VTK
pipeline.
A segmented pipeline browser is used to make it easier to look at parts
of the VTK pipeline.
\layout Itemize
A modular design so one can add ones own modules and filters.
\layout Itemize
A Lookup Table editor to customize lookup tables easily while visualizing
data!
\layout Itemize
The visualization (or a part of it) can be saved and reloaded in the future.
\layout Itemize
Export the visualized scene to a Post Script file, PPM/BMP/TIFF/JPEG/PNG
image, Open Inventor, Geomview OOGL, VRML files or RenderMan RIB files.
It is also possible to save the scene to a vector graphic via GL2PS <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.geuz.org/gl2ps}{
\backslash
textgreater}
\end_inset
.
This is only available if VTK is built with GL2PS support.
\layout Itemize
Support for picking data points or cells and also configuring the lighting
of the visualization.
\layout Standard
\noindent
And a lot more.
MayaVi is free software and hence can be modified to do things differently.
The rest of this manual will provide information on how to use it.
\layout Section
Getting started
\layout Standard
\begin_inset LatexCommand \label{getting-started}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{getting-started}{}
\end_inset
MayaVi is a pretty powerful tool.
This chapter describes the GUI that MayaVi provides and the way to use
it.
This chapter gets you started using MayaVi.
\layout Subsection
Starting MayaVi
\layout Standard
\begin_inset LatexCommand \label{starting}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{starting}{}
\end_inset
Under *nix if your installation is setup such that the script
\series bold
mayavi
\series default
is on the system wide path just run the executable
\series bold
mayavi
\series default
anywhere.
If not, change the current directory to the directory where MayaVi was
installed and run:
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
If you have an already saved MayaVi visualization in some file, say
\family typewriter
saved_
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
viz.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
mv
\family default
you can start MayaVi using that file like so:
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
Under Windows visit the directory where MayaVi was installed and double
click on the executable
\series bold
mayavi.pyw
\series default
.
If your installation went well this should start MayaVi.
\layout Standard
If you have problems running MayaVi, consult the MayaVi home page and look
at the Installation sections.
You can also ask for help at the mailing list or ask the author.
\layout Subsection
Command line arguments
\layout Standard
\begin_inset LatexCommand \label{command-line-options}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{command-line-options}{}
\end_inset
\layout Subsubsection
Basic options
\layout Standard
\begin_inset LatexCommand \label{basic-options}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{basic-options}{}
\end_inset
This section lists some simple useful command line options
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}-
\backslash
dbz{}display DISPLAY}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Use DISPLAY for the X display.
This option makes sense only when running MayaVi under X.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}g WIDTHxHEIGHT+
\backslash
dbz{}XOFF+
\backslash
dbz{}YOFF}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Set the geometry of the main window when it is launched.
The arguments that can be passed follow the standard X convention and include
the width, height, x offset and y offset of the window.
This option is also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
geometry
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}h}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This prints all the available command line options and exits.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
help
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}V}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This prints the MayaVi version on the command line and exits.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
version
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{filename.
\backslash
dbz{}mv}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This loads a previously saved MayaVi visualization.
\layout Subsubsection
Advanced options
\layout Standard
\begin_inset LatexCommand \label{advanced-options}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{advanced-options}{}
\end_inset
This section lists some advanced command line options.
This section is intended for those who already understand how MayaVi works.
If you are new to MayaVi it is recommended that you read the rest of the
guide and then get back here when you need more advanced command line options.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}d vtk
\backslash
_
\backslash
dbz{}file.
\backslash
dbz{}vtk}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Opens a VTK file (even the new XML format is supported) passed as the argument.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
vtk
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}x plot3d
\backslash
_
\backslash
dbz{}xyz
\backslash
_
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This opens a PLOT3D co-ordinate file passed as the argument.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
plot3d-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
xyz
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}q plot3d
\backslash
_
\backslash
dbz{}q
\backslash
_
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This opens a PLOT3D solution file passed as the argument.
Please note that this option must
\emph on
always
\emph default
follow a -q or --plot3d-xyz option.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
plot3d-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
q
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}e ensight
\backslash
_
\backslash
dbz{}case
\backslash
_
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Opens an EnSight case file passed as the argument.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
ensight
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}m module-
\backslash
dbz{}name}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
The passed module name is loaded in the current ModuleManager.
The module name must be a valid one if not you will get an error message.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
module
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}f filter-
\backslash
dbz{}name}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
The passed filter name is loaded in the current ModuleManager.
The filter name must be a valid one if not you will get an error message.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
filter
\family default
\series default
.
If the filter is the
\family typewriter
\series bold
UserDefined
\family default
\series default
filter then it could be specified as
\family typewriter
\series bold
UserDefined:vtkSomeFilter
\family default
\series default
where
\family typewriter
\series bold
vtkSomeFilter
\family default
\series default
is a valid VTK class.
In this case the filter will not prompt you for the VTK filter to use.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}z saved-
\backslash
dbz{}visualization-
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Loads a previously saved MayaVi visualization file passed as the argument.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
viz
\family default
\series default
and
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
visualization
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}M module-
\backslash
dbz{}manager-
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Loads a module manager saved to a file.
If a file that does not exist is given this will simply create a new module
manager that can be populated with filters and modules.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
module-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
mgr
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}w vrml2-
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Imports a VRML2 scene given an appropriate file.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
vrml
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}3 3DStudio-
\backslash
dbz{}file}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Imports a 3D Studio scene given an appropriate file.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
3ds
\family default
\series default
.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
ttfamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries{{{
\backslash
bfseries{mayavi}} {
\backslash
texttt{{-
\backslash
dbz{}n}}}}}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Creates a new window.
Any options passed after this will apply to this newly created window.
Also available through
\family typewriter
\series bold
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
new-
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
window
\family default
\series default
.
\layout Subsubsection
Examples
\layout Standard
\begin_inset LatexCommand \label{cmd-examples}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{cmd-examples}{}
\end_inset
Here are a few interesting examples.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
This command loads an existing visualization.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
This command loads the
\family typewriter
heart.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
mv
\family default
saved visualization in one window, creates a new window and loads the
\family typewriter
other.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
mv
\family default
in the other.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
> -M new -f Threshold -m IsoSurface
\backslash
\newline
> -n -d examples/heart.vtk -m Outline -m ContourGridPlane
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
This command loads a VTK data file called
\family typewriter
heart.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
vtk
\family default
, loads the
\family typewriter
Axes
\family default
,
\family typewriter
GridPlane
\family default
modules in one
\family typewriter
ModuleManager
\family default
.
Then creates a new
\family typewriter
ModuleManager
\family default
and loads a
\family typewriter
Threshold
\family default
filter and an
\family typewriter
IsoSurface
\family default
module in it.
It then opens a new visualization window, loads the VTK data file,
\family typewriter
heart.
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
vtk
\family default
, the modules
\family typewriter
Outline
\family default
and
\family typewriter
ContourGridPlane
\family default
in it.
\layout Standard
The provided options make it possible to construct very useful visualizations
from the command line.
\layout Subsection
The MayaVi Window
\layout Standard
\begin_inset LatexCommand \label{MayaVi-win}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{MayaVi-win}{}
\end_inset
MayaVi provides an easy to use GUI.
The picture shown below shows the basic GUI that MayaVi provides.
The regions marked out in red are to be noted.
The top left shows a set of menus.
Below the menus is a control panel on the left and the actual visualization
on the right.
At the bottom of the application window is a status bar that turns red
when MayaVi is busy doing something.
In between the status bar and the visualization are provided a set of buttons
that help control the visualization view.
\layout Standard
\begin_inset Float figure
wide false
collapsed false
\layout Standard
\align center
\begin_inset Graphics
filename fig/mayavi_basic_anot.jpg
lyxscale 60
width 70page%
\end_inset
\layout Caption
MayaVi window
\end_inset
\layout Standard
\noindent
Each section of the screen marked and described above provides important
functionality.
\begin_inset LatexCommand \label{id2488890}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2488890}{}
\end_inset
\layout Description
Menu
\begin_deeper
\layout Standard
This provides a set of menus from which provide the user with bulk of the
functionality.
\end_deeper
\layout Description
Visualization
\begin_deeper
\layout Standard
This part of the screen is where the data is visualized using VTK.
\end_deeper
\layout Description
Control\SpecialChar ~
Panel
\begin_deeper
\layout Standard
The control panel allows the user to configure and control the particular
visualization.
It provides various lists for the user's convenience.
These are discussed in detail subsequently.
\end_deeper
\layout Description
Status\SpecialChar ~
Bar
\begin_deeper
\layout Standard
This part of the screen indicates the status of MayaVi to the user.
If MayaVi is busy doing something this part of the screen will turn red
and the cursor will change to a
\emph on
watch
\emph default
indicating that MayaVi is busy.
\end_deeper
\layout Description
View\SpecialChar ~
Modes
\begin_deeper
\layout Standard
These are a set of convenience buttons that help the user quickly see one
particular view of the visualization.
\end_deeper
\layout Standard
The next chapter deals with using MayaVi.
\layout Section
Using MayaVi
\layout Standard
\begin_inset LatexCommand \label{usage}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{usage}{}
\end_inset
This chapter describes in detail the way to use MayaVi for your data visualizati
on.
\layout Subsection
The Basic Design of MayaVi
\layout Standard
\begin_inset LatexCommand \label{design}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{design}{}
\end_inset
It is important to understand the basic design of MayaVi before you use
it.
MayaVi is a data visualizer and the design reflects this.
The basic design is simple and is described in this section.
\layout Subsubsection
The Control Panel
\layout Standard
\begin_inset LatexCommand \label{control-panel}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{control-panel}{}
\end_inset
The control panel needs to be understood before one can do anything serious
with MayaVi.
This section describes the control panel in some detail.
\layout Itemize
Associated with each data file that is to be visualized is an object called
a
\family typewriter
DataVizManager
\family default
.
This object is responsible for the datafile and the entire visualization
associated with that data file.
Each
\family typewriter
DataVizManager
\family default
instance is shown in the first list in the control panel.
\layout Itemize
Each
\family typewriter
DataVizManager
\family default
controls a set of
\family typewriter
ModuleManager
\family default
s.
These
\family typewriter
ModuleManager
\family default
s are listed in the second list from the top.
\layout Itemize
Each
\family typewriter
ModuleManager
\family default
controls set of two legends (one for scalar visualization and one for vector
visualization), a collection of
\family typewriter
Filter
\family default
s and a collection of
\family typewriter
Module
\family default
s.
Any number of Filters and Modules can be used.
\layout Itemize
A
\family typewriter
Filter
\family default
is an object that filters out the data in some way or the other.
A simple example is the
\family typewriter
ExtractVectorNorm
\family default
filter.
This extracts the magnitude of the selected vector data field attribute
for the data file.
All modules that use this as an input will receive the vector magnitude
as the scalar field data.
The filters can be chosen from the
\family sans
\series bold
Visualize
\family default
\series default
menu.
Each
\family typewriter
ModuleManager
\family default
can have as many filters as are required.
When multiple filters are used, it is important to note that each filter
sends its data to the next filter in sequence.
This could be problematic in some situations.
Lets say there is a structured grid object and that needs to be subsampled.
We can use the
\family typewriter
ExtractGrid
\family default
filter and then display a
\family typewriter
GridPlane
\family default
.
Now we want to show contours but this time we want to threshold the contours
based on input scalars so we use the
\family typewriter
Threshold
\family default
filter.
If we put the
\family typewriter
Threshold
\family default
filter in the same ModuleManager, the grid will disappear since the
\family typewriter
Threshold
\family default
output is an unstructured grid.
So to handle this we create a new
\family typewriter
ModuleManager
\family default
(click the
\family sans
\series bold
New
\family default
\series default
button) and add the
\family typewriter
Threshold
\family default
filter in that
\family typewriter
ModuleManager
\family default
.
Put all the modules that use this filter in that
\family typewriter
ModuleManager
\family default
.
\layout Itemize
A
\family typewriter
Module
\family default
is an object that actually visualizes the data.
There are a large number of Modules that can be used and these are also
available from the
\family sans
\series bold
Visualize
\family default
\series default
menu.
Each
\family typewriter
ModuleManager
\family default
can have as many modules as are required.
\layout Standard
\noindent
Although the above sounds complex, it really is not.
It may just take a little getting used to before you are completely comfortable
with it.
The following figure illustrates the above and clarifies matters.
\layout Standard
\begin_inset Float figure
wide false
collapsed false
\layout Standard
\align center
\begin_inset Graphics
filename fig/mayavi_control_panel_anot.jpg
lyxscale 60
width 3in
\end_inset
\layout Caption
MayaVi control panel
\end_inset
\layout Standard
\begin_inset ERT
status Open
\layout Standard
%
\backslash
includegraphics[scale=0.5]{figures/control_panel_anot.jpg}
\end_inset
\layout Standard
If you have multiple
\family typewriter
DataVizManager
\family default
s and want to see the
\family typewriter
ModuleManager
\family default
s of one of them then you either double click on the appropriate manager
or single click on the manager and click on the
\family sans
\series bold
Show Pipeline
\family default
\series default
for the
\family typewriter
DataVizManager
\family default
s and on the
\family sans
\series bold
Show
\family default
\series default
for the
\family typewriter
ModuleManager
\family default
s.
\layout Standard
The other GUI buttons and features are all rather self explanatory.
There are only a few points that need to be made in order to make this
description complete:
\layout Itemize
The creation and deletion of a
\family typewriter
DataVizManager
\family default
is controlled via the
\family sans
\series bold
File
\family default
\series default
menu.
The open menu items will create a new
\family typewriter
DataVizManager
\family default
and the
\family sans
\series bold
Close
\family default
\series default
menu item will close the selected
\family typewriter
DataVizManager
\family default
and all its
\family typewriter
ModuleManager
\family default
s.
The
\family sans
\series bold
Close All
\family default
\series default
menu item will close all the
\family typewriter
DataVizManager
\family default
s.
\layout Itemize
The addition and deletion of
\family typewriter
ModuleManager
\family default
s, can be done using the
\family sans
\series bold
New
\family default
\series default
and
\family sans
\series bold
Delete
\family default
\series default
buttons in the control panel.
\layout Itemize
\family typewriter
Filter
\family default
s and
\family typewriter
Module
\family default
s can be added from the
\family sans
\series bold
Visualize
\family default
\series default
menu and the corresponding
\family sans
\series bold
Filters
\family default
\series default
and
\family sans
\series bold
Modules
\family default
\series default
the sub menus.
They can be deleted from the control panel.
\layout Itemize
\family typewriter
Filter
\family default
s and
\family typewriter
Module
\family default
s can be configured by either double clicking on the corresponding item
or by selecting the item and clicking on the
\family sans
\series bold
configure
\family default
\series default
button.
\layout Subsection
Data formats
\layout Standard
\noindent
\begin_inset LatexCommand \label{data}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{data}{}
\end_inset
MayaVi is a data visualizer and one first needs to have data to visualize
anything.
MayaVi supports the following data formats:
\begin_inset LatexCommand \label{id2489419}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2489419}{}
\end_inset
\layout Description
VTK\SpecialChar ~
data\SpecialChar ~
format\SpecialChar ~
<
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/pdf/file-formats.pdf}{
\backslash
textgreater}
\end_inset
\begin_deeper
\layout Standard
MayaVi supports
\emph on
any
\emph default
VTK dataset using the VTK data format <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/pdf/file-formats.pdf}{
\backslash
textgreater}
\end_inset
.
This includes rectilinear, structured and unstructured grid data and also
polygonal data.
Please refer the linked document for details on the VTK data format.
The new VTK XML data format is also supported by MayaVi.
\end_deeper
\layout Description
PLOT3D\SpecialChar ~
data
\begin_deeper
\layout Standard
MayaVi supports PLOT3D file format with binary structured grid data.
The other PLOT3D datasets will not work due to limitations in VTK's vtkPLOT3DRe
ader.
Simple support for multi-block data is also incorporated.
\end_deeper
\layout Description
EnSight\SpecialChar ~
data
\begin_deeper
\layout Standard
MayaVi supports EnSight data.
EnSight6 and EnSightGold formats are supported.
Only single parts are supported at this time.
\end_deeper
\layout Standard
In addition to this MayaVi allows one to import VRML2 files and 3D Studio
files.
Texturing is not yet supported due to limitations in VTK's vtkVRMLImporter.
\layout Standard
Those interested in converting data arrays under Python into VTK files should
look at Pearu Peterson's pyVTK <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://cens.ioc.ee/projects/pyvtk/}{
\backslash
textgreater}
\end_inset
Python module.
\layout Standard
MayaVi ships with a simple example of a heart CT scan data in the VTK data
format (this should be in the
\family typewriter
examples/
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
\family default
directory).
The dataset used is a structured points dataset with a scalar field.
This can be used as a simple reference.
More VTK, PLOT3D and EnSight data samples should be available from the
VTK download page <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/get-software.php}{
\backslash
textgreater}
\end_inset
.
\layout Subsection
Opening a data file
\layout Standard
\begin_inset LatexCommand \label{open-file}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{open-file}{}
\end_inset
Once data suitable for MayaVi is available one can begin the visualization.
If you don't have data then please note that MayaVi ships with a simple
example of a heart CT scan data in the VTK data format (this should be
in the
\family typewriter
examples/
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
\family default
directory).
The dataset used is a structured points dataset with a scalar field.
More VTK, PLOT3D and EnSight data samples should be available from the
VTK download page <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.vtk.org/get-software.php}{
\backslash
textgreater}
\end_inset
.
\layout Standard
The first thing to do is load an appropriate data file.
Visit the
\family sans
\series bold
File
\family default
\series default
menu and choose the appropriate menu item for the data you have and select
the file you want from the resulting GUI.
Once you do this, you will notice that the control panel will show a
\emph on
DataVizManager
\emph default
at the topmost list and you will see a lot of controls below this.
The
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{control panel}
\end_inset
is described in some detail in
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{this}
\end_inset
section.
If you aren't familiar with that section yet, this might be a good time
to
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{review}
\end_inset
it.
\layout Standard
Once the data file is opened a dialog box will pop up that allows one to
configure the datafile.
One can choose the appropriate data field one is interested in.
This configuration window can be closed when unnecessary.
To reconfigure the data use the
\family sans
\series bold
Configure Data
\family default
\series default
button provided in the
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{control panel}
\end_inset
.
Only one scalar attribute and one vector attribute is supported at a given
time.
Each
\emph on
DataVizManager
\emph default
that is seen represents a different file.
One can open as many data files as one wants.
Different data types can be loaded simultaneously too.
Using a similar procedure one can import a simple VRML2 scene or even a
3D studio file.
To close a VRML or 3D Studio file choose the appropriate file in the
\family sans
\series bold
Close
\family default
\series default
menu.
\layout Standard
MayaVi also supports time series data.
If the file name ends with an integer, MayaVi treats this integer as a
time index.
All files in the same directory as the loaded file are scanned.
If any of them share the same pattern (without the last integer) as the
name of the opened file, then the files are treated as part of the time
series.
These files are then sorted.
The
\family sans
\series bold
Configure Data
\family default
\series default
GUI automatically addes a slider to switch between these time steps and
an auto-sweep button to sweep through the time series.
\layout Standard
Once the data file is read and a
\family typewriter
DataVizManager
\family default
is created an instance of a
\family typewriter
ModuleManager
\family default
is also created.
At this point one has to load the
\family typewriter
Filter
\family default
s and the
\family typewriter
Module
\family default
s in order to do the visualization.
\layout Subsection
Visualizing the Data
\layout Standard
\begin_inset LatexCommand \label{vis}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{vis}{}
\end_inset
Once the data file has been opened and the appropriate field attribute for
both scalars and vectors has been chosen one can either filter the data
or one can directly apply a module to the data and visualize it.
MayaVi provides a large number of Modules and a few Filters.
They are described in more detail subsequently.
\layout Standard
In order to Filter the data one must use the
\family sans
\series bold
Visualize
\family default
\series default
menu and from the
\family sans
\series bold
Filters
\family default
\series default
sub-menu choose the appropriate filter.
As soon as a filter is requested a popup window will appear that helps
you configure the particular filter.
Please note that it is not at all necessary to filter the data.
If no filtering is required one does not need to load any filter.
Even if a filter is used one can delete it at any time using the controls
provided in the
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{control panel}
\end_inset
.
\layout Standard
In order to use a particular visualization module a procedure similar to
the one for Filters is used.
One merely uses the
\family sans
\series bold
Visualize
\family default
\series default
menu and from the
\family sans
\series bold
Modules
\family default
\series default
sub-menu chooses the appropriate Module.
The module might take a little while to load.
If there is some kind of error a warning dialog will attempt to describe
the problem and hopefully the user can correct the situation.
\layout Subsubsection
Navigating the Visualization
\layout Standard
\begin_inset LatexCommand \label{navigation}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{navigation}{}
\end_inset
It is important to be able to navigate the data and view it appropriately.
In MayaVi this is achieved in one of two ways.
Using the standard view mode buttons provided at the bottom of the visualizatio
n widget or by using the mouse to navigate through the visualization.
The mouse based navigation is far more powerful and general purpose.
The buttons however provide quick shortcuts to commonly desired views.
The buttons and the visualization widget are shown in the illustration
in an
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{MayaVi-win}{earlier chapter}
\end_inset
.
\layout Paragraph
Navigating using the mouse
\layout Standard
\noindent
\begin_inset LatexCommand \label{mouse-nav}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{mouse-nav}{}
\end_inset
Mouse navigation is powerful but takes a little getting used to.
It is relatively simple and with experience can be used easily.
This section briefly describes how one can use the mouse to navigate through
the data.
\begin_inset LatexCommand \label{id2489898}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2489898}{}
\end_inset
\layout Description
Rotating\SpecialChar ~
the\SpecialChar ~
visualization
\begin_deeper
\layout Standard
With 3D visualization it is important to be be able to rotate the visualized
scene.
In MayaVi this is achieved by first placing the mouse pointer on top of
the visualization window.
Then one keeps the left mouse button pressed and drags the mouse pointer
in the direction one needs to rotate the scene.
This is very much like rotating an actual object.
\end_deeper
\layout Description
Zooming\SpecialChar ~
in\SpecialChar ~
and\SpecialChar ~
out
\begin_deeper
\layout Standard
To zoom in and out of the scene first one places the mouse pointer inside
the visualization window.
To zoom into the scene one keeps the the right mouse button pressed and
drags the mouse upwards.
To zoom out of the scene one keeps the right mouse button pressed and drags
the mouse downwards.
\end_deeper
\layout Description
Panning\SpecialChar ~
the\SpecialChar ~
scene
\begin_deeper
\layout Standard
To pan a scene implies translating the center of the rendered scene.
In MayaVi this is done in two ways.
\end_deeper
\layout Enumerate
By keeping the left mouse button pressed and simultaneously holding down
the
\series bold
Shift
\series default
key and dragging the mouse in the appropriate direction.
\begin_deeper
\layout Enumerate
By keeping the middle mouse button pressed and dragging the mouse in the
appropriate direction.
\end_deeper
\layout Standard
Just practice this a few times and you should get used to this pretty easily.
This practically covers all that you need to know to be able to use MayaVi
effectively.
The best way to really learn about MayaVi is to explore the various options
and try them out.
Subsequent sections provide more details on the various menu's provided
and the various modules and filters that are available.
\layout Subsection
Picking data
\layout Standard
\noindent
\begin_inset LatexCommand \label{picking}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{picking}{}
\end_inset
MayaVi supports data picking.
While visualizing some data press the
\series bold
p
\series default
or
\series bold
P
\series default
key to pick the data point above the current mouse position.
This will pop up a new window where the picked values will be displayed.
The window also has a few controls that let you configure the type of picking
you wish to perform.
Please note that the picker will pick data on the actors that you have
visualized on screen.
It will attempt to find the nearest actor and pick the data on that.
The picked point will be highlighted using an axes.
The picker supports picking the following:
\begin_inset LatexCommand \label{id2490062}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490062}{}
\end_inset
\layout Description
Picking\SpecialChar ~
the\SpecialChar ~
nearest\SpecialChar ~
point
\begin_deeper
\layout Standard
This option is the default and lets you pick the nearest point in the data.
You could use this if you have data specified as point data.
Note that when you pick using this option the picked location may not be
exactly where you placed the mouse.
The location will snap to the nearest available point.
By changing the tolerance presented in the GUI you can control how near
the point should be to the exact picked position.
\end_deeper
\layout Description
Picking\SpecialChar ~
the\SpecialChar ~
nearest\SpecialChar ~
cell
\begin_deeper
\layout Standard
This option lets you pick the nearest cell in the data.
You could use this if you have data specified as cell data.
By changing the tolerance you can control how closely the picker finds
the nearest cell.
\end_deeper
\layout Description
Picking\SpecialChar ~
an\SpecialChar ~
arbitrary\SpecialChar ~
point
\begin_deeper
\layout Standard
This option lets you pick an arbitrary point in space that is not tied to
the nearest cell or point.
The motion of this picker is much smoother than the point or cell picker.
However, the point that you pick will not be exactly at a point in the
actual data.
The results will therefore be interpolated using a probe filter.
\end_deeper
\layout Subsection
Configuring the lights
\layout Standard
\begin_inset LatexCommand \label{lighting}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{lighting}{}
\end_inset
MayaVi allows you to configure the lighting of the scene using a graphical
utility.
When the mouse is over the visualization frame of the window press the
\series bold
l
\series default
or
\series bold
L
\series default
key to open the light configuration kit.
This will pop up a new window where you can configure as many as eight
different lights.
The default light is to have one light placed as a headlight.
A headlight is a light that points directly ahead in the same direction
as the camera.
It is possible to change the position of the default light.
It is also possible to turn on other lights, configure their elevation
and azimuthal positions using the sliders provided, configure their intensity
and color.
To configure a particular light click on one of the conical glyphs that
indicate a particular light.
The GUI is fairly easy to follow.
Experiment with it to become comfortable with it.
\layout Standard
Note that if you save a visualization your light settings are also saved
and when you reload the visualization these settings are restored.
\layout Subsection
The Menus
\layout Standard
\begin_inset LatexCommand \label{menus}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{menus}{}
\end_inset
This section details the various menus that MayaVi provides.
Almost all the menu items have hot keys associated with them.
The underlined letter indicates the key sequence to be used.
Consider the case of the
\family sans
\series bold
New Window
\family default
\series default
menu item (the letter
\emph on
N
\emph default
is underlined) that is in the
\family sans
\series bold
File
\family default
\series default
menu (the letter
\emph on
F
\emph default
is underlined).
This can be reached by using the following key strokes.
\series bold
Alt-F
\series default
followed by
\series bold
N
\series default
.
The Menu itself requires the
\series bold
Alt
\series default
modifier but the menu item does not.
The following are the various menus that MayaVi provides.
\layout Subsubsection
File Menu
\layout Standard
\noindent
\begin_inset LatexCommand \label{file-menu}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{file-menu}{}
\end_inset
The
\family sans
\series bold
File
\family default
\series default
menu provides the following menu items.
\begin_inset LatexCommand \label{id2490239}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490239}{}
\end_inset
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
New\SpecialChar ~
Window
\begin_deeper
\layout Standard
This creates a new MayaVi visualization window that is completely independent
of the first window.
Any number of such windows can be created.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Open
\begin_deeper
\layout Standard
\noindent
This provides a submenu containing two items.
\begin_inset LatexCommand \label{id2490280}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490280}{}
\end_inset
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
VTK\SpecialChar ~
file
\begin_deeper
\layout Standard
This provides a GUI dialog from which a VTK file can be selected for opening.
Once the file is opened a new
\family typewriter
DataVizManager
\family default
is created and a GUI dialog for configuring the data file is provided.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
VTK\SpecialChar ~
XML\SpecialChar ~
file
\begin_deeper
\layout Standard
This provides a GUI dialog from which a VTK XML file can be chosen.
This is a new VTK format and is only available in VTK versions higher than
4.0.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
PLOT3D\SpecialChar ~
file
\begin_deeper
\layout Standard
This provides a sub menu from which either a PLOT3D file containing single
block or multi-block binary structured grid data can be selected for opening.
Once the file is opened a new
\family typewriter
DataVizManager
\family default
is created and a GUI dialog for configuring the data file is provided.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
EnSight\SpecialChar ~
case\SpecialChar ~
file
\begin_deeper
\layout Standard
This provides a sub menu from which an EnSight case file can be opened.
\end_deeper
\end_deeper
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Import
\begin_deeper
\layout Standard
\noindent
This provides a submenu containing two items.
\begin_inset LatexCommand \label{id2490397}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490397}{}
\end_inset
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
VRML2\SpecialChar ~
scene
\begin_deeper
\layout Standard
This loads a VRML2 scene into the current visualization.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
3D\SpecialChar ~
Studio\SpecialChar ~
scene
\begin_deeper
\layout Standard
This provides a menu containing all the VRML files that are already opened.
The chosen VRML file is closed and the VRML files actors are removed from
the rendered scene.
\end_deeper
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Load
\begin_deeper
\layout Standard
\noindent
This provides a submenu containing three items.
\begin_inset LatexCommand \label{id2490461}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490461}{}
\end_inset
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Visualization
\begin_deeper
\layout Standard
This loads a saved
\emph on
complete
\emph default
visualization.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
ModuleManagers
\begin_deeper
\layout Standard
This creates new
\family typewriter
ModuleManager
\family default
s for the current
\family typewriter
DataVizManager
\family default
and loads
\family typewriter
ModuleManager
\family default
s that have been saved to a file into the newly created ones.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
ModuleManagers\SpecialChar ~
(Append)
\begin_deeper
\layout Standard
This is slightly different from the previous menu item and loads the first
of the saved
\family typewriter
ModuleManager
\family default
s into the current
\family typewriter
ModuleManager
\family default
and for the subsequent saved
\family typewriter
ModuleManager
\family default
s it creates new
\family typewriter
ModuleManager
\family default
s and loads
\family typewriter
ModuleManager
\family default
s from the saved file.
\end_deeper
\end_deeper
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Save
\begin_deeper
\layout Standard
\noindent
This provides a submenu containing four items.
\begin_inset LatexCommand \label{id2490580}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490580}{}
\end_inset
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Entire\SpecialChar ~
Visualization
\begin_deeper
\layout Standard
This saves the
\emph on
entire
\emph default
visualization configuration to a file such that it can be loaded by the
\family sans
\series bold
Load
\family default
\series default
menu's
\family sans
\series bold
Visualization
\family default
\series default
menu item.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Current\SpecialChar ~
DataVizManager
\begin_deeper
\layout Standard
This creates saves the current
\family typewriter
DataVizManager
\family default
to a file.
This can be loaded as a visualization.
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Current\SpecialChar ~
ModuleManager
\begin_deeper
\layout Standard
This enables one to store the currently active
\family typewriter
ModuleManager
\family default
into a file such that it can be loaded later.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
All\SpecialChar ~
ModuleManagers
\begin_deeper
\layout Standard
This enables one to store the all the
\family typewriter
ModuleManager
\family default
s for the currently active
\family typewriter
DataVizManager
\family default
into a file such that it can be loaded later.
\end_deeper
\end_deeper
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Save\SpecialChar ~
Scene\SpecialChar ~
to
\begin_deeper
\layout Standard
Provides a menu which in turn provides menu items to export the visualized
scene to a Post Script file, PPM/BMP/TIFF/JPEG/PNG image, Open Inventor,
Geomview OOGL, VRML and RenderMan RIB files.
It is also possible to save the scene to a vector graphic via GL2PS <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.geuz.org/gl2ps}{
\backslash
textgreater}
\end_inset
.
This is only available if VTK is built with GL2PS support.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Close
\begin_deeper
\layout Standard
Provides submenu's to close the current
\family typewriter
DataVizManager
\family default
.
This means that all the
\family typewriter
ModuleManager
\family default
s of that particular
\family typewriter
DataVizManager
\family default
will also be deleted.
It also provides menus to close the currently active VRML and 3D Studio
scenes that have been imported.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Close\SpecialChar ~
All
\begin_deeper
\layout Standard
Close all the
\family typewriter
DataVizManager
\family default
s and all the imported VRML2 and 3D Studio scenes.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Exit
\begin_deeper
\layout Standard
Close this particular MayaVi Window.
If this is the only MayaVi window the application exits completely.
\end_deeper
\layout Subsubsection
Visualize Menu
\layout Standard
\noindent
\begin_inset LatexCommand \label{viz-menu}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{viz-menu}{}
\end_inset
The
\family sans
\series bold
Visualize
\family default
\series default
menu provides the following menu items.
\begin_inset LatexCommand \label{id2490828}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490828}{}
\end_inset
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Modules
\begin_deeper
\layout Standard
Provides a sub-menu which contains a list of all available
\family typewriter
Module
\family default
s.
This list is dynamically generated based on the available modules.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Filters
\begin_deeper
\layout Standard
Provides a sub-menu which contains a list of all available
\family typewriter
Filter
\family default
s.
This list is dynamically generated based on the available filters.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Pipeline\SpecialChar ~
browser
\begin_deeper
\layout Standard
This creates a GUI that shows the entire VTK visualization pipeline.
The objects in the pipeline can be configured by double clicking on the
items.
If there are a large number of objects this can become confusing to use
and it would be better to use the pipeline segment browser configuration
provided with the configuration for each
\family typewriter
Module
\end_deeper
\layout Subsubsection
Options Menu
\layout Standard
\noindent
\begin_inset LatexCommand \label{options-menu}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{options-menu}{}
\end_inset
The
\family sans
\series bold
Options
\family default
\series default
menu provides the following menu items.
\begin_inset LatexCommand \label{id2490928}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2490928}{}
\end_inset
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Preferences
\begin_deeper
\layout Standard
Provides a GUI using which one can edit the default preferences.
The preferences allow one to set various default settings including foreground
color, background color, default directory where the file related dialogs
will open in initially.
These options can be saved so that the next time MayaVi is started it will
use these defaults.
If you set the default directory to an empty one the directory that the
file open/save dialogs will use will be intelligently chosen.
The stereo rendering option enables stereo rendering in the MayaVi window.
If the save current lighting option is set then the current lighting is
saved as the default and used in all subsequent MayaVi visualizations.
\layout Standard
The search path setting allows the user to specify a list of directories
where user defined sources, modules and filters are made available.
The search path is a ':'-separated string and is specified like the PYTHONPATH.
'~', '~user' and '$VAR' are all expanded.
Each of the directories specified in this string can have a
\family typewriter
Sources/
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
\family default
, a
\family typewriter
Modules/
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
\family default
and a
\family typewriter
Filters/
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
dbz{}
\end_inset
\family default
directory inside where user defined sources, modules and filters can be
stored.
These modules and filters will be made available inside the
\family sans
\series bold
User
\family default
\series default
sub-menu of the
\family sans
\series bold
File/Open
\family default
\series default
,
\family sans
\series bold
Module
\family default
\series default
and
\family sans
\series bold
Filter
\family default
\series default
menus respectively.
These sources, modules and filters can be used from the command line or
from a Python interpreter session by using 'User.SourceName' (sources cannot
be specified from the command line), 'User.ModuleName' or 'User.FilterName'.
When creating user defined sources or modules or filters make sure that
the name of the module is the same as the name of the class that defines
the particular object.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Configure\SpecialChar ~
RenderWindow
\begin_deeper
\layout Standard
Provides a simple GUI to configure the Visualization RenderWindow.
This is also where one can change the stereo rendering options.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Change\SpecialChar ~
Foreground
\begin_deeper
\layout Standard
Allows one to change the default foreground color.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Change\SpecialChar ~
Background
\begin_deeper
\layout Standard
Allows one to change the default background color.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Show\SpecialChar ~
Debug\SpecialChar ~
window
\begin_deeper
\layout Standard
Pops up a small window where debug messages are printed.
This is very useful if you run into trouble and want to know what happened.
It also shows the function call sequence.
The messages are also printed to stderr.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Show\SpecialChar ~
Control\SpecialChar ~
Panel
\begin_deeper
\layout Standard
Toggles the visibility of the
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{control-panel}{control panel}
\end_inset
.
This can be very useful when you want to do a full screen visualization.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Reload\SpecialChar ~
Modules
\begin_deeper
\layout Standard
This function reloads all the currently loaded Python modules.
This is
\emph on
very
\emph default
useful while debugging a new feature for some module that one is creating.
One may also see funny behavior for already instantiated objects.
\end_deeper
\layout Subsubsection
Help Menu
\layout Standard
\noindent
\begin_inset LatexCommand \label{help-menu}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{help-menu}{}
\end_inset
The
\family sans
\series bold
Help
\family default
\series default
menu provides the following menu items.
\begin_inset LatexCommand \label{id2491186}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2491186}{}
\end_inset
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
About
\begin_deeper
\layout Standard
Displays a few details about MayaVi.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Users\SpecialChar ~
Guide
\begin_deeper
\layout Standard
Opens a web browser and displays this MayaVi users guide.
\end_deeper
\layout Description
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sffamily
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
bfseries
\end_inset
Home\SpecialChar ~
page
\begin_deeper
\layout Standard
Opens a web browser and displays the MayaVi home page.
\end_deeper
\layout Subsection
Module Documentation
\layout Standard
\noindent
\begin_inset LatexCommand \label{module-docs}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{module-docs}{}
\end_inset
The following are the list of provided Modules along with a brief description.
\begin_inset LatexCommand \label{id2491259}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2491259}{}
\end_inset
\layout Description
Axes
\begin_deeper
\layout Standard
This module creates and manages a set of three axes for your data.
The class uses a vtkCubeAxesActor2D.
\end_deeper
\layout Description
BandedSurfaceMap
\begin_deeper
\layout Standard
Displays a surface map with special contouring using the vtkBandedPolyDataContou
rFilter.
This contour filter produces filled contours of the same color between
two contour lines rather than either a continuous color distribution or
just individual contour lines.
It should work for any input dataset.
It is best used for 2d surfaces.
Note that one can either specify a total number of contours between the
minimum and maximum values by entering a single integer or specify the
individual contours by specifying a Python list/tuple in the GUI.
\end_deeper
\layout Description
ContourGridPlane
\begin_deeper
\layout Standard
This module shows a grid plane of the given input structured, rectilinear
or structured points grid with the scalar data either as a color map or
as contour lines.
This works only for structured grid, structured point and rectilinear grid
data.
Note that one can either specify a total number of contours between the
minimum and maximum values by entering a single integer or specify the
individual contours by specifying a Python list/tuple in the GUI.
\end_deeper
\layout Description
CustomGridPlane
\begin_deeper
\layout Standard
This module shows a grid plane of the given input grid.
The plane can be shown as a wireframe or coloured surface with or without
scalar visibility and contour lines.
The module basically wraps around the vtk*GeometryFilters.
This module enables one to completely configure the grid plane.
It works only for structured grid, structured point and rectilinear grid
datasets.
Note that one can either specify a total number of contours between the
minimum and maximum values by entering a single integer or specify the
individual contours by specifying a Python list/tuple in the GUI.
\end_deeper
\layout Description
Glyph
\begin_deeper
\layout Standard
This module displays glyphs scaled and colored as per the input data.
This will work for any dataset and can be used for both scalar and vector
data.
\end_deeper
\layout Description
GridPlane
\begin_deeper
\layout Standard
This module shows a grid plane of the given input grid.
The plane can be shown as a wireframe or coloured surface with or without
scalar visibility.
This works only for structured grid, structured point and rectilinear grid
data.
Useful for debugging and displaying your created grid.
\end_deeper
\layout Description
HedgeHog
\begin_deeper
\layout Standard
This module shows the given vector data as a 'hedge hog' plot.
The lines can be colored based on the input scalar data.
This class should work with any dataset.
\end_deeper
\layout Description
IsoSurface
\begin_deeper
\layout Standard
This module shows an iso-surface of scalar data.
This will work for any dataset.
\end_deeper
\layout Description
Labels
\begin_deeper
\layout Standard
Displays text labels of input data.
When instantiated, the class can be given a module name (the same name
as listed in the Modules GUI) or an index of the module (starting from
0) in the current module manager.
If this is not provided the module will ask the user to choose a particular
module or choose filtered data.
The module will then generate text lables for the data in the chosen module
and display it.
The module provides many configuration options.
It also lets one turn on and off the use of a vtkSelectVisiblePoints filter.
Using this filter will cause the module to only display visible points.
Note that if the module that is being labeled has changed significantly
or is deleted this Labels module will have to be updated by changing one
of the settings (like the RandomModeOn check button) to a different value
and then back to the original one.
Alternatively, choose the module to be labeled again.
\end_deeper
\layout Description
Locator
\begin_deeper
\layout Standard
This module creates a 'Locator' axis, that can be used to mark a three dimension
al point in your data.
\end_deeper
\layout Description
Outline
\begin_deeper
\layout Standard
Displays an Outline for any data input.
\end_deeper
\layout Description
PolyData
\begin_deeper
\layout Standard
Displays any input polydata, nothing fancy.
\end_deeper
\layout Description
ScalarCutPlane
\begin_deeper
\layout Standard
This module plots scalar data on a cut plane either as a color map or with
contour lines.
This will work for any dataset.
Note that one can either specify a total number of contours between the
minimum and maximum values by entering a single integer or specify the
individual contours by specifying a Python list/tuple in the GUI.
\end_deeper
\layout Description
Streamlines
\begin_deeper
\layout Standard
This module makes it possible to view streamlines, streamtubes, and stream
ribbons for any type of vector data.
Any number of point sources can be added and deleted.
A fairly powerful UI is provided.
This module should work with any dataset.
\end_deeper
\layout Description
StructuredGridOutline
\begin_deeper
\layout Standard
Displays an Outline for a structured grid.
\end_deeper
\layout Description
SurfaceMap
\begin_deeper
\layout Standard
Displays a surface map of any data.
It should work for any dataset but is best if used for 2d surfaces (polydata
and unstructured surfaces).
Note that one can either specify a total number of contours between the
minimum and maximum values by entering a single integer or specify the
individual contours by specifying a Python list/tuple in the GUI.
\end_deeper
\layout Description
TensorGlyphs
\begin_deeper
\layout Standard
This module displays glyphs, scaled and colored as per the tensor data.
This will work for any dataset.
\end_deeper
\layout Description
Text
\begin_deeper
\layout Standard
Displays simple text on the screen.
The text properties and position are configurable.
The text can also be multi-line if newlines are embedded in it.
\end_deeper
\layout Description
VectorCutPlane
\begin_deeper
\layout Standard
This module displays cone glyphs scaled and colored as per the vector or
scalar data on cut plane.
This will work for any dataset.
\end_deeper
\layout Description
VelocityVector
\begin_deeper
\layout Standard
This module displays cone or arrow glyphs scaled and colored as per the
vector data.
This will work for any dataset.
\end_deeper
\layout Description
Volume
\begin_deeper
\layout Standard
This Volume module allows one to view a structured points dataset with either
unsigned char or short data as a volume.
The module also provides a powerful GUI to edit the Color Transfer Function
(CTF).
You can drag the mouse with different buttons to change the colors.
The following are the mouse buttons and key combinations that can be used
to edit the CTF -- red curve: Button-1, green curve: Button-2/Control-Button-1,
blue curve: Button-3/Control-Button-2, alpha/opacity: Shift-Button-1.
It is possible to use either the vtkVolumeRayCastMapper or the vtkVolumeTexture
Mapper2D.
It is also possible to choose among various ray cast functions.
\end_deeper
\layout Description
WarpVectorCutPlane
\begin_deeper
\layout Standard
This module takes a cut plane and warps it using a vtkWarpVector as per
the vector times a scale factor.
This will work for any dataset.
\end_deeper
\layout Subsection
Filter Documentation
\layout Standard
\noindent
\begin_inset LatexCommand \label{filter-docs}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{filter-docs}{}
\end_inset
The following are the list of provided Filters along with a brief description.
\begin_inset LatexCommand \label{id2492266}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{id2492266}{}
\end_inset
\layout Description
CellToPointData
\begin_deeper
\layout Standard
This class produces PointData given an input that contains CellData.
This is useful because many of VTK's algorithms work best with PointData.
The filter basically wraps the vtkCellDataToPointData class.
\end_deeper
\layout Description
CutPlane
\begin_deeper
\layout Standard
This filter takes a cut plane of any given input data set.
It interpolates the attributes onto a plane.
The position and orientation of the plane are configurable using a GUI.
\end_deeper
\layout Description
Delaunay2D
\begin_deeper
\layout Standard
This filter wraps around the vtkDelaunay2D filter and lets you do 2D triangulati
on of a collection of points.
The key parameters are Tolerance and the Alpha value.
Tolerance gives the criteria for joining neighbouring data points and alpha
is the threshold for the circumference of a caluculated triangulated polygon.
\end_deeper
\layout Description
Delaunay3D
\begin_deeper
\layout Standard
This filter wraps around the vtkDelaunay3D filter and lets you do 3D triangulati
on of a collection of points.
The key parameters are Tolerance and the Alpha value.
Tolerance gives the criteria for joining neighbouring data points and alpha
is the threshold for the circumference of a caluculated triangulated polygon.
\end_deeper
\layout Description
ExtractGrid
\begin_deeper
\layout Standard
Wraps vtkExtractGrid (structured grid), vtkExtractVOI (imagedata/structured
points) and vtkExtractRectilinearGrid (rectilinear grids).
These filters enable one to select a portion of, or subsample an input
dataset.
Depending on the input data the appropriate filter is used.
\end_deeper
\layout Description
ExtractTensorComponents
\begin_deeper
\layout Standard
This wraps the vtkExtractTensorComponents filter and allows one to select
any of the nine components or the effective stress or the determinant from
an input tensor data set.
This will work for any dataset.
\end_deeper
\layout Description
ExtractUnstructuredGrid
\begin_deeper
\layout Standard
This wraps the vtkExtractUnstructuredGrid filter.
From the VTK docs: vtkExtractUnstructuredGrid is a general-purpose filter
to extract geometry (and associated data) from an unstructured grid dataset.
The extraction process is controlled by specifying a range of point ids,
cell ids, or a bounding box (referred to as 'Extent').
Those cells lying within these regions are sent to the output.
The user has the choice of merging coincident points (Merging is on) or
using the original point set (Merging is off).
\end_deeper
\layout Description
ExtractVectorComponents
\begin_deeper
\layout Standard
This wraps the vtkExtractVectorComponents filter and allows one to select
any of the three components of an input vector data attribute.
\end_deeper
\layout Description
ExtractVectorNorm
\begin_deeper
\layout Standard
This wraps the vtkVectorNorm filter and produces an output scalar data with
the magnitude of the vector.
\end_deeper
\layout Description
MaskPoints
\begin_deeper
\layout Standard
This wraps the vtkMaskPoints filter.
The problem with this filter is that its output is Polygonal data.
This means that if you add this filter to a ModuleManager with visualizations
apart from HedgeHog or other velocity vector data you won't see anything!
If that happens create another ModuleManager and show the other visualizations
there.
Also, this means that this filter should be typically inserted at the end
of the list of filters.
\end_deeper
\layout Description
PolyDataNormals
\begin_deeper
\layout Standard
This wraps the vtkPolyDataNormals filter.
vtkPolyDataNormals is a filter that computes point normals for a polygonal
mesh.
This filter tries its best to massage the input data to a suitable form.
Its output is a vtkPolyData object.
Computing the normals is very useful when one wants a smoother looking
surface.
\end_deeper
\layout Description
StructuredPointsProbe
\begin_deeper
\layout Standard
A useful filter that can be used to probe any dataset using a Structured
Points dataset.
The filter also allows one to convert the scalar data to an unsigned short
array so that the scalars can be used for volume visualization.
\end_deeper
\layout Description
Threshold
\begin_deeper
\layout Standard
This wraps the vtkThreshold filter.
The problem with this filter is that its output is an Unstructured Grid.
This means that if you add this filter to a ModuleManager of a gridded
dataset and you have a few grid planes, then your grid planes won't show
anymore.
If that happens create another ModuleManager and show the grid planes there
acting on unfiltered data.
\end_deeper
\layout Description
UserDefined
\begin_deeper
\layout Standard
This filter wraps around a user specified filter and lets one experiment
with VTK filters that are not yet part of MayaVi.
By default if the class is instantiated it will ask the user for the VTK
class to wrap around.
If passed a valid VTK class name it will try to use that particular class.
\end_deeper
\layout Description
WarpScalar
\begin_deeper
\layout Standard
This wraps the vtkWarpScalar filter.
vtkWarpScalar is a filter that modifies point coordinates by moving points
along point normals by the scalar amount times the scale factor.
Useful for creating carpet or x-y-z plots.
\end_deeper
\layout Description
WarpVector
\begin_deeper
\layout Standard
Warps the geometry using the vtkWarpVector filter.
vtkWarpVector is a filter that modifies point coordinates by moving points
along vector times the scale factor.
Useful for showing flow profiles or mechanical deformation.
\end_deeper
\layout Section
Using MayaVi from Python
\layout Standard
\begin_inset LatexCommand \label{python-module}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{python-module}{}
\end_inset
If you have installed MayaVi from the sources and are not using a binary
release, then you can use MayaVi as a Python module.
This chapter details how you can use MayaVi as a Python module.
If you are looking for a powerful, interactive, cross-platform Python interpret
er you might be interested in IPython.
<
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://ipython.scipy.org}{
\backslash
textgreater}
\end_inset
\layout Subsection
An example
\layout Standard
\begin_inset LatexCommand \label{interpreter-example}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{interpreter-example}{}
\end_inset
Its very easy using MayaVi as a Python module.
Thanks to Tkinter, it is also possible to use MayaVi from the Python interprete
r.
This means that one can script MayaVi! This is a pretty powerful and useful
feature.
To illustrate using MayaVi as a module and its scriptability, we will consider
a few simple examples where the user generates some data and a VTK file
and then uses MayaVi to visualize the data.
\layout Subsubsection
Generating some data
\layout Standard
\begin_inset LatexCommand \label{generate-data}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{generate-data}{}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> # generate the data.
\newline
>>> from Numeric import *
\newline
>>> import scipy
\newline
>>> x = (arange(50.0)-25)/2.0
\newline
>>> y = (arange(50.0)-25)/2.0
\newline
>>> r = sqrt(x[:,NewAxis]**2+y**2)
\newline
>>> z = 5.0*scipy.special.j0(r) # Bessel function of order 0
\newline
>>> # now dump the data to a VTK file.
\newline
>>> import pyvtk
\newline
>>> # Flatten the 2D array data as per VTK's requirements.
\newline
>>> z1 = reshape(transpose(z), (-1,))
\newline
>>> point_data = pyvtk.PointData(pyvtk.Scalars(z1))
\newline
>>> grid = pyvtk.StructuredPoints((50,50, 1), (-12.5, -12.5, 0), (0.5, 0.5, 1))
\newline
>>> data = pyvtk.VtkData(grid, point_data)
\newline
>>> data.tofile('/tmp/test.vtk')
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
The above example uses the Numeric <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://numpy.sourceforge.net}{
\backslash
textgreater}
\end_inset
, SciPy <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://www.scipy.org}{
\backslash
textgreater}
\end_inset
and pyVtk <
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
url{http://cens.ioc.ee/projects/pyvtk/}{
\backslash
textgreater}
\end_inset
modules.
Please note the step where
\family typewriter
z1
\family default
is obtained from
\family typewriter
z
\family default
.
This step is done to correctly flatten the two dimensional array
\family typewriter
z
\family default
.
The problem with Numeric arrays and VTK data is that you have to be careful
of the order of the data points.
The way VTK reads data (for all the data formats that have a structure)
is something like this:
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> for k in range(n_z):
\newline
>>> for j in range(n_y):
\newline
>>> for i in range(n_x):
\newline
>>> read_line()
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
This means that the x values must be iterated over first, the y values next
and the z values last.
If you simply flatten the 2D numeric array then this will not happen properly.
By using
\family typewriter
reshape(transpose(z), (-1,))
\family default
we ensure that the data points are specified in the correct order.
The next step is to visualize the generated data.
\layout Subsubsection
Visualize the generated data
\layout Standard
\begin_inset LatexCommand \label{viz-data}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{viz-data}{}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> import mayavi
\newline
>>> v = mayavi.mayavi() # create a MayaVi window.
\newline
>>> d = v.open_vtk('/tmp/test.vtk', config=0) # open the data file.
\newline
>>> # The config option turns on/off showing a GUI control for the data/filter/module.
\newline
>>> # load the filters.
\newline
>>> f = v.load_filter('WarpScalar', config=0)
\newline
>>> n = v.load_filter('PolyDataNormals', 0)
\newline
>>> n.fil.SetFeatureAngle (45) # configure the normals.
\newline
>>> # Load the necessary modules.
\newline
>>> m = v.load_module('SurfaceMap', 0)
\newline
>>> a = v.load_module('Axes', 0)
\newline
>>> a.axes.SetCornerOffset(0.0) # configure the axes module.
\newline
>>> o = v.load_module('Outline', 0)
\newline
>>> v.Render() # Re-render the scene.
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
\begin_inset Float figure
wide false
collapsed false
\layout Standard
\align center
\begin_inset Graphics
filename fig/mayavi_cmd_line_sc_shot.jpg
lyxscale 60
width 70page%
\end_inset
\layout Caption
Surface plot
\end_inset
\layout Standard
The result of this is seen in the above figure.
It is important to note that the Python interpreter will continue to remain
interactive when MayaVi is running.
In fact, it is possible to create an animation from the interpreter as
done in the following.
\layout Standard
\begin_inset ERT
status Open
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> # now do some animation.
\newline
>>> import time
\newline
>>> for i in range (0, 10):
\newline
... f.fil.SetScaleFactor(i*0.1)
\newline
... v.Render()
\newline
... v.renwin.save_png('/tmp/anim...')
\layout Standard
... time.sleep(1)
\newline
>>>
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
The above example saves the screen each iteration to a PNG image.
One will need VTK 4.0 for PNG support.
These images can be later used by some other utility to create a movie.
It is therefore possible to create very useful visualizations from within
the Python interpreter.
\layout Subsubsection
Using VTK data objects
\layout Standard
\begin_inset LatexCommand \label{using-vtkdata}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{using-vtkdata}{}
\end_inset
There are times when the user has created a VTK data object that needs to
be visualized.
MayaVi has a special data handler for such cases.
The following shows how this can be used.
The example itself uses a VTK file but the data could have also been generated
using other means.
\layout Standard
\begin_inset ERT
status Open
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> # import VTK
\newline
>>> import vtkpython
\newline
>>> # create some data.
\newline
>>> reader = vtkpython.vtkStructuredPointsReader()
\newline
>>> reader.SetFileName('/tmp/test.vtk')
\newline
>>> reader.Update()
\newline
>>> data = reader.GetOutput() # this is a vtkStructuredPoints object.
\newline
>>> import mayavi
\newline
>>> v = mayavi.mayavi() # create a MayaVi window
\newline
>>> v.open_vtk_data(data) # load the data from the vtkStructuredPoints object.
\newline
>>> f = v.load_filter('WarpScalar', 0)
\newline
>>> # Load other filters and modules...
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
The above example uses a
\family typewriter
vtkStructuredPoints
\family default
as the input.
Other types can also be used as the input.
The other valid types are:
\family typewriter
vtkRectilinearGrid
\family default
,
\family typewriter
vtkStructuredGrid
\family default
,
\family typewriter
vtkUnstructuredGrid
\family default
and
\family typewriter
vtkPolyData
\family default
.
Any of these objects can be used as an input and then visualized using
MayaVi.
\layout Standard
Right now the best way to find out what functions are available etc.
would be to read the sources or use pydoc to browse through the code.
Experimenting with MayaVi from the interpreter is also a good idea and
will be highly educative.
\layout Subsubsection
Standalone MayaVi scripts
\layout Standard
\begin_inset LatexCommand \label{standalone-scripts}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{standalone-scripts}{}
\end_inset
After interactively exploring MayaVi from the interpreter one usually would
like to run these in a non-interactive fashion.
That is you'd like to create a Python script that invokes MayaVi.
The easiest way to do it is as shown in the following simple example
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
import mayavi
\newline
v = mayavi.mayavi()
\newline
v.load_visualization('heart.mv')
\newline
# Do whatever you please with the MayaVi window.
\newline
\newline
# To make the MayaVi window interact with the user and wait
\newline
# till it is closed to proceed, do the following:
\newline
v.master.wait_window()
\newline
\newline
# Now once the previous window is closed if you need
\newline
# to open another do this:
\newline
v = mayavi.mayavi()
\newline
d = v.open_vtk('file.vtk')
\newline
# etc.
\newline
v.master.wait_window()
\newline
\newline
# Once the MayaVi window is closed the program will exit.
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
As can be seen above, it is easy to use code from an interactive session
in a standalone Python script.
It is also possible to script MayaVi in the following manner.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
import Tkinter
\newline
r = Tkinter.Tk()
\newline
r.withdraw()
\newline
import mayavi
\newline
v = mayavi.Main.MayaViTkGUI(r)
\newline
v.load_visualization('heart.mv')
\newline
# Do whatever you please with the MayaVi window.
\newline
\newline
# now do this to start the Tk event loop.
\newline
root.mainloop()
\newline
# Once the MayaVi window is closed the program will exit.
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
This is an alternative way to do use MayaVi from Python scripts.
This might be helpful if you have used
\family typewriter
Tkinter
\family default
and know how to use it.
However, the first approach is a lot easier.
\layout Subsection
Useful Python Modules
\layout Standard
\begin_inset LatexCommand \label{util-modules}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{util-modules}{}
\end_inset
This section describes some other useful modules that are released as part
of MayaVi but are not necessarily part of the core MayaVi module/application.
The module
\family typewriter
ivtk
\family default
is described in the next section.
The MayaVi package also contains a sub-package called
\family typewriter
tools
\family default
.
This directory contains miscellaneous but useful tools that use or are
related to MayaVi.
This is described subsequently.
\layout Subsection
The Interactive VTK module
\layout Standard
\begin_inset LatexCommand \label{ivtk}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{ivtk}{}
\end_inset
It is very nice to be able to use and experiment with VTK from the Python
interpreter.
In order to make this easier I've written a simple module that uses some
of the MayaVi classes.
This makes using VTK from Python very pleasant.
The module is called
\family typewriter
ivtk
\family default
which stands for interactive VTK.
\family typewriter
ivtk
\family default
provides the following features.
\layout Itemize
An easy to use VTK actor viewer that has menus to save the scene, change
background, show a help browser, show a pipeline browser etc.
\layout Itemize
A simple class documentation search tool/browser that lets you search for
arbitrary strings in the VTK class documentation and lets you browse the
VTK class documentation.
\layout Itemize
An easy to use GUI to configure VTK objects using the
\family typewriter
vtkPipeline.ConfigVtkObj
\family default
module.
\layout Itemize
An integrated picker that can be activated by pressing the
\series bold
p
\series default
or
\series bold
P
\series default
keys.
This picker functions the same way as the
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{picking}{MayaVi picker}
\end_inset
.
\layout Itemize
An integrated light configuration kit that can be activated by pressing
the
\series bold
l
\series default
or
\series bold
L
\series default
keys.
This light configuration functions the same way as the
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hyperlink{lighting}{MayaVi light kit}
\end_inset
.
\layout Standard
\noindent
The help browser allows one to search for arbitrary strings in the VTK class
documentation.
'and' and 'or' keywords are supported and this makes searching for specific
things easier.
If a search is successful a list of matching classes is returned.
Clicking on a class will pop up a window with the particular class documentatio
n.
It is also possible to search for a particular class name.
All classes matching the searched name will be shown.
The searching is case insensitive.
\layout Standard
Here is a sample session that illustrates how
\family typewriter
ivtk
\family default
can be used.
A simple cone example is shown.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> from mayavi import ivtk
\newline
>>> from vtkpython import *
\newline
>>> c = vtkConeSource()
\newline
>>> m = vtkPolyDataMapper()
\newline
>>> m.SetInput(c.GetOutput())
\newline
>>> a = vtkActor()
\newline
>>> a.SetMapper(m)
\newline
>>> v = ivtk.create_viewer() # or ivtk.viewer()
\newline
# this creates the easy to use render window that can be used from
\newline
# the interpreter. It has several useful menus.
\newline
\newline
>>> v.AddActors(a) # add actor(s) to viewer
\newline
>>> v.config(c) # pops up a GUI configuration for object.
\newline
>>> v.doc(c) # pops up class documentation for object.
\newline
>>> v.help_browser() # pops up a help browser where you can search!
\newline
>>> v.RemoveActors(a) # remove actor(s) from viewer.
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
The
\family typewriter
AddActors/RemoveActors
\family default
method can be passed a list/tuple or a single actor.
All of the passed actors will be added/removed to the
\family typewriter
vtkRenderWindow
\family default
.
The
\family typewriter
config
\family default
method provides an easy to use GUI to configure the passed VTK object.
The viewer also provides menus to save the rendered scene and also provides
a menu to open a VTK Pipeline browser that can be used to browse the VTK
pipeline and configure objects in it.
\layout Standard
Even without creating the actor viewer it is possible to use the help browser
and the configure code as shown below.
\layout Standard
\begin_inset ERT
status Open
\layout Standard
\backslash
begin{verbatim}
\newline
\newline
>>> from mayavi import ivtk
\newline
>>> d = ivtk.doc_browser()
\newline
# pops up a standalone searcheable VTK class help browser.
\newline
>>> from vtkpython import *
\newline
>>> c = vtkConeSource()
\newline
>>> ivtk.doc(c) # pops up class documentation for c
\newline
>>> ivtk.doc('vtkObject') # class documentation for vtkObject.
\newline
>>> ivtk.config(c) # configure object with GUI.
\newline
\newline
\backslash
end{verbatim}
\end_inset
\layout Standard
The module is fairly well documented and one should look at the module for
more information.
However, the above information should suffice if one wants to start using
the module.
\layout Subsubsection
The MayaVi
\family typewriter
tools
\family default
sub-package
\layout Standard
\begin_inset LatexCommand \label{tools}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{tools}{}
\end_inset
MayaVi has a
\family typewriter
tools
\family default
sub-package that contains useful modules that use or are related to MayaVi.
The following modules are present currently.
\layout Paragraph
The
\family typewriter
imv
\family default
package
\layout Standard
\begin_inset LatexCommand \label{imv}
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
hypertarget{imv}{}
\end_inset
The
\family typewriter
imv
\family default
module provides Matlab-like one liners that make it easy to visualize data
from the Python interpreter.
It currently provides three useful functions.
These are partially described below.
A simple example is also provided below that.
The
\family typewriter
imv
\family default
module is well documented so please read the documentation strings in the
module for more details.
\layout Description
\family typewriter
surf(x,\SpecialChar ~
y,\SpecialChar ~
f)
\family default
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
This samples the function or 2D array
\family typewriter
\shape italic
f
\family default
\shape default
along
\family typewriter
\shape italic
x
\family default
\shape default
and
\family typewriter
\shape italic
y
\family default
\shape default
and plots a 3D surface.
\layout Description
\family typewriter
view(arr)
\family default
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Views 2D arrays as a structured points dataset.
The view is set to the way we usually think of matrices with (0,0) at the
top left of the screen.
\layout Description
\family typewriter
viewi(arr)
\family default
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Views 2D arrays as a structured points dataset.
The data is viewed as an image.
This function is meant to be used with large arrays.
For smaller arrays one should use the more powerful
\family typewriter
view()
\family default
function.
The implementation of this function is a bit of a hack and many of MayaVi's
features cannot be used.
For instance you cannot change the lookup table color and expect the color
of the image to change.
\layout Description
\family typewriter
sampler(xa,\SpecialChar ~
ya,\SpecialChar ~
func)
\family default
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
null{}
\end_inset
Samples a function (
\family typewriter
func
\family default
) at an array of ordered points (with equal spacing) and returns an array
of scalars as per VTK's requirements for a structured points data set,
i.e.
x varying fastest and y varying next.
\layout Standard
\noindent
Here is a simple example of what can be done with the
\family typewriter
imv
\family default
module.
\layout LyX-Code
>>> from Numeric import *
\newline
>>> from mayavi.tools import imv
\newline
\newline
>>> # surf example.
\newline
>>> def f(x, y):
\newline
...
return sin(x*y)/(x*y)
\newline
>>> x = arange(-5., 5.05, 0.05)
\newline
>>> y = arange(-5., 5.05, 0.05)
\newline
>>> v = imv.surf(x, y, f)
\newline
\newline
>>> # view/viewi example.
\newline
>>> z1 = fromfunction(lambda i,j:i+j, (128,256))
\newline
>>> v1 = imv.view(z1)
\newline
\newline
>>> z2 = fromfunction(lambda i,j:i+j, (512, 512))
\newline
>>> v2 = imv.viewi(z2)
\layout Section
Scripted examples
\layout Standard
Load John's dataset, make a mayavi script out of his vtk one
\layout Standard
volumetric rendering
\layout Standard
time animation
\layout Standard
slicing a 4d dataset
\the_end