Matlab transform issue

I am quite confused. I have a .mat that I want to apply bunch of points. Slicer does it correctly. This is the transform that it displays in the Information tab:

Transform to parent:

0.999281 0.0298646 -0.0233499 -9.08338 
-0.026954 0.992844 0.116332 15.7514 
0.026657 -0.115619 0.992936 27.7003 
0 0 0 1 

When I read the same transform into readMat function of R.matlab package, this is what I get:

> X
$AffineTransform.float.3.3
             [,1]
 [1,]  0.99928123
 [2,] -0.02695397
 [3,] -0.02665700
 [4,]  0.02986464
 [5,]  0.99284458
 [6,]  0.11561931
 [7,]  0.02334986
 [8,] -0.11633231
 [9,]  0.99293584
**[10,]  1.79939485**
**[11,] -2.39244556**
**[12,]  0.75802612**

$fixed
          [,1]
[1,] -108.9425
[2,] -275.4168
[3,] -114.8110

attr(,"header")
attr(,"header")$version
[1] "4"
attr(,"header")$endian
[1] "little"

I can correct the sign issues due to LPS/RAS difference, but why is the translation so different? How do I rearrange the matlab transform to match the 4x4 transform I see in Slicer? This is the link to the transform if it helps.
https://app.box.com/s/j0zpgwwjhok99i0eu1nxwf0gp1tb31fi

It is not just LPS/RAS conversion but also modeling/resampling transform difference. See explanation and conversion code here:

https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Transform_files

1 Like

I just had to explain this to someone (and re-explain to myself), so I added a Python example I used, below the C++ snippet at your link.

I also edited the following (similar) FAQ entry to try to make the wording clearer, and added a link to the discussion in the Transforms documentation:

https://www.slicer.org/wiki/Documentation/Nightly/FAQ/Registration#The_registration_transform_file_saved_by_Slicer_does_not_seem_to_match_what_is_shown

1 Like