[Insight-developers] Understanding an ITK transform file

Daniel Haehn haehn at bwh.harvard.edu
Tue May 21 11:10:25 EDT 2013


Hi all,

unfortunately I am still a little bit struggling with the ITK transform
files.

I wrote the following code to import an ITK transform using Python:
https://gist.github.com/haehn/5614966

If I feed this transform:

#Insight Transform File V1.0
#Transform 0
Transform: MatrixOffsetTransformBase_double_3_3
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
FixedParameters: -1.11311 -3.55441 16.6988

The script generates the following 4x4 matrix (numpy array):

[[  9.90750000e-01   1.22687000e-03   2.15557000e-04  -6.04141688e-01]
 [  5.99895000e-03   1.00337000e+00   1.57795000e-02  -8.00550978e-02]
 [  2.60199000e-03  -7.97336000e-03   9.91337000e-01   3.38798138e-01]
 [  0.00000000e+00   0.00000000e+00   0.00000000e+00   1.00000000e+00]]

Could somebody check if this output is correct?

Thank you very much!

Daniel


On Wed, May 15, 2013 at 12:35 PM, David Doria <daviddoria at gmail.com> wrote:

> On Wed, May 15, 2013 at 11:23 AM, Daniel Haehn <haehn at bwh.harvard.edu>
> wrote:
> > Hi devs,
> >
> > I have the following ITK transform file
> >
> > #Insight Transform File V1.0
> > #Transform 0
> > Transform: MatrixOffsetTransformBase_double_3_3
> > Parameters: 0.991654 0.00303429 0.0015616 -0.000274293 0.970948 0.261678
> > -0.00143037 -0.263587 0.953079 -0.546243 21.4937 -28.456
> > FixedParameters: -1.11311 -3.55441 16.6988
> >
> > How does the matrix look? I googled and only found some theoretical
> > explanations but I would really benefit if someone could just show me the
> > matrix resulting from this transform file.
> >
> > Thank you so much!
> > Daniel
>
> Daniel,
>
> I've never played with the transform factory, but I believe what you
> need to do is this:
>
> http://www.itk.org/Wiki/ITK/Examples/IO/RegisterTransform
>
> For your file, it outputs:
>
> MatrixOffsetTransformBase (0x29cb170)
> RTTI typeinfo: itk::MatrixOffsetTransformBase<double, 3u, 3u>
> Reference Count: 2
> Modified Time: 427
> Debug: Off
> Observers:
> none
> Matrix:
> 0.991654 0.00303429 0.0015616
> -0.000274293 0.970948 0.261678
> -0.00143037 -0.263587 0.953079
>
> Offset: [-0.570825, 17.0204, -28.611]
> Center: [-1.11311, -3.55441, 16.6988]
> Translation: [-0.546243, 21.4937, -28.456]
> Inverse:
> 1.00841 -0.00335021 -0.00073243
> -0.000114468 0.95848 -0.263161
> 0.00148176 0.265076 0.976449
>
> Singular: 0
>
> Does that seem right to you?
>
> Can anyone confirm that I did this correctly? I thought that I might
> not be able to register a "*TransformBase" (and instead the file
> should be changed to a (the only) subclass of
> MatrixOffsetTransformBase, AffineTransform), but it seems to work.
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130521/af15e545/attachment.htm>


More information about the Insight-developers mailing list