<div dir="ltr">Thanks Matt for the link.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 12:10 PM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Vincent,<br>
<br>
The values can also be used directly in the matrix as demonstrated here [1].<br>
<br>
HTH,<br>
Matt<br>
<br>
[1] <a href="https://gist.github.com/thewtex/8712205" target="_blank">https://gist.github.com/thewtex/8712205</a><br>
<div><div class="h5"><br>
On Tue, Aug 5, 2014 at 10:08 PM, vincent ngai <<a href="mailto:vincent.ngai@gmail.com">vincent.ngai@gmail.com</a>> wrote:<br>
> Hi Bradley,<br>
><br>
> Hmm, GetCenter() negated should be the same as InvCRM. I'll flip the order<br>
> of the multiplication and see what happens, it could be the C++ operator*()<br>
> order being different from the way its written. Its so annoying to get the<br>
> results close but not exact :(<br>
><br>
> Thanks<br>
><br>
><br>
> On Tue, Aug 5, 2014 at 9:12 PM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> That looks pretty close, but I think CRM[12,13,14] should be -GetCenter(),<br>
>> with the negative there.  Then the TM should be applied last, using your<br>
>> original notation with the previously mentioned correction I'd expect this<br>
>> to be correct:<br>
>><br>
>> OGLM = TM * InvCRM * Rot * CRM<br>
>><br>
>> Hope that helps,<br>
>> Brad<br>
>><br>
>> [1]<br>
>> <a href="http://www.itk.org/Doxygen/html/classitk_1_1MatrixOffsetTransformBase.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1MatrixOffsetTransformBase.html</a><br>
>><br>
>> On Aug 5, 2014, at 5:26 AM, vincent ngai <<a href="mailto:vincent.ngai@gmail.com">vincent.ngai@gmail.com</a>> wrote:<br>
>><br>
>> > Hi all, apologies if this has been asked before, I googled the above but<br>
>> > only got 4x4 -> AffineTransform and not the other way around.<br>
>> ><br>
>> > I need to get the output of an AffineTransform after registration to my<br>
>> > OpenGL renderer.<br>
>> ><br>
>> > From what I understand, the AffineTransform is composed of a Rotation,<br>
>> > Center of Rotation and Translation.<br>
>> ><br>
>> > So would the following sequence of 4x4 transformation be correct?<br>
>> ><br>
>> > OGLM = InvCRM * Rot * CRM * TM<br>
>> ><br>
>> > where<br>
>> ><br>
>> > CRM      = 4x4 identity matrix with indices [ 12, 13, 14] set to XYZ<br>
>> > value of GetCenter()<br>
>> > InvCRM  = Inverse of CRM<br>
>> > Rot        = 4x4 Identity matrix with 3x3 set to the rotation parameters<br>
>> > TM        = 4x4 identity matrix with indicies[ 12, 13, 14 ] set to the<br>
>> > translation parameters<br>
>> ><br>
>> > Essentially:<br>
>> ><br>
>> > 1) translate center to origin<br>
>> > 2) perform rotation<br>
>> > 3) translate back to where we were<br>
>> > 4) slap on translation<br>
>> ><br>
>> > I am doing the above, but for some reason the translation does not match<br>
>> > up. The rotation seems fine.<br>
>> > --<br>
>> > Regards,<br>
>> > Vincent<br>
>> > _____________________________________<br>
>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Kitware offers ITK Training Courses, for more information visit:<br>
>> > <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Regards,<br>
> Vincent<br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
><br>
</div></div>> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org">Community@itk.org</a><br>
> <a href="http://public.kitware.com/mailman/listinfo/community" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Vincent<br>
</div>