Download - NA-MIC, 2008 June Workshop, IHK Akademie Westerham VTK Sebastien BARRE, Ph.D. - Kitware, Inc
NA-MIC, 2008 June Workshop, IHK Akademie Westerham
VTK
Sebastien BARRE, Ph.D. - Kitware, Inc.
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 2
VTK domain: Visualization
• A definition for visualization• Map data or information into images or other sensory input
(touch, sound, smell, taste)• Engages human perception system• Simple, effective powerful
• Complex data• Voluminous data
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 3
VTK: The Visualization Toolkit
• Began with a textbook (work began 1993 – 1st edition 1995)
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 4
What is VTK?
• A visualization toolkit• Designed and implemented using object-oriented principles• C++ class library (nearly 1,000,000 LOC)• Automated Java, Tcl, Python bindings• Portable across Unix, Windows, MacOSX• Supports 2D/3D graphics, visualization, image processing,
volume rendering, infoviz, geoviz• 2500+ user mailing list; 40+ active developers• World-wide academic, commercial, government users• Basis of college undergraduate and graduate courses• Free (BSD-like license)
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 5
VTK is not a system
• Embeddable• Plays with other software
• Separable• Can pull out “pieces”
• Adaptable• Not dependent on GUI• Not dependent on rendering library
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 6
Building applications with VTK
• Applications can be created using• C++ (compiled language)• Tcl (interpreted language)• Java (interpreted language)• Python (interpreted language)
• Interpreted Languages• Have GUI support• Easy to prototype with• Slower than compiled C++
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 7
vtkPolyData
vtkImageData
vtkStructuredGrid
vtkUnstructuredGrid
vtkRectilinearGrid
DataSet types
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 8
Examples
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 9
Surface rendering
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 10
Volume rendering
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 11
Image processing
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 12
Information visualization
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 13
Interaction Widgets
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 14
Instances of render window (vtkRenderWindow)
Actor instances(vtkActor)
Renderer instances(vtkRenderer)
The VTK graphics subsystem
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 15
A VTK scene consists of:• vtkRenderWindow - contains the final image• vtkRenderer - draws into the render window• vtkActor - combines properties / geometry• vtkLight - illuminate actors• vtkCamera - renders the scene• vtkPolyDataMapper - represents geometry• vtkTransform - position actors
The VTK graphics subsystem
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 16
sphere source
polydata mapper
actor
renderer
render window
render window interactor
VTK « Hello world »
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 17
vtkSphereSource *sphere = vtkSphereSource()::New(); // create data pipeline vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();sphereMapper->SetInputConnection(sphere->GetOutputPort());
vtkActor *sphereActor = vtkActor::New();sphereActor->SetMapper(sphereMapper); //mapper connects actor with pipeline
vtkRenderer *renderer = vtkRenderer::New();vtkRenderWindow *renWin = vtkRenderWindow::New();renWin->AddRenderer(renderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();iren->SetRenderWindow(renWin);
renderer->AddViewProp(sphereActor);renderer->SetBackground(1,1,1);renWin->SetSize(300,300);
renWin->Render();iren->Start(); //starts the event loop
VTK « Hello world » (C++)
June 16-17, 2008 NA-MIC, 2008 June Workshop, IHK Akademie Westerham 18
Find more about VTK…
• Online documentation• http://vtk.org• Wiki• FAQ• Manual pages (Generated by doxygen)• search the archive of the mailing lists
• Source code• Embedded documentation in header files *.h• Examples/ and Testing/ directories
• Books• VTK Textbook• VTK User's Guide