<div dir="ltr">Hi Wang,<div><br></div><div>Please note that in ITK, the resampling of an image is done in physical coordiantes, not in pixel space (the image grid).</div><div><br></div><div>That is, ITK will actually take into account the pixel spacing of your images, as well as the Direction matrix of the images themselves.</div>
<div><br></div><div>This may account for some of the differences that you see when comparing to Matlab operations.</div><div><br></div><div><br></div><div>Note also that the ITK transforms have a "Center" of rotation parameter, that play into the calculation.</div>
<div><br></div><div><br></div><div>    Thanks</div><div><br></div><div>       Luis</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 10:41 PM, WANG Chengjia <span dir="ltr"><<a href="mailto:wangchengjia1986@gmail.com" target="_blank">wangchengjia1986@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">More generally, I have a transformation matrix calculated, anyone know how to transform a volume using this matrix? <div>
<br></div><div>It is just a simple Rigid 3D transformation. In Matlab, I just use "tform = maketform('affine', transM');" to make up the transformation and apply it using " tformarray " then the images are perfectly aligned. But in ITK, I find I have to switch the x, y coordinate of translation when doing "targetTransform->SetTranslation(trans)". The result was still wrong, although quite close to the one I got in Matlab.</div>

<div><br></div><div>Can anyone help? Thanks in advance!</div><div><br></div><div>Best,</div><div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 7:39 PM, WANG Chengjia <span dir="ltr"><<a href="mailto:wangchengjia1986@gmail.com" target="_blank">wangchengjia1986@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, <div><br></div><div>I'm now working on a machine learning based 3D image registration work. To create the ground truth registration, I need to firstly using simple least square method to calculate a transformation from the corresponding point (I'm using RIRE datasets). </div>


<div><br></div><div>The same working flow in matlab and itk produced the same transformation matrix, but different transformed volume! In matlab, it's well aligned using the coordinates of control points given by RIRE dataset. But in ITK I have to inverse and switch the translation parameters. Then I realized it's because of the different coordinate system in itk and Matlab. </div>


<div><br></div><div>Can anyone tell me a method to convert transformation matrix calculated from the common coordinate system into the ITK one?</div><div><br></div><div>Thank you very much!</div><div><br></div><div>Best,</div>

<span><font color="#888888">
<div><div><br></div>-- <br>Chengjia Wang<br>Phd Student, <br>University of Edinburgh<br>Clinical Research Imaging Center (CRIC)<br>Toshiba Medical Visualization Systems Europe, Ltd<br>Email: <a href="mailto:wangchengjia1986@gmail.com" target="_blank">wangchengjia1986@gmail.com</a><br>



</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Chengjia Wang<br>Phd Student, <br>University of Edinburgh<br>Clinical Research Imaging Center (CRIC)<br>Toshiba Medical Visualization Systems Europe, Ltd<br>Email: <a href="mailto:wangchengjia1986@gmail.com" target="_blank">wangchengjia1986@gmail.com</a><br>


</div>
</div></div><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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div>