<div dir="ltr">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.<div>
<br></div><div>Regards,</div><div style>Manuel.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 13, 2013 at 3:18 PM, Manuel Corrales <span dir="ltr"><<a href="mailto:manuelcorrales@gmail.com" target="_blank">manuelcorrales@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have a very simple code (python, but it's simple):<div><br></div><div><div><font face="courier new, monospace">import vtk</font></div>
<div><span style="font-family:'courier new',monospace"># Reader</span><br>
</div><div><font face="courier new, monospace">reader = vtk.vtkDICOMImageReader()</font></div><div><font face="courier new, monospace">reader.SetDirectoryName("folderWithDICOMImages/")<span style="white-space:pre-wrap">        </span></font></div>
<div><font face="courier new, monospace">reader.Update()<span style="white-space:pre-wrap">        </span></font></div><div><span style="font-family:'courier new',monospace"><br></span></div><div><span style="font-family:'courier new',monospace"># Mapper</span><br>
</div><div><font face="courier new, monospace">mapper = vtk.vtkImageSliceMapper()</font></div><div><font face="courier new, monospace">mapper.SetInputConnection(reader.GetOutputPort())<span style="white-space:pre-wrap">                </span></font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"># Actor</font></div><div><font face="courier new, monospace">actor = vtk.vtkImageActor()</font></div><div><font face="courier new, monospace">actor.SetMapper(mapper)</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"># Renderer</font></div><div><font face="courier new, monospace">renderer = vtk.vtkRenderer()</font></div><div><font face="courier new, monospace">renderer.AddViewProp(actor)<span style="white-space:pre-wrap">        </span></font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"># Window</font></div><div><font face="courier new, monospace">renwin = vtk.vtkRenderWindow()</font></div><div><font face="courier new, monospace">renwin.SetSize(500, 500)</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">renwin.AddRenderer(renderer)</font></div><div><font face="courier new, monospace">renwin.Render()<span style="white-space:pre-wrap">        </span></font></div>
</div><div><font face="courier new, monospace"><span style="white-space:pre-wrap"><br></span></font></div><div><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">This code works fine when executed in vtkpython. My problem is when I call </font></span></div>
<div><span><span style="white-space:pre-wrap"><font face="courier new, monospace"><br></font></span></span></div><div><span><span style="white-space:pre-wrap"><font face="courier new, monospace">mapper.SetSliceNumber(1)</font></span><br>
</span></div><div><span><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif"><br></font></span></span></div><div><span><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">and render the window again, the window goes black. Why is not showing the slice? The images have 12 slices because </font></span></span><span style="white-space:pre-wrap"><font face="courier new, monospace">mapper.GetSliceNumberMaxValue() </font><font face="arial, helvetica, sans-serif">says so.</font></span></div>
<div><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Any help?</font></span></div><div>
<span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Thanks.</font></span></div><span class="HOEnZb"><font color="#888888"><div>
<span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Manuel.</font></span></div>
<div><span style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><br></div></font></span></div>
</blockquote></div><br></div>