<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Using the Mayavi application — Mayavi2 v2.2.0 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '2.2.0', COLLAPSE_MODINDEX: false, }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/interface.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="contents" title="Global table of contents" href="contents.html" /> <link rel="index" title="Global index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="top" title="Mayavi2 v2.2.0 documentation" href="index.html" /> <link rel="next" title="Simple Scripting with mlab" href="mlab.html" /> <link rel="prev" title="Learning Mayavi by example" href="examples.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li> <li class="right" > <a href="mlab.html" title="Simple Scripting with mlab" accesskey="N">next</a> |</li> <li class="right" > <a href="examples.html" title="Learning Mayavi by example" accesskey="P">previous</a> |</li> <li><a href="index.html">Mayavi2 v2.2.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section"> <h1 id="id1"><span id="using-the-mayavi-application"></span>Using the Mayavi application<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1> <p>This chapter primarily concerns using the <tt class="docutils literal"><span class="pre">mayavi2</span></tt> application. Some of the things mentioned here also apply when mayavi is scripted. We recommend that new users read this chapter before going to the more advanced ones.</p> <div class="section"> <h2 id="id2"><span id="general-layout-of-ui"></span>General layout of UI<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2> <p>When the <cite>mayavi2</cite> application is started it will provide a user interface that looks something like the figure shown below.</p> <img alt="Figure of Mayavi's initial UI window." src="_images/mayavi_ui_first.png" /> <p><em>Figure of Mayavi’s initial UI window.</em></p> <p>The UI features several sections described below.</p> <blockquote> <dl class="docutils"> <dt>Menus</dt> <dd>The menus let you open files, load modules, set preferences etc.</dd> <dt>The Mayavi engine tree view</dt> <dd><dl class="first last docutils"> <dt>This is a tree view of the mayavi pipeline.</dt> <dd><ul class="first last simple"> <li>Right click a tree node to rename, delete, copy the objects.</li> <li>Left click on a node to edit its properties on the object editor below the tree.</li> <li>It is possible to drag the nodes around on the tree. For example it is possible to drag and move a module from one set of Modules to another, or to move a visualization from one scene to another.</li> </ul> </dd> </dl> </dd> <dt>The object editor</dt> <dd>This is where the properties of mayavi pipeline objects can be changed when an object on the engine’s pipeline is clicked.</dd> <dt>TVTK scenes</dt> <dd>This is where the visualization of the data happens. One can interact with this scene via the mouse and the keyboard. More details are in the following sections.</dd> <dt>Python interpreter</dt> <dd>The built-in Python interpreter that can be used to script mayavi and do other things. You can drag nodes from the mayavi tree and drop them on the interpreter and then script the object represented by the node!</dd> <dt>Logger</dt> <dd>Application log messages may be seen here.</dd> </dl> </blockquote> <p>Mayavi’s UI layout is highly configurable:</p> <blockquote> <ul class="simple"> <li>the line in-between the sections can be dragged to resize particular views.</li> <li>most of the “tabs” on the widgets can be dragged around to move them anywhere in the application.</li> <li>Each view area (the mayavi engine view, object editor, python shell and logger) can all be disabled and enabled at will using the <cite>View</cite> menu by toggling the views on and off.</li> </ul> </blockquote> <p>Each time you change the appearance of mayavi it is saved and the next time you start up the application it will have the same configuration. In addition, you can save different layouts into different “perspectives” using the <cite>View->Perspectives</cite> menu item.</p> <p>Shown below is a specifically configured mayavi user interface view. In this view the size of the various parts are changed. The Python shell is activated by default.</p> <img alt="Figure of Mayavi's UI after being configured by a user." src="_images/mayavi_ui_second.png" /> <p><em>Figure of Mayavi’s UI after being configured by a user.</em></p> </div> <div class="section"> <h2 id="visualizing-data">Visualizing data<a class="headerlink" href="#visualizing-data" title="Permalink to this headline">¶</a></h2> <p>Mayavi modules can be used to visualize the data as described in the <a class="reference" href="overview.html#an-overview-of-mayavi"><em>An overview of Mayavi</em></a> section and the <a class="reference" href="examples.html#learning-mayavi-by-example"><em>Learning Mayavi by example</em></a> section. One needs to have some data or the other loaded before a <cite>Module</cite> or <cite>Filter</cite> may be used. Mayavi supports several data file formats most notably VTK data file formats. More information on this is available here in the <a class="reference" href="data.html#creating-data-for-mayavi"><em>Creating data for Mayavi</em></a> section.</p> <p>Once data is loaded one can optionally use a variety of <a class="reference" href="#filters">Filters</a> to filter or modify the data in some way or the other and then visualize the data using several <a class="reference" href="#modules">Modules</a>.</p> <div class="section"> <h3 id="id3"><span id="modules"></span>Modules<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3> <p>Modules are the objects that perform the visualization itself: they use data to create the visual elements on the scene.</p> <p>Here is a list of the Mayavi modules along with a brief description.</p> <blockquote> <dl class="docutils"> <dt>Axes</dt> <dd>Draws simple axes.</dd> <dt>ContourGridPlane</dt> <dd>A contour grid plane module. This module lets one take a slice of input grid data and view contours of the data.</dd> <dt>CustomGridPlane</dt> <dd>A custom grid plane with a lot more flexibility than GridPlane module.</dd> <dt>Glyph</dt> <dd>Displays different types of glyphs oriented and colored as per scalar or vector data at the input points.</dd> <dt>GridPlane</dt> <dd>A simple grid plane module.</dd> <dt>HyperStreamline</dt> <dd>A module that integrates through a tensor field to generate a hyperstreamline. The integration is along the maximum eigenvector and the cross section of the hyperstreamline is defined by the two other eigenvectors. Thus the shape of the hyperstreamline is “tube-like”, with the cross section being elliptical. Hyperstreamlines are used to visualize tensor fields.</dd> <dt>ImageActor</dt> <dd>A simple module to view image data efficiently.</dd> <dt>ImagePlaneWidget</dt> <dd>A simple module to view image data.</dd> <dt>IsoSurface</dt> <dd>A module that allows the user to make contours of input point data.</dd> <dt>Labels</dt> <dd>Allows a user to label the current dataset or the current actor of the active module.</dd> <dt>OrientationAxes</dt> <dd>Creates a small axes on the side that indicates the position of the co-ordinate axes and thereby marks the orientation of the scene. Requires VTK-4.5 and above.</dd> <dt>Outline</dt> <dd>A module that draws an outline for the given data.</dd> <dt>ScalarCutPlane</dt> <dd>Takes a cut plane of any input data set using an implicit plane and plots the data with optional contouring and scalar warping.</dd> <dt>SliceUnstructuredGrid</dt> <dd>This module takes a slice of the unstructured grid data and shows the cells that intersect or touch the slice.</dd> <dt>Streamline</dt> <dd>Allows the user to draw streamlines for given vector data. This supports various types of seed objects (line, sphere, plane and point seeds). It also allows the user to draw ribbons or tubes and further supports different types of interactive modes of calculating the streamlines.</dd> <dt>StructuredGridOutline</dt> <dd>Draws a grid-conforming outline for structured grids.</dd> <dt>Surface</dt> <dd>Draws a surface for any input dataset with optional contouring.</dd> <dt>TensorGlyph</dt> <dd>Displays tensor glyphs oriented and colored as per scalar or vector data at the input points.</dd> <dt>Text</dt> <dd>This module allows the user to place text on the screen.</dd> <dt>VectorCutPlane</dt> <dd>Takes an arbitrary slice of the input data using an implicit cut plane and places glyphs according to the vector field data. The glyphs may be colored using either the vector magnitude or the scalar attributes.</dd> <dt>Vectors</dt> <dd>Displays different types of glyphs oriented and colored as per vector data at the input points. This is merely a convenience module that is entirely based on the Glyph module.</dd> <dt>Volume</dt> <dd>The Volume module visualizes scalar fields using volumetric visualization techniques.</dd> <dt>WarpVectorCutPlane</dt> <dd>Takes an arbitrary slice of the input data using an implicit cut plane and warps it according to the vector field data. The scalars are displayed on the warped surface as colors.</dd> </dl> </blockquote> </div> <div class="section"> <h3 id="id4"><span id="filters"></span>Filters<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3> <p>Filters transform the data, but do not display it. They are used as an intermediate between the data sources and the modules.</p> <p>Here is a list of the Mayavi Filters.</p> <blockquote> <dl class="docutils"> <dt>CellDerivatives</dt> <dd>Computes derivatives from input point scalar and vector data and produces cell data on the gradients. Can be used to approximately calcuate the vorticity for example.</dd> <dt>CellToPointData</dt> <dd>Transforms cell attribute data to point data by averaging the cell data from the cells at the point.</dd> <dt>Contour</dt> <dd>A contour filter that wraps around the Contour component to generate iso-surfaces on any input dataset.</dd> <dt>CutPlane</dt> <dd>This class represents a cut plane that can be used to slice through any dataset. It also provides a 3D widget interface to position and move the slice interactively.</dd> <dt>DecimatePro</dt> <dd>Reduces the number of triangles in a triangular mesh by approximating the original mesh.</dd> <dt>Delaunay2D</dt> <dd>Performs a 2D Delaunay triangulation.</dd> <dt>Delaunay3D</dt> <dd>Performs a 3D Delaunay triangulation.</dd> <dt>ElevationFilter</dt> <dd>Creates scalar data corresponding to the elevation of the points along a line.</dd> <dt>ExtractEdges</dt> <dd>This filter extracts cell edges from any input data.</dd> <dt>ExtractGrid</dt> <dd>Allows a user to select a part of a structured grid.</dd> <dt>ExtractTensorComponents</dt> <dd>Wraps the TVTK <tt class="docutils literal"><span class="pre">ExtractTensorComponents</span></tt> filter to extract components from a tensor field.</dd> <dt>ExtractUnstructuredGrid</dt> <dd>Allows a user to select a part of an unstructured grid.</dd> <dt>ExtractVectorNorm</dt> <dd>Computes the norm (Euclidean) of the input vector data (with optional scaling between [0, 1]). This is useful when the input data has vector input but no scalar data for the magnitude of the vectors.</dd> <dt>ExtractVectorComponents</dt> <dd>Wraps the TVTK ExtractVectorComponents filter to extract components of a vector. This is useful for analysing individual components of a vector data.</dd> <dt>GaussianSplatter</dt> <dd>This filter splat points into a volume with an elliptical, Gaussian distribution.</dd> <dt>GreedyTerrainDecimation</dt> <dd>Approximates a height field (image data) with a triangle mesh, keeping the number of triangles minimum.</dd> <dt>ImageDataProbe</dt> <dd>A 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.</dd> <dt>MaskPoints</dt> <dd>Selectively passes the input points downstream. This can be used to subsample the input points. Note that this does not pass geometry data, this means all grid information is lost.</dd> <dt>PointToCellData</dt> <dd>Does the inverse of the CellToPointData filter.</dd> <dt>PolyDataNormals</dt> <dd>Computes normals from input data. This gives meshes a smoother appearance. This should work for any input dataset. Note: this filter is called “Compute Normals” in Mayavi2 GUI (Visualize/Filters/Compute Normals).</dd> <dt>QuadricDecimation</dt> <dd>Reduce triangles in a mesh, forming a good approximation of the original mesh.</dd> <dt>SelectOutput</dt> <dd>A filter that allows a user to select one among several of the outputs of a given input. This is typically very useful for a multi-block data source.</dd> <dt>SetActiveAttribute</dt> <dd>This filter lets a user set the active data attribute (scalars, vectors and tensors) on a VTK dataset. This is particularly useful if you need to do something like compute contours of one scalar on the contour of another scalar.</dd> <dt>Threshold</dt> <dd>A simple filter that thresholds on input data.</dd> <dt>TransformData</dt> <dd>Performs a linear transformation to input data.</dd> <dt>Tube</dt> <dd>Turns lines into tubes.</dd> <dt>UserDefined</dt> <dd>This filter lets the user define their own filter dynamically/interactively. It is like <cite>FilterBase</cite> but allows a user to specify the class without writing any code.</dd> <dt>Vorticity</dt> <dd>This filter computes the vorticity of an input vector field. For convenience, the filter allows one to optionally pass-through the given input vector field. The filter also allows the user to show the component of the vorticity along a particular cartesian co-ordinate axes. It produces point data on output which is ready to visualize.</dd> <dt>WarpScalar</dt> <dd>Warps the input data along a particular direction (either the normals or a specified direction) with a scale specified by the local scalar value. Useful for making carpet plots.</dd> <dt>WarpVector</dt> <dd>Warps the input data along a the point vector attribute scaled as per a scale factor. Useful for showing flow profiles or displacements.</dd> </dl> </blockquote> </div> </div> <div class="section"> <h2 id="id5"><span id="interaction-with-the-scene"></span>Interaction with the scene<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2> <p>The TVTK scenes on the UI can be closed by clicking on the little ‘x’ icon on the tab. Each scene features a toolbar that supports various features:</p> <blockquote> <ul class="simple"> <li>Buttons to set the view to view along the positive or negative X, Y and Z axes or obtain an isometric view.</li> <li>A button to turn on parallel projection instead of the default perspective projection. This is particularly useful when one is looking at 2D plots.</li> <li>A button to turn on an axes to indicate the x, y and z axes.</li> <li>A button to turn on full-screen viewing. Note that once full-screen mode is entered one must press ‘q’ or ‘e’ to get back a normal window.</li> <li>A button to save the scene to a variety of image formats. The image format to use is determined by the extension provided for the file.</li> <li>A button that provides a UI to configure the scene properties.</li> </ul> </blockquote> <p>The primary means to interact with the scene is to use the mouse and keyboard.</p> <div class="section"> <h3 id="mouse-interaction">Mouse interaction<a class="headerlink" href="#mouse-interaction" title="Permalink to this headline">¶</a></h3> <p>There are two modes of mouse interaction:</p> <blockquote> <ul class="simple"> <li>Camera mode: the default, where the camera is operated on with mouse moves. This mode is activated by pressing the ‘c’ key.</li> <li>Actor mode: in this mode the mouse actions operate on the actor the mouse is currently above. This mode is activated by pressing the ‘a’ key.</li> </ul> </blockquote> <p>The view on the scene can be changed by using various mouse actions. Usually these are accomplished by holding down a mouse button and dragging.</p> <blockquote> <ul> <li><p class="first">holding the left mouse button down and dragging will rotate the camera/actor in the direction moved.</p> <blockquote> <ul class="simple"> <li>Holding down “SHIFT” when doing this will pan the scene – just like the middle button.</li> <li>Holding down “CONTROL” will rotate about the camera’s focal point.</li> <li>Holding down “SHIFT” and “CONTROL” and dragging up will zoom in and dragging down will zoom out. This is like the right button.</li> </ul> </blockquote> </li> <li><p class="first">holding the right mouse button down and dragging upwards will zoom in (or increase the actors scale) and dragging downwards will zoom out (or reduce scale).</p> </li> <li><p class="first">holding the middle mouse button down and dragging will pan the scene or translate the object.</p> </li> <li><p class="first">Rotating the mouse wheel upwards will zoom in and downwards will zoom out.</p> </li> </ul> </blockquote> </div> <div class="section"> <h3 id="keyboard-interaction">Keyboard interaction<a class="headerlink" href="#keyboard-interaction" title="Permalink to this headline">¶</a></h3> <p>The scene supports several features activated via keystrokes. These are:</p> <blockquote> <ul class="simple"> <li>‘3’: Turn on/off stereo rendering. This may not work if the ‘stereo’ preference item is not set to True.</li> <li>‘a’: Use actor mode for mouse interaction instead of camera mode.</li> <li>‘c’: Use camera mode for mouse interaction instead of actor mode.</li> <li>‘e’/’q’/’Esc’: Exit full-screen mode.</li> <li>‘f’: Move camera’s focal point to current mouse location. This will move the camera focus to center the view at the current mouse position.</li> <li>‘j’: Use joystick mode for the mouse interaction. In joystick mode the mouse somewhat mimics a joystick. For example, holding the mouse left button down when away from the center will rotate the scene.</li> <li>‘l’: Configure the lights that are illumining the scene. This will pop-up a window to change the light configuration.</li> <li>‘p’: Pick the data at the current mouse point. This will pop-up a window with information on the current pick. The UI will also allow one to change the behavior of the picker to pick cells, points or arbitrary points.</li> <li>‘r’: Reset the camera focal point and position. This is very handy.</li> <li>‘s’: Save the scene to an image, this will first popup a file selection dialog box so you can choose the filename, the extension of the filename determines the image type.</li> <li>‘t’: Use trackball mode for the mouse interaction. This is the default mode for the mouse interaction.</li> <li>‘=’/’+’: Zoom in.</li> <li>‘-‘: Zoom out.</li> <li>‘left’/’right’/’up’/’down’ arrows: Pressing the left, right, up and down arrow let you rotate the camera in those directions. When “SHIFT” modifier is also held down the camera is panned.</li> </ul> </blockquote> </div> </div> <div class="section"> <h2 id="id6"><span id="the-embedded-python-interpreter"></span>The embedded Python interpreter<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h2> <p>The embedded Python interpreter offers extremely powerful possibilities. The interpreter features command completion, automatic documentation, tooltips and some multi-line editing. In addition it supports the following features:</p> <blockquote> <ul> <li><p class="first">The name <tt class="docutils literal"><span class="pre">mayavi</span></tt> is automatically bound to the <tt class="docutils literal"><span class="pre">enthought.mayavi.script.Script</span></tt> instance. This may be used to easily script mayavi.</p> </li> <li><p class="first">The name <tt class="docutils literal"><span class="pre">application</span></tt> is bound to the envisage application.</p> </li> <li><p class="first">If a Python file is opened via the <tt class="docutils literal"><span class="pre">File->Open</span> <span class="pre">File...</span></tt> menu item one can edit it with a color syntax capable editor. To execute this script in the embedded Python interpreter, the user may type <tt class="docutils literal"><span class="pre">Control-r</span></tt> on the editor window. To save the file press <tt class="docutils literal"><span class="pre">Control-s</span></tt>. This is a very handy feature when developing simple mayavi scripts.</p> </li> <li><p class="first">As mentioned earlier, one may drag and drop nodes from the Mayavi engine tree view onto the Python shell. The object may then be scripted as one normally would. A commonly used pattern when this is done is the following:</p> <div class="highlight"><pre><span class="gp">>>> </span><span class="n">tvtk_scene_1</span> <span class="go"><enthought.mayavi.core.scene.Scene object at 0x9f4cbe3c></span> <span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="n">_</span> </pre></div> <p>In this case the name <tt class="docutils literal"><span class="pre">s</span></tt> is bound to the dropped tvtk_scene object. The <tt class="docutils literal"><span class="pre">_</span></tt> variable stores the last evaluated expression which is the dropped object. Using <tt class="docutils literal"><span class="pre">tvtk_scene_1</span></tt> will also work but is a mouthful.</p> </li> </ul> </blockquote> </div> <div class="section"> <h2 id="id7"><span id="command-line-arguments"></span>Command line arguments<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2> <p>The <tt class="docutils literal"><span class="pre">mayavi2</span></tt> application features several useful command line arguments that are described in the following section. These options are described in the <tt class="docutils literal"><span class="pre">mayavi2</span></tt> man page as well.</p> <p>Mayavi can be run like so:</p> <div class="highlight"><pre><span class="n">mayavi2</span> <span class="p">[</span><span class="n">options</span><span class="p">]</span> <span class="p">[</span><span class="n">args</span><span class="p">]</span> </pre></div> <p>Where <tt class="docutils literal"><span class="pre">arg1</span></tt>, <tt class="docutils literal"><span class="pre">arg2</span></tt> etc. are optional file names that correspond to saved Mayavi2 visualizations (<tt class="docutils literal"><span class="pre">filename.mv2</span></tt>) or Mayavi2 scripts (<tt class="docutils literal"><span class="pre">filename.py</span></tt>). If no options or arguments are provided mayavi will start up with a default blank scene.</p> <p>The options are:</p> <table class="docutils option-list" frame="void" rules="none"> <col class="option" /> <col class="description" /> <tbody valign="top"> <tr><td class="option-group"> <kbd><span class="option">-h</span></kbd></td> <td>This prints all the available command line options and exits. Also available through –help.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-V</span></kbd></td> <td>This prints the Mayavi version on the command line and exits. Also available through –version.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-z <var>file_name</var></span></kbd></td> <td>This loads a previously saved Mayavi2 visualization. Also available through –viz file_name or –visualization file_name.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-d <var>vtk_file</var></span></kbd></td> <td>Opens a (legacy or XML) VTK file (<tt class="docutils literal"><span class="pre">*.vt*</span></tt>) passed as the argument. Also available through –vtk.</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-p <var>plot3d_xyz_file</var></span></kbd></td> </tr> <tr><td> </td><td>This opens a PLOT3D co-ordinate file passed as the argument. The plot3d-xyz-file must be a PLOT3D single block co-ordinate file. Also available through –plot3d-xyz.</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-q <var>plot3d_q_file</var></span></kbd></td> </tr> <tr><td> </td><td>This opens a PLOT3D (single block) solution file passed as the argument. Please note that this option must always follow a -p or –plot3d-xyz option. Also available through –plot3d-q.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-w <var>vrml-file</var></span></kbd></td> <td>Imports a VRML2 scene given an appropriate file. Also available through –vrml.</td></tr> <tr><td class="option-group" colspan="2"> <kbd><span class="option">-3 <var>threed-studio-file</var></span></kbd></td> </tr> <tr><td> </td><td>Imports a 3D Studio scene given an appropriate file. Also available through –3ds.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-m <var>module-name</var></span></kbd></td> <td><p class="first">A module is an object that actually visualizes the data. The given <tt class="docutils literal"><span class="pre">module-name</span></tt> is loaded in the current <tt class="docutils literal"><span class="pre">ModuleManager</span></tt>. The module name must be a valid one if not you will get an error message.</p> <p>If a module is specified as <tt class="docutils literal"><span class="pre">package.sub.module.SomeModule</span></tt> then the module (<tt class="docutils literal"><span class="pre">SomeModule</span></tt>) is imported from <tt class="docutils literal"><span class="pre">package.sub.module</span></tt>. Standard modules provided with <tt class="docutils literal"><span class="pre">mayavi2</span></tt> do not need the full path specification. For example:</p> <pre>mayavi2 -d data.vtk -m Outline -m user_modules.AModule</pre> <p class="last">In this example <tt class="docutils literal"><span class="pre">Outline</span></tt> is a standard module and <tt class="docutils literal"><span class="pre">user_modules.AModule</span></tt> is some user defined module. Also available through –module.</p> </td></tr> <tr><td class="option-group"> <kbd><span class="option">-f <var>filter-name</var></span></kbd></td> <td><p class="first">A filter is an object that filters out the data in some way or the other. The given <tt class="docutils literal"><span class="pre">filter-name</span></tt> is loaded with respect to the current source/filter object. The filter name must be a valid one if not you will get an error message.</p> <p>If the filter is specified as <tt class="docutils literal"><span class="pre">package.sub.filter.SomeFilter</span></tt> then the filter (<tt class="docutils literal"><span class="pre">SomeFilter</span></tt>) is imported from <tt class="docutils literal"><span class="pre">package.sub.filter</span></tt>. Standard modules provided with <tt class="docutils literal"><span class="pre">mayavi2</span></tt> do not need the full path specification. For example:</p> <pre>mayavi2 -d data.vtk -f ExtractVectorNorm -f user_filters.AFilter</pre> <p class="last">In this example <tt class="docutils literal"><span class="pre">ExtractVectorNorm</span></tt> is a standard filter and <tt class="docutils literal"><span class="pre">user_filters.AFilter</span></tt> is some user defined filter. Also available through –filter.</p> </td></tr> <tr><td class="option-group"> <kbd><span class="option">-M</span></kbd></td> <td>Starts up a new module manager on the Mayavi pipeline. Also available through –module-mgr.</td></tr> <tr><td class="option-group"> <kbd><span class="option">-n</span></kbd></td> <td><dl class="first last docutils"> <dt>Creates a new window/scene. Any options passed after this will</dt> <dd>apply to this newly created scene. Also available through –new-window.</dd> </dl> </td></tr> <tr><td class="option-group"> <kbd><span class="option">-x <var>script-file</var></span></kbd></td> <td>This executes the given script in a namespace where we guarantee that the name ‘mayavi’ is Mayavi’s script instance – just like in the embedded Python interpreter. Also available through –exec.</td></tr> </tbody> </table> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Note that <tt class="docutils literal"><span class="pre">-x</span></tt> or <tt class="docutils literal"><span class="pre">--exec</span></tt> uses <cite>execfile</cite>, so this can be dangerous if the script does something nasty!</p> </div> <p>It is important to note that mayavi’s <strong>command line arguments are processed sequentially</strong> in the same order they are given. This allows users to do interesting things.</p> <p>Here are a few examples of the command line arguments:</p> <pre>$ mayavi2 -d heart.vtk -m Axes -m Outline -m GridPlane \ > -m ContourGridPlane -m IsoSurface $ mayavi2 -d fire_ug.vtu -m Axes -m Outline -m VectorCutPlane \ > -f MaskPoints -m Glyph</pre> <p>In the above examples, <tt class="docutils literal"><span class="pre">heart.vtk</span></tt> and <tt class="docutils literal"><span class="pre">fire_ug.vtu</span></tt> VTK files can be found in the <tt class="docutils literal"><span class="pre">examples/data</span></tt> directory in the source. They may also be installed on your computer depending on your particular platform.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <p class="logo"><img class="logo" src="_static/mayavi-logo.png" alt="Logo"/></p> <h3>Table Of Contents</h3> <ul> <li><a class="reference" href="">Using the Mayavi application</a><ul> <li><a class="reference" href="#id2">General layout of UI</a></li> <li><a class="reference" href="#visualizing-data">Visualizing data</a><ul> <li><a class="reference" href="#id3">Modules</a></li> <li><a class="reference" href="#id4">Filters</a></li> </ul> </li> <li><a class="reference" href="#id5">Interaction with the scene</a><ul> <li><a class="reference" href="#mouse-interaction">Mouse interaction</a></li> <li><a class="reference" href="#keyboard-interaction">Keyboard interaction</a></li> </ul> </li> <li><a class="reference" href="#id6">The embedded Python interpreter</a></li> <li><a class="reference" href="#id7">Command line arguments</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="examples.html" title="previous chapter">Learning Mayavi by example</a></p> <h4>Next topic</h4> <p class="topless"><a href="mlab.html" title="next chapter">Simple Scripting with <tt class="docutils literal docutils literal"><span class="pre">mlab</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/application.txt">Show Source</a></li> </ul> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li> <li class="right" > <a href="mlab.html" title="Simple Scripting with mlab" accesskey="N">next</a> |</li> <li class="right" > <a href="examples.html" title="Learning Mayavi by example" accesskey="P">previous</a> |</li> <li><a href="index.html">Mayavi2 v2.2.0 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Prabhu Ramachandran, Gaël Varoquaux. Last updated on Jun 29, 2008. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. </div> </body> </html>