[vtkusers] Issue when changing slice on DICOM series

Manuel Corrales manuelcorrales at gmail.com
Thu Jun 13 16:46:37 EDT 2013


More information. Setting slices 0 and 1 seems to work (image change and is
displayed) but setting slices > 1 gives me a black window.


On Thu, Jun 13, 2013 at 3:46 PM, Manuel Corrales
<manuelcorrales at gmail.com>wrote:

> Adding more information to this, I can use the imageViewer and that works
> fine when changing slices using imageViews->SetSlice but I would like to
> have more control and have the instances of mapper, actor and interactor
> myself.
>
> Regards,
> Manuel.
>
>
> On Thu, Jun 13, 2013 at 3:18 PM, Manuel Corrales <manuelcorrales at gmail.com
> > wrote:
>
>> 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/7b3201a6/attachment.htm>


More information about the vtkusers mailing list