Hi Bob,
When using B0ref.nii as the base and B0vols.nii[0] as the source (all same resolution), I assumed that this would potentially mitigate any underlying issues of the 3dAllineate -nwarp bilinear warp field being created from different resolution datasets being off.
Interestingly, when I used 3dNwarpApply on the resulting warp field the image looked correct except that it was shifted in the Z direction by 1.5*(Zvox resolution). In my case since the voxel size in the Z direction is 2mm I used the following commands to fix the error:
1) Create the warpfield:
3dAllineate -base B0ref.nii.gz -source 'B0vols.nii[0]' -master BASE -prefix eddy_1.nii -1Dmatrix_save dwi_1.aff12.1D -1Dparam_save dwi_1.param.1D -nwarp_save warp_1.nii.gz -warp aff -nwarp bilinear
2) Extract the X and Y component of the warp field which seem correct:
3dcalc -a warp_1.nii.gz[0..1] -datum float -prefix warp_1a.nii.gz -expr 'a'
3) Fix the Z component of the warp field which is off by 3mm in this case (or generalized to 1.5*Zvoxsize)
3dcalc -a warp_1.nii.gz[2] -datum float -prefix warp_1b.nii.gz -expr 'a+3'
4) Concatenate the new field
3dTcat -prefix warp_2.nii.gz warp_1a.nii.gz warp_1b.nii.gz
5) Apply warp
3dNwarpApply -master B0ref.nii.gz -source B0vols.nii[0] -prefix 3dNwarp.nii -nwarp "warp_2.nii.gz"
The scaling is still an issue with different resolution between base/source, but when matched this seems to work....I am going to be running a few datasets with different resolutions in case the 1.5*Zvox was somehow a fluke and will follow up if this is not the case. Hope this helps.
Best,
Ajay