blip volreg_base_external

AFNI version info: AFNI_23.0.02.

Hi afni team,

When specifying an external volume registration base that hasn’t been unwarped yet, registers all unwarped images to this non-unwarped target due to the "blip" block coming before the "volreg" block.
I am aware that by not specifying a volume registration base, afni uses a subbrik of the first image after it has been unwarped.

Is there a solution to specifying an external volume registration base that will be unwarped within before the other unwarped images are registered to it?

Thank you for your help.
Best wishes,

Hi, Letitia-

I'm guessing Rick will have more advice on this issue than I can offer, but could you please post your current command? That might simplify the process of discussing options.


Sure!                                                                 \
    -subj_id                  $subdir                                        \
    -dsets                    $ddir/$subdir/$run_1.nii                       \
                              $ddir/$subdir/$run_2.nii                       \
                              $ddir/$subdir/$run_3.nii                       \
                              $ddir/$subdir/$run_4.nii                       \
                              $ddir/$subdir/$run_5.nii                       \
                              $ddir/$subdir/$run_6.nii                       \
    -blocks                   volreg scale regress                           \
    -blip_forward_dset        $ddir/$subdir/$forward.nii                     \
    -blip_reverse_dset        $ddir/$subdir/$reverse.nii                     \
    -tcat_remove_first_trs    $init_discard_TR                               \
    -volreg_base_dset         unwarped_run1.nii                              \
    -regress_stim_times       $modeldir/Runs1-6StimTimesHRF.1D               \
    -regress_stim_labels      hrf                                            \
    -regress_basis            'CSPLINzero(0,20,21)'                          \
    -regress_opts_3dD         -jobs 2                                        \
                              -gltsym 'SYM: hrf'                             \
                              -glt_label 1 HRF                               \
    -regress_motion_per_run                                                  \
    -regress_censor_motion    0.3                                            \
    -regress_censor_outliers  0.05                                           \
    -regress_reml_exec                                                       \
    -regress_compute_fitts                                                   \
    -regress_run_clustsim     no                                             \
    -html_review_style        pythonic                                       \

Hi Letitia,

There is probably no direct mechanism for this right now, though it could be considered. To be sure, what is special about this external volume? Note that MIN_OUTLIER is a much better choice than "first" for the volreg base.

  • rick

Hi Rick and Paul - just to chime in on Letitia's question, this issue came up when we were looking at some cross-session alignment with a subject who had a larger-than-usual amount of warping. 3dvolreg seemed to be less effective than usual because of the shape difference between the PE-rev-unwarped vols and the not-unwarped MIN_OUTLIER base volume.

Rick posted some years ago on a related topic explaining why you don't want to volreg then unwarp (makes sense) but for the usual procpy routine, I didn't quite understand why one wouldn't want to volreg the unwarped runs to an unwarped target (MIN_OUTLIER or whatever) since the geometry should be more similar.

Of course, entirely possible I have not understood this right!


Hi Fred,

Indeed, 3dvolreg is run after unwarping, not before. The MIN_OUTLIER volume does get the distortion correction, along with the rest of the EPI data. The special thing is that in the volreg block the (possibly 5) transformations are then concatenated, so that the EPI does not get resampled more than once.

Cross-session alignment is more messy though. How are you trying to handle that? To be sure, are the EPI runs here all from one session?

  • rick

Hi Rick,

Thank you for your helpful reply.
To add, I am actually not using MIN_OUTLIER but a single band volume that I am not using for the rest of the pre-processing, hence, an external volreg base.
And regarding the cross-session alignment, I am using 3dQWarp -allineate to register session2 to session1.

Hi Rick, apologies for long delay, missed the notification! And yes,, the cross-sess align is challenging. qwarp worked very well though as long as some padding was added, quite impressive.

Now all is making sense to me (re MIN_OUTLIER) - I think it's time to transition!


That is good news Fred, thanks for the update!

  • rick