Hi AFNI team again,
I've successfully executed the following preprocessing script for a single run of multi-echo data. Now, I would like to extend this process across various runs. This tcsh script, named 'afni2_preproc.tcsh', is being executed on an HPC server using the Slurm scheduler. In my search for a solution, I came across 'run_26_ap_me_bT.tcsh' in the demo data, but I'm uncertain if it can be adapted for processing multiple runs within each subject. Should I make a run loop in this script?
Any advice or guidance on this matter would be greatly appreciated!
Thanks,
Byeol
AFNI version info (afni -ver
): 23.0.04
...
# dataset inputs
set dsets_epi_me = ( ${sdir_epi}/${subj}_${ses}_*run-05_echo-?_bold.nii* )
set me_times = ( 13.2 31.45 49.7 )
set epi_forward = "${sdir_fmap}/${subj}_${ses}_acq-mb3_dir-ap_run-01_epi.nii.gz[0..1]"
set epi_reverse = "${sdir_fmap}/${subj}_${ses}_acq-mb3_dir-pa_run-01_epi.nii.gz[0..1]"
set anat_cp = ${sdir_ssw}/anatSS.${subj}.nii
set anat_skull = ${sdir_ssw}/anatU.${subj}.nii
set dsets_NL_warp = ( ${sdir_ssw}/anatQQ.${subj}.nii \
${sdir_ssw}/anatQQ.${subj}.aff12.1D \
${sdir_ssw}/anatQQ.${subj}_WARP.nii )
# control variables
set nt_rm = 8 # pre-steady state volume (dummy)
set blur_size = 4 # smaller blur, since ME and NL warp
set final_dxyz = 3 # can test against inputs
set cen_motion = 0.3
set cen_outliers = 0.1
# ---------------------------------------------------------------------------
# run programs
# ---------------------------------------------------------------------------
set ap_cmd = ${sdir_ap}/ap.cmd.${subj}
\mkdir -p ${sdir_ap}
# write AP command to file
cat <<EOF >! ${ap_cmd}
# ME:
# - -dsets_me_run, -echo_times, -combine_method
# - mask combine blur
afni_proc.py \
-subj_id ${subj} \
-blocks despike tshift align tlrc volreg mask combine blur scale \
regress \
-radial_correlate_blocks tcat volreg \
-copy_anat ${anat_cp} \
-anat_has_skull no \
-blip_forward_dset "${epi_forward}" \
-blip_reverse_dset "${epi_reverse}" \
-dsets_me_run ${dsets_epi_me} \
-echo_times ${me_times} \
-align_unifize_epi local \
-combine_method OC \
-tcat_remove_first_trs ${nt_rm} \
-tshift_interp -wsinc9 \
-align_opts_aea -cost lpc+ZZ -giant_move -check_flip \
-tlrc_base ${template} \
-tlrc_NL_warp \
-tlrc_NL_warped_dsets ${dsets_NL_warp} \
-volreg_align_to MIN_OUTLIER \
-volreg_align_e2a \
-volreg_tlrc_warp \
-volreg_warp_final_interp wsinc5 \
-volreg_warp_dxyz ${final_dxyz} \
-volreg_compute_tsnr yes \
-blur_size ${blur_size} \
-mask_epi_anat yes \
-regress_motion_per_run \
-regress_censor_motion ${cen_motion} \
-regress_censor_outliers ${cen_outliers} \
-regress_apply_mot_types demean deriv \
-regress_est_blur_epits \
-regress_est_blur_errts \
-html_review_style pythonic
EOF
cd ${sdir_ap}
# execute AP command to make processing script
tcsh -xef ${ap_cmd} |& tee output.ap.cmd.${subj}
set ecode = ${status}
if ( ! ${ecode} ) then
# execute the proc script, saving text info
time tcsh -xef proc.${subj} |& tee output.proc.${subj}
endif
set ecode = ${status}
if ( ${ecode} ) then
echo "++ FAILED AP: ${ap_label}"
else
echo "++ FINISHED AP: ${ap_label}"
endif
# ---------------------------------------------------------------------------
exit ${ecode}