AFNI version info (afni -ver
): Precompiled binary macos_10.12_local: Oct 31 2024 (Version AFNI_24.3.06 'Elagabalus')
Hi all,
I’m working on my first complete afni_proc.py
script to analyze resting-state data and have been following Example 11 from the AFNI afni_proc.py
examples.
Here’s what I’ve done so far:
- I’ve processed my T1-weighted images using
sswarper2
, which generated skull-stripped and MNI-warped versions of the T1s. - I’m running the original (subject-space) T1s through
recon-all
to generate theaaseg
,aeseg
, white matter, and ventricle masks.
Now, here’s where I’m confused:
In my afni_proc.py
script, I am including both the original (subject-space) and MNI-warped (from sswarper2
) T1s. Since recon-all
was run on the subject-space T1, the resulting masks for white matter and ventricles will also be in subject space, right? How do I handle this mismatch when incorporating these masks into the MNI-warped space for my analysis?
Any advice or guidance on best practices for this situation would be greatly appreciated!
#!/bin/bash
# Template for Preprocessing Resting-State Data with afni_proc.py
# Each line is commented to explain its purpose. Replace placeholders with your specific data.
# Main afni_proc.py command to process resting-state data
afni_proc.py \
-subj_id <SUBJECT_ID> # Unique subject identifier (e.g., sub-001)
-blocks despike tshift align tlrc volreg blur \ # Steps in the preprocessing pipeline
mask scale regress # These are common blocks for resting-state analysis
-radial_correlate_blocks tcat volreg regress # Run radial correlation checks at specific stages
# Anatomical Dataset
-copy_anat <ANAT_SKULL_STRIPPED_FILE> # Skull-stripped anatomical dataset (e.g., anatSS.sub-001.nii)
-anat_has_skull no # Indicate that the anatomical image is skull-stripped
-anat_follower anat_w_skull anat <ANAT_WITH_SKULL_FILE> # Anatomical dataset with skull (e.g., anatU.sub-001.nii)
# FreeSurfer Outputs (if available)
-anat_follower_ROI aaseg anat <AASEG_FILE> # FreeSurfer aseg parcellation on anatomical grid
-anat_follower_ROI aeseg epi <AESEG_FILE> # FreeSurfer aseg parcellation on EPI grid
-anat_follower_ROI FSvent epi <FS_VENTRICLE_FILE> # FreeSurfer ventricle mask
-anat_follower_ROI FSWe epi <FS_WHITE_MATTER_FILE> # FreeSurfer white matter mask
-anat_follower_erode FSvent FSWe # Erode ventricle and white matter masks
# Functional Dataset
-dsets <FUNC_FILES> # Functional datasets (e.g., sub-001_task-rest_bold+orig.HEAD)
-tcat_remove_first_trs <NUM_TRS_TO_REMOVE> # Number of initial TRs to remove (e.g., 2)
# Alignment Options
-align_unifize_epi local # Unifize EPI for alignment
-align_opts_aea -cost lpc+ZZ # Alignment cost function
-giant_move # Allow large movements for alignment
-check_flip # Check for left-right flipping issues
# Template Registration
-tlrc_base MNI152_2009_template_SSW.nii.gz # Template for normalization
-tlrc_NL_warp # Use non-linear warping for template alignment
-tlrc_NL_warped_dsets <ANAT_WARPED> <AFFINE_TRANSFORM> # Non-linear warp outputs from SSwarper
<NONLINEAR_WARP> # Files: anatQQ.sub-001.nii, anatQQ.sub-001.aff12.1D, anatQQ.sub-001_WARP.nii
# Motion Correction and Warping
-volreg_align_to MIN_OUTLIER # Align volumes to the one with the least outliers
-volreg_align_e2a # Align EPI to anatomy
-volreg_tlrc_warp # Apply warps to EPI data
# Masks
-mask_epi_anat yes # Create EPI mask aligned with anatomy
# Smoothing
-blur_size 4 # Apply spatial smoothing with 4mm FWHM kernel
# Regressors
-regress_apply_mot_types demean deriv # Regress motion parameters (demeaned and derivatives)
-regress_motion_per_run # Regress motion separately for each run
-regress_anaticor_fast # Use fast ANATICOR for local white matter regression
-regress_anaticor_label FSWe # Use FreeSurfer white matter mask for ANATICOR
-regress_ROI_PC FSvent 3 # Regress first 3 principal components from ventricles
-regress_ROI_PC_per_run FSvent # Compute PCs per run
-regress_censor_motion 0.2 # Censor TRs with motion > 0.2 mm
-regress_censor_outliers 0.05 # Censor TRs with > 5% outliers
-regress_make_corr_vols aeseg FSvent # Create correlation volumes for gray matter and ventricles
# Estimation and Review
-regress_est_blur_epits # Estimate smoothness of preprocessed data
-regress_est_blur_errts # Estimate smoothness of residuals
-html_review_style pythonic # Generate Python-style HTML QC report
# Areas to Fill In:
# - <SUBJECT_ID>: Unique identifier for the subject (e.g., sub-001).
# - <ANAT_SKULL_STRIPPED_FILE>: Skull-stripped anatomical dataset (e.g., anatSS.sub-001.nii).
# - <ANAT_WITH_SKULL_FILE>: Anatomical dataset with the skull included (e.g., anatU.sub-001.nii).
# - <AASEG_FILE>, <AESEG_FILE>: FreeSurfer parcellation outputs.
# - <FS_VENTRICLE_FILE>, <FS_WHITE_MATTER_FILE>: FreeSurfer ventricle and white matter masks.
# - <FUNC_FILES>: Functional datasets for preprocessing.
# - <NUM_TRS_TO_REMOVE>: Number of initial TRs to remove from functional datasets.
# - <ANAT_WARPED>, <AFFINE_TRANSFORM>, <NONLINEAR_WARP>: Outputs from @SSwarper for non-linear warping.