[vtkusers] Rendering two isosurfaces (vtkVolumeRayCastIsosurfaceFunction)
Greg051
gd0514 at gmail.com
Mon Dec 20 10:22:33 EST 2010
Hello,
I try to render two different isosurfaces values but
it does not work as expected.
Is there a way to render the two isosurfaces in the same renderer ?
Please look at the tcl code below and the attached image.
Is there a way to add transparency to the rendering ?
http://vtk.1045678.n5.nabble.com/file/n3312127/IsoSurfaces.jpg
#Filename: TestRayCastIsosurface.tcl
package require vtk
package require vtkinteraction
# create pipeline
vtkVolume16Reader v16
v16 SetDataDimensions 64 64
[v16 GetOutput] SetOrigin 0.0 0.0 0.0
v16 SetDataByteOrderToLittleEndian
v16 SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
v16 SetImageRange 1 93
v16 SetDataSpacing 3.2 3.2 1.5
# first actor
vtkColorTransferFunction constColorTransferFunc
constColorTransferFunc RemoveAllPoints
constColorTransferFunc AddRGBPoint 0.0 1.0 0.0 0.0
constColorTransferFunc AddRGBPoint 255.0 1.0 0.0 0.0
vtkVolumeProperty volumeProperty
volumeProperty SetColor constColorTransferFunc
volumeProperty ShadeOn
volumeProperty SetInterpolationType 1
vtkVolumeRayCastIsosurfaceFunction isosurfaceFunc
isosurfaceFunc SetIsoValue 127
vtkVolumeRayCastMapper volumeRayCastMapper
volumeRayCastMapper SetInput [v16 GetOutput]
volumeRayCastMapper SetVolumeRayCastFunction isosurfaceFunc
vtkVolume actor
actor SetMapper volumeRayCastMapper
actor SetProperty volumeProperty
# second actor
vtkColorTransferFunction constColorTransferFunc2
constColorTransferFunc2 RemoveAllPoints
constColorTransferFunc2 AddRGBPoint 0.0 0.0 0.0 1.0
constColorTransferFunc2 AddRGBPoint 255.0 0.0 0.0 1.0
vtkVolumeProperty volumeProperty2
volumeProperty2 SetColor constColorTransferFunc2
volumeProperty2 ShadeOn
volumeProperty2 SetInterpolationType 1
vtkVolumeRayCastIsosurfaceFunction isosurfaceFunc2
isosurfaceFunc2 SetIsoValue 30
vtkVolumeRayCastMapper volumeRayCastMapper2
volumeRayCastMapper2 SetInput [v16 GetOutput]
volumeRayCastMapper2 SetVolumeRayCastFunction isosurfaceFunc2
vtkVolume actor2
actor2 SetMapper volumeRayCastMapper2
actor2 SetProperty volumeProperty2
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
[iren GetInteractorStyle] SetCurrentStyleToTrackballCamera
vtkCamera camera
ren1 SetActiveCamera camera
ren1 AddActor actor
ren1 AddActor actor2
ren1 SetBackground 1 1 1
renWin SetSize 400 400
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.0
renWin Render
# prevent the tk window from showing up then start the event loop
wm withdraw .
--
View this message in context: http://vtk.1045678.n5.nabble.com/Rendering-two-isosurfaces-vtkVolumeRayCastIsosurfaceFunction-tp3312127p3312127.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list