Now, I want to use the isosurface
with vtkSmartVolumeMapper
. My code is:
import vtkmodules.all as vtk
import time
reader = vtk.vtkDICOMImageReader()
reader.SetDirectoryName('D:\\TestData\\20210811095000100001')
reader.Update()
img = reader.GetOutput()
mapper = vtk.vtkSmartVolumeMapper()
mapper.SetInputData(img)
mapper.SetBlendModeToIsoSurface()
mapper.Update()
actor = vtk.vtkVolume()
actor.SetMapper(mapper)
actor.GetProperty().GetIsoSurfaceValues().SetValue(0, 300)
color = vtk.vtkColorTransferFunction()
color.AddRGBPoint(300, 0, 0, 1)
actor.GetProperty().SetColor(0, color)
actor.Update()
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
renderer.SetBackground(1, 1, 1)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(renderer)
renWin.Render()
iren = vtk.vtkRenderWindowInteractor()
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
iren.SetRenderWindow(renWin)
iren.Initialize()
iren.Start()
The result is:
It do not has any shadow. How to add shadow for the actor?
I want to try actor.GetProperty().SetInterpolationToPhong()
, but the vtkVolumeProperty
has no SetInterpolationToPhong
method.
Any suggestion is appreciated~~~