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, 50... and then rotate 30 degrees...<br><br>I should have:<br><br>myTransform->PostMultiply();
<br>myTransform->Translate(100, 100, 50);<br>myTransform->RotateX(30);<br>myTransform->Translate(-100, -100, -50);<br><br>Cheers and many thanks,<br>Anja<br> <br><br><div><span class="gmail_quote">On 19/09/06, <b class="gmail_sendername">
David Gobbi</b> <<a href="mailto:dgobbi@atamai.com">dgobbi@atamai.com</a>> 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. 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->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 (the new M is the product of matrices R and the old value of M)
<br><br>If you do transform->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>> Hi everyone,<br>><br>> Another qustion... I am really having a bad day...<br>><br>> Been trying to play with the vtkTransform object and want to do the
<br>> following operations...<br>><br>> Translate->Rotate->Translate back...<br>><br>> I am getting a bit hairy results... Are the translate parameters<br>> expressed in actual physical units... i.e
. taking the spacing into<br>> account...<br>><br>> For example, I have an image data set that is centered using<br>> vtkImageChangeInformation and I want to move to pixel (x, y) on a<br>> particular slice (n) and then rotate 30 degrees around the X axes. How
<br>> does one go about doing these operations?<br>><br>> Any small code/pseudo code would be awesome!<br>><br>> Thanks,<br>> Anja<br>> ------------------------------------------------------------------------
<br>><br>> _______________________________________________<br>> This is the private VTK discussion list.<br>> 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>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>><br><br></blockquote></div><br>