[vtkusers] How to start?

Roger Blum roger_blum at swissonline.ch
Thu Aug 18 03:32:57 EDT 2005


Hi vtk users,

I am completely new to vtk and do not know where to start looking for 
information.
I have the "VTK User Guide" and the "Visualization Toolkit" books. There is 
a lot
of information, but I do not find what I need to solve my problem.

I want do build a GUI with Tcl/Tk for the visualization of a simulation. In 
a first step
- I want to have a background consisting of geographic maps (3500x2400 
pixels each)
  - The simulation area can be big, so the maps may have to be assembled
  ----------------------------
  |                    |                   |
  |     MAP 1   |     MAP 2   |
  |                    |                   |
  ----------------------------
  |                    |                   |
  |     MAP 3   |     MAP 4   |
  |                    |                   |
  ----------------------------

- There can additional information be displayed (user can switch on/off)
   - Special areas like ellipses and rectangels
   - Lines and text

- There are actors moving around in the scene
   - Actors should be displayed as a symbol (marker)
   - User should be able to interact with the actors (select them)

The following code snipet shows what I tried so far:

##################
package require vtk
package require vtkinteraction

vtkTkRenderWidget .r -width 800 -height 600
pack .r -fill both -expand yes
::vtk::bind_tk_render_widget .r
set renwin [.r GetRenderWindow]

# Create a renderer
vtkRenderer ren
$renwin AddRenderer ren
$renwin SetNumberOfLayers 1

ren SetBackground 0.6 0.6 0.6

# Read the file
vtkTIFFReader reader
  reader SetFileName "KOMB_1e.tif"
  reader SetDataExtent 0 3500 0 2400 0 0
  reader SetDataSpacing 1 1 1
  reader SetDataOrigin 0 0 0
  reader UpdateWholeExtent

# Create a mapper
vtkImageMapper mapper
mapper SetInput [reader GetOutput]

# Create an actor
vtkActor2D act
act SetMapper mapper

# Add the actor to the renderer and render the window
ren AddActor act
$renwin Render

##################

I can see the map displayed in the vtk window, but the colors are not clear. 
What I see can be influenced
by "ren SetBackground 0.6 0.6 0.6". I also can not pan/zoom the window.
How do I correctly display this TIFF image?
How can I have pan/zoom functionality (as in some of the examples)?

Can I have layers (for the additional objects to be displayed) that can be 
turned on/off?
Is a layer just an other vtkRenderer to add to vtkRenderWindow?

Do I have to create a vtkActor for every actor of the simulation?
How do I interact with those?
What kind of actor do I choose, to display it as a symbol at a specific 
coordinate?

That's all for the beginning, but I am sure there will be more questions.
Any help is very much appreciated!

Thanks,
Roger






More information about the vtkusers mailing list