Skip to content
Emmanuelle Gouillart edited this page Sep 28, 2011 · 4 revisions

Documentation

tomoviz is based on the Mayavi 3-D visualization module. More information on Mayavi can be found on http://github.enthought.com/mayavi/mayavi/

Loading files

Images visualized in tomoviz can be of three types of formats:

  • hdf5: a hierarchical binary format (many data arrays can be stored in the same file)
  • npy: the binary format used by numpy for data arrays
  • raw binary data

tomoviz can be used inside the Ipython shell: launch Ipython in a terminal with the following options

ipython -pylab -wthread

(in Python(x,y) in Windows, choose the wx python mode)

Inside the Ipython shell, first import the TimeVisualizer class from the time_sizeries_visualizer module:

>>> from time_series_visualizer import TimeVisualizer

Then create an instance of TimeVisualizer:

>>> tv = TimeVisualizer('my_data*.h5', mode='h5', name='data')

This loads all files corresponding to the pattern my_data*.h5, and tells the visualized to look for objects named data in the hdf5 files.

Examples with other file formats:

>>> tv_npy = TimeVisualizer('data/data*.npy', mode='npy')
>>> # or
>>> tv_raw = TimeVisualizer('data/data*.raw', mode='raw',
>>> ...         dtype=np.float, shape=(60, 60, 60))

For raw data files, it is compulsory to specify the data type and the shape of the 3-D image.

The script test_visualizer.py shows how to create synthetic data with different file formats to play with.

Launching the visualization

Two more calls to methods of the TimeVisualizer need to be done to (i) launch the graphical interface and (ii) plot cuts of the image:

>>> tv_h5.configure_traits()
>>> tv_h5.plot()

This opens a graphical interface with a window for 3-D visualization:

http://github.com/emmanuelle/tomoviz/raw/master/images/thumb_tomo1.png

This is a classical Mayavi window; therefore, it is possible to rotate the view, zoom, move the cuts by dragging them, etc.

Setting the volume of interest

Click on the Volume panel of the graphical interface. In this subpanel, you can choose a region of interest to be visualized. In each direction, you may specify a lower bound, an upper bound, and a binning step. In particular, it is possible to choose a binning step (visualize only one pixel out of two, three; ... in every direction) by modifying the third component of xslice, yslice, and zlice. This is useful if you have very large datasets that do not fit into memory.

Once you have modifed the volume of interest, click on 'update volume'.

http://github.com/emmanuelle/tomoviz/raw/master/images/thumb_volume_tab.png

Navigating in time

tomoviz is meant to provide a 4-D visualization: it is possible to update the data field by clicking on the Previous and Next buttons.

Preloading files in memory

For a faster navigation through time, it is possible to preload the 3-D images in memory (RAM). This accelerates the time navigation, but the process of loading large data in memory can be quite long, and of course you need to have enough memory for that.

To do that, check the preloaded box in the Evolution subpanel. Before you do that, you can first limit the number of files that will be loaded in memory by modifying the files boxes.

http://github.com/emmanuelle/tomoviz/raw/master/images/thumb_files.png

Modifying settings of the visualization

Beyond the parameters provided by the tomoviz interface, it is possible to modify most parameters of the visualization by launching the Mayavi pipeline. This is done by clicking on the Mayavi logo on the top-left corner of the interface.

http://github.com/emmanuelle/tomoviz/raw/master/images/thumb_pipeline_labels.png

In this pipeline, you may for example change the colormap, bound the minimum and maximum value of the data, change the axis of the cuts (image plane widgets), etc.