<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1498" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=938372012-27052005><FONT face=Arial color=#0000ff
size=2>Yu,</FONT></SPAN></DIV>
<DIV><SPAN class=938372012-27052005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=938372012-27052005><FONT face=Arial color=#0000ff size=2>
When moving to Matlab from ITK, remember that Matlab uses row-colum-slice
(i,j,k) coordinates for indexing while ITK uses x,y,z directly. Thus
X and Y are switched and you'll need to permute your columns in the Rotation
matrix and the rows in the Translation column vector. However, I may be a
day late and a dollar short on this as I joined the topic
late.</FONT></SPAN></DIV>
<DIV><SPAN class=938372012-27052005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=938372012-27052005><FONT face=Arial color=#0000ff
size=2>-dan</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
insight-users-bounces+blezek=crd.ge.com@itk.org
[mailto:insight-users-bounces+blezek=crd.ge.com@itk.org]<B>On Behalf Of </B>Yu
Qi<BR><B>Sent:</B> Thursday, May 26, 2005 5:23 PM<BR><B>To:</B> insight
insight<BR><B>Subject:</B> Re: [Insight-users] FW: How to convert
VersorRigid3DTransform tovtkTransform<BR><BR></FONT></DIV>
<DIV>
<DIV>Hi Luis,</DIV>
<DIV> </DIV>
<DIV>Thank you!</DIV>
<DIV> </DIV>
<DIV>In SPM, the equations to transform the moving image is as follows</DIV>
<DIV><FONT color=#00007f>x1=R00*x+R01*y+R02*z+Trans0</FONT></DIV>
<DIV><FONT color=#00007f>y1=R10*x+R11*y+R12*z+Trans1</FONT></DIV>
<DIV><FONT color=#00007f>z1=R20*x+R21*y+R22*z+Trans2</FONT></DIV>
<DIV> </DIV>
<DIV>But SPM integrates spacing info into the rotation 3X3 matrix.</DIV>
<DIV> </DIV>
<DIV>I compared the result from ITK and the one from SPM, </DIV>
<DIV><FONT color=#00407f><FONT color=#000000>I found</FONT>
ITKrotation*ITKspacing</FONT> is very close to the <FONT
color=#00007f>Ratation</FONT> matrix in SPM and the translations are also very
close.</DIV>
<DIV> </DIV>
<DIV>But I can not obtain a good transform in SPM using ITK result.</DIV>
<DIV>Do you think there will be other reasons for this? like the interpolation
method (default setting in SPM is linear and I use linear in ITK)?</DIV>
<DIV> </DIV>
<DIV>Best regards,</DIV>
<DIV>Yu Qi</DIV>
<DIV><BR><BR><B><I>Luis Ibanez <luis.ibanez@kitware.com></I></B>
дµÀ£º</DIV>
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Hi
Yu,<BR><BR>I'm not familiar enough with SPM to give you a good advice
here.<BR><BR>But in general the part that needs to be transposed is just
the<BR>3x3 Matrix containing the rotational part of the
transform.<BR><BR>This may or may not be enough for SPM, you may end up
needing a<BR>full 4x4 transpose.<BR><BR>Note that you don't necessarily need
to transpose the transform.<BR>This is only if you find that the
representation of the transform<BR>in ITK uses a different standard from the
one present in SPM.<BR><BR><BR>Sorry for not being of much help in this
issue,<BR><BR><BR>Luis<BR><BR><BR><BR>--------------------------------------------------------------<BR>Yu
Qi wrote:<BR><BR>> Hi Luis,<BR>> <BR>> I am alsoo trying to export
the transform in ITK to other applications, <BR>> but to SPM rather tan
VTK.<BR>> <BR>> One question I want to ask is<BR>> ca! n I simply
use the a 4X4 matrix as follows to transform a image?<BR>> | last
translationX |<BR>> | GetRotationMatrix 3X3 last translationY |<BR>> |
last translationZ |<BR>> | 0 0 0 1 |<BR>> <BR>> and you mentioned
transpose, why do we need transpose?<BR>> <BR>> <BR>> Thank
you!<BR>> Best regards,<BR>> Yu Qi<BR>> <BR>> <BR>> */Luis
Ibanez <LUIS.IBANEZ@KITWARE.COM>/* дµÀ£º<BR>> <BR>> <BR>> Hi
Toon,<BR>> <BR>> <BR>> What you are doing seems to be
reasonable.<BR>> <BR>> The only thing that can be wrong in your
process is<BR>> that the Matrix may need to be transposed.<BR>>
<BR>> <BR>> However, before we go there, could you please<BR>>
share with us the evidence that lead you to think<BR>> that the
transformation is not correct ?<BR>> <BR>> <BR>> If you are
obtaining the Versor transform as the<BR>> result of an image
registration process in ITK,<BR>> chances are that you are being co!
nfused by the<BR>> direction in which Transforms are computed in
ITK.<BR>> <BR>> <BR>> Please let us know,<BR>> <BR>> <BR>>
Thanks<BR>> <BR>> <BR>> Luis<BR>> <BR>> <BR>>
-------------------<BR>> Toon Huysmans wrote:<BR>> <BR>> >
Hi,<BR>> ><BR>> ><BR>> ><BR>> >; I have registered
two images and I have the result in a<BR>> > VersorRigid3DTransform,
now I would like to transform some<BR>> vtkPolyData<BR>> > using
this transform. I believe! that VersorRigid3DTransform<BR>> contains
a<BR>> > rotation (the versor) and a translation, so I set up a 4x4
matrix,<BR>> > containing the rotation and translation as
follows:<BR>> ><BR>> > | R11 R12 R13 Tx |<BR>> ><BR>>
> | R21 R22 R23 Ty |<BR>> ><BR>> > | R31 R32 R33 Tz |<BR>>
><BR>> > | 0 0 0 1 |<BR>> ><BR>> ><BR>> ><BR>>
> I get the rotation matrix R using<BR>> >
VersorRigid3DTransform::GetRotationMatrix<BR>> > ,<BR>> > and
the translation part using VersorRigid3DTransform::GetOffset<BR>> >
.<BR>> > Then I use vtkTransform::SetMatrix to set the transform for
the<BR>> > polydata, and I use<BR>> ><BR>> >
vtkTransformPolyDataFilter to transform the polydata. But the<BR>> resul!
t is<BR>> > not as expected, i.e. the transformation is not
correct.<BR>> ><BR>> ><BR>> ><BR>> > Does anyone
have any clues on how to do it the right way?<BR>> ><BR>>
><BR>> ><BR>> > Many thanks,<BR>> ><BR>>
><BR>> ><BR>> > Toon Huysmans.<BR>> ><BR>>
><BR>> ><BR>> ><BR>> ><BR>> >
¥ ?lt;br>><BR>> > ?Postal Address:
?lt;br>><BR>> > ? ?lt;br>><BR>> > ?Vision Lab,
Department of Physics ?lt;br>><BR>> > ?Universit! y of Antwerp
(CMI) ?lt;br>><BR>> > ?Groenenborgerlaan 171 (U306)
?lt;br>><BR>> > ?B-2020 Antwerp, Belgium ?lt;br>><BR>>
>
°€EUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUR?lt;br>><BR>>
> ?Tel: +32 (0) 3 265 32 24 ?lt;br>><BR>> >
°€EUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUR?lt;br>><BR>>
> ?Fax: +32 (0) 3 265 33 18 ?lt;br>><BR>> >
°€EUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUR?lt;br&g!
t;><BR>> > ?Email: toon.huysmans@ua.ac.be<BR>> >
?lt;br>><BR>> >
°€EUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUREUR?lt;br>><BR>>
> ?Web: http://webhost.ua.ac.be/visielab/staff/tohu/
?lt;br>><BR>> >
« ?lt;br>><BR>> ><BR>> ><BR>>
><BR>> ><BR>>
------------------------------------------------------------------------<BR>>
><BR>> > ________________________________________________<BR>>
> Insight-users mailing list<BR>> > Insight-users@itk.org<BR>>
> http://www.itk.org/mailman/listinfo/insight-users<BR>> <BR>>
<BR>> <BR>> _______________________________________________<BR>>
Insight-users mailing list<BR>> Insight-users@itk.org<BR>>
http://www.itk.org/mailman/listinfo/insight-users<BR>> <BR>> <BR>>
------------------------------------------------------------------------<BR>&!
gt; *Do You Yahoo!?*<BR>> 150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌà <HTTP:
music.yisou.com><BR>> ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ <HTTP: image.yisou.com><BR>>
1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡ <BR>> <HTTP: cn.rd.yahoo.com mail_cn tag 1g *http:
cn.mail.yahoo.com event mail_1g /><BR>> <BR><BR><BR><BR></BLOCKQUOTE></DIV>
<P><BR>
<HR SIZE=1>
<B>Do You Yahoo!?</B><BR><A href="http://music.yisou.com"
target=blank>150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌÃ</A><BR><A href="http://image.yisou.com"
target=blank>ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ</A><BR><A
href="http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/"
target=blank>1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡</A></BLOCKQUOTE></BODY></HTML>