Opening a data file
Prev | Chapter 3. Using MayaVi | Next

## Opening a data file

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 `examples/` 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.

The first thing to do is load an appropriate data file. Visit the File 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 DataVizManager at the topmost list and you will see a lot of controls below this. The control panel is described in some detail in this section. If you aren't familiar with that section yet, this might be a good time to review it.

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 Configure Data button provided in the control panel. Only one scalar attribute and one vector attribute is supported at a given time. Each DataVizManager 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 Close menu.

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 Configure Data GUI automatically addes a slider to switch between these time steps and an auto-sweep button to sweep through the time series.

Once the data file is read and a `DataVizManager` is created an instance of a `ModuleManager` is also created. At this point one has to load the `Filter`s and the `Module`s in order to do the visualization.

Prev | Up | Next
Data formats | Home | Visualizing the Data