Print

Print


Dear Xuemei,

> Hi experts,
> We performed non-linear registration using the following command:
> flirt -in con01_T1.nii -ref MNI152_T1_2mm -omat flirt_mat -out flirt_out
> fnirt --ref=MNI152_T1_2mm --in=con01_T1.nii --aff=flirt_mat --cout=warp --iout=fnirt_out

this command is unlikely to give you good results. You should add
—config=T1_2_MNI152_2mm.cnf
to your command.

> 
> Assume that (x,y,z) is in the original image(e.g con01_T1.nii) in ”mm coordinates”, which corresponds to the index (i,j,k) in the reference image. And (x’,y’,z’) is the final location in the reference image, then the transform is given by
> (x',y',z',1).T = A*(x,y,z,1).T + (dx(i,j,k),dy(i,j,k),dz(i,j,k),0).T
> Where A is the 4*4 affine matrix (e.g flirt_mat), d is the displacements field, and .T denotes the transpose.
> 
> Suppose (x’,y’,z’) is known, we want to obtain (x,y,z) in the original image. Our solving process is as follows:
> First we separate the nonlinear part from warp using “fnirtfileutils” command.
> fnirtfileutils --in=warp --ref=MNI152_T1_2mm --out=displacement_field
> 
> Then we apply the output to the following formula.
> (x,y,z,1).T = A.inv()*((x’,y’,z’,1).T - (dx(i,j,k),dy(i,j,k),dz(i,j,k),0).T)
> Where A.inv() denotes the inverse of the affine matrix.

No, this isn’t quite correct. The inverse of the non-linear part is not identical to the negation.

Use the invwarp command

invwarp —warp=<your cout file> —out=my_inverted_warp —ref=con01_T1.nii

and then you can apply “my_inverted_warp” directly to any image in standard space.

Jesper

> 
> Is above process correct? And if there exits other methods that can realize that?
> Would someone give me some suggestions?
> 
> Xuemei