help > RE: Can I compose forward and inverse transforms
Feb 13, 2012  04:02 PM | Babak Ardekani
RE: Can I compose forward and inverse transforms
Hi Roger,

The following procedure would register MRI B (mriB.nii) to MRI A (mriA.nii), that is, MRI A would be the target and MRI B would be the subject image:

(1) Register MRI A to mni2009a as follows:

3dwarper -trg mni2009a.nii -sub mriA.nii -v -acpc -A

The output displacement field will be saved as: mriA_wrp.nii

(2) Invert mriA_wrp.nii using the ivf program as follows:

ivf -nx 256 -ny 256 -nz 128 -dx 1.0 -dy 1.0 -dz 1.25 -i mriA_wrp.nii -o mriA_inverse_wrp.nii

The output, inverted displacement field, is mriA_inverse_wrp.nii

Note that the -nx, -ny, -nz, -dx, -dy, -dz options are used here to specify the size of the mriA_inverse_wrp.nii that we would require.   The original displacment field (mriA_wrp.nii) is the size of the mni2009a.nii, but we would like the inverse (mriA_inverse_wrp.nii) to be the same size as the mriA.nii image, which in my case happens to be: 256x256x128 voxels and 1.0x1.0x1.25 mm^3.

(3) Register MRI B to mni2009a as follows:

3dwarper -trg mni2009a.nii -sub mriB.nii -v -acpc -A

The output displacment field will be saved as: mriB_wrp.nii

(4) Finally mriB.nii can be resliced to match mriA.nii as follows:

applywarp3d -w mriA_inverse_wrp.nii -w2d mriB_wrp.nii mriB.nii

The output image CmriB.nii would be registered to mriA.nii.

What happens here is the applywarp3d combines the two displacement fields mriA_inverse_wrp.nii and mriB_wrp.nii and applies a single reslicing representing their combintation to mriB.nii.   The order of warping operation (*) is:

CmriB.nii = mriA_inverse_wrp.nii * mriB_wrp.nii * mriB.nii

I hope this answers your question.

Best,
Babak

Threaded View

TitleAuthorDate
Roger Tait Feb 10, 2012
RE: Can I compose forward and inverse transforms
Babak Ardekani Feb 13, 2012
Roger Tait Feb 17, 2012