Hi everyone,<br>
<br>
vtkImageViewer2 allows the user to set the slice orientation to XY, XZ
and YZ planes. I am trying to implement the same functionality in
vtkImageViewer.<br>
<br>
I call the SetExtent function on the input image data but it does not
seem to have any effect in the displayed slice. It always displays the
slice in the XY plane regardless of the extent values.<br>
<br>
So, I have something like:<br>
<br>
vtkImageData *input = this-&gt;GetInput();<br>
<br>
if (!input || !this-&gt;ImageMapper)<br>
{<br>
&nbsp;&nbsp; &nbsp;return;<br>
}<br>
<br>
input-&gt;UpdateInformation();<br>
int *w_ext = input-&gt;GetWholeExtent();<br>
<br>
// Is the slice in range ? If not, fix it<br>
int slice_min = w_ext[this-&gt;m_sliceOrientation * 2];<br>
int slice_max = w_ext[this-&gt;m_sliceOrientation * 2 + 1];<br>
<br>
if (this-&gt;m_slice &lt; slice_min || this-&gt;m_slice &gt; slice_max)<br>
{<br>
&nbsp;&nbsp; &nbsp;this-&gt;m_slice = static_cast&lt;int&gt;((slice_min + slice_max) * 0.5);<br>
}<br>
<br>
// Set the image actor<br>
switch (this-&gt;m_sliceOrientation)<br>
{<br>
&nbsp;&nbsp; &nbsp;case MyViewer::SliceOrientation_XY:<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;input-&gt;SetExtent(<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;w_ext[0], w_ext[1], w_ext[2], w_ext[3], this-&gt;m_slice, this-&gt;m_slice);<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br>
<br>
&nbsp;&nbsp; &nbsp;case MyViewer::SliceOrientation_XZ:<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;input-&gt;SetExtent(<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;w_ext[0], w_ext[1], this-&gt;m_slice, this-&gt;m_slice, w_ext[4], w_ext[5]);<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br>
<br>
&nbsp;&nbsp; &nbsp;case MyViewer::SliceOrientation_YZ:<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;input-&gt;SetExtent(<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;this-&gt;m_slice, this-&gt;m_slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5]);<br>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br>
}<br>
<br>
However, it always renders the first slice in the XY plane. Any ideas on how to fix this?<br>
<br>
Thanks,<br>
<br>
Anna