3dNwarpCat: warp from dataset 'B-warp_for.nii.gz' doesn't match earlier input geometry

Hi AFNIers.

I’m running AFNI version=AFNI_18.1.01 (Apr 4 2018) [64-bit]

I have two nonlinear warps that I want to concatenate using 3dNwarpCat:
$ 3dNwarpCat -warp1 A-warp_for.nii.gz -warp2 B-warp_for.nii.gz -prefix AB-warp_for.nii.gz
Here, warp B maps the original anatomical to an intermediate, subject-specific template; warp A maps the subject-specific template to an MNI template.

I get the following error:
** ERROR: warp from dataset ‘B-warp_for.nii.gz’ doesn’t match earlier input geometry
However, the program continues to run and it outputs the file AB-warp_for.nii.gz.

The subject-specific template does not lie on the MNI grid, which is what may be triggering this error. The documentation for 3dNwarpCat states:

  • If any of the input warps are datasets, they must all be defined on the same 3D grid!

However, if I understand correctly, 3dNwarpApply, with the -nwarp option, does not have this limitation. Given that my run of 3dNwarpCat does not abort and indeed outputs a (correct?) warp, I’m wondering if the ERROR message above is a vestigial warning left over from a previous, less sophisticated version of 3dNwarpCat, and that the current version uses the same mechanism as 3dNwarpApply to interpolate coordinates between non-coincident warp chains.

I would use 3dNwarpApply directly, but I aim to generate the concatenated warp’s jacobian (via the -bulk option of 3dNwarpFuncs) of the concatenated warp. (Note that 3dNwarpFuncs has the -nwarp option as well, but it generates the same error message as 3dNwarpCat listed above.)

So, I guess my question is: do I trust the warp provided by 3dNwarpCat despite the error message it gives?

%%% -

Just as a follow-up: I’ve used 3dNwarpApply with the warp computed by 3dNwarpCat (as above) and using the concatenation approach with 3dNwarpApply -nwarp option. The results are similar, but not identical: the two volumes seem aligned, but the voxel values are within 10%, not as close as I’d be comfortable with.

Any insight you might have into this would be most welcome. Thank you very much!

  • Daniel

Just a follow up: 3dNwarpCat drops the second transformation, B-warp_for.nii.gz, from the concatenation. The transformation it produces, AB-warp_for.nii.gz, is identical to the first transformation, A-warp_for.nii.gz.

Still uncertain why 3dNwarpApply can handle this concatenation but 3dNwarpCat cannot.

  • Daniel

3dNwarpApply, I believe, is the only program that will handle multiple grids for the warps. Both 3dNwarpCat and 3dNwarpCalc require the same grid for combinations of warp datasets. There, not only should the grid be the same, but the extents of the dataset should be the same. 3dNwarpApply will create a common space in memory that covers all input datasets, and that can consume quite a bit of memory if datasets are far apart and small voxels. One alternative is to resample the warps to the other grid assuming the datasets overlap completely. Then concatenate by simply adding the deformation distances. You can also compute the warps starting with an @Align_Centers step first to get the most overlap of the grids. That will make the procedure faster and less memory intensive too. In all cases, it’s best to compare your results with the 3dNwarpApply results.

Thanks Daniel.

The volumes have already been through @Align_Centers, so overlap with the MNI template is high. I use the -plusminus option of 3dQwarp to form the subject-specific template from two visits in time. There doesn’t seem to be an option in 3dQwarp to provide a -master data set (i.e., the MNI template) for the output grid, so I’ll reslice the result in a separate step.

Thanks for the clarifications!

  • Daniel