FMRIPREP ANTS .h5 composite transform file decomposition?

Hi experts

From the decomposition of the .h5 file from FMRIPREP ANTS pipline, I can get the AffineTransform.mat and the DisplacementFieldTransform.nii.gz.

I suppose the initialization is with a affine transformation (DOF >6)? Is it with 12 DOF?
Currently, I saw a .fixed field and a .AffineTransform_double_3_3 field in the .mat file, would anyone please advice on how to correctly interpret the 3 parameters in the .fixed field and the 12 parameters in the .AffineTransform_double_3_3 field?

I would also like to ask is it possible to further divide the affine transformation into one rigid transformation matrix and a second transformation file containing the rest of the DOFs? And would these resulting files function correctly? That is whether I can use the rigid transformation matrix to perform rigid body transform only and use the combined rigid transform matrix and the 2nd transformation matrix containing the rest of the DOFs to perform the full Affine transformation? And combine these two with the displacementFieldTransform to perform the whole non-linear transformation?
If the answer is yes, what tools or ANTS command could I use to accomplish this task?

Thank you very much!

Hi,
It might help if you could provide a bit more context to the problem. There might be a different, easier solution than what your question suggest. Fore example are you trying do statistics on the transformation parameters? Invert the transformation? Apply it to some data (which data)?

Thank you!

I have sorted the problem to my data by applying the composite transform to warp directly between T1w and MNI space.
But just out of curiosity, is it possible to get a rigid body transformation matrix directly from a 12 DOF affine transformation matrix?

You can decompose an affine matrix into rotations, translations, scales and shears. See, in Python, transforms3d.affines.decompose44.

So you could get a rigid body transform that drops the scaling and shearing like so:

T, R, Z, S = decompose44(orig_affine)
rigid_affine = T.dot(R)

I believe the order of translation/rotation/scaling/shearing is purely by convention, so if you chose a different order to decompose into, you could get different translation and rotation, and thus a different rigid approximation of an affine transform.

1 Like

Thank you very much!

MANAGED BY INCF