490 likes | 715 Views
The Visualization Toolkit (VTK). By Ken Walker May 4, 2001. What is Visualization?. Visualization -- “2: the act or process of interpreting in visual terms or of putting into visual form,” Webster’s Ninth New Collegiate Dictionary.
E N D
The Visualization Toolkit (VTK) By Ken Walker May 4, 2001
What is Visualization? • Visualization -- “2: the act or process of interpreting in visual terms or of putting into visual form,” Webster’s Ninth New Collegiate Dictionary. • Visualization is the process of exploring, transforming, and viewing data as images to gain understanding and insight into the data.
What’s the purpose? • Visualization is a necessary tool to make sense of the flood of information in today’s world of computers. • It helps to extract the important information hidden within the data. • It takes advantage of the natural abilities of the human vision system.
Often confused terms • Imaging--the study of 2D pictures, or images. This includes techniques to transform (e.g., rotate, scale, shear), extract information from, analyze, and enhance images. • Computer graphics--the process of creating images using a computer. This includes both 2D paint-and-draw techniques as well as more sophisticated 3D drawing (or rendering) techniques. • Visualization--the process of exploring, transforming, and viewing data as images (or other sensory forms) to gain understanding and insight into the data.
Visualization • Concerned with data transformation. Information is repeatedly created and modified to enhance the meaning of the data. • Naturally interactive, including the human directly in the process of creating, transforming, and viewing data.
Computer Graphics • Surface rendering • Volume rendering
VTK • An object-oriented approach to 3D graphics and visualization. • VTK software is a group of classes packaged in a C++ class library. • About 600 classes in the system. • It’s a toolkit for utilizing visualization techniques.
VTK • High-level interface to graphics capabilities of a system. • Able to draw complex primitives, rather than individual pixels. • No need to worry about the details of which pixels are being set to which colors.
VTK • Allows users to access the class libraries through C++, TCL, Java and Python. • This is accomplished through wrappers that are automatically generated as part of the build process. • Access to VTK through a script level language (e.g. TCL and Python) facilitates the testing process but also adds complexity to the testing since multiple language testing must be performed.
Basic VTK objects • 7 basic objects that we use to render a scene: • vtkRenderWindow • vtkRenderer • vtkLight • vtkCamera • vtkActor • vtkProperty • vtkMapper
vtkRenderWindow • Manages a window on the display device. • One or more renderers draw into an instance of vtkRenderWindow. • Instances of vtkRenderWindow are device independent. • Manages renderers and stores graphic specific characteristics such as size, position, window title, window depth, and the double buffering flag.
vtkRenderer • Coordinates the rendering process involving lights, cameras, and actors. • At least one actor must be defined, but if lights and a camera are not, they will be created automatically by the renderer. • In such a case, the actors are centered in the image and the default camera view is down the z-axis.
vtkLight • A source of light to illuminate the scene. • Positional lights • Infinite lights • If no lights are defined and turned on, the renderer constructs a light automatically.
vtkCamera • Defines the view position, focal point, and other viewing properties of the scene.
vtkActor • Represents an object rendered in the scene. • Both its properties and position in the world coordinate system. • vtkFollower is a subclass of vtkActor. Instances of this class always face the active camera.
vtkProperty • Defines the appearance properties of an actor including color, transparency, and lighting properties such as specular and diffuse. • Also, representational properties like wireframe and solid surface. • When actors are created, a property instance is automatically created with them. • Creating property objects directly and then associating the property object with one or more actors is also possible. • In this way actors can share common properties.
vtkMapper • The geometric representation for an actor. • More than one actor may refer to the same mapper.
vtkRenderWindowInteractor • Another important object is vtkRenderWindowInteractor. • Captures events for a renderer in the rendering window and then triggers certain operations like camera pan, rotate, actor picking, and so on.
VTK • Applications built with VTK are device independent. • VTK achieves device independence transparently by a combination of inheritance and a technique known as object factories. • Certain classes like vtkActor are broken into two parts: a device independent superclass and a device dependent subclass. • The user creates a device dependent subclass by invoking the special constructor New() in the device independent superclass.
Device independence • For example, in C++: • The user sees no device dependent code, but in actuality anActor is a pointer to a device dependent subclass of vtkActor. vtkActor *anActor = vtkActor::New() will create a device dependent instance of vtkActor.
Inheritance of device classes Device independent superclass Device dependent subclasses
Object Factories vtkActor *vtkActor::New(){ char *temp = vtkRenderWindow::GetRenderLibrary();… if (!strcmp(“OpenGL”, temp)) // vtkOpenGLActor::New() is a simple constructor // returning an instance of itself using // {return new vtkOpenGLActor;} return vtkOpenGLActor::New();…}
VTK • Open source and free to download • Everyone has read access and can download the software for use. • Members of the development team can read and write to the repository. • VTK source code is kept under the cvs revision control system.
Distribution Process • The beta and major release processes follow common software distribution procedures. • Nightly releases provide users with access to the latest software release that has passed VTK’s quality control process.
Nightly Release • Provides frequent bug fixes and enhancements to users without forcing them to wait for the next major release. • Nightly testing before the release provides confidence to users.
VTK Extreme Testing • The goal is to identify defects as soon as they are introduced into the software. • A combination of regression and functional testing.
Regression Testing • To assure that changes to the system do not change the operation of the software. • Ensure prior operation of the software has not been affected by new changes. • More than 500 regression tests. • Each night, a control script choreographs the regression testing on 12 different hardware/software configurations.
Regression Testing (cont.) • Dynamic Memory Analysis • Uses Rational’s Purify to catch memory leaks as soon as they are introduced. • Timing • CPU and wall time for each test is recorded. • They’re compared to see if tests are running slower or faster than they have in the past.
Regression Testing (cont.) • Coverage • One of the builds is configured to run the regression tests with a compile flag that produces annotated listings of the source code. • Each executable line is labeled with a number or hash marks (#’s). • The number tells how many times the statement was executed. • The hash marks indicate lines that are not executed at all. • The percent coverage for each file is displayed on the coverage pages, with the listings.
Regression Testing (cont.) • Style • A commercial style checker called CodeCheck (from Abraxas Software) summarizes deviations from agreed upon coding conventions of the development team.
Functional Testing • Assure that each element of the system meets global requirements. • These tests are generated automatically from the source files.
Functional Testing (cont.) • Black box tests are run to check for documentation defects and adherence to functional requirements. • For example, VTK requires that each class in the system have a method PrintSelf that prints the values of each instance variable. • Important in debugging and in interpreted applications. • Another test exercises each PrintSelf method to ensure that the Print method does not fail.
Functional Testing (cont.) • A third test checks the integrity of pipeline mechanism.
The Nightly Build • Begins at 8:00PM and completes around 7:00AM the following morning. • The results of the nightly test are summarized on the Internet before the nightly software release is distributed.
VTK Dashboard Blue--Internal Test System Green--Build/Test Successful Cyan--External Test System Yellow--Build/Test Error Red--System or Network Error Orange--Timing Change
Continuous Build • To protect the nightly build from failing. • The process checks the revision control repository for changes (every 5 minutes). • If a change occurs, the process checks out the changes, compiles the new toolkit and runs four smoke tests to ensure a minimal conformance for the nightly tests.
Smoke Tests • Show that the toolkit will, at a minimum, run an application in each of the four supported language bindings: C++, tcl, java and python. • If the build fails or one of the tests fail, the process sends an e-mail to the offending party, informing him/her of the problem.
Example e-mail Subject: vtk Build Problem: 04/10/01 11:50 Please look at http://vtk.scorec.rpi.edu/Nightly/ContinuousResults/solaris/ContinuousResults/html. It appears that you may have checked in code that has broken the vtk build. We realize that another developer may have caused the build to break but you are one of the last people to check changes into the vtk repository.
Continuous Build • Since the continuous build process began, only one nightly build process has failed completely and one has failed partially. In both cases, the failure was caused because a developer checked in changes without watching the continuous build and did not check their e-mail.
VTK Extreme Testing Benefits • Able to make broad changes to the system with confidence. • As long as the tests pass, they can proceed. • Defects are detected within 24 hours of their introduction. • New team members can become productive immediately. • They can move to new third party software and upgrades with confidence. • The extensive test suite empowers developers to improve the system without fear of breaking it. • Everyone knows the status of the system daily. Users are encouraged to check the Dashboard before they download the new version.
References • VTK website • http://www.kitware.com/vtk.html • The Visualization Toolkit, 2nd Edition • By Will Schroeder, Ken Martin, and Bill Lorensen