Hi David,<br><br>Thanks for the explanation. I totally missed the postmultiply order. So basically, this affects the order in which the transformations are put on the stack, right?<br><br>Also, back to the original question... It should be then enough to provide the actual pixel values as translation values.
<br><br>So, if you imagine that I have a volume that has the dimensions: 256 X 256 X 120 and I want to traslate to 100, 100,&nbsp; 50... and then rotate 30 degrees...<br><br>I should have:<br><br>myTransform-&gt;PostMultiply();
<br>myTransform-&gt;Translate(100, 100, 50);<br>myTransform-&gt;RotateX(30);<br>myTransform-&gt;Translate(-100, -100, -50);<br><br>Cheers and many thanks,<br>Anja<br>&nbsp;<br><br><div><span class="gmail_quote">On 19/09/06, <b class="gmail_sendername">
David Gobbi</b> &lt;<a href="mailto:dgobbi@atamai.com">dgobbi@atamai.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Anja,<br><br>When you use vtkTransform with vtk image data, it takes the Spacing and<br>Origin of the data into account.<br><br>You have to be careful about the PreMultiply(), PostMultiply() state of<br>the transform, though.&nbsp;&nbsp;These are two vtkTransform methods that you use
<br>to control whether the rotation, translations, etc. that you apply to a<br>vtkTransform should occur before, or after the transformation already<br>represented by the vtkTransform.<br><br>For example: let's say that you have a vtkTransform whose matrix is M.
<br><br>If you do transform-&gt;PostMultiply(), and then perform a rotation R<br>(where R is a 4x4 matrix), then the new matrix value M for the transform<br>will be given by the following equation:<br><br> M = R M&nbsp;&nbsp;(the new M is the product of matrices R and the old value of M)
<br><br>If you do transform-&gt;PreMultiply() (or if you do nothing, since<br>PreMultiply is the default):<br><br> M = M R (the transforms are applied in the opposite order)<br><br><br>The way to think about this is that in PostMultiply mode, any new
<br>rotation, translations etc. that you do occur after any rotations,<br>translations, etc. that you have already done.<br><br><br>So if you want to translate and then rotate, make sure you are in<br>PostMultiply() or you will end up with a vtkTransform that performs the
<br>rotation first and the translation second...<br><br> - David<br><br><br><br>Anja Ende wrote:<br>&gt; Hi everyone,<br>&gt;<br>&gt; Another qustion... I am really having a bad day...<br>&gt;<br>&gt; Been trying to play with the vtkTransform object and want to do the
<br>&gt; following operations...<br>&gt;<br>&gt; Translate-&gt;Rotate-&gt;Translate back...<br>&gt;<br>&gt; I am getting a bit hairy results... Are the translate parameters<br>&gt; expressed in actual physical units... i.e
. taking the spacing into<br>&gt; account...<br>&gt;<br>&gt; For example, I have an image data set that is centered using<br>&gt; vtkImageChangeInformation and I want to move to pixel (x, y) on a<br>&gt; particular slice (n) and then rotate 30 degrees around the X axes. How
<br>&gt; does one go about doing these operations?<br>&gt;<br>&gt; Any small code/pseudo code would be awesome!<br>&gt;<br>&gt; Thanks,<br>&gt; Anja<br>&gt; ------------------------------------------------------------------------
<br>&gt;<br>&gt; _______________________________________________<br>&gt; This is the private VTK discussion list.<br>&gt; Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ
</a><br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br><br></blockquote></div><br>