[vtkusers] How to save a updated image etc..
Koichiro Suzuki
suz at mito.ssd.ssg.fujitsu.com
Sun Feb 6 09:19:49 EST 2005
Hello all.
Are there good ideas?
1. How to save a updated image
I would like to save a new image after updating the camera position, cutting pl
ane
and so on. But I can't save the updated image after changing these value.
The following code changes azimuth and saves images. But "camara.1.jpg"
is just same as "camera.0.jpg".
My coding is wrong..?
---------------------------------------------------------------
package require vtk
package require vtkinteraction
package require vtktesting
vtkPLOT3DReader pl3d
pl3d SetXYZFileName "$VTK_DATA_ROOT/Data/combxyz.bin"
pl3d SetQFileName "$VTK_DATA_ROOT/Data/combq.bin"
pl3d SetScalarFunctionNumber 100
pl3d SetVectorFunctionNumber 202
pl3d Update
vtkStructuredGridGeometryFilter plane
plane SetInput [pl3d GetOutput]
plane SetExtent 1 60 1 60 7 7
vtkLookupTable lut
vtkPolyDataMapper planeMapper
planeMapper SetLookupTable lut
planeMapper SetInput [plane GetOutput]
eval planeMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]
vtkActor planeActor
planeActor SetMapper planeMapper
vtkStructuredGridOutlineFilter outline
outline SetInput [pl3d GetOutput]
vtkPolyDataMapper outlineMapper
outlineMapper SetInput [outline GetOutput]
vtkActor outlineActor
outlineActor SetMapper outlineMapper
lut SetNumberOfColors 256
lut Build
for {set i 0} {$i<16} {incr i 1} {
eval lut SetTableValue [expr $i*16] $red 1
eval lut SetTableValue [expr $i*16+1] $green 1
eval lut SetTableValue [expr $i*16+2] $blue 1
eval lut SetTableValue [expr $i*16+3] $black 1
}
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
ren1 AddActor outlineActor
ren1 AddActor planeActor
ren1 SetBackground 0.1 0.2 0.4
ren1 TwoSidedLightingOff
renWin SetSize 250 250
set cam1 [ren1 GetActiveCamera]
renWin Render
# write a initial image
vtkWindowToImageFilter w2i
w2i SetInput renWin
vtkJPEGWriter writer
writer SetInput [w2i GetOutput]
writer SetFileName "camara.0.jpg"
writer Write
# changing Azimuth
$cam1 Azimuth 30
renWin Render
# write a updated image , but the written image is not updated
w2i Update
writer SetFileName "camara.1.jpg"
writer Write
exit
---------------------------------------------------------------
2. How to get the grid mesh size
The above code uses a vtkPLOT3DReader class.
Can we get the grid mesh size ?
We could "SetExtent 1 60 1 60 7 7" ,if we knew sizes previosly.
But I would like to get sizes dinamically.
Best regards.
Koichiro Suzuki
suz at mito.ssd.ssg.fujitsu.com
More information about the vtkusers
mailing list