<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 class="" style="white-space:pre"> </span></font></div>
<div><font face="courier new, monospace">reader.Update()<span class="" style="white-space:pre"> </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 class="" style="white-space:pre"> </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 class="" style="white-space:pre"> </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 class="" style="white-space:pre"> </span></font></div>
</div><div><font face="courier new, monospace"><span class="" style="white-space:pre"><br></span></font></div><div style><span class="" style="white-space:pre"><font face="arial, helvetica, sans-serif">This code works fine when executed in vtkpython. My problem is when I call </font></span></div>
<div style><span class=""><span style="white-space:pre"><font face="courier new, monospace"><br></font></span></span></div><div style><span class=""><span style="white-space:pre"><font face="courier new, monospace">mapper.SetSliceNumber(1)</font></span><br>
</span></div><div style><span class=""><span style="white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></span></div><div style><span class=""><span style="white-space:pre"><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"><font face="courier new, monospace">mapper.GetSliceNumberMaxValue() </font><font face="arial, helvetica, sans-serif">says so.</font></span></div>
<div style><span style="white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div style><span style="white-space:pre"><font face="arial, helvetica, sans-serif">Any help?</font></span></div><div style>
<span style="white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div style><span style="white-space:pre"><font face="arial, helvetica, sans-serif">Thanks.</font></span></div><div style><span style="white-space:pre"><font face="arial, helvetica, sans-serif">Manuel.</font></span></div>
<div style><span class="" style="white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><br></div></div>