ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.21k stars 381 forks source link

how to interpret the transformation matrix? #1754

Closed wangtianyipsy closed 3 months ago

wangtianyipsy commented 5 months ago

Hi ANTs community, I'm using ANTs to register brain A to brain B (rigid body registration with -r). And I got a .mat file (*registered0GenericAffine.mat). If I open it in matlab it's a struct with two fields: AffineTransform_double_3_3 and fixed. afineTransform_double_3_3 = 1.0000 0.0002 -0.0012 -0.0002 1.0000 -0.0004 0.0012 0.0004 1.0000 -0.0327 -0.6251 -0.5731

fixed = -7.6055 -4.7252 -6.2409

My question is (1) I did rigid body registration. Is it correct that I got an affine transform matrix? (2) is there a tool that I can translate the matrix to something like the brain A rotates a, b, c degrees in x, y, z axis (and the direction of the rotation)? (3) It seems the last 3 numbers of afineTransform_double_3_3 mean translations in x, y, z axis but I'm not sure the meanings of the signs. For example, -0.6251 means brain A moves anteriorly or posteriorly? Thank you for your help!

gdevenyi commented 5 months ago

You would need to decompose the transform: https://caff.de/posts/4X4-matrix-decomposition/decomposition.pdf

gdevenyi commented 5 months ago

I believe antsTransformInfo might give euler angles from a affine transform.

cookpa commented 3 months ago

FYI for help in interpreting transform parameters: the transforms are in physical space, and ITK uses LPS coordinates

https://www.slicer.org/wiki/Coordinate_systems

The fixed parameters are the center of rotation

gdevenyi commented 3 months ago

SimpleITK docs have the best coverage I've seen of ITK coordinates and transforms: https://simpleitk.readthedocs.io/en/release/fundamentalConcepts.html

wangtianyipsy commented 3 months ago

thank you all. these are very helpful resources and they answered my questions. Hope they are also helpful to people in the future