Title: Object-oriented Visualization
1Object-oriented Visualization
- João Duarte Cunha
- Univ. de Lisboa - Faculdade de Ciências
- Socrates Programme
- Plzen, May 2001
2Visualization
- Overcoming spatial, temporal and physical
barriers
3Sensorial limitations
- Our senses are our interface everything we got
from the outside world comes through them - Our senses are quite limited
- in the type of stimuli they can perceive
- in their sensitivity
4Sensorial limitations
- Because of those limitations, the world within
our reach is - limited in space
- limited in time
- limited in the type of objects and phenomena that
we can perceive!
5Mans inconformism
- Man always struggled against his sensorial
limitations! - Oral tradition in primitive societies was a away
of overcoming the time barrier (and, combined
with travelling, also the space barrier) - Painting and other art forms have a similar role!
6Mans inconformism
- The introduction of writing was an enormous step
forward. - And the discovery of the press by Gutemberg in
the 15th century amplified its impact by orders
of magnitude.
7Mans inconformism
- And so we got the 19th century!
8Mans inconformism
- All these ways of overcoming the space and time
barriers are human mediated - by ONE man in the case of writing and the plastic
arts - by MANY men in the case of oral tradition, music,
dance.
9Mans inconformism
- The senses involved are always vision and hearing!
10Mans inconformism
- Galileos telescope and other optical instruments
pushed away the space barrier. - And we know well how
- important this was for
- our understanding of
- the universe!
11Mans inconformism
- With the development of measuring instruments the
struggle against the physical barrier proceeded
step by step. - But slowly!
12Mans inconformism
- In the 19th century a new era begun!
- Telegraphy (1856) introduced the instanta-neous
transmission of the written word. - We can say, at Earth scale at least,
- that with telegraphy
- space became independent of time!
13Mans inconformism
- The telephone (1876) and radio or wireless
telephony (already in the 20th century) are new
advances allowing for a limited form of direct
(not human mediated) perception. - Photography (1839), sound recording (1877) and
the cinema (1895) are other important landmarks.
14Mans inconformism
- But it was undoubtedly the television (1926) the
most significant step in mans struggle against
the space barrier!
15"Sensing" information
- From Visualization to "Perception" !
16SEEING information
- Knowledge is based on information and action is
determined by knowledge. - Computers are essential to generate new
information (simulation and data acquisition). - But they are, more than anything else, the ideal
instrument to store, search, retrieve and process
information.
17SEEING information
- In their book "Readings in Information
Visualization - Using vision to think", Card,
Mackinlay e Shneiderman define visualization as - The use of computer-supported,
- interactive, visual representations
- of data to amplify cognition
18SEEING information
- Look at the following table
- 0,000 0,087 0,174 0,259 0,342 0,423 0,500 0,574
- 0,643 0,707 0,766 0,819 0,866 0,906 0,940 0,966
- 0,985 0,996 1,000 0,996 0,985 0,966 0,940 0,906
- 0,866 0,819 0,766 0,707 0,643 0,574 0,500 0,423
- 0,342 0,259 0,174 0,087 0,000
- and at the graph in the following slide
19SEEING information
20SEEING information
- These two slides just point out what we already
knew very well our ability to get information is
highly dependent on its form. - In general, a graph or image allow a much faster
understanding than a list of numbers or a textual
description.
21SEEING information
- Visualization was used long before, but the
Scientific Visualization and Information
Visualization areas were born in the late 80s. - The confluence of push and pull factors was
determinant for that.
22SEEING information
- Push factors
- 30 years of experience in Computer Graphics
- Availability of powerful graphical hardware
- Developments in human-machine interfaces
23SEEING information
- Pull factors
- Ever greater amounts of data to store and analyze
coming from - Sophisticated simulations made possible by the
available computing power - Very large and complex data bases
24SEEING information
- Simplified reference model for visualization
Data
Mapping
Rendering
25SEEING information
Mapping
Information is converted into geometry and/or
graphical attributes.
26Scientific Visualization
- Scientific Visualization or Visualization of
Scientific Data is usually defined as concer-ned
with visualization of data associated with a
spatial grid, as opposed to Informa-tion
Visualization which concentrates on more abstract
kinds of data.
27The Visualization Toolkit - vtk
- VTK is an object-oriented toolkit for 3D
graphics(http//www.kitware.com/vtk.html) - Although tailored for the scientific
visuali-zation field it can also be sucessfully
used to illustrate the basics of 3D graphics and
rendering.
28The Visualization Toolkit - vtk
- The toolkit consists of a set of C classes
providing the functionality to build 3D graphics
applications, namely visualization applications,
without the need for any low level programming. - Vtk is compatible with several graphical systems,
namely OpenGL and X-Windows.
29The Visualization Toolkit - vtk
- Vtk may be used from C, Java or Tcl/Tk
programmes. - In this talk Tcl/Tk will be used.
30The Visualization Toolkit - vtk
- Vtk being object-oriented, we need only to create
objects of the appropriate types and call the
available methods.
31The Visualization Toolkit - vtk
- Vtk object types can be grouped according to
their functionality. - The most important object groups are Sources,
Mappers, Graphics and Filters. - We will now look in some detail at each group.
32The Visualization Toolkit - vtk
- Sources are information provider objects.
- Some sources are readers, that is, they get the
information from files in appropriate formats.
Examples - vtkPLOT3DReader
- vtkBYUReader
- vtkPolyDataReader (one of vtk own formats)
33The Visualization Toolkit - vtk
- Others generate data algorithmically. The typical
example are the sources that create basic
geometric shapes like - vtkSphereSource
- vtkCylinderSource
- vtkConeSource
34The Visualization Toolkit - vtk
- Mappers, as suggested by the name itself, get the
information provided by source objects, directly
or through appropriate filters, and generate
graphic primitives. - There are two types of mappers
- vtkDataSetMapper
- vtkPolyDataMapper
35The Visualization Toolkit - vtk
- A special type of mappers are the writers, which
write out information in files with differente
formats. Examples - vtkBYUWriter
- vtkTIFFWriter
- vtkPolyDataWriter
36The Visualization Toolkit - vtk
- Objects in the graphics group are respon-sible
for the rendering portion of the visua-lization
pipeline.
37The Visualization Toolkit - vtk
- Objects in this group include
- vtkRenderer
- vtkRenderWindow
- vtkActor
- vtkProperty
- vtkTransform
- vtkCamera
- vtkLight
38The Visualization Toolkit - vtk
- vtkRenderer is a virtual class.
- But vtkOpenGLRenderer, which inherits from
vtkRenderer, is a concrete class instan-tiated
when the graphics systems is OpenGL.
39The Visualization Toolkit - vtk
- Objects of type vtkRenderWindow repre-sent the
application window. - The window will be a Windows window or an X
window, according to the graphics system being
used.
40The Visualization Toolkit - vtk
- Each instance of vtkActor represents a scene
object, combining the geometry (provided by the
mapper) with the optical properties (colour,
texture, etc) and con-crete values for the
location, orientation and size.
41The Visualization Toolkit - vtk
- Instances of vtkProperty are associated with
actors to control its appearance. - Similarly, instances of vtkTransform are
associated with actors to determine their
location, orientation and size.
42The Visualization Toolkit - vtk
- Instances of vtkCamera and vtkLight are
associated with Renderer objects to specify how
the scene is seen and illuminated. - If the user does not explicitely create objects
of these two types, default ones are provided.
43The Visualization Toolkit - vtk
- Filters are transformation objects and there
are many types of filters available. - For example, the marching cubes and mar-ching
squares algorithms are implemented as filters.
The same is true for decimation, sampling,
geometry extraction, threshol-ding, particle and
many other algorithms.
44The visualization pipeline in vtk
- The simplest pipeline includes a source, a mapper
and an actor. - To be seen, actors must be associated with a
renderer and the renderer associated to a window.
45The visualization pipeline in vtk
46Case study
- We will now see and briefly discuss the
application of vtk to meteorological data. - The data was provided by the Lisbon
Meteorological Institute (IM) for use in a course
of Computer Graphics for physics students.
47Case study
- The data were collected with intervals of six
hours between April 5 at 12h and April 6 at 12h. - Physical quantities measured are Tempera-ture,
Humidity, Altitude and Wind velocity along the
parallel and along the meridian.
48Case study
- The grid is topologically and geometrically
regular (cartesian grid), covering a region from
-45º W to 45º E and from 80º N to 20º N, at 0.5º
intervals. - This means a total of 108000 data points for each
physical quantity.
49Case study
- The data were measured at the so called
mid-atmosphere, defined as the 500 hPa
isobaric. - We will start by having a look at the data using
WebWinds, a visualization program developped by
the Jet Propulsion Lab (http//www.jpl.nasa.gov/di
rectory)
50Case study
- WebWinds is also object-oriented, but the objects
are provided with a complete inter-face and a
visual programming approach was adopted.
51Case study
- Now the vtk application.
- First the essential parts of the Tcl code.
52Case study
- Create RenderWindow and Renderer
- vtkRenderer ren1
- vtkRenderWindow renWin
- renWin AddRenderer ren1
53Case study
- Get the Temperature data
- vtkStructuredPointsReader reader
- reader SetFileName "dados_meteo_T_vtk.vtk"
- reader Update
54Case study
- Extract planes for each time slice
- Plane 0
- vtkStructuredPointsGeometryFilter compPlane
- compPlane SetInput reader GetOutput
- compPlane SetExtent 0 200 0 200 0 0
- vtkPolyDataMapper planeMapper
- planeMapper SetInput compPlane GetOutput
55Case study
- planeMapper ScalarVisibilityOn
- eval planeMapper SetScalarRange reader
GetOutput GetPointData GetScalars GetRange - vtkActor planeActor
- planeActor SetMapper planeMapper
- planeMapper SetColorModeToLuminance
- planeActor GetProperty SetRepresentationToSurfac
e
56Case study
- Plane 1
- .....
- Plane 2
- .....
- Plane 3
- .....
- Plane 4
- .....
57Case study
- Cut data using a plane
- vtkPlane plane
- Plane contains the volume center
- eval plane SetOrigin reader GetOutput
GetCenter - and is parallel to the latitude and time axis
- plane SetNormal 1 0 0
- vtkCutter planeCut
58Case study
- planeCut SetInput reader GetOutput
- planeCut SetCutFunction plane
- vtkDataSetMapper cutMapper
- cutMapper SetInput planeCut GetOutput
- cutMapper SetColorModeToLuminance
- eval cutMapper SetScalarRange reader
GetOutput GetPointData GetScalars GetRange - vtkActor cutActor
- cutActor SetMapper cutMapper
59Case study
- Draw the outline
- vtkOutlineFilter outline
- outline SetInput reader GetOutput
- vtkPolyDataMapper outlineMapper
- outlineMapper SetInput outline GetOutput
- vtkActor outlineActor
- outlineActor SetMapper outlineMapper
- eval outlineActor GetProperty SetColor 0 0 0
60Case study
- Add actors to the renderer
- ren1 AddActor outlineActor
- ren1 AddActor planeActor
- ren1 AddActor planeActor1
- ren1 AddActor planeActor2
- ren1 AddActor planeActor3
- ren1 AddActor planeActor4
- ren1 AddActor cutActor
61Case study
- Adjust camera
- set cam1 ren1 GetActiveCamera
- cam1 SetClippingRange 3.95297 50
- cam1 SetFocalPoint 0 50 3
- cam1 SetPosition 0 28 -200
- cam1 ComputeViewPlaneNormal
- cam1 SetViewUp 0 -0.99 0.06
62Case study
- Get the rendering done!
- renWin Render
63Case study
- Now we are ready to play with the application
itself
64Case Study
- Thank you for your attention!