What is VTK?
VTK: The Visualization Toolkit
Part I: Overview and object models
March 28, 2001
Volume Rendering Isosurface Extraction
Software Data Hardware
Vector Field Visualization What is VTK?
n An open source, freely available software system for 3D graphics, image processing, and visualization.
n Support for hundreds of algorithms in visualization and image processing
n Object-oriented design with different interpreted language wrapers.
1 At a Glance System Architecture
Interpreted Wrapper (Tcl, Java, Python) [ Why?] n The core of VTK is written entirely in C++ •Tcl/Tk shell •Tcl/Tk source n Contains 600 existing classes with 325K lines of code •Java interpreter •Java JDK •Python interpreter •Python source n VTK will compile and run on Windows 98/NT, SGI, C++ core Linux, Sun, HP, etc. All class source code Libraries and includes n Support OpenGL and Mesa (dll and .h files) (could take hours to compile) Or n Different interfaces for fast prototyping: Tcl/Tk, Java, (.a and .h files) and Python
n Have users all over the world – The beauty of Open Source! Binary Installation: if you will use Source code Installation: The classes to build your applicatoin If you want to extend vtk
Installation (1) Installation (2)
Windows 9x/NT/2000 Unix (alpha,beta, etc) :I have installed a copy on /usr/class/cis788.14Q/vtk3.2 = path n Binary : vtk32Core, vtk32Cpp, vtk32Tcl, vtk32Java, vtk32Python (dll and includes) n Library: $path/common/libVTKCommon.a $path/graphics/libVTKGraphics.a They will install Tcl/Tk for you (for example) if your PCdoes not $path/imaging/libVTKImaging.a have one already. also there are directories ‘patented’ and ‘contrib’ that you might With this installed, you can run their sample programs and use. write your own C++ application. n Includes: -I$path/common –I$path/graphics –I$path/imaging
n Source: You will need VC++ 6.0 installed too. Check the makefile in $path/graphics/exampleCxx/Makefile
Installation (2.1) VTK classes
• CIS unix servers will be slow as we do not have native OpenGL support. Instead, we use Mesa3d. But you can do your labs in any of the CIS labs • Only C++ is supported (not Tcl/Tk at least) • When use the server to run vtk examples, you need to do
setenv LD_LIBRARY_PATH /n/gold/1/graphics/Mesa3.0/lib
• We probably can install a copy on albatross (graphics lab server)
2 VTK Object models Pipeline Execution
n Graphics and Visualization Model Direction of ‘update’ Render n Graphics objects: rendering Visualization model Graphics model n Visualization objects: generating geometry
Source Filter Mapper Actor Data Flow System: Pipeline execution
Data source Visualizatoin Graphics Direction of data flow
The Graphics Model The Graphics Model
The purpose is to render the geometry (volume) on the screen The purpose is to render the geometry (volume) on the screen
camera vtkCamera vtkActor Actor Light vtkLight •vtkProperty screen •vtkMapper vtkRenderWindow •vtkTransform
vtkRenderer vtkRenderWindowInteractor
To see is to believe … Example Program
1 vtkRenderWindow Main() { Window create a window; create a renderer; give the renderer to the window; Renderer create procedural geometry; create a mapper; give the geometry to the mapper; Actor create an actor; give the mapper to the actor; Mapper
vtkCamera give the actor to the renderer; 2 vtkRenderer vtkLight window->render(); Geometry vtkActor } ( property, geometry(mapper), transformation, etc)
3 User interaction Go home to do the following… n vtkRenderWindowInteractor – allow the user to interact with the n Install VTK (in your PC) graphics objects n Run Tcl or C++ examples n Try the following keypresses: n Build C++ examples OR w: wireframe mode n Use the VTK installation on beta: s: surface mode r: reset the transformation n /usr/class/cis788.14Q/vtk3.2/ 3: toggle stereo n Copy a couple of examples in button 3: zoom; botton 2: pan; button1: rotate; graphics/examplesCxx to your local directory c/o: camera mode or object mode n Modify the makefile there and compile from your j/t: joy stick or tracer ball mode local directory e: exit n Give it a try!
4