errts and vr_base_min_outlier files are not co-registered

AFNI version info (afni -ver): Latest

Dear experts,

I use -volreg_align_to MIN_OUTLIER in my script (without tlrc block or registration to anatomical) and was expecting the final errts output to be aligned to this min outlier file (vr_base_min_outlier+orig.BRIK). However, they are not aligned when I convert both images to NIFTI using 3dAFNItoNIFTI and display them on FSLeyes.

Does someone have an idea what I am doing wrong? I would like to have the min-outlier volume and the resulting errts file in the same space and be co-registered.


Hi, Avi-

The option "-volreg_align_to .." is for choosing one particular volume of the input EPI dsets to be a reference volume for volume registration (i.e., motion estimation). That dataset will necessarily be in native/original space. Choosing MIN_OUTLIER is a good argument for that opt, because that helps one choose programmatically a time point that is likely not motion-corrupted.

The errts*HEAD dataset will be in the final space. So, if you are using the tlrc block it will be in some reference template space (e.g., MNI or whatever). If you don't have that block but have align, then it will be in the subject anatomical (which is likely a bit different than that of the input EPIs). If you have neither of those, then the volreg volume would define the final space---but note that the final voxel size might be different in errts* dataset still.

So, it would only be an extremely rare case for the vr_base*HEAD dset and the errts to be on the same grid, and still quite rare for them to be in the same space even.


Thank you pt for the prompt response. My command is as follows, no tlrc or anatomical: -subj_id dac830proj519 -dsets_me_run \
echo-01_bold.nii.gz \
echo-02_bold.nii.gz \
echo-03_bold.nii.gz \
-echo_times 14.0 37.87 61.74 \
-out_dir  sub-dac830proj519 \
-blocks despike tshift volreg mask combine scale regress \                                                                                    -regress_apply_mot_types demean deriv -regress_censor_motion 0.3 \                                                                         
-regress_motion_per_run -volreg_align_to MIN_OUTLIER \
-combine_method OC \ 
-combine_tedana_path /hpc/users/chowda26/.local/bin/tedana \                                                                       
-combine_opts_tedwrap -tedana_is_exec

I used 3dinfo to check the number of voxels in each direction for both the min_outlier and errts files and it is the same. However, the two images are not aligned. I was wondering if there is any -deoblique type command that changes the orientation.


Hi, Avi-

What is the output of:

3dinfo -same_all_grid -prefix vr_base_min_outlier+orig.HEAD errts*HEAD

On a minor note about your command:                                                                 \
    -subj_id                  dac830proj519                                  \
    -dsets_me_run             echo-01_bold.nii.gz echo-02_bold.nii.gz        \
                              echo-03_bold.nii.gz                            \
    -echo_times               14.0 37.87 61.74                               \
    -out_dir                  sub-dac830proj519                              \
    -blocks                   despike tshift volreg mask combine scale       \
                              regress                                        \
    -regress_apply_mot_types  demean deriv                                   \
    -regress_censor_motion    0.3                                            \
    -regress_motion_per_run                                                  \
    -volreg_align_to          MIN_OUTLIER                                    \
    -combine_method           OC                                             \
    -combine_tedana_path      /hpc/users/chowda26/.local/bin/tedana          \
    -combine_opts_tedwrap     -tedana_is_exec

... we might usually add these opts for more QC:

  • -volreg_compute_tsnr yes
  • -radial_correlate_blocks tcat volreg regress


Thank you. The output for the command you provided is as below:

1	1	1	1	0	                   vr_base_min_outlier
1	1	1	1	0	          errts.dac130proj506.tproject

Hi, Avi-

OK, that shows what is happening differently. From the help file of 3dinfo, what those 5 numbers mean is comparing these 5 properties (in order), where 1 means agreement and 0 means disagreement:

   -same_all_grid: Equivalent to listing all of -same_dim -same_delta
                   -same_orient, -same_center, and -same_obl on the 

Indeed, there is obliquity in vr_*HEAD dset that is purged by the end.

Since all the other 4 attributes match, I believe you should be able to "reattach" the obliquity to the errts* data from the vr*HEAD dset with (since 3drefit will change the header in place, always start with a copy):

3dcopy DSET_ERRTS errts_obl
3drefit \
    -atrcopy vr_base_min_outlier+orig.HEAD IJK_TO_DICOM_REAL \

... and you can verify that the two dsets match with:

3dinfo -same_all_grid -prefix vr_base_min_outlier+orig.HEAD errts_obl+orig.HEAD

NB: if you don't care about going to standard space, I would probably purge the obliquity from my EPI datasets from the start. Why would you want your final data to have obliquity? I would run adjunct_deob_around_origin on the EPI datasets to start with, to purge obliquity while preserving the location of the coordinate origin and also not incurring any blurring/smoothing. Then you won't have to do any of this stuff, nor deal with hassles that obliquity causes all software.


Thank you, this is helpful.

The reason I wanted the vr_base_min_outlier+orig.HEAD to be aligned to the final output (errts) is because I wanted a reference functional volume to conduct EPI --> T1 --> MNI transforms. Since I will be using the errts for analysis, we need the transforms to be in the space of errts, and was hoping to use the min_outlier volume as the reference volume.

Hi, Avi-

Hm, I see. Actually, it is pretty standard to send the EPI -> T1 -> MNI during FMRI processing, and a much better way of doing that is to let do that for you. This reduces scripting/work on your part, and importantly allows the transformations to be calculated individually but applied in a single step, which reduces blurring.

Please see this AFNI Academy playlist on Alignment, as well as this description of processing with

  • Taylor PA, Chen G, Glen DR, Rajendra JK, Reynolds RC, Cox RW (2018). FMRI processing with AFNI: Some comments and corrections on ‘Exploring the Impact of Analysis Software on Task fMRI Results’. bioRxiv 308643; doi:10.1101/308643

You really shouldn't have to be doing those alignments separately. Most help examples show how to do this, as do many of the AFNI Codex processing examples.