Octaviz is a visualization system for octave (www.octave.org). It consists of two major parts:
- VTK wrapper that creates an Octave object (a function that simulates objects using . operator) for each VTK class. Functions are named after classes they represent, for example vtkRenderer class is wrapped in vtkRenderer function. Instances of VTK objects are created by calling the class function without parameters: command "ren = vtkRenderer;" creates a new instance of vtkRenderer class that is kept in octave variable ren. Methods within a class are accessed directly using C++ (or Python) syntax, for example, using the above created object ren, the method Render is accessible as ren.Render(). Online help is also available for each class and method. vtkClass("Help") displays the description of vtkClass, while vtkClass("MethodName","Help") displays help for the method vtkClass.MethodName.
At this point, the first part, i.e. VTK wrapper, is almost complete, the missing part are callback functions. For those familiar with both octave and vtk it should be as simple to use as in Python with the same syntax and functionality. Excluding language specific constructs, Python examples (included in VTK) can be used in octave without any modification. The only exception is the creation of new instances that are created as obj = vtk.vtkClassName in Python while the octave syntax is obj = vtkClassName. You can use a text editor to replace all "vtk." strings in a Python example and it should run fine in octave. About 70 Python examples are converted to Octave and included in Octaviz.
2. High-level functions for 2D and 3D visualization, surf, trisurf, plot3, figure, etc.
The development of high-level octave functions just started. Following functions are available:
vtk_figure - creates a new figure
vtk_close - closes a figure
plot3 - Displays a set of 3D points trisurf - Displays a triangulated surface contour3 - Contour plot mesh - Displays a surface as a mesh meshc - Displays a surface as a mesh with contour plot underneath plot3 - plots a set of 3D points quiver3 - vector field visualization surf - Displays a surface surfc - Displays a surface with contour plot underneath trimesh - Displays a triangulated mesh vtk_eps - Saves current figure in .eps format vtk_imshow - Displays an image vtk_rib - Saves current figure as Renderman .RIB file
vtk_plot
And some demos:
demo.m - Basic demo. Displays a colored cube. demo_old_syntax.m - Same as above with the alternative syntax
image_demo.m - Image display example (requires vtk-data) image_demo2.m - imshow example. somb.m - Sombrero xyPlot.m - Example of multiple plots in a single figure test_xy.m - Interactive 2D plot (allows interactive scaling and shifting)
BUILDING
Octaviz has been tested only in Linux with X-Window System and OpenGL but it should work on any platform that supports X. Octaviz compiles under CygWin but there is a problem related to cygwin implementation of fork, dlopen, base addresses in dlls or something. If you know how to solve it please share...
You'll need octave 2.1.53 or later and VTK CVS to build octaviz (VTK 4.2 works but closing figures crashes). You will probably need to recompile octave with -pthread flag in order to make multithreading function properly (alternatively you can export LD_ASSUME_KERNEL=2.4.1 before starting octave). To compile octaviz, run "ccmake ." in the root directory of the source tree, then "make" and finally "make create_links".
To build octaviz under CygWin follow the following steps (keep in mind that it will compile but it will NOT work due to the fork/dlopen problem. Unless you want to solve the problem, you be compiling octaviz in vain.)
- Compile VTK with support for XFree under Cygwin and OpenGL from XFree (NOT Win32!)
- rum "ccmake ." in the root directory of the VTK source tree
- Set the following options (press "t" to see advanced options)
X11_X11_LIB /usr/X11R6/lib/libX11.dll.a X11_Xext_LIB /usr/X11R6/lib/libXext.dll.a OPENGL_INCLUDE_PATH /usr/X11R6/include OPENGL_gl_LIBRARY /usr/X11R6/lib/libGL.dll.a OPENGL_glu_LIBRARY /usr/X11R6/lib/libGLU.dll.a BUILD_TESTING OFF BUILD_SHARED ON CMAKE_X_LIBS -lX11 -lXt
- press "c" to configure
- change VTK_USE_X to ON
- press "c" to configure
- press "g" to generate Makefiles
- press "q" to quit
- run make
- run make install
- Set the following options (press "t" to see advanced options)
- do chmod +x libvtk* in the VTK installation directory (usually /usr/local/lib/vtk).
- Make sure that the VTK installation directory is in your $PATH
- rum "ccmake ." in the root directory of the VTK source tree
- Compile Octave
- run ./configure --enable-shared --enable-dl in the root directory of octave source tree
- run make
- make install
- Compile Octaviz
- run ccmake . in Octaviz root directory
- press "c" to configure
- press "g" to generate Makfiles
- press "q" to quit ccmake
- run make
- make install
- make create_links
- run ccmake . in Octaviz root directory
Comments, suggestions, bug repports and patches are most welcome (you can use mailing lists at SourceForge or send to dragant@users.sourceforge.net).
Octaviz is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
Octaviz is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more details.
Parts of this software are
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See http://www.kitware.com/Copyright.htm for details.
