# How to open Nrrd File using mapper/actor

**URL:** https://discourse.vtk.org/t/how-to-open-nrrd-file-using-mapper-actor/1202
**Category:** Development
**Created:** [June 24, 2019, 8:50am UTC](https://discourse.vtk.org/t/how-to-open-nrrd-file-using-mapper-actor/1202 "2019-06-24T08:50:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Script\_K](https://discourse.vtk.org/user_avatar/discourse.vtk.org/script_k/32/476_2.png) [@Script\_K](https://discourse.vtk.org/u/Script_K)
#### Post date: [June 24, 2019, 8:50am UTC](https://discourse.vtk.org/t/how-to-open-nrrd-file-using-mapper-actor/1202/1 "2019-06-24T08:50:16Z")

</div>

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()

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 24, 2019, 11:58am UTC](https://discourse.vtk.org/t/how-to-open-nrrd-file-using-mapper-actor/1202/2 "2019-06-24T11:58:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Script\_K](https://discourse.vtk.org/user_avatar/discourse.vtk.org/script_k/32/476_2.png) [@Script\_K](https://discourse.vtk.org/u/Script_K)
#### Post date: [June 25, 2019, 12:06am UTC](https://discourse.vtk.org/t/how-to-open-nrrd-file-using-mapper-actor/1202/3 "2019-06-25T00:06:26Z")

</div>

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