Hello,
I have generated transformations for a set of healthy subjects to a population template using the population_template
command in MRtrix with the FODs. I have 5D warps taking me from the native space of each subject to the population space (located in the -warp_dir
folder I specified in the command). Here is the header of one of the warps which I’ll call Subject001_Warp.mif
:
************************************************
Image: "Subject001_Warp.mif"
************************************************
Dimensions: 109 x 134 x 104 x 3 x 4
Voxel size: 1.91026 x 1.89794 x 1.92643 x ? x ?
Data strides: [ 1 2 3 4 5 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 1 6.661e-16 -6.106e-16 -102.8
-1.138e-15 1 -1.277e-15 -140.8
3.886e-16 1.582e-15 1 -92.81
fod_reorientation: 1
linear1: 1.0579835101175998 -0.0057100130228221468 -0.0045276824586087949 -0.16094934862215396
0.017963484901439064 1.0234703153454938 0.010130773301195661 -0.32280480469699424
0.014231631646098752 -0.01248235931505115 1.0596555352451582 1.1173797021705958
linear2: 0.94505033498786706 0.0053211298695585848 0.0039871264984566281 0.14936778790039384
-0.016459538461600094 0.97686131919834795 -0.0094095522586667302 0.3232004180662027
-0.012886321708920215 0.011435608293369136 0.94353850852177634 -1.0526733534220045
mrtrix_version: 0.3.15-4-g4a69f806
nl_disp_smooth: 1
nl_gradient_step: 0.5
nl_lmax: [ 4 ]
nl_niter: [ 5 ]
nl_scale: [ 1 ]
nl_update_smooth: 2
What I would like to do is take those warps and apply them to other images in native space using another software which requires ITK type of displacement fields and ITK affine transformations. I feel like working with transformconvert
and warpconvert
could let me accomplish this.
Because ITK works with displacement fields (instead of deformation fields), I tried converting the MRTRIX fields into displacement fields using warpconvert
.
warpconvert -force -type warpfull2displacement -from 1 -template template_fod.nii.gz Subject001_Warp.mif Subject001_displacement.nii
Does this only extract the non-linear part, or does it incorporate the affine with it? If it incorporates the affine in it, I should only need to apply this warp with the other software and not combine the affine with Subject001_displacement.nii
, correct? Otherwise, I will have to either combine the affine with Subject001_displacement.nii
or apply them one after another to get my images in the template space.
If I need to use the affine separately, I have to convert it to ITK format as well. (On a side note, the file Subject001.txt
in the corresponding -linear_transformations_dir
is not the same as in the header of the warp (see below), is this normal?)
cat Subject001.txt
1.105446728447772919e+00 -1.158590634477877669e-02 -8.317694813222968608e-03 -4.596644981732365132e-01
5.031356841812080483e-02 1.038548748515115694e+00 2.274031364493591875e-02 -6.984325658287743321e-01
2.152625712070514383e-02 -1.464040315123524803e-02 1.109894666433130395e+00 2.625905259292831140e+00
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00
As far as I know, transformconvert
only lets users convert from ITK to MRtrix format but not the other way around. Is there a work-around for this in MRtrix, or would anyone know a tool to do this? I imagine that if warpconvert
already incorporates the affine in the warp, I shouldn’t have to bother with this step.
Thanks for any input from the MRtrix community!
Eric