Thank you David,<br><br><br>I am going to inquire about vtkCamera and vtkViewPort to better understand...<br><br>I completely agree with you with the fact that I can easily resolve the problem of my example with a simple zoom of the camera...<br>
<br>=&gt; if I was sure to be in the case 1 (27,5 &lt; 60), I could resolve all my problems with a zoom, and after that it would be easy to convert the coordinates of the window(mouse) to coordinates of the images.<br><br>
But what about the case 2 (80&gt;60)...?<br>Even if I do a &quot;negative zoom&quot;, I have the impression that it would be &quot;too late&quot;, I mean the image had already been cropped and a &quot;negative&quot; zoom would just display new black borders top and down (instead of the 10 cm top and down of the coronal image)<br>
<br>I hope you understand, it&#39;s not so easy to explain...<br><br>Concerning this case, I just wanted to ask you a last question...<br><br>I think I found something interresting in the vtkImageReslice documentation (<a href="http://www.vtk.org/doc/nightly/html/classvtkImageReslice.html#ce80eced5f32389efe97e72612dec960">http://www.vtk.org/doc/nightly/html/classvtkImageReslice.html#ce80eced5f32389efe97e72612dec960</a>) :<br>
<br><table class="memname"><tbody><tr><td class="memname">virtual void vtkImageReslice::SetAutoCropOutput           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname">          <br></td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [virtual]</code></td>
        </tr>
      </tbody></table>

<div class="memdoc">

<p>
<span style="font-family: courier new,monospace;">Turn this on if you want to guarantee that the extent of the output
will be large enough to ensure that none of the data will be cropped
(default: Off). </span><br></p><p><br></p><p>I&#39;m a newbie in vtk and I wanted to have your opinion : don&#39;t you think it&#39;s what I&#39;m looking for (to resolve the &quot;case 2&quot;)?</p><p><br></p><p><br></p>
<p>I think it&#39;s the last time that I annoy you today with my problem ;-)</p><p><br></p><p>Have a very nice day,</p><p><br></p><p><br></p><p>Stéphane<br></p></div><br><br><br><div class="gmail_quote">2008/11/11 David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Stephane,<br>
<br>
I think that I understand what you are trying to do, but I really<br>
think that your problem is because of the camera and not because of<br>
vtkImageReslice.<br>
<br>
The output of vtkImageReslice does have its own physical coordinate<br>
system: if we say that matrix &quot;A&quot; is the ResliceAxes, and (x,y,z)<br>
define the physical space of the axial image, and (x&#39;,y&#39;,z&#39;) define<br>
the physical space of the coronal image, the the following simple<br>
equation holds true:<br>
<br>
 &nbsp;[x;y;z] = A [x&#39;;y&#39;;z&#39;] &nbsp;(pretend these are column vectors)<br>
<br>
In this equation, (x,y,z) and (x&#39;,y&#39;,z&#39;) are real physical coordinates<br>
(i.e. in millimetres).<br>
<br>
These real, physical coordinates are being mapped to screen<br>
coordinates according to transformations that are done by the<br>
vtkCamera and by the ViewPort of the renderer. &nbsp;Unless you understand<br>
what the Camera and ViewPort are doing, you won&#39;t be able to map mouse<br>
coordinates to physical coordinates.<br>
<font color="#888888"><br>
 &nbsp; David<br>
</font><div><div></div><div class="Wj3C7c"><br>
On Tue, Nov 11, 2008 at 10:37 AM, Stéphane CALANDE &lt;<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>&gt; wrote:<br>
&gt; Thank you David, I&#39;ll try to change the background.<br>
&gt;<br>
&gt; But in fact, even if I saw that the borders were red, it wouldn&#39;t resolve my<br>
&gt; problem. I&#39;m going to explain you why...<br>
&gt;<br>
&gt;<br>
&gt; Here&#39;s what I&#39;d like :<br>
&gt;<br>
&gt; If I call something like :<br>
&gt;<br>
&gt; &quot;window.SetSize(x,y)&quot; (with x,y proportionnal to 60 x 27.5 =&gt; if you<br>
&gt; remember it is the real proportions of the coronal image)<br>
&gt;<br>
&gt; Have a look at <a href="http://info.fundp.ac.be/%7Escalande/borders2.PNG" target="_blank">http://info.fundp.ac.be/~scalande/borders2.PNG</a> to<br>
&gt; understand...<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; It is so important for me because I&#39;m creating an interface that allow the<br>
&gt; select a region of the image with the mouse...<br>
&gt; So I have to do a conversion between the mouse coordinates and the image<br>
&gt; coordinates.<br>
&gt;<br>
&gt;<br>
&gt; I&#39;ve another thing to say. In my example, the height of the coronal image is<br>
&gt; smaller than the height of the axial image. (60 &gt; 27.5)<br>
&gt; And so there are borders... But if it was the contrary, if the coronal image<br>
&gt; height was 80, for example...<br>
&gt;<br>
&gt; Would the image be croped of 10 on top and 10 on down?<br>
&gt;<br>
&gt;<br>
&gt; To avoid the borders in the first case (&lt;60) and the possible crop in the<br>
&gt; second case (&gt;60), it would be really nice if the coronal views created by<br>
&gt; ImageReslice were represented in their own &quot;physical space&quot; (instead of the<br>
&gt; axial views physical space).<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Do you understand better ?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I thank you one more time for the help,<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Stéphane<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2008/11/11 David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi Stephane,<br>
&gt;&gt;<br>
&gt;&gt; When you get back to you office, try setting the background of the<br>
&gt;&gt; renderer to red and I&#39;m sure that you will see that the borders are<br>
&gt;&gt; not part of the image.<br>
&gt;&gt;<br>
&gt;&gt; The reason that the borders don&#39;t disappear when you resize the window<br>
&gt;&gt; is that everything in the vtkRenderer gets resized when you resize the<br>
&gt;&gt; window. &nbsp;That is always the behavior of vtkImageActor or any other<br>
&gt;&gt; actor that is not a 2D actor: everything gets scaled relative to the<br>
&gt;&gt; window size.<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; David<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Nov 11, 2008 at 9:29 AM, Stéphane CALANDE &lt;<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hi vtk-list, hi David,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you very much for your answer.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I had already fixed the problem of zoom (that is not 1.0 by default)<br>
&gt;&gt; &gt; before.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; About the problem of the borders, I understand what you say, but I think<br>
&gt;&gt; &gt; that the borders are &quot;really&quot; included in the image.<br>
&gt;&gt; &gt; To be honnest, I can&#39;t try your advice beacuse I&#39;m not in my office<br>
&gt;&gt; &gt; today,<br>
&gt;&gt; &gt; but I can give you other details to prove that the borders are included<br>
&gt;&gt; &gt; in<br>
&gt;&gt; &gt; the image.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Even if I re-sized manually the window with the mouse (for example the<br>
&gt;&gt; &gt; height), all the image (the coronal subject and the borders) are<br>
&gt;&gt; &gt; proportionally reduced.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; (I&#39;ve tinkered a PNG to explain this. Have a look at :<br>
&gt;&gt; &gt; <a href="http://info.fundp.ac.be/%7Escalande/borders.PNG" target="_blank">http://info.fundp.ac.be/~scalande/borders.PNG</a><br>
&gt;&gt; &gt; But it&#39;s obviously not the real images because I&#39;m not in my office<br>
&gt;&gt; &gt; today,<br>
&gt;&gt; &gt; it&#39;s just to give an example of the same effect...)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; If the black borders were &quot;just&quot; the background, they should slowly<br>
&gt;&gt; &gt; disappear during the re-sizing of the window... But it&#39;s not the case...<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I really have the impression that the coronal views created by<br>
&gt;&gt; &gt; ImageReslice<br>
&gt;&gt; &gt; are represented in the same &quot;physic space&quot; than the basic axial views<br>
&gt;&gt; &gt; (representing the volume).<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Can my explanation help you to understand the problem?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you very much for your help,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Stéphane<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2008/11/10 David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Hi Stephane,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; The black borders that you see in this example are actually the<br>
&gt;&gt; &gt;&gt; background in the renderer. &nbsp;If you add<br>
&gt;&gt; &gt;&gt; &quot;renderer-&gt;SetBackground(1.0,0.0,0.0);&quot; to the example, then you will<br>
&gt;&gt; &gt;&gt; see the black bars turn to red.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; In other words, it isn&#39;t vtkImageReslice that is adding these borders.<br>
&gt;&gt; &gt;&gt; &nbsp;These borders are present because the RenderWindow is square, and<br>
&gt;&gt; &gt;&gt; vtkImageReslice has no control over the window size.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; So what you need to do is call window-&gt;SetSize() to set the size of<br>
&gt;&gt; &gt;&gt; the window to the size of your image. &nbsp;You can call Update() on<br>
&gt;&gt; &gt;&gt; ImageReslice and get the size of its output, so that you know what<br>
&gt;&gt; &gt;&gt; size to make the window.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Even after you do this, though, you will still have to do one more<br>
&gt;&gt; &gt;&gt; thing. &nbsp;By default, the zoom factor for camera is not 1.0. &nbsp;You will<br>
&gt;&gt; &gt;&gt; have to call add code like the following:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &nbsp;vtkCamera *camera = renderer-&gt;GetActiveCamera();<br>
&gt;&gt; &gt;&gt; &nbsp;camera-&gt;SetViewAngle(2.0*atan(0.5*height_of_image/camera_distance));<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Alternatively, you can switch to parallel projections, which makes the<br>
&gt;&gt; &gt;&gt; math easier but I&#39;m not sure if the VTK interactors all work properly<br>
&gt;&gt; &gt;&gt; in parallel mode:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &nbsp;camera-&gt;ParallelProjectionOn();<br>
&gt;&gt; &gt;&gt; &nbsp;camera-&gt;SetParallelScale(height_of_image);<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I hope this is what you were looking for,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &nbsp; &nbsp;David<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Mon, Nov 10, 2008 at 9:38 AM, Stéphane CALANDE &lt;<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I&#39;m trying &quot;ImageSlicing.cxx&quot; to display an &quot;coronal&quot; slice from a<br>
&gt;&gt; &gt;&gt; &gt; volume<br>
&gt;&gt; &gt;&gt; &gt; (multiple axial slices).<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; It works well, but there is just a problem.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Information about my axial slices :<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; SIZE : 512 x 512<br>
&gt;&gt; &gt;&gt; &gt; SPACING : (1,17188 ; 1,17188)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; &quot;REAL&quot; SIZE = 60 cm x 60 cm<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Information about the coronal slices that SHOULD be created<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; SIZE : 512 x 55<br>
&gt;&gt; &gt;&gt; &gt; SPACING : (1,17188 ; 5)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; &quot;REAL&quot; SIZE = 60 cm x 27.5 cm<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; But the problem is that the image created by &quot;ImageSlicing&quot; has the<br>
&gt;&gt; &gt;&gt; &gt; shape of<br>
&gt;&gt; &gt;&gt; &gt; a square.<br>
&gt;&gt; &gt;&gt; &gt; I mean it has the same shape than the axial images.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The representation of the coronal object is correct (good<br>
&gt;&gt; &gt;&gt; &gt; proportions)<br>
&gt;&gt; &gt;&gt; &gt; but<br>
&gt;&gt; &gt;&gt; &gt; there are 2 black borders (top and down)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Something like that :<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt; +++++++++++++++++++<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; (&#39;+&#39; = black)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; In fact, I&#39;d like the image to have the proportion &quot;60 x 27.5 &quot;<br>
&gt;&gt; &gt;&gt; &gt; (without<br>
&gt;&gt; &gt;&gt; &gt; any<br>
&gt;&gt; &gt;&gt; &gt; black borders...)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt; ---CORONAL IMAGE---<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Do you see what I mean ?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I&#39;ve searched in the methods of vtkImageReslice but I didn&#39;t find<br>
&gt;&gt; &gt;&gt; &gt; what<br>
&gt;&gt; &gt;&gt; &gt; I&#39;m<br>
&gt;&gt; &gt;&gt; &gt; looking for...<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Do you have any idea to help me ?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Any help would be appreciated ;-)<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thank you in advance !<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Stéphane<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; This is the private VTK discussion list.<br>
&gt;&gt; &gt;&gt; &gt; Please keep messages on-topic. Check the FAQ at:<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt; &gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>