I want to Display a 3D image with the vtk module python. The image was saved in .vti format. I wrote the following simple code but it does not work correctly. How i can fix that?
import vtk
file_name = 'Vug.vti'
# Read the source file.
reader = vtk.vtkNrrdReader()
reader.SetFileName(file_name)
reader.Update()
# Map the image through the lookup table
color = vtk.vtkImageMapToColors()
#color.SetLookupTable(table)
color.SetInputConnection(reader.GetOutputPort())
# Display the image
actor = vtk.vtkImageActor()
actor.GetMapper().SetInputConnection(color.GetOutputPort())
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
# Set up the interaction
interactor = vtk.vtkRenderWindowInteractor()
window.SetInteractor(interactor)
window.Render()
# Start interaction
interactor.Start()