-
Notifications
You must be signed in to change notification settings - Fork 2
howto
tomoviz is based on the Mayavi 3-D visualization module. More
information on Mayavi can be found on
http://github.enthought.com/mayavi/mayavi/
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 bynumpyfor data arrays -
rawbinary 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.
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:
This is a classical Mayavi window; therefore, it is possible to
rotate the view, zoom, move the cuts by dragging them, etc.
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'.
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.
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.
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.
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.