Re-doing afni_proc regress block with WM & ventricle segmentations

AFNI version info (afni -ver): 23.1.02

Hello AFNI experts,

Similarly to a question I asked before here, I am hoping to re-do only the regression block of my afni_proc.py script, with a different censoring threshold. However, this time it is on my resting-state data, for which we have followed the suggested preprocessing steps in the afni_proc.py -help Example 11 (Resting state analysis WITH FreeSurfer).

I am wondering how I can re-do the regress block only, with everything the exact same, except for the censoring threshold. The problem I am confused about is arising around the WM and ventricle regression; it seems to me that you specify the WM and ventricle segmentation labels early in the script with the '-anat_follower_ROI' command, so that they get warped alongside the other anat/EPI images. Unless I am mistaken, when using the '-regress_ROI_PC' and '-regress_anaticor_label' later in the script, you specify the label you gave to your segmentation in 'anat_follower_ROI', but at that point it would be using the warped segmentations, not the original ones, in the regression?

Is there a way for me to tell afni_proc to use the final "warped" versions of the WM and ventricle segmentations without having to use '-anat_follower_ROI' and go through the warping from scratch?

I've attached my original afni_proc code below if it helps.

Thank you so much!

Ryann

afni_proc.py \
    -subj_id $sub_id \
    -blocks despike tshift align tlrc volreg blur mask scale regress \
    -radial_correlate_blocks tcat volreg \
    -copy_anat $prewarp_dir/pre_warp_$sub_id/anatSS.$sub_id.nii \
    -anat_has_skull no \
    -anat_follower anat_w_skull anat $T1_data \
    -anat_follower_ROI aaseg anat $SUMA_dir/aparc.a2009s+aseg.nii.gz \
    -anat_follower_ROI aeseg epi $SUMA_dir/aparc.a2009s+aseg.nii.gz \
    -anat_follower_ROI FSvent epi $SUMA_dir/fs_ap_latvent.nii.gz \
    -anat_follower_ROI FSWe epi $SUMA_dir/fs_ap_wm.nii.gz \
    -anat_follower_erode FSvent FSWe \
    -dsets $fmri_data \
    -tcat_remove_first_trs 0 \
    -align_opts_aea -ginormous_move -cost lpc+ZZ -check_flip \
    -tlrc_base MNI152_2009_template_SSW.nii.gz \
    -tlrc_NL_warp \
    -tlrc_NL_warped_dsets \
           prewarp/pre_warp_$sub_id/anatQQ.$sub_id.nii \
           prewarp/pre_warp_$sub_id/anatQQ.$sub_id.aff12.1D \
           prewarp/pre_warp_$sub_id/anatQQ.${sub_id}_WARP.nii \
    -volreg_align_to MIN_OUTLIER \
    -volreg_align_e2a \
    -volreg_tlrc_warp \
    -blur_size 4 \
    -mask_epi_anat yes \
    -regress_motion_per_run \
    -regress_ROI_PC FSvent 3 \
    -regress_ROI_PC_per_run FSvent \
    -regress_make_corr_vols aeseg FSvent \
    -regress_anaticor_fast \
    -regress_anaticor_label FSWe \
    -regress_censor_motion 0.2 \
    -regress_censor_outliers 0.05 \
    -regress_apply_mot_types demean deriv \
    -regress_est_blur_epits \
    -regress_est_blur_errts \
    -html_review_style pythonic \
    -tshift_opts_ts -tpattern @$slicetimesfile \
    -execute

Hi Ryann,

There are at least 2 aspects to this that make it a little messy, one is that the current output does not have the censoring file that you would want to use, and the other is a consequence of it. Since -regress_ROI_PC is being applied, a change in censoring would lead to a change in the PC regressors (they are generated from censored volreg results, so that motion-to-be-censored would not affect computation of the components). So you would have to re-run that PC extraction loop, as well as generate new censor files.

The alternative would be to run a new afnI_proc.py command only runs the post-volreg blocks. But I am not sure whether not having a volreg block would be allowed with the PC regression.

It would not be toooo difficult to write a new script (extracted from the current proc) that generates the censored PCs and the censor time series and then runs a new regression on it. But there is no direct mechanism to short circuit that right now.

I am happy to look at a script that you might try for it.

  • rick

Hey Rick!

Thanks so much for the detailed explanation. I ended up just re-running the preprocessing again from the beginning, just with a different censoring threshold... probably not the most time-saving or exciting way to go about it but it seemed the most straightforward way to tackle the problem.

Maybe some day someone with better programming skills (and more time to figure it out) than me will stumble on this thread and be able to figure it out!

Ryann