AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
August 27, 2014 04:03PM
Dear Afni Gurus

My compulsive nature had me push a little more on this today.

First, I simplified the problem by comparing the outputs of 3dQwarp and 3dNwarpApply without any motion correction (or more precisely by doing motion correction independantly in a first step and not using -affter in 3dNwarpApply). That made me realize that I should not use the 'IS:' operator in -nwarp, and now the warped image of motion corrected run10 (the run closest to my reference image) from 3dQwarp is the same as the motion corrected run10 warped separatly with 3dNwarpApply.

So I tried again to input the motion parameters to 3dNwarpApply in the following way:
# Compute motion correction
3dvolreg -prefix trun10_mc.nii.gz -base 0 -1Dmatrix_save trun10_mcMatrix trun10.nii.gz
3dTstat -mean -prefix trun10_mc_mean.nii.gz trun10_mc.nii.gz
# Compute deformation correction
3dQwarp -prefix trun10_mc_mean.nii.gz -base deformationRef.nii.gz -weight brainmask.nii.gz -source trun10_mc_mean.nii.gz -noZdis -noXdis -plusminus -superhard -minpatch 9 -nmi
# Apply deformation correction
3dNwarpApply -prefix trun10_mdc.nii.gz -source trun10.nii.gz -nwarp trun10_mc_mean_PLUS_WARP.nii.gz -affter trun10_mcMatrix.aff12.1D
# Visual inspection
fslview trun10_mc_mean_PLUS.nii.gz trun10_mdc.nii.gz
and yes, it works, the images are the same wheather motion and deformation are applied sequentialy (trun10_mc_mean_PLUS.nii.gz) or simultaneously (trun10_mdc.nii.gz). Note that run10 was chosen as it is the closest to my reference with reversed phase-encoding direction.

Then I tried to do the same with the first run of my session (which as the same slice prescription as run10 and which I motion correct to run10) in the following way:
# Compute motion correction
3dvolreg -prefix trun10_mc.nii.gz -base 0
3dTstat -mean -prefix trun10_mc_mean.nii.gz trun10_mc.nii.gz
3dvolreg -prefix trun01_mc.nii.gz -base trun10_mc_mean.nii.gz -1Dmatrix_save trun01_mcMatrix trun01.nii.gz
3dTstat -mean -prefix trun01_mc_mean.nii.gz trun01_mc.nii.gz
# Compute deformation correction
3dQwarp -prefix trun01_mc_mean.nii.gz -base deformationRef.nii.gz -weight brainmask.nii.gz -source trun01_mc_mean.nii.gz -noZdis -noXdis -plusminus -superhard -minpatch 9 -nmi
# Apply deformation correction
3dNwarpApply -prefix trun01_mdc.nii.gz -source trun01.nii.gz -nwarp trun01_mc_mean_PLUS_WARP.nii.gz -affter trun01_mcMatrix.aff12.1D -interp cubic
3dTstat -mean -prefix trun01_mdc_mean.nii.gz trun01_mdc.nii.gz
# Visual inspection
fslview trun01_mc_mean_PLUS.nii.gz trun01_mdc_mean.nii.gz
And unfortunatly, I see the same weird rotation between the images corrected sequentialy and simultaneously. Since the similar procedure on run09 produced very descent results and that I know that run09 is originaly much closer to run10 than run01 is, it seems to me that the 6dof affine transformation from 3dvolreg is not properly combined with the nonlinear warp from 3dQwarp when using the -affter option in 3dNwarpApply. I tried to play around with the resampling grid, with -master WARP for example, but it didn't work either.

Am I doing something wrong or getting closer to find a bug?

Please, help me keep my sanity smiling smiley

Sebastien
Subject Author Posted

Deformation and motion correction of EPI in "one step"

Sébastien Proulx August 26, 2014 06:44PM

Re: Deformation and motion correction of EPI in "one step"

Sébastien Proulx August 27, 2014 04:03PM

Re: Deformation and motion correction of EPI in "one step"

rick reynolds August 29, 2014 09:59AM