Hello David,<div><br></div><div>I was already trying to position the camera based on the normal and origin, which worked quite well to start well. Combined with some of your tips, this seems to be the best solution for now, thank you for that :)</div>

<div><br></div><div>I guess that the vtkShader2 error has something to do with some other change from 5.6 to 5.9. This is not a big problem, since it occurs when the  program is terminating (and the destructors are called).</div>

<div><br></div><div>Cheers,</div><div>Tijmen<br><br><div class="gmail_quote">On Thu, Sep 22, 2011 at 5:20 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Timjen,<br>
<br>
The vtkImageSlice class is a vtkProp3D, so the only way to view the<br>
slice like a 2D image is to move the camera into the right position.<br>
So you will need to write some code that will set the camera<br>
orientation from the normal of your plane.  It isn&#39;t that hard to do,<br>
just follow these steps:<br>
<br>
1) call camera-&gt;ParallelProjectionOn(), you don&#39;t want perspective in a 2D view<br>
2) call camera-&gt;SetParallelScale(100), use the image size in place of 100<br>
3) call renderer-&gt;ResetCamera() to automatically set the camera focal point<br>
4) use the following code to set the view:<br>
<br>
double focalPoint[3];<br>
double camPosition[3];<br>
double camDistance = camera-&gt;GetDistance();<br>
camera-&gt;GetFocalPoint(focalPoint);<br>
camPosition[0] = focalPoint[0] + camDistance*normal[0];<br>
camPosition[1] = focalPoint[1] + camDistance*normal[1];<br>
camPosition[2] = focalPoint[2] + camDistance*normal[2];<br>
camera-&gt;SetPosition(position);<br>
camera-&gt;SetViewUp(0,1,0); // whatever &quot;up&quot; should be<br>
renderer-&gt;ResetCameraClippingRange();<br>
<br>
Use SetParallelScale() to change the magnification and<br>
use SetViewUp() to change the rotation around the normal.<br>
<br>
The ResampleToScreenPixels() doesn&#39;t do what you think.<br>
It is just a quality setting.<br>
<br>
I can&#39;t answer about the vtkShader2 object, the slice rendering does<br>
not use shaders.<br>
<font color="#888888"><br>
 - David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Thu, Sep 22, 2011 at 5:03 AM, Tijmen Klein &lt;<a href="mailto:T.R.Klein@student.rug.nl">T.R.Klein@student.rug.nl</a>&gt; wrote:<br>
&gt; Hi David,<br>
&gt; This is exactly what I was looking for, thank you! Got the newest VTK<br>
&gt; version from git, compiled it and modified my program<br>
&gt; (using <a href="http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/ImageProcessing/Python/ImageInteractorReslice.py" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/ImageProcessing/Python/ImageInteractorReslice.py</a> as<br>


&gt; an example). vtkImageResliceMapper really makes a world of difference, and<br>
&gt; makes the slicing a lot easier.<br>
&gt; However, there is still one small issue for me. I would like to display this<br>
&gt; slice as if it was a 2D image. Would you have an idea how to do this? If I<br>
&gt; simply add the vtkImageSlice to my renderer, it shows up at the exact<br>
&gt; location of the cut (which is to be expected). I could set the camera<br>
&gt; position + focal point based on the origion and normal of the cutting plane,<br>
&gt; but I would like the slice to fill the whole viewport. The<br>
&gt; method  ResampleToScreenPixelsOn() seems to be designed to do this, using<br>
&gt; this however does not change a thing for me.<br>
&gt; Cheers,<br>
&gt; Tijmen<br>
&gt;<br>
&gt; On Wed, Sep 21, 2011 at 5:06 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Tijmen,<br>
&gt;&gt;<br>
&gt;&gt; If you are able to grab the devel version of VTK from git, your<br>
&gt;&gt; best option is to use the new image rendering classes:<br>
&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes" target="_blank">http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes</a><br>
&gt;&gt; The vtkImageResliceMapper has a method called SetSlicePlane(),<br>
&gt;&gt; so all you have to do is set the image as the input, then set the<br>
&gt;&gt; plane you want to slice with.  The mapper will do everything else.<br>
&gt;&gt;<br>
&gt;&gt;  - David<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Sep 21, 2011 at 3:42 AM, Tijmen Klein &lt;<a href="mailto:T.R.Klein@student.rug.nl">T.R.Klein@student.rug.nl</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hello Everyone,<br>
&gt;&gt; &gt; I have a volume that I cut off using a vtkPlane<br>
&gt;&gt; &gt; (volume-&gt;AddClippingPlane()), which works really well. But sometimes I<br>
&gt;&gt; &gt; also<br>
&gt;&gt; &gt; need to show to cut itself. First I tried to use a vtkCutter for this,<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; geometry of the output is fine, but the texture is incorrect.<br>
&gt;&gt; &gt; So I&#39;m now used a vtkImageReslice, which gives the desired output.<br>
&gt;&gt; &gt; However,<br>
&gt;&gt; &gt; the textured plane of the output does not always cover the whole area of<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; vtkCutter. For example, see this<br>
&gt;&gt; &gt; image: <a href="http://dl.dropbox.com/u/27566470/slice_and_cut.png" target="_blank">http://dl.dropbox.com/u/27566470/slice_and_cut.png</a> The red bar<br>
&gt;&gt; &gt; indicates the geometry of the vtkCutter, the blue plane is the slice of<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; vtkImageReslice.<br>
&gt;&gt; &gt; How can I make sure that the output of vtkImageReslice covers the whole<br>
&gt;&gt; &gt; vtkCutter? I have the feeling that my current method is too complex. I<br>
&gt;&gt; &gt; want<br>
&gt;&gt; &gt; an output that is equal to the output of creating a slice in Paraview.<br>
&gt;&gt; &gt; Cheers,<br>
&gt;&gt; &gt; Tijmen<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>