How to open Nrrd File using mapper/actor

Hi.

I want to make a program that prints the nrrd file.

I wrote the code like this and it prints only black screen with nothing.

I can not find any problems with other code.

I would appreciate it if you could see what went wrong.

from dot import *
import vtk
import dot

def main():
renWin = vtk.vtkRenderWindow()
renderer = vtk.vtkRenderer()
renWin.AddRenderer(renderer)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

> reader = vtk.vtkNrrdReader()
reader.SetFileName('Segmentation-label_2.nrrd')
reader.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(reader.GetOutputPort())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

renderer.AddActor(actor)

iren.Initialize()
renWin.Render()
iren.Start()

if name == ‘main’:
main()

You load an image (vtkImageData) and you try to display it using a mapper that requires a surface mesh (vtkPolyData) as input. You can either display the image using an image mapper, or convert the image to a surface mesh (using contour filter) and display it using a polydata mapper.

Thanks your reply.
nrrd file can open using vtkImageData?
now i am trying it is not work…