the visualization toolkit (vtk)

47
The Visualization Toolkit (VTK) By Ken Walker May 4, 2001

Upload: katina

Post on 05-Jan-2016

75 views

Category:

Documents


2 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Visualization Toolkit  (VTK)

The Visualization Toolkit (VTK)

By Ken Walker

May 4, 2001

Page 2: The Visualization Toolkit  (VTK)

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.

Page 3: The Visualization Toolkit  (VTK)

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.

Page 4: The Visualization Toolkit  (VTK)

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.

Page 5: The Visualization Toolkit  (VTK)

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.

Page 6: The Visualization Toolkit  (VTK)

The Visualization Process

Page 7: The Visualization Toolkit  (VTK)

Computer Graphics

• Surface rendering

• Volume rendering

Page 8: The Visualization Toolkit  (VTK)

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.

Page 9: The Visualization Toolkit  (VTK)

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.

Page 10: The Visualization Toolkit  (VTK)

Typical Graphics Interface Hierarchy

Page 11: The Visualization Toolkit  (VTK)

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.

Page 12: The Visualization Toolkit  (VTK)

Basic VTK objects

• 7 basic objects that we use to render a scene:– vtkRenderWindow– vtkRenderer– vtkLight– vtkCamera– vtkActor– vtkProperty– vtkMapper

Page 13: The Visualization Toolkit  (VTK)

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.

Page 14: The Visualization Toolkit  (VTK)

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.

Page 15: The Visualization Toolkit  (VTK)

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.

Page 16: The Visualization Toolkit  (VTK)

vtkCamera

• Defines the view position, focal point, and other viewing properties of the scene.

Page 17: The Visualization Toolkit  (VTK)

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.

Page 18: The Visualization Toolkit  (VTK)

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.

Page 19: The Visualization Toolkit  (VTK)

vtkMapper

• The geometric representation for an actor.

• More than one actor may refer to the same mapper.

Page 20: The Visualization Toolkit  (VTK)

Diagram of Graphics Objects

Page 21: The Visualization Toolkit  (VTK)

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.

Page 22: The Visualization Toolkit  (VTK)

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.

Page 23: The Visualization Toolkit  (VTK)

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.

Page 24: The Visualization Toolkit  (VTK)

Inheritance of device classes

vtkOpenGLActor vtkXGLActor vtkStarbaseActor

vtkActor

Device independent superclass

Device dependent subclasses

Page 25: The Visualization Toolkit  (VTK)

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();

…}

Page 26: The Visualization Toolkit  (VTK)

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.

Page 27: The Visualization Toolkit  (VTK)

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.

Page 28: The Visualization Toolkit  (VTK)

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.

Page 29: The Visualization Toolkit  (VTK)

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.

Page 30: The Visualization Toolkit  (VTK)

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.

Page 31: The Visualization Toolkit  (VTK)

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.

Page 32: The Visualization Toolkit  (VTK)

Timing Results

Page 33: The Visualization Toolkit  (VTK)

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.

Page 34: The Visualization Toolkit  (VTK)

Coverage

Page 35: The Visualization Toolkit  (VTK)

Regression Testing (cont.)

• Style– A commercial style checker called

CodeCheck (from Abraxas Software) summarizes deviations from agreed upon coding conventions of the development team.

Page 36: The Visualization Toolkit  (VTK)

Functional Testing

• Assure that each element of the system meets global requirements.

• These tests are generated automatically from the source files.

Page 37: The Visualization Toolkit  (VTK)

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.

Page 38: The Visualization Toolkit  (VTK)

Functional Testing (cont.)

• A third test checks the integrity of pipeline mechanism.

Page 39: The Visualization Toolkit  (VTK)

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.

Page 40: The Visualization Toolkit  (VTK)

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

Page 41: The Visualization Toolkit  (VTK)

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.

Page 42: The Visualization Toolkit  (VTK)

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.

Page 43: The Visualization Toolkit  (VTK)

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.

Page 44: The Visualization Toolkit  (VTK)

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.

Page 45: The Visualization Toolkit  (VTK)

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.

Page 46: The Visualization Toolkit  (VTK)

References

• VTK website– http://www.kitware.com/vtk.html

• The Visualization Toolkit, 2nd Edition– By Will Schroeder, Ken Martin, and Bill

Lorensen

Page 47: The Visualization Toolkit  (VTK)

Thank You!