Combine full warps



I’m trying to take a subjects full warp to an FOD template and combine it with another full warp.
I am aware transformcompose can take separate affines and nonlinear warps and combine them but it doesn’t work with the full warps.

Is it possible to combine the full warps that contain the affine and the nonlinear warp? Or maybe decompose them so that transformcompose works?



Hi @Goku

I’m pretty sure you want to be looking at transformconvert warpconvert (:man_facepalming:) to extract from the full warp format only the specific warp in which you are interested, such that you can then compose it with other transformations.



That’s not it either. It says transformconvert is for converting linear transforms in ITK and FSL into a mrtrix format. I can recompute the transforms using mrregister and save the affine and the nonlinear warp out separately but was seeing if there was an easier and faster way then rerunning mrregister.


Hello @Goku,

You can not compose full 5D warps as they are defined in their respective midways space and we currently have no tools to estimate the midway space between two arbitrary warps. As Rob points out, you can, however, combine 4D deformation fields via using transformcompose. To convert full warps to deformation fields, you’d use warpconvert:

For a transformation chain from image 1 to image 2 with target 3 this should (not tested) extract and combine the linear and nonlinear transformations:

warpconvert warp_full_1to2.mif warpfull2deformation -template image2.mif -from 1 deformation_1to2.mif
warpconvert warp_full_2to3.mif warpfull2deformation -template image3.mif -from 1 deformation_2to3.mif

transformcompose deformation_1to2.mif deformation_2to3.mif deformation1_to3.mif