[vtkusers] Some question about the vtk 3.2 and 4.2

Wei Guo weiguo at cs.utah.edu
Tue Sep 20 16:40:14 EDT 2005


Hi, all,

I thought that this should be a old question but I can not find it in the
archives.

I had written some program in tcl for vtk 3.2 which runs great and tried
to run them in the vtk 4.2 but the problem is that the vtk seems to be
frozen: take more than 30 mins for display and can not have a look
interactively. I fixed some  problems like modifying the name of old
expired method, so no error msg comes.

Could someone give me some advice on that?

Thanks,

Wei

# vtk program for the isosurface

catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL
"../examplesTcl" }
if { [catch {set VTK_DATA $env(VTK_DATA)}] != 0} { set VTK_DATA
"../vtkdata" }


# Read the data

vtkStructuredPointsReader reader
    reader SetFileName $VTK_DATA/data.vtk

# Put the data to the isosurface

vtkContourFilter contour
  contour SetInput [reader GetOutput]
  contour SetValue 0 0.000000

#0.000000000000000000000000001

vtkPolyDataMapper mapper
  mapper SetInput [contour GetOutput]
  mapper SetScalarRange -100 100
  mapper SetColorModeToMapScalars

# set up the actor

vtkActor vActor
  vActor SetMapper mapper

# Create the RenderWindow, Renderer
#
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# Add the actors to the renderer, set the background and size
#
ren1 AddActor vActor
ren1 SetBackground 0 1 1
renWin SetSize 300 300

# render the image
#
iren AddObserver {wm deiconify .vtkInteract}
set cam1 [ren1 GetActiveCamera]
$cam1 Elevation -100
$cam1 Zoom 1.4
iren Initialize

# interface for the debug
frame .f
label .f.l -text "Isovalue"
scale .f.i -from -5 -to 60 -orient horizontal -command SetIsoValue
button .f.draw -text "Redraw" -command {ren1 Render}
button .f.quit -text "Quit" -command {exit}
pack .f.l .f.i .f.draw .f.quit
pack .f

#####
proc SetIsoValue {value} {
    set A [expr [.f.i get]/1.0]

    contour SetValue 0 [expr [.f.i get]/0.100]

    [vActor GetMapper] SetInput [contour GetOutput]

    renWin Render
}


#wm withdraw .





More information about the vtkusers mailing list