[vtkusers] Issue when changing slice on DICOM series

Manuel Corrales manuelcorrales at gmail.com
Thu Jun 13 14:18:54 EDT 2013


I have a very simple code (python, but it's simple):

import vtk
# Reader
reader = vtk.vtkDICOMImageReader()
reader.SetDirectoryName("folderWithDICOMImages/")
reader.Update()

# Mapper
mapper = vtk.vtkImageSliceMapper()
mapper.SetInputConnection(reader.GetOutputPort())

# Actor
actor = vtk.vtkImageActor()
actor.SetMapper(mapper)

# Renderer
renderer = vtk.vtkRenderer()
renderer.AddViewProp(actor)

# Window
renwin = vtk.vtkRenderWindow()
renwin.SetSize(500, 500)

renwin.AddRenderer(renderer)
renwin.Render()

This code works fine when executed in vtkpython. My problem is when I call

mapper.SetSliceNumber(1)

and render the window again, the window goes black. Why is not showing the
slice? The images have 12 slices because mapper.GetSliceNumberMaxValue() says
so.

Any help?

Thanks.
Manuel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130613/de31321c/attachment.htm>


More information about the vtkusers mailing list