<div dir="ltr"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">Hi all,</span><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
unfortunately I am still a little bit struggling with the ITK transform files.</div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
I wrote the following code to import an ITK transform using Python: <a href="https://gist.github.com/haehn/5614966" target="_blank">https://gist.github.com/haehn/5614966</a></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">If I feed this transform:</div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<div class="im"><div>#Insight Transform File V1.0</div><div>#Transform 0</div><div>Transform: MatrixOffsetTransformBase_double_3_3</div></div><div>Parameters: 0.99075 0.00122687 0.000215557 0.00599895 1.00337 0.0157795 0.00260199 -0.00797336 0.991337 -0.595451 -0.169443 0.104441</div>
<div>FixedParameters: -1.11311 -3.55441 16.6988</div><div><br></div><div>The script generates the following 4x4 matrix (numpy array):</div><div><br></div><div><div>[[ 9.90750000e-01 1.22687000e-03 2.15557000e-04 -6.04141688e-01]</div>
<div> [ 5.99895000e-03 1.00337000e+00 1.57795000e-02 -8.00550978e-02]</div><div> [ 2.60199000e-03 -7.97336000e-03 9.91337000e-01 3.38798138e-01]</div><div> [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00000000e+00]]</div>
<div><br></div><div>Could somebody check if this output is correct?</div></div><div><br></div></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">Thank you very much!</div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<br></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">Daniel</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 15, 2013 at 12:35 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@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 class="HOEnZb"><div class="h5">On Wed, May 15, 2013 at 11:23 AM, Daniel Haehn <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>> wrote:<br>
> Hi devs,<br>
><br>
> I have the following ITK transform file<br>
><br>
> #Insight Transform File V1.0<br>
> #Transform 0<br>
> Transform: MatrixOffsetTransformBase_double_3_3<br>
> Parameters: 0.991654 0.00303429 0.0015616 -0.000274293 0.970948 0.261678<br>
> -0.00143037 -0.263587 0.953079 -0.546243 21.4937 -28.456<br>
> FixedParameters: -1.11311 -3.55441 16.6988<br>
><br>
> How does the matrix look? I googled and only found some theoretical<br>
> explanations but I would really benefit if someone could just show me the<br>
> matrix resulting from this transform file.<br>
><br>
> Thank you so much!<br>
> Daniel<br>
<br>
</div></div>Daniel,<br>
<br>
I've never played with the transform factory, but I believe what you<br>
need to do is this:<br>
<br>
<a href="http://www.itk.org/Wiki/ITK/Examples/IO/RegisterTransform" target="_blank">http://www.itk.org/Wiki/ITK/Examples/IO/RegisterTransform</a><br>
<br>
For your file, it outputs:<br>
<br>
MatrixOffsetTransformBase (0x29cb170)<br>
RTTI typeinfo: itk::MatrixOffsetTransformBase<double, 3u, 3u><br>
Reference Count: 2<br>
Modified Time: 427<br>
Debug: Off<br>
Observers:<br>
none<br>
Matrix:<br>
<div class="im">0.991654 0.00303429 0.0015616<br>
-0.000274293 0.970948 0.261678<br>
-0.00143037 -0.263587 0.953079<br>
<br>
</div>Offset: [-0.570825, 17.0204, -28.611]<br>
Center: [-1.11311, -3.55441, 16.6988]<br>
Translation: [-0.546243, 21.4937, -28.456]<br>
Inverse:<br>
1.00841 -0.00335021 -0.00073243<br>
-0.000114468 0.95848 -0.263161<br>
0.00148176 0.265076 0.976449<br>
<br>
Singular: 0<br>
<br>
Does that seem right to you?<br>
<br>
Can anyone confirm that I did this correctly? I thought that I might<br>
not be able to register a "*TransformBase" (and instead the file<br>
should be changed to a (the only) subclass of<br>
MatrixOffsetTransformBase, AffineTransform), but it seems to work.<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span></blockquote></div><br></div></div>