Menu

[r1006]: / trunk / course / vtk_tut.lyx  Maximize  Restore  History

Download this file

187 lines (145 with data), 4.9 kB

#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass amsbook
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard

The Visualization Toolkit is a library for creating, analyzing, and visualizing
 3D data, and is a high level library that sits on top of a low-level library
 like OpenGL.
 Because 3D interaction and visualization is so computationally intensive,
 video cards come with special processors to do computations for 3D geometry
 at the hardware level, and low-level software libraries like OpenGL are
 used to communicate with the video card.
 However, low level libraries are just that, and do not support the higher
 level geometrical concepts that describe the problem at hand; eg OpenGL
 has no concept of a cube -- you can create a cube by making six rectangular
 faces placed in the proper positions -- but you can't say "draw me a cube"
 
\begin_inset LatexCommand \cite{Redbook}

\end_inset 

.
\layout Standard

That is where high level libraries like VTK come in.
 VTK is an enormously powerful and complex visualization library written
 in C++ that can drive low level 3D libraries such as Mesa, a pure software
 OpenGL implementation, and OpenGL itself.
 It relies heavily on principles of object oriented design, and can be plugged
 into all widely used graphical user interfaces: Cocoa, Win32, Tkinter,
 WX, GTK, FLTK and more.
 Wrappers of the C++ code exist for Python, Java and TCL.
 VTK provides python users the ability to do cross-platform, hardware accelerate
d rendering from the comfort of the python interpreter, all with better
 quality than money can buy.
\layout Standard

VTK is a complex library -- with over 1000 classes and a deep inheritance
 scheme, it has an API rivaling Java's in complexity.
 The system was initially developed by Bill Schroeder and Will Lorenson,
 who designed the library after working in visualization and animation for
 10 years.
 The initial design identified only 25 core classes, and four software professio
nals spent 10 months designing the library before touching a keyboard! These
 original 25 classes still exist in the library today 
\begin_inset LatexCommand \cite{SchroederEtal2002}

\end_inset 

.
\layout Section

Hello world in VTK
\layout Standard

We'll start with a minimal example that creates and displays a cube.
 The example below creates a cube.
 The src for this example is 
\family typewriter 
examples/vtk_hello.py
\layout Standard


\begin_inset ERT
status Open

\layout Standard

\backslash 
lstinputlisting[caption={A minimal VTK example to display a cube}]{examples/vtk_hello.py}
\end_inset 


\layout Standard


\begin_inset LatexCommand \ref{fig:vtkcube}

\end_inset 


\begin_inset Float figure
wide false
collapsed true

\layout Standard
\align center 

\begin_inset Graphics
	filename fig/vtkcube.png
	lyxscale 50
	width 3in

\end_inset 


\layout Caption


\begin_inset LatexCommand \label{fig:vtkcube}

\end_inset 

A Cube, brought to you by VTK
\end_inset 


\layout Exercise


\shape italic 
Make a translucent sphere.

\shape default 
 Modify 
\family typewriter 
examples/vtk_hello.py
\family default 
 to add a translucent blue sphere to the to scene.
 
\shape italic 
Translucency hint
\shape default 
: translucency is an actor property -- as you see in the code above, you
 call 
\family typewriter 
actor.GetProperty()
\family default 
 to get the actor property reference.
 Visit the VTK class docs web page and click on the vtk class 
\family typewriter 
vtkActor
\family default 
 and find the method 
\family typewriter 
GetProperty()
\family default 
.
 If you click on the return value of this method (
\family typewriter 
vtkProperty
\family default 
) you'll be taken to the right page.
 Read over the available methods to determine the appropriate one for setting
 the translucency and note all the other properties that you can control.
\layout Section

Working with medical image data
\layout Standard

VTK has very strong support for medical image data, including volume data
 readers, DICOM readers, surface contour filters, plane slice widgets, and
 so on.
 In addition, the Insight Toolkit (ITK), which was developed by a consortium
 of universities and private companties, provides a large number state-of-the-ar
t image segmentation and registration algorithms
\begin_inset LatexCommand \cite{IbanezSchroeder2003}

\end_inset 

.
 Liek VTK, ITK is a large, sophisticated C++ library which comes with wrappers
 for a number of interpreted languages: Java, Tcl and Python.
\the_end
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.