# Copy+pasteable commands from the AFNI Bootcamp's "afni11_roi.pdf" # presentation. # # date = May 1, 2019 cd AFNI_data6/roi_demo # Change grid/resolution of data set from (high res) anat to # (low res) EPI 3dresample \ -master rall_vr+orig \ -prefix anat_roi_resam \ -inset anat_roi+orig \ -rmode NN # Calculate average value per time point, dump to text file... 3dmaskave \ -mask anat_roi_resam+orig \ -quiet \ rall_vr+orig > epi_avg.1D # ... and view dumped text file results, using either of these more epi_avg.1D 1dplot -yaxis 1000:1200:2:1 epi_avg.1D # Dump *values* of a dset that are within a mask region into a # text file; no coordinate locations saved in this case, but could # save the coordinates of each voxel, too. 3dmaskdump \ -noijk \ -mask anat_roi_resam+orig \ func_slim+orig'[2]' > Vrel-tstats.txt # ... and view dumped text file results more Vrel-tstats.txt # Compute separate statistics for each ROI in a volume 3dROIstats \ -mask 3rois+orig \ func_slim+orig'[0]' # Clusterizing example, using labels to specify stat and effect # estimate volumes, and using p-value to specify voxelwise threshold. 3dClusterize \ -1Dformat \ -inset func_slim+orig \ -idat Vrel#0_Coef \ -ithr Vrel#0_Tstat \ -NN 2 \ -clust_nvox 200 \ -bisided p=0.0001 \ -pref_map Clust_map \ -pref_dat Clust_dat \ > Clust_report.1D # ... and use the peak locations of clusters for identification in loaded # atlases with 'whereami' whereami \ -tab \ -coord_file Clust_report.1D'[1,2,3]' \ > Clust_whereami_peak.1D # ... AND we could use the map of ROIs to find out locations, based on # overlaps in loaded atlases, also with whereami whereami \ -omask Clust_map+orig \ > Clust_whereami_omask.1D # Find suprathreshold voxels, and make into clusters (kinda like GUI's # Clusterize functionality and/or 3dclust) 3dmerge \ -prefix func_roi \ -dxyz=1 \ -1clip 99.0 \ -1clust_order 1 200 \ func_slim+orig.'[0]' # ============ "Getting around with spheres" example ========== # This example shows how make spherical ROIs of a given radius around # peak locations of clusters. adwarp \ -apar anat+tlrc \ -dpar func_slim+orig \ -dxyz 3 # 1) In afni GUI, select: # Underlay -> anat, # Overlay -> func_slim # 2) Switch 'view' to Talairach # 3) Overlay index -> vrel_coef, # Threshold index -> vrel_tstat # 4) Set threshold value (say, p=0.001, or t-stat ~ 3)) # 5) Clusterize (default opts OK), and Save Tabl 1dcat Clust_table.1D'[4..6]' > Clust_PeakXYZ.1D 3dUndump -srad 7.5 -master func_slim+tlrc -orient RAI \ -prefix clust_spheres -xyz Clust_PeakXYZ.1D