cropped volume with 3dNwarpApply

Dear AFNI experts,

I am using 3dNwarpApply (from afni 18.1.26) to unwarp an EPI image and move to the space of structural scan via another structural scan .

my command looks like that :

3dNwarpApply -source myepi.nii.gz -prefix epi.REG2SWI.nii.gz
-master myswi.nii.gz
-nwarp " UNI2SWI.txt epi2UNI.txt 03_epi_MidWarped_Forward_WARP.nii.gz"

Given that all my EPIs have a partial coverage I found it much easier to do the registration with itksnap and then convert the affine to the afni format. So I

  1. Unwarp my EPI with and register it to the MP2RAGE
  2. Register the SWI image to the MP2RAGE
  3. I run 3dNwarpApply in order to avoid multiple interpolations

If I simply concatenate my two affines and use 3dAllineate the registration works (so I think all my affines are in the right format) and the final volume is not cropped.

When I use 3dNwarpApply in two (out of 10 subjects) the final volume is cropped.

Before the whole process starts I use @Align_Centers to move all my volumes to the center of the MP2RAGE.

I tried to use 3dZeroPad on the -master myswi.nii.gz, but the final volume is still cropped.

Am I doing something silly? I am surprised that I get this issue only in 2/10 subjects which makes it more difficult to understand what the problem might be,

Any help would be much appreciated,

Best Regards,


Is there any error in the output? I recommend centering the datasets over the template first. You can recenter the reverse warped data later over the original dataset if needed.

Hi Daniel,

thanks for the prompt reply!

No error in the output.

I tried what you suggested (run align centers on EPI and MP2RAGE, so everything centered to the final SWI space) and the result is the same. See in attachment result of 3dAllineate vs 3dNwarpApply.

Do you have a feeling of what could be causing this? I should add that I also deobliqued (with 3drefit -deoblique) all datasets before starting the registration.

Many thanks,


It’s not obvious to me right now. Probably best to send me some data. I’ll PM you with some instructions.

Brilliant, thank you!

It looks to me that the orientations of your VASO datasets is not correct. With this partial data, it’s hard to say what is correct, but the orientation might be LPS. You can reset that with 3drefit -orient LPS (better on a copy of the data, of course). Still, that might not be enough to solve this problem.Using affine transformations across software packages can be problematic because of differences in definitions. With lost information from the header, that can be very difficult to solve. You may want to stick with one software package all the way through transformations.